|
@ -83,9 +83,7 @@ class CustomInfoProperty(models.Model): |
|
|
self.mapped("template_id").check_access_rule(operation) |
|
|
self.mapped("template_id").check_access_rule(operation) |
|
|
return super().check_access_rule(operation) |
|
|
return super().check_access_rule(operation) |
|
|
|
|
|
|
|
|
@api.constrains("default_value", "field_type") |
|
|
|
|
|
def _check_default_value(self): |
|
|
|
|
|
"""Ensure the default value is valid.""" |
|
|
|
|
|
|
|
|
def _check_default_value_one(self): |
|
|
if self.default_value: |
|
|
if self.default_value: |
|
|
try: |
|
|
try: |
|
|
self.env["custom.info.value"]._transform_value( |
|
|
self.env["custom.info.value"]._transform_value( |
|
@ -98,6 +96,12 @@ class CustomInfoProperty(models.Model): |
|
|
_("Default value %s cannot be converted to type %s.") % |
|
|
_("Default value %s cannot be converted to type %s.") % |
|
|
(self.default_value, selection[self.field_type])) |
|
|
(self.default_value, selection[self.field_type])) |
|
|
|
|
|
|
|
|
|
|
|
@api.constrains("default_value", "field_type") |
|
|
|
|
|
def _check_default_value(self): |
|
|
|
|
|
"""Ensure the default value is valid.""" |
|
|
|
|
|
for rec in self: |
|
|
|
|
|
rec._check_default_value_one() |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
@api.onchange("required", "field_type") |
|
|
@api.onchange("required", "field_type") |
|
|
def _onchange_required_warn(self): |
|
|
def _onchange_required_warn(self): |
|
|