质量检查优化-界面部分
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
'sequence': 120,
|
||||
'summary': 'Control the quality of your products',
|
||||
'website': 'https://www.odoo.com/app/quality',
|
||||
'depends': ['quality', 'sf_manufacturing'],
|
||||
'depends': ['quality', 'sf_manufacturing', 'base_import'],
|
||||
'description': """
|
||||
Quality Control
|
||||
===============
|
||||
@@ -26,6 +26,7 @@ Quality Control
|
||||
'views/product_views.xml',
|
||||
'views/stock_move_views.xml',
|
||||
'views/stock_picking_views.xml',
|
||||
'views/quality.check.measures.line.xml',
|
||||
'wizard/quality_check_wizard_views.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_quality_check_wizard,access.quality_check_wizard,model_quality_check_wizard,quality.group_quality_user,1,1,1,0
|
||||
access_quality_check_measure_line,quality.check.measure.line,model_quality_check_measure_line,base.group_user,1,1,1,0
|
||||
|
||||
|
21
quality_control/views/quality.check.measures.line.xml
Normal file
21
quality_control/views/quality.check.measures.line.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="quality_check_measure_line_tree" model="ir.ui.view">
|
||||
<field name="name">quality.check.measure.line.tree</field>
|
||||
<field name="model">quality.check.measure.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree create="false" editable="bottom">
|
||||
<field name="sequence"/>
|
||||
<field name="measure_item"/>
|
||||
<field name="measure_value1"/>
|
||||
<field name="measure_value2"/>
|
||||
<field name="measure_value3"/>
|
||||
<field name="measure_value4"/>
|
||||
<field name="measure_value5"/>
|
||||
<field name="measure_result"/>
|
||||
<field name="remark"/>
|
||||
<button name="del_measure_value" type="object" string="删除测量值" class="btn-danger"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -255,6 +255,7 @@
|
||||
<field name="quality_state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<field name="is_out_check" invisible="1"/>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="action_see_alerts" icon="fa-bell" type="object" class="oe_stat_button"
|
||||
attrs="{'invisible': [('alert_count', '=', 0)]}">
|
||||
@@ -265,10 +266,12 @@
|
||||
<group>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="product_id" attrs="{'invisible' : [('measure_on', '=', 'operation')]}"/>
|
||||
<field name="measure_on" attrs="{'readonly': [('point_id', '!=', False)]}"/>
|
||||
<field name="part_name"/>
|
||||
<field name="part_number"/>
|
||||
<field name="material_name"/>
|
||||
<field name="total_qty"/>
|
||||
<field name="check_qty"/>
|
||||
<field name="report_number"/>
|
||||
<field name="show_lot_text" invisible="1"/>
|
||||
<field name="move_line_id" invisible="1"/>
|
||||
<field name="product_tracking" invisible="1"/>
|
||||
@@ -301,23 +304,48 @@
|
||||
<field name="alert_ids" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="picking_id"
|
||||
attrs="{'invisible': [('quality_state', 'in', ('pass', 'fail')), ('picking_id', '=', False)]}"/>
|
||||
<field name="point_id"/>
|
||||
<field name="measure_on" attrs="{'readonly': [('point_id', '!=', False)]}"/>
|
||||
<field string="Type" name="test_type_id" options="{'no_open': True, 'no_create': True}"
|
||||
attrs="{'readonly': [('point_id', '!=', False)]}"/>
|
||||
<field name="picking_id"
|
||||
attrs="{'invisible': [('quality_state', 'in', ('pass', 'fail')), ('picking_id', '=', False)]}"/>
|
||||
<field name="control_date" invisible="1"/>
|
||||
<field name="partner_id" string="Partner"
|
||||
attrs="{'invisible': [('partner_id', '=', False)]}"/>
|
||||
<field name="team_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="user_id" string="Control Person" invisible="1"/>
|
||||
<field name="partner_id" string="Partner"
|
||||
attrs="{'invisible': [('partner_id', '=', False)]}"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('test_type', '!=', 'picture')]}">
|
||||
<field name="picture" widget="image"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<!-- 增加page页:测量、出厂检验报告、2D加工图纸、质检标准、发布历史,它们均在is_out_check为True时显示 -->
|
||||
<!-- 测量page内有一个添加测量值按钮,点击可以新增一行测量值,新增的行在tree视图中显示,显示的列有:序号、检测项目、测量值1、测量值2、测量值3、测量值4、测量值5、判定、备注。其中检测项目、测量值1、测量值2、测量值3、测量值4、测量值5为必填项,判定为下拉框,默认选中合格,备注为文本框。 -->
|
||||
<page string="测量" name="measure" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
||||
<div class="o_row">
|
||||
<button name="add_measure_line" type="object" class="btn-primary" string="添加测量值"/>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="o_row">
|
||||
<field name="measure_line_ids" widget="tree"/>
|
||||
</div>
|
||||
</page>
|
||||
<page string="出厂检验报告" name="out_check" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
||||
<!-- <field name="report_number"/> -->
|
||||
</page>
|
||||
<page string="2D加工图纸" name="2d_drawing" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
||||
<!-- <field name="2d_drawing"/> -->
|
||||
</page>
|
||||
<page string="质检标准" name="quality_standard" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
||||
<!-- <field name="quality_standard"/> -->
|
||||
</page>
|
||||
|
||||
|
||||
|
||||
<page string="Notes" name="notes">
|
||||
<group>
|
||||
<field name="report_result"/>
|
||||
@@ -327,6 +355,9 @@
|
||||
|
||||
</group>
|
||||
</page>
|
||||
<page string="发布历史" name="release_history" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
||||
<!-- <field name="release_history"/> -->
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
|
||||
Reference in New Issue
Block a user