调整编程记录生成

This commit is contained in:
mgw
2025-01-14 11:12:07 +08:00
parent fa80d42fc0
commit 40603fea6a
3 changed files with 67 additions and 9 deletions

View File

@@ -15,7 +15,8 @@ class sf_programming_reason(models.TransientModel):
if self._context.get('active_id'):
production = self.env['mrp.production'].browse(self._context.get('active_id'))
res.update({
'reprogramming_count': production._cron_get_programming_state()['reprogramming_num'],
'reprogramming_count': production._cron_get_programming_state()['reprogramming_num'] if
production._cron_get_programming_state().get('reprogramming_num') else 0,
'programming_state': production.programming_state, # 假设制造订单模型中有这个字段
})
return res
@@ -33,7 +34,7 @@ class sf_programming_reason(models.TransientModel):
'reason': self.reason,
'programming_method': cloud_programming['programme_way'],
'current_programming_count': cloud_programming['reprogramming_num'],
'target_production_id': cloud_programming['production_order_no'],
'target_production_id': self.production_id.name,
'apply_time': self._context.get('default_apply_time'),
'send_time': False,
})

View File

@@ -8,8 +8,19 @@
<group>
<label for="reason" string="重新编程原因:"/>
<field name="reason" widget="textarea" nolabel="1"/>
<p class="text-muted">注意:该制造订单产品已申请重新编程次数为<field name="reprogramming_count" readonly="1" nolabel="1" class="oe_inline"/>,且当前编程状态为<field name="programming_state" readonly="1" nolabel="1" class="oe_inline"/></p>
<!-- <p class="text-muted">注意:该制造订单产品已申请重新编程次数为<field name="reprogramming_count" readonly="1" nolabel="1" class="oe_inline"/>,且当前编程状态为<field name="programming_state" readonly="1" nolabel="1" class="oe_inline"/></p> -->
</group>
<div attrs='{"invisible": [("reprogramming_count","=",0)]}'>
<span style='font-weight:bold;'>
注意: 该制造订单产品已申请重新编程次数为<field
name="reprogramming_count" string=""
readonly="1"
style='color:red;'/>,且当前编程状态为
<field name="programming_state" string=""
decoration-warning="programming_state =='编程中'"
decoration-success="programming_state =='已编程'" readonly="1"/>
</span>
</div>
<field name="production_id" invisible="True"/>
<footer>
<button name="action_confirm" string="确认" type="object" class="btn-primary"/>