控制字段、page显隐逻辑
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="quality_point_out_check_report" model="quality.point">
|
||||
<field name="title">出厂检验报告</field>
|
||||
<field name="picking_type_ids" eval="[(4, ref('stock.picking_type_out'))]"/> <!-- 作业类型:发料出库 -->
|
||||
<field name="measure_on">product</field> <!-- 控制方式:产品 -->
|
||||
<field name="measure_frequency_type">all</field> <!-- 控制频率:全部 -->
|
||||
<record id="test_type_factory_inspection" model="quality.point.test_type">
|
||||
<field name="name">出厂检验报告</field>
|
||||
<field name="technical_name">factory_inspection</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
class SfQualityPoint(models.Model):
|
||||
_inherit = 'quality.point'
|
||||
@@ -16,4 +16,14 @@ class SfQualityPoint(models.Model):
|
||||
operation_id = fields.Many2one(
|
||||
'mrp.routing.workcenter', 'Step', check_company=True,
|
||||
domain="[('is_outsource', '=', False),('company_id', 'in', (company_id, False))]")
|
||||
|
||||
@api.onchange('test_type_id')
|
||||
def _onchange_test_type_id(self):
|
||||
"""
|
||||
如果类型选择了出厂检验报告,检查measure_on的值是否为product,如果为product,则类型的值不变,如果
|
||||
不是,则提示错误
|
||||
"""
|
||||
if self.test_type_id.name == '出厂检验报告':
|
||||
if self.measure_on != 'product':
|
||||
raise ValidationError('出厂检验报告的测量对象必须为产品')
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="2D图纸" attrs="{'invisible': [('production_id', '=', False)]}">
|
||||
<field name="machining_drawings" string="" widget="adaptive_viewer"/>
|
||||
<page string="2D加工图纸" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])]}">
|
||||
<field name='machining_drawings' widget="adaptive_viewer"/>
|
||||
</page>
|
||||
<page string="客户质量标准" attrs="{'invisible': [('production_id', '=', False)]}">
|
||||
<field name="quality_standard" string="" widget="adaptive_viewer"/>
|
||||
<page string="质检标准" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])]}">
|
||||
<field name='quality_standard' widget="adaptive_viewer"/>
|
||||
</page>
|
||||
<page string="其他"
|
||||
attrs="{'invisible': ['|',('quality_state', 'not in', ['pass', 'fail']), ('production_id', '=', False)]}">
|
||||
|
||||
Reference in New Issue
Block a user