[7.0] Manufacturing Order forces scheduled products recomputation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Addons revno: 9789
Reproduction:
1. Create Manufacturing Order in draft state
2. In the page Scheduled Products click button Compute Data
3. Click on any of the recently computed line and change desired value (say quantity)
4. Save MO and observe that the changed value persists
5. Confirm an order and observe that changed value is reset to the value from BOM
6. Stock Moves in Products to Consume list also holds these reset values, not the changed ones from step #3
Expected behaviour:
When confirming MO the system should create Stock Moves from lines in Scheduled Products page, without implicitly resetting then to the BOM's values.
Investigation:
It turns out the method test_if_product() was modified with this revision:
http://
IMHO prior to this revision the method was already broken, but at least it did not implicitly reset the Scheduled Lines. After this revision the lines are modified. So there 2 wrong things with that:
1. Why do method named "test_if_product" also implicitly modifies data (name suggest it should just check something without leaving any impact)
2. I assume you are intentionally resetting those lines, which IMHO shouldn't happen. If you do that, at least mark Scheduled Products as readonly, so that users wouldn't be confused after altering expected MO composition and later getting different composition...
Cheers,
Andrius
I confirm that this happened due to test_if_product method change, and has another side effects like you cannot change any data of scheduled products.
Solution is to replace that method with this code:
def test_if_ product( self, cr, uid, ids, context=None): product_ lines:
self. _action_ compute_ lines(cr, uid, [production.id],
context= context)
production = self.browse(cr, uid, production.id, context=context) product_ lines: line.product_ id.type in ('product', 'consu'):
res = True
"""
@return: True or False
"""
res = True
for production in self.browse(cr, uid, ids, context=context):
res = False
if not production.
# Reload record
for product_line in production.
if product_
return res