质量检查优化-界面部分
This commit is contained in:
@@ -10,6 +10,7 @@ from odoo import api, models, fields, _
|
||||
from odoo.api import depends
|
||||
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT, float_round
|
||||
from odoo.osv.expression import OR
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class QualityPoint(models.Model):
|
||||
@@ -129,12 +130,33 @@ class QualityCheck(models.Model):
|
||||
# 材料
|
||||
material_name = fields.Char('材料名称', compute='_compute_material_name', readonly=True)
|
||||
|
||||
# # 总数量,值未调拨单_产品明细_数量
|
||||
# # 总数量,值为调拨单_产品明细_数量
|
||||
# total_qty = fields.Float('总数量', compute='_compute_total_qty', readonly=True)
|
||||
# # 检验数
|
||||
# check_qty = fields.Float('检验数', compute='_compute_check_qty', readonly=True)
|
||||
# # 出厂检验报告编号
|
||||
# report_number = fields.Char('出厂检验报告编号', compute='_compute_report_number', readonly=True)
|
||||
# 总数量,值为调拨单_产品明细_数量
|
||||
total_qty = fields.Float('总数量', readonly=True)
|
||||
# 检验数
|
||||
check_qty = fields.Float('检验数', creadonly=True)
|
||||
# 出厂检验报告编号
|
||||
report_number_id = fields.Many2one('document.document', string='出厂检验报告编号', readonly=True)
|
||||
is_out_check = fields.Boolean(string='是否出库检验', compute='_compute_is_out_check', readonly=True)
|
||||
|
||||
measure_line_ids = fields.One2many('quality.check.measure.line', 'check_id', string='测量明细')
|
||||
|
||||
def add_measure_line(self):
|
||||
'''
|
||||
新增测量值,如果测量值有5列了,则提示“最多只能有5列测量值”
|
||||
'''
|
||||
self.ensure_one()
|
||||
if len(self.measure_line_ids) >= 5:
|
||||
raise UserError('最多只能有5列测量值')
|
||||
self.env['quality.check.measure.line'].create({
|
||||
'check_id': self.id,
|
||||
'sequence': len(self.measure_line_ids) + 1,
|
||||
})
|
||||
|
||||
@depends('product_id')
|
||||
def _compute_part_name_number(self):
|
||||
@@ -149,6 +171,14 @@ class QualityCheck(models.Model):
|
||||
materials_type_name = record.product_id.materials_type_id.name if record.product_id.materials_type_id else ''
|
||||
record.material_name = materials_id_name + ' ' + materials_type_name
|
||||
|
||||
@depends('point_id')
|
||||
def _compute_is_out_check(self):
|
||||
for record in self:
|
||||
if record.point_id.title == '出厂检验报告':
|
||||
record.is_out_check = True
|
||||
else:
|
||||
record.is_out_check = False
|
||||
|
||||
failure_message = fields.Html(related='point_id.failure_message', readonly=True)
|
||||
measure = fields.Float('Measure', default=0.0, digits='Quality Tests', tracking=True)
|
||||
measure_success = fields.Selection([
|
||||
@@ -541,3 +571,41 @@ class ProductProduct(models.Model):
|
||||
|
||||
def _additional_quality_point_where_clause(self):
|
||||
return ""
|
||||
|
||||
|
||||
class QualityCheckMeasureLine(models.Model):
|
||||
_name = 'quality.check.measure.line'
|
||||
_description = '质检测量明细'
|
||||
_order = 'sequence, id'
|
||||
|
||||
sequence = fields.Integer('序号', default=10)
|
||||
check_id = fields.Many2one('quality.check', string='质检单', required=True, ondelete='cascade')
|
||||
|
||||
# 基本信息
|
||||
product_name = fields.Char('产品名称', related='check_id.product_id.name', readonly=True)
|
||||
drawing_no = fields.Char('图号')
|
||||
measure_item = fields.Char('检测项目')
|
||||
|
||||
# 测量值
|
||||
measure_value1 = fields.Char('测量值1')
|
||||
measure_value2 = fields.Char('测量值2')
|
||||
measure_value3 = fields.Char('测量值3')
|
||||
measure_value4 = fields.Char('测量值4')
|
||||
measure_value5 = fields.Char('测量值5')
|
||||
|
||||
# 展示列数
|
||||
show_colomn_number = fields.Integer('展示列数', default=1)
|
||||
|
||||
# 判定结果
|
||||
measure_result = fields.Selection([
|
||||
('OK', 'OK'),
|
||||
('NG', 'NG')
|
||||
], string='判定', default='OK')
|
||||
|
||||
remark = fields.Char('备注')
|
||||
|
||||
def del_measure_value(self):
|
||||
self.ensure_one()
|
||||
self.sudo().unlink()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user