出厂检验报告发布时二次确认
This commit is contained in:
32
sf_quality/wizard/confirmation_wizard.py
Normal file
32
sf_quality/wizard/confirmation_wizard.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class ConfirmationWizard(models.TransientModel):
|
||||
_name = 'confirmation.wizard'
|
||||
_description = '二次确认向导'
|
||||
|
||||
# 可根据需要传递上下文参数
|
||||
check_id = fields.Many2one('quality.check', string='质检单', required=True)
|
||||
picking_name = fields.Char(string='拣货单', related='check_id.picking_id.name', store=True)
|
||||
number = fields.Char(string='数量', related='check_id.total_qty', store=True)
|
||||
picking_num = fields.Integer(string='拣货数量', compute='_compute_picking_num', store=True)
|
||||
|
||||
@api.depends('check_id.picking_id')
|
||||
def _compute_picking_num(self):
|
||||
for record in self.check_id:
|
||||
if record.picking_id:
|
||||
for move in record.picking_id.move_ids_without_package:
|
||||
if move.product_id == record.product_id:
|
||||
self.picking_num = int(move.product_uom_qty)
|
||||
else:
|
||||
self.picking_num = 0
|
||||
|
||||
button_text = fields.Char(string='确认按钮文字')
|
||||
|
||||
def action_confirm(self):
|
||||
self.ensure_one()
|
||||
|
||||
# 获取原始记录
|
||||
check = self.env['quality.check'].browse(self.check_id.id)
|
||||
# 调用实际发布方法
|
||||
return check._do_actual_publish()
|
||||
Reference in New Issue
Block a user