[FIX] base(_address_extended): correctly fix cache miss bug when creating company
Without this flush, partner computed fields are not computed when creating
the company, leading to a cache miss. It is due to the quite complex model
introduced in base_address_extended with multiple related / computed / inverse
fields.
How to reproduce
* have base_address_extended installed;
* create a company with address bits (street_name, street_number,
street_number2);
* encounter a nice cache miss bug (partner<ID>.street_number):
Original task ID 2068145
PR odoo/odoo#42701
closes odoo/odoo#42722
X-original-commit: 69ea928828fca06c9b0f589e23ca3c0d4c387ab0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
This commit is contained in:
co-authored by
Aurélien Warnon
parent
8a1010ba48
commit
5f4fa56856
@@ -224,6 +224,8 @@ class Company(models.Model):
|
||||
'website': vals.get('website'),
|
||||
'vat': vals.get('vat'),
|
||||
})
|
||||
# compute stored fields, for example address dependent fields
|
||||
partner.flush()
|
||||
vals['partner_id'] = partner.id
|
||||
self.clear_caches()
|
||||
company = super(Company, self).create(vals)
|
||||
|
||||
Reference in New Issue
Block a user