From 02abe4ca20938e975577dbb278eb5c49241d9bf6 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 4 Jun 2019 08:35:25 +0000 Subject: [PATCH] [IMP] website_sale: product.product support website_publish_button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now when you click on a variant and have the website_publisher right, you are redirected to the correct variant. If you don't have the access, you have the same behaviour than before and it is the template that is unpublished. (strange!) closes odoo/odoo#33175 Signed-off-by: Jérémy Kersten (jke) --- addons/website_sale/models/product.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 3927b081295..e5bf6ca82f4 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -441,7 +441,12 @@ class Product(models.Model): @api.multi def website_publish_button(self): self.ensure_one() - return self.product_tmpl_id.website_publish_button() + res = self.product_tmpl_id.website_publish_button() + + # res can be the result of write() if not website_publisher + if type(res) == dict and res.get('type') == 'ir.actions.act_url': + res['url'] = self.website_url + return res @api.multi def _get_images(self):