[7.0] Manufacturing Order forces scheduled products recomputation

Bug #1274026 reported by Andrius Preimantas @ hbee
12
This bug affects 2 people
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://bazaar.launchpad.net/~openerp/openobject-addons/7.0/revision/9445
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

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

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):
        """
        @return: True or False
        """
        res = True
        for production in self.browse(cr, uid, ids, context=context):
            res = False
            if not production.product_lines:
                self._action_compute_lines(cr, uid, [production.id],
                                           context=context)
                # Reload record
                production = self.browse(cr, uid, production.id, context=context)
            for product_line in production.product_lines:
                if product_line.product_id.type in ('product', 'consu'):
                    res = True
        return res

Changed in openobject-addons:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.