summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2020-05-05 08:09:42 +0000
committerJeremy Kersten <jke@odoo.com>2020-05-05 18:47:13 +0000
commit541205fbcb4c0d8e04e45c56cbdfaaeb9e373174 (patch)
tree48453fcfa7d4d1d77253371bf7548b2e0dd7fa3b
parente9230a1e945cac0fab986005f714c878af90be63 (diff)
[FIX] website: _compute_pricelist_id compute on correct website
Before this fix, in case you try to compute the pricelist_id with another context, the computed value is set to the website with the new context, and so another cache. Now with compute for the env from self, and assign the computed value with the website with ot without another context. Before this commit, you was unable to add fields pricelist_id or currency_id in a tree view. opw-2233122 closes odoo/odoo#50705 X-original-commit: 2f83c5bad94775a8f85e65c129afdcf503995ecb Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
-rw-r--r--addons/website_sale/models/website.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/addons/website_sale/models/website.py b/addons/website_sale/models/website.py
index deb6e746828..0525f9942fa 100644
--- a/addons/website_sale/models/website.py
+++ b/addons/website_sale/models/website.py
@@ -56,12 +56,9 @@ class Website(models.Model):
Pricelist._get_website_pricelists_domain(website.id)
)
- @api.depends_context('website_id')
def _compute_pricelist_id(self):
for website in self:
- if website._context.get('website_id') != website.id:
- website = website.with_context(website_id=website.id)
- website.pricelist_id = website.get_current_pricelist()
+ website.pricelist_id = website.with_context(website_id=website.id).get_current_pricelist()
# This method is cached, must not return records! See also #8795
@tools.ormcache('self.env.uid', 'country_code', 'show_visible', 'website_pl', 'current_pl', 'all_pl', 'partner_pl', 'order_pl')