Odoo Many2one context form_view_ref does not work for a field

76 Views Asked by At

I have a very funny error and don't know what to do:

I have created my own view for res.partner which should simplify my entries. the view also works correctly for 4 out of 3 fields:

For the field e.g. everything works normally, the correct view is opened.

                <field name="event_location_id"
                       attrs="{'readonly': [('event_sale_state', 'not in', ['draft'])]}"
                       widget="res_partner_many2one"
                       context="{ 'default_type':'delivery', 'show_address': 1, 'default_user_id': user_id ,
                       'default_parent_id': sale_partner_id ,
                       'form_view_ref':'chn_events.chnevent_sale_location_partner_view' }"
                       options='{"always_reload": True ,"no_quick_create": 1}'/>

but with that:

<field name="event_partner_invoice_id" widget="res_partner_many2one"
                                   context="{'default_type':'invoice', 'default_parent_id': event_partner_id , 'default_user_id': user_id ,'form_view_ref':'chn_events.chnevent_sale_location_partner_view'}"
                                   options='{"always_reload": True ,"no_quick_create": 1}'/>

the standard view of odoo always opens i can't understand this because the context is always the same and the deffinition of the fields is similar.

i have already tried to rename it because i thought it was due to the field name invoice_id but it doesn't help either.

i have also tried to change the field in the form editor to another field which is in the same view but has a different name and there it works normally again

here are the two fields from python :

 event_partner_invoice_id = fields.Many2one(
        comodel_name='res.partner',
        string="Invoice Address",
        compute='_compute_partner_invoice_id',
        store=True, readonly=False, required=True, precompute=True,
        domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",)

    partner_shipping_id = fields.Many2one(
        comodel_name='res.partner',
        string="Delivery Address",
        compute='_compute_partner_shipping_id',
        store=True, readonly=False, required=True, precompute=True,
        domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", )

The field event_partner_invoice_id always opens the standard view and the other one if I change the name opens the correct one why ?

0

There are 0 best solutions below