调整向导提示语逻辑

This commit is contained in:
mgw
2025-03-14 14:02:14 +08:00
parent 4200fdbf3b
commit 4138903bff
4 changed files with 29 additions and 3 deletions

View File

@@ -177,6 +177,8 @@ class QualityCheck(models.Model):
# 出厂检验报告编号
report_number_id = fields.Many2one('documents.document', string='出厂检验报告编号', readonly=True)
old_report_name = fields.Char('旧出厂检验报告编号', default='')
# 出厂检验报告、关联文档的数据
report_content = fields.Binary(string='出厂检验报告', related='report_number_id.datas')
@@ -259,6 +261,8 @@ class QualityCheck(models.Model):
'default_check_qty': self.check_qty,
'default_measure_count': self.column_nums,
'default_item_count': len(self.measure_line_ids),
'default_old_report_name': self.old_report_name,
'default_publish_status': self.publish_status,
}
}
@@ -309,7 +313,8 @@ class QualityCheck(models.Model):
# 关联到当前质检记录
self.write({
'report_number_id': doc.id,
'publish_status': 'published'
'publish_status': 'published',
'old_report_name': self.report_number_id.name
})
# 记录发布历史

View File

@@ -274,7 +274,8 @@
<field name="check_qty" attrs="{'invisible': [('measure_on', '!=', 'product')]}"/>
<!-- <field name="categ_type"/> -->
<field name="report_number_id"/>
<field name="column_nums"/>
<field name="column_nums" invisible="1"/>
<field name="publish_status"/>
<field name="show_lot_text" invisible="1"/>
<field name="move_line_id" invisible="1"/>
<field name="product_tracking" invisible="1"/>

View File

@@ -11,6 +11,8 @@ class QualityCheckPublishWizard(models.TransientModel):
check_qty = fields.Char('检验数', readonly=True)
measure_count = fields.Integer('测量件数', readonly=True)
item_count = fields.Integer('检验项目数', readonly=True)
old_report_name = fields.Char('旧出厂检验报告编号', readonly=True)
publish_status = fields.Selection([('draft', '草稿'), ('published', '已发布'), ('canceled', '已撤销')], string='发布状态', readonly=True)
def action_confirm_publish(self):
"""确认发布"""

View File

@@ -7,7 +7,25 @@
<form string="发布确认">
<div class="alert alert-info" role="alert" style="margin-bottom:0px;">
<p>您即将发布出厂检验报告:产品<strong><field name="product_name" class="oe_inline"/></strong>,总数量<strong><field name="total_qty" class="oe_inline"/></strong>,检验数<strong><field name="check_qty" class="oe_inline"/></strong>,测量<strong><field name="measure_count" class="oe_inline"/></strong>件,检验项目<strong><field name="item_count" class="oe_inline"/></strong>项。</p>
<p>注意:发布后所有用户可扫描下载本报告</p>
<field name="publish_status" invisible="1"/>
<!-- 状态为draft时显示 -->
<div attrs="{'invisible': [('publish_status', '!=', 'draft')]}">
<span style="font-weight:bold;">
注意:发布后所有用户可扫描下载本报告
</span>
</div>
<!-- 状态不为draft时显示 -->
<div attrs="{'invisible': [('publish_status', '=', 'draft')]}">
<span style="font-weight:bold;">
注意:已发布的报告
<field name="old_report_name" readonly="1"
style="color:red;"
attrs="{'invisible': [('old_report_name', '=', False)]}"/>
<span style="color:red;"
attrs="{'invisible': [('old_report_name', '!=', False)]}">(未知报告编号)</span>
可能已被客户下载
</span>
</div>
</div>
<footer>
<button name="action_confirm_publish" string="发布" type="object" class="btn-primary"/>