|
|
@ -138,19 +138,19 @@ class ResPartner(models.Model): |
|
|
|
after create/update, just as if those were all modeled as |
|
|
|
fields.related to the parent |
|
|
|
""" |
|
|
|
self.ensure_one() |
|
|
|
super(ResPartner, self)._fields_sync(update_values) |
|
|
|
for record in self: |
|
|
|
contact_fields = record._contact_fields() |
|
|
|
# 1. From UPSTREAM: sync from parent contact |
|
|
|
if update_values.get('contact_id'): |
|
|
|
record._contact_sync_from_parent() |
|
|
|
# 2. To DOWNSTREAM: sync contact fields to parent or related |
|
|
|
elif any(field in contact_fields for field in update_values): |
|
|
|
update_ids = record.other_contact_ids.filtered( |
|
|
|
lambda p: not p.is_company) |
|
|
|
if record.contact_id: |
|
|
|
update_ids |= record.contact_id |
|
|
|
update_ids.update_contact(update_values) |
|
|
|
contact_fields = self._contact_fields() |
|
|
|
# 1. From UPSTREAM: sync from parent contact |
|
|
|
if update_values.get('contact_id'): |
|
|
|
self._contact_sync_from_parent() |
|
|
|
# 2. To DOWNSTREAM: sync contact fields to parent or related |
|
|
|
elif any(field in contact_fields for field in update_values): |
|
|
|
update_ids = self.other_contact_ids.filtered( |
|
|
|
lambda p: not p.is_company) |
|
|
|
if self.contact_id: |
|
|
|
update_ids |= self.contact_id |
|
|
|
update_ids.update_contact(update_values) |
|
|
|
|
|
|
|
@api.onchange('contact_id') |
|
|
|
def _onchange_contact_id(self): |
|
|
|