Hi all!
I have multiple operators that utilize the shop floor app only, and sometimes they have to add in work/tasks that would be outside of normal planning.
I would like to add a dummy work order that they can access and record time/notes for when those occurrences do happen. I already have that set up.
Upon marking it complete, I would like to have an automated action repopulate another identical work order in it's place, but with a new number that would be next in sequence.
Assuming the "execute python code" function is necessary here. Is there someone that can help me out with the code to complete this?
TIA!
After some trial and error, I have come up with a working solution. Before, I was trying to add to the work order sequence, however, there is no sequence setup for a workorder as those are tied to the manufacturing order. The code below will creates a new MO based on defined variables
#set variables for new MO:
mo_vals = {
'product_id': 3765,
'qty_producing': 1.0,
'product_uom_id': 1,
'bom_id': 18
}
#create new MO based on variables above and will follow the existing sequence:
new_mo = env['mrp.production'].create(mo_vals)
#confirm the MO so it is available in the shop floor app:
new_mo.action_confirm()