From 665fcb62cfc0231125fc5d0815668b945e2a8d0d Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Tue, 8 May 2018 17:50:52 +0200 Subject: [FIX] website: always show menu if its a container with visible menus Before this commit: 1. If a menu was used as a container (dropdown) and had an unpublished page_id (website.page), we would never show that menu (and so its submenus) even if it has visible submenu. Some users are stuck with this since they: a) create a new page 'A' (unpublished by default) included in menu. b) create a new page 'B' (unpublished by default) included in menu. c) set 'B' as a submenu of 'A' in the menu manager d) decide to publish the website.page linked to menu 'B' Then, since menu 'A' is linked to an unpublished page, the menu 'A' and 'B' are never visible. 2. If a menu is being created with an URL that match a website.page URL, the m2o relation will automatically be set (website.menu.page_id). Still, if the user type the URL without the leading slash, the m2o won't be set. This could be misleading since on the page property in the page manager the URL is being shown without the leading slash even if it is stored in DB. Now: 1. We always show menu container if they contains visible submenu, even if the container menu is linked to an unpublished page 2. The page URL search is more clever and will match URL even if the only difference is the leading slash. This closes #24635 --- addons/website/models/website.py | 3 ++- addons/website/views/website_templates.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'addons') diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 35038877749..eb5483f7915 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -885,9 +885,10 @@ class Menu(models.Model): for menu in data['data']: menu_id = self.browse(menu['id']) # if the url match a website.page, set the m2o relation - page = self.env['website.page'].search([('url', '=', menu['url'])], limit=1) + page = self.env['website.page'].search(['|', ('url', '=', menu['url']), ('url', '=', '/' + menu['url'])], limit=1) if page: menu['page_id'] = page.id + menu['url'] = page.url elif menu_id.page_id: menu_id.page_id.write({'url': menu['url']}) menu_id.write(menu) diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 16fc3e33444..3573ca8a4df 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -74,7 +74,7 @@ -
  • -- cgit v1.2.3 From b793e23ae53b5f1edab8c98bbed7ac5f5f921280 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 8 May 2018 10:57:53 +0200 Subject: [FIX] stock: incorrect PO sequence - Create 2 companies A & B - Create a sequence for PO in each company - Set User A in Company A and Admin in Company B - Create a MTO product with a 'Buy' route - Create a SO with User A using the product, validate The PO created uses the sequence for Company B instead of Company A. The creation is done as `sudo`, and ultimately `next_by_code` will use the company of the Admin. opw-1839656 --- addons/stock/models/procurement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons') diff --git a/addons/stock/models/procurement.py b/addons/stock/models/procurement.py index 6f8402c1fe7..49f65a8f61c 100644 --- a/addons/stock/models/procurement.py +++ b/addons/stock/models/procurement.py @@ -77,7 +77,7 @@ class ProcurementRule(models.Model): data = self._get_stock_move_values(product_id, product_qty, product_uom, location_id, name, origin, values, group_id) # Since action_confirm launch following procurement_group we should activate it. - move = self.env['stock.move'].sudo().create(data) + move = self.env['stock.move'].sudo().with_context(force_company=data.get('company_id', False)).create(data) move._action_confirm() return True -- cgit v1.2.3