From 4d8337fec87332669bcdb377a427da50a408b20d Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 4 Aug 2014 14:22:54 +0200 Subject: [PATCH 1/3] [FIX] mrp: better selection of bom When searching for a bom based on a product.product, the method used to return any bom linked to the template (so searching for bom for variant A could return bom for variant B if both share the same product.template). This will allow to return bom not linked to a variant without returning the one of another variant (opw 609358) --- addons/mrp/mrp.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index ca4109c1b9a..ba49ba7a9b4 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -240,16 +240,27 @@ class mrp_bom(osv.osv): """ if properties is None: properties = [] - domain = None if product_id: - domain = ['|',('product_id', '=', product_id),('product_tmpl_id.product_variant_ids', '=', product_id)] - else: + if not product_tmpl_id: + product_tmpl_id = self.pool['product.product'].browse(cr, uid, product_id).product_tmpl_id.id + domain = [ + '|', + ('product_id', '=', product_id), + '&', + ('product_id', '=', False), + ('product_tmpl_id', '=', product_tmpl_id) + ] + elif product_tmpl_id: domain = [('product_id', '=', False), ('product_tmpl_id', '=', product_tmpl_id)] + else: + # neither product nor template, makes no sense to search + return False if product_uom: domain += [('product_uom','=',product_uom)] domain = domain + [ '|', ('date_start', '=', False), ('date_start', '<=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)), '|', ('date_stop', '=', False), ('date_stop', '>=', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))] - ids = self.search(cr, uid, domain) + # order to prioritize bom with product_id over the one without + ids = self.search(cr, uid, domain, order='product_id') for bom in self.pool.get('mrp.bom').browse(cr, uid, ids): if not set(map(int,bom.property_ids or [])) - set(properties or []): return bom.id From 497883cc51c5a563a31dd892c536d8799933def5 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 5 Aug 2014 15:44:57 +0200 Subject: [PATCH 2/3] [FIX] web_kanban: parent can be undefined in some cases opw-611106, when clicking quickly Sales > Opportunities than Sales > Leads. --- addons/web_kanban/static/src/xml/web_kanban.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_kanban/static/src/xml/web_kanban.xml b/addons/web_kanban/static/src/xml/web_kanban.xml index c1d504e51be..aebdbacb9dd 100644 --- a/addons/web_kanban/static/src/xml/web_kanban.xml +++ b/addons/web_kanban/static/src/xml/web_kanban.xml @@ -45,8 +45,8 @@ From 7d7f6fefb19a43f7bf3d2e31da5d94df7f7fa857 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 5 Aug 2014 16:01:55 +0200 Subject: [PATCH 3/3] [FIX] purchase: now allow 'can be purchased' to be checked even if not variant Before, the field purchase_ok was set as readonly on the product form if the product wasn't a variant, to avoid users to set all the products variants associated to the product template to be set as purchase able in one action. We now consider that this can be done by the end user --- addons/purchase/purchase_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 2f88439f076..570583dcb48 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -594,7 +594,7 @@
- +