Я хочу отправить контекст методу python. В xml у меня есть этот код:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_mim_wizardfor" model="ir.ui.view">
<field name="name">mim.wizard.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<notebook position="before">
<field name="entete"/>
<field name="purchase_order_id" context="{'show_state': True}"/>
</notebook>
<group name="sale_total" position="after">
<button name="action_mim_wizard"
attrs="{'invisible': [('state','not in',('draft','sent'))]}"
type="object" string="Ajout avancé"
class="oe_link oe_edit_only"/>
</group>
</field>
</record>
</data>
и я python У меня есть это:
def name_get(self, cr, uid, ids, context=None):
if context is None:
context = {}
res = []
for record in self.browse(cr, uid, ids, context=context):
_logger.info('==============context============================%s', context)
name = record.name
if context.get('show_state', False):
name = '%s %s' % (name, record.state)
res.append((record.id, name))
_logger.info('==============name_get============================name_get==============')
return res
У меня нет 'show_state' в контексте, я не знаю почему. Вы можете мне помочь?