[FIX] base: company not deleted on linked partners

Steps:
- Install Contacts
- Have Multi-Companies enabled
- Go to a Contact of type "Company"
- Click "Sales & Purchases"
- Assign it the company you're on
- Save and Edit again
- Remove the assigned company
- Go to a contact of type "Individual" linked to this company
- Click "Sales & Purchases"

Bug:
The company has not been deleted on the linked Individual

Explanation:
When we delete the company of a contact, the value of `vals.get('company_id')` is `False`.
This is why it didn't enter the propagation process.

opw:2391464

closes odoo/odoo#62464

X-original-commit: 80902bee453cf485906bb07be6af9072aee2e76f
Signed-off-by: backspac <backspac@users.noreply.github.com>
This commit is contained in:
nie
2020-11-26 17:54:26 +00:00
parent 9c4df33e20
commit 9d0773b6ab
+1 -1
View File
@@ -527,7 +527,7 @@ class Partner(models.Model):
vals['website'] = self._clean_website(vals['website'])
if vals.get('parent_id'):
vals['company_name'] = False
if vals.get('company_id'):
if 'company_id' in vals:
company = self.env['res.company'].browse(vals['company_id'])
for partner in self:
if partner.user_ids: