コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
109 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
2
8月 25
495
2
8月 25
1535
0
2月 25
1624
1
8月 25
2245
2
12月 24
1882