Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
115 มุมมอง

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!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 25
512
2
ส.ค. 25
1542
0
ก.พ. 25
1630
1
ส.ค. 25
2254
2
ธ.ค. 24
1888