Accept Merge Request #1925: (feature/制造功能优化 -> develop)
Merge Request: 出厂检验报告bug修改 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1925?initial=true
This commit is contained in:
@@ -15,8 +15,30 @@
|
||||
<field name="measure_value5" attrs="{ 'column_invisible': [('parent.column_nums', '<', 5)] }"/>
|
||||
<field name="measure_result"/>
|
||||
<field name="remark"/>
|
||||
<button name="del_measure_value" type="object" string="删除" class="btn-danger"/>
|
||||
<button name="del_measure_value" type="object" string="删除" class="btn-danger" attrs="{'invisible': [('parent.publish_status', '=', 'published')]}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="quality_check_measure_line_form" model="ir.ui.view">
|
||||
<field name="name">quality.check.measure.line.form</field>
|
||||
<field name="model">quality.check.measure.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="measure_item"/>
|
||||
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="measure_result"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -268,10 +268,10 @@
|
||||
<field name="categ_type" invisible="1"/>
|
||||
<field name="product_id" attrs="{'invisible' : [('measure_on', '=', 'operation')]}"/>
|
||||
<field name="part_name" attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name="part_number" attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name="part_number" attrs="{'invisible': [('categ_type', '!=', '成品')], 'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
<field name="material_name" attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name="total_qty" attrs="{'invisible': ['|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False)]}"/>
|
||||
<field name="check_qty" attrs="{'invisible': [('measure_on', '!=', 'product')]}"/>
|
||||
<field name="check_qty" attrs="{'invisible': [('measure_on', '!=', 'product')], 'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
<!-- <field name="categ_type"/> -->
|
||||
<field name="report_number_id"/>
|
||||
<field name="column_nums" invisible="1"/>
|
||||
@@ -320,7 +320,7 @@
|
||||
<field name="team_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="user_id" string="Control Person" invisible="1"/>
|
||||
<field name="measure_operator" string="操机员"/>
|
||||
<field name="measure_operator" string="操机员" attrs="{'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
@@ -338,11 +338,11 @@
|
||||
type="action"
|
||||
class="btn-primary"
|
||||
attrs="{'force_show':1}"
|
||||
context="{'default_model_name': 'quality.check.measure.line'}"/>
|
||||
context="{'default_model_name': 'quality.check.measure.line', 'default_check_id': id}"/>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="o_row">
|
||||
<field name="measure_line_ids" widget="tree"/>
|
||||
<field name="measure_line_ids" widget="tree" attrs="{'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
</div>
|
||||
</page>
|
||||
<page string="出厂检验报告" name="out_check" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
||||
|
||||
@@ -24,6 +24,7 @@ class ImportComplexModelWizard(models.TransientModel):
|
||||
file_data = fields.Binary("数据文件")
|
||||
model_name = fields.Char(string='Model Name')
|
||||
field_basis = fields.Char(string='Field Basis')
|
||||
check_id = fields.Many2one(string='质检单', comodel_name='quality.check')
|
||||
|
||||
def get_model_column_name_labels(self, model):
|
||||
fields_info = model.fields_get()
|
||||
@@ -96,6 +97,9 @@ class ImportComplexModelWizard(models.TransientModel):
|
||||
"""导入Excel数据"""
|
||||
if not self.file_data:
|
||||
raise UserError(_('请先上传Excel文件'))
|
||||
|
||||
if self.check_id.measure_line_ids:
|
||||
self.sudo().check_id.measure_line_ids.unlink()
|
||||
|
||||
# 解码文件数据
|
||||
file_content = base64.b64decode(self.file_data)
|
||||
@@ -156,6 +160,7 @@ class ImportComplexModelWizard(models.TransientModel):
|
||||
valid_data_imported = False
|
||||
|
||||
# 从第二行开始读取数据(跳过表头)
|
||||
max_columns = 1
|
||||
for row_index in range(1, sheet.nrows):
|
||||
row = sheet.row_values(row_index)
|
||||
|
||||
@@ -182,8 +187,15 @@ class ImportComplexModelWizard(models.TransientModel):
|
||||
'remark': row[10] if len(row) > 10 and row[10] else '', # 备注列
|
||||
}
|
||||
|
||||
for i in range(1, 6):
|
||||
if measure_line_vals.get(f'measure_value{i}'):
|
||||
if i > max_columns:
|
||||
max_columns = i
|
||||
|
||||
self.env['quality.check.measure.line'].create(measure_line_vals)
|
||||
valid_data_imported = True
|
||||
|
||||
quality_check.column_nums = max_columns
|
||||
|
||||
# 检查是否有有效数据被导入
|
||||
if not valid_data_imported:
|
||||
|
||||
@@ -116,6 +116,9 @@ class QualityCheckWizard(models.TransientModel):
|
||||
|
||||
# 对于成品出库的出厂检验报告,增加发布按钮
|
||||
def publish(self):
|
||||
self.current_check_id._check_part_number()
|
||||
self.current_check_id._check_measure_line()
|
||||
self.current_check_id._check_check_qty_and_total_qty()
|
||||
self.current_check_id._do_publish_implementation()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user