From 342e0f567b701c14d462a3a4da7bf3944d76afd7 Mon Sep 17 00:00:00 2001 From: Jordi Riera Date: Wed, 1 Apr 2015 13:12:39 -0400 Subject: [PATCH] [FIX] error raise if the manufacturing order produce in more than 1 move. --- mrp_bom_reference_selection/__openerp__.py | 2 +- .../models/mrp_production.py | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/mrp_bom_reference_selection/__openerp__.py b/mrp_bom_reference_selection/__openerp__.py index f28afd5f4..d2b272cf7 100644 --- a/mrp_bom_reference_selection/__openerp__.py +++ b/mrp_bom_reference_selection/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'Bill of Material Selection Reference', - 'version': '1.0', + 'version': '1.1', 'author': 'Savoir-faire Linux', 'license': 'AGPL-3', 'category': 'Others', diff --git a/mrp_bom_reference_selection/models/mrp_production.py b/mrp_bom_reference_selection/models/mrp_production.py index 8fad0c9ec..931a7cd73 100644 --- a/mrp_bom_reference_selection/models/mrp_production.py +++ b/mrp_bom_reference_selection/models/mrp_production.py @@ -20,18 +20,19 @@ # ############################################################################## +import logging from openerp import models, api +_logger = logging.getLogger(__name__) + class MrpProduction(models.Model): _inherit = 'mrp.production' @api.model - def action_produce( - self, production_id, production_qty, production_mode, wiz=False - ): - """ - Affect the Bill of Material to each serial number related to + def action_produce(self, production_id, production_qty, + production_mode, wiz=False): + """Affect the Bill of Material to each serial number related to the produced stocks """ res = super(MrpProduction, self).action_produce( @@ -39,7 +40,8 @@ class MrpProduction(models.Model): production = self.browse(production_id) - prod_lots = production.move_created_ids2.lot_ids - prod_lots.write({'bom_id': production.bom_id.id}) + for move in production.move_created_ids2: + prod_lots = move.lot_ids + prod_lots.write({'bom_id': production.bom_id.id}) return res