控制字段、page显隐逻辑
This commit is contained in:
@@ -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('出厂检验报告的测量对象必须为产品')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user