Skip to Content
Menu
This question has been flagged

I have created dozens of Manufacturing Orders and the Bill of Materials has been changed.


Before confirming them, I'd like to refresh or update these MO's so that they will use the new BoM instead of the historic list of components from the BoM before the update.

Avatar
Discard
Best Answer

You can create a Server Action that essentially runs the same methods that would run if you created a new Manufacturing Order.  

Be sure to click CREATE CONTEXTUAL ACTION after you've saved it so you can select all your draft MO's in a list and update them in one step:


Updated Answer: v15 (plus carry over the original Quantity):

for record in records:
prior_quantity = record.product_qty
record._onchange_bom_id()
record._onchange_move_raw()
record._onchange_move_finished()
record._onchange_location
record['product_qty'] = prior_quantity


Original Answer: v14:


for record in records:
record._compute_allowed_product_ids()
record._onchange_bom_id()
record._onchange_move_raw()
record._onchange_move_finished()
record._onchange_location
Avatar
Discard

Hello Ray,
Thank you for your answer !
Would you by chance know what methods to use on Odoo 13.0 ?

Hello Ray,

Do you have an update on this for v15?

Thanks in advance!

For v15, comment out or remove the line "record._compute_allowed_product_ids()"

Thanks Ray, Works like a charm!

Thank you, Ray, for the reply. This was always a bummer.
The only issue is, that the product quantity (product_qty) is always set to 1, which may be wrong.
Also, we would like to update MO's after confirmation as well.

Do you have any idea how to achieve this? (v15

See my updated answer for v15 that changes the quantity after the update from 1 back to the original quantity.

Thanks for the answer. We need to make a little adjustment to your suggestion, because the quantity is getting changed, but the quantity of the raw lines isn't. Writing the quantity right after "(_onchange_bom_id()) fixes that:

for record in records:
prior_quantity = record.product_qty
record._onchange_bom_id()
record['product_qty'] = prior_quantity
record._onchange_move_raw()
record._onchange_move_finished()
record._onchange_location

Now I only need to figure out a way to do this with confirmed MOs or set the state to draft at the beginning and back to confirmed at the end of the server-action. But I couldn't find a pre-defined funtion to set it to draft.

Best Answer

Is there also a way to reload the steps in the operations of a confirmed manufacturing order?
When we make changes to the operations-steps of a product with serial numbers, the work order still has the old steps until, for example, one of a batch of 20 has been completed and 19 are still available. The work order is split and a new one (FE01234--001) is generated. This then has the new steps. This leads to inconsistency in the work orders and all production orders have to be created again. Is there a workaround for this? (Odoo V16)

Avatar
Discard
Related Posts Replies Views Activity
2
Sep 16
3766
2
Aug 22
4829
1
Mar 22
2623
1
Feb 22
2438
1
Feb 22
2960