[MERGE] mrp: confirmation of procurements when production order is confirmed was broken + fix and re-enable tests

During the workflow signalling refactoring the signal for
confirming the procurements was sent to the wrong model,
thus having no effect at all.
In addition the MRP tests were incorrectly disabled and
did not cover this case properly. They were re-enabled
and corrected to cover it.

bzr revid: odo@openerp.com-20130801132150-gfp1saryq48249pu
This commit is contained in:
Olivier Dony 2013-08-01 15:21:50 +02:00
commit 957fa4e2da
3 changed files with 10 additions and 5 deletions

View File

@ -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,

View File

@ -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):

View File

@ -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.
-