diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index 6e025ae2d90..83f0a4f11eb 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -77,9 +77,9 @@ Dashboard / Reports for MRP will include: #TODO: This yml tests are needed to be completely reviewed again because the product wood panel is removed in product demo as it does not suit for new demo context of computer and consultant company # so the ymls are too complex to change at this stage 'test': [ -# 'test/order_demo.yml', -# 'test/order_process.yml', -# 'test/cancel_order.yml', + 'test/order_demo.yml', + 'test/order_process.yml', + 'test/cancel_order.yml', ], 'installable': True, 'application': True, diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index f51f7292c76..82db2ace570 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -885,7 +885,7 @@ class mrp_production(osv.osv): 'move_id': shipment_move_id, 'company_id': production.company_id.id, }) - self.signal_button_confirm(cr, uid, [procurement_id]) + procurement_order.signal_button_confirm(cr, uid, [procurement_id]) return procurement_id def _make_production_internal_shipment_line(self, cr, uid, production_line, shipment_id, parent_move_id, destination_location_id=False, context=None): diff --git a/addons/mrp/test/order_process.yml b/addons/mrp/test/order_process.yml index acbfea48182..801f20f0747 100644 --- a/addons/mrp/test/order_process.yml +++ b/addons/mrp/test/order_process.yml @@ -94,6 +94,11 @@ procurement_ids = procurement.search(cr, uid, [('move_id','=',move_line.id)]) assert procurement_ids, "Procurement should be created for shipment line of raw materials." shipment_procurement = procurement.browse(cr, uid, procurement_ids[0], context=context) + # procurement state should be `confirmed` at this stage, except if mrp_jit is installed, in which + # case it could already be in `running` or `exception` state (not enough stock) + expected_states = ('confirmed', 'running', 'exception') + assert shipment_procurement.state in expected_states, 'Procurement state is `%s` for %s, expected one of %s' % \ + (shipment_procurement.state, shipment_procurement.product_id.name, expected_states) assert shipment_procurement.date_planned == date_planned, "Planned date is not correspond in procurement." assert shipment_procurement.product_id.id == order_line.product_id.id, "Product is not correspond in procurement." assert shipment_procurement.product_qty == order_line.product_qty, "Qty is not correspond in procurement." @@ -157,9 +162,9 @@ scrap_location_id = scrap_location_ids[0] order = self.browse(cr, uid, ref("mrp_production_test1")) for move in order.move_lines: - move.action_consume(move.product_qty) if move.product_id.id == ref("product.product_product_6"): move.action_scrap(5.0, scrap_location_id) + move.action_consume(move.product_qty) - I produce product. -