Search code examples
odooodoo-9

On change not triggered with different type


I override onchange_partner_id and it works perfectly if I create contact with type "contact" but if I chose type "delivery address" onchange is not triggered.. why is that and how can I fix it?

def onchange_parent_id(self, cr, uid, ids, parent_id, context=None):
        res = super(ResPartner, self).onchange_parent_id(cr, uid, ids, parent_id, context=context)
        new_contact_obj = self.browse(cr,uid,ids,context=context)
        parent_obj = self.browse(cr,uid, parent_id,context=context)
        if not new_contact_obj.multiply_pricelists_ids:
            new_contact_obj.multiply_pricelists_ids = parent_obj.multiply_pricelists_ids
        return res

Solution

  • Maybe it's because of this check:

    https://github.com/odoo/odoo/blob/4d46569766bdba6c1e5c27b0a454705d400671a7/openerp/addons/base/res/res_partner.py#L352

    I think that due to that condition the onchange occurs but returns no values from parent.