diff options
| author | Martin Trigaux <mat@odoo.com> | 2020-01-09 14:41:08 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2020-03-13 08:20:32 +0000 |
| commit | b53614fcc56733a45dab03262896ba14110a4816 (patch) | |
| tree | 1f678dee281a179b9c8be539c3cdd2288673f800 /odoo | |
| parent | 23e7d0f46ce67a82a1b5be7b71b622c0f54047e4 (diff) | |
[FIX] base_vat: apply child changes before propagation
The synchronisation of commercial_partner_id was introduced at
0d68acff8e4436e as a way to ensure the value is always correct.
The order or the operation was not important though.
This synchronisation has a side effect in the following scenario:
0. install base_vat
1. disable vat_check_vies in the settings
2. set an invalid VAT number on a company with at least one contact
3. enable vat_check_vies in the settings
4. correct the VAT number on the company with a valid one
--> an error was raised for an invalid VAT number on the contact
This is because the commercial_partner_id synchronisation is done
before the update of the VAT number. Even if the value has not
changed, this triggers the check_vat method.
Invert both instructions
Courtesy of Wolfgang Taferner
Closes odoo/odoo#43065
Closes odoo/odoo#42973
closes odoo/odoo#47543
X-original-commit: d9b2605eadc129924d085fffc4056d777cfbbbeb
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/addons/base/models/res_partner.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index e84570cf555..647afd65820 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -429,8 +429,9 @@ class Partner(models.Model): sync_children = self.child_ids.filtered(lambda c: not c.is_company) for child in sync_children: child._commercial_sync_to_children() + res = sync_children.write(sync_vals) sync_children._compute_commercial_partner() - return sync_children.write(sync_vals) + return res def _fields_sync(self, values): """ Sync commercial fields and address fields from company and to children after create/update, |
