-1

I have a question which has no relation to this video content at all. I want to make a context of field of type reference The field in module quality_control of oca (odoo 12) The field is

( object_id = fields.Reference(string='Reference', selection=lambda self: self.object_selection_values(), readonly=True, states={'draft': [('readonly', False)]}, ondelete="set null"))

We tried with :

<field name="context">{'default_object_id': 'mrp.production', active_id}</field>

but we had an error. If you have any comment on this it would be great. Thank You.

1 Answers1

0

Don't know if you're looking for this or not :

<field name="partner_id" widget="res_partner_many2one"
domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1, 'show_vat':True}" options='{"always_reload": True}'/>

here in xml you can specify the context data and later use the same in python.

Himanshu Sharma
  • 706
  • 3
  • 10