Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
123 Ansichten

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!

Avatar
Verwerfen
Beste Antwort

Hi,

You can solve this by creating an Automated Action on the Work Order (mrp.workorder) model with trigger On Update, and using the following Python code in the action:


if record.state == 'done' and record.production_id:

    new_wo = record.copy({

        'state': 'ready',

        'time_ids': [(5, 0, 0)],

        'qty_produced': 0,

    })

    new_wo.name = self.env['ir.sequence'].next_by_code('mrp.workorder') or new_wo.name


This will duplicate your dummy work order when marked done, reset it to ready, clear logs, and give it the next sequence number.


Hope it helps

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Aug. 25
514
2
Aug. 25
1550
0
Feb. 25
1641
1
Aug. 25
2266
2
Dez. 24
1899