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