Enforce unique value for invisible field

Closes #12034
This commit is contained in:
Cédric Krier
2023-02-11 18:07:06 +01:00
parent de8d5477a0
commit 82b0f2779b
4 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
* Use toggle button and label on translate dialog
* Support border type of images
* Manage domain on id in single value list as unique
* Do not validate domain and enforce uniqueness for empty fields unless they're required
* Do not validate domain nor enforce uniqueness for empty fields unless they're required or invisible
* Display the number of selected records on xxx2Many
Version 6.6.0 - 2022-10-31
+2
View File
@@ -1662,6 +1662,7 @@
var invalid = false;
var state_attrs = this.get_state_attrs(record);
var is_required = Boolean(parseInt(state_attrs.required, 10));
var is_invisible = Boolean(parseInt(state_attrs.invisible, 10));
state_attrs.domain_readonly = false;
var inversion = new Sao.common.DomainInversion();
var domain = inversion.simplify(this.validation_domains(record,
@@ -1688,6 +1689,7 @@
screen_domain)[0];
if (this._is_empty(record) &&
!is_required &&
!is_invisible &&
!unique_from_screen) {
// Do nothing
} else if (unique) {
+1 -1
View File
@@ -5,7 +5,7 @@
* Use ``&`` and ``|`` as boolean operator in search widget
* Use toggle button and label on translate dialog
* Manage domain on id in single value list as unique
* Do not validate domain and enforce uniqueness for empty fields unless they're required
* Do not validate domain nor enforce uniqueness for empty fields unless they're required or invisible
* Display the number of selected records on xxx2Many
Version 6.6.0 - 2022-10-31
@@ -97,6 +97,7 @@ class Field(object):
return True
state_attrs = self.get_state_attrs(record)
is_required = bool(int(state_attrs.get('required') or 0))
is_invisible = bool(int(state_attrs.get('invisible') or 0))
invalid = False
state_attrs['domain_readonly'] = False
domain = simplify(self.validation_domains(record, pre_validate))
@@ -114,6 +115,7 @@ class Field(object):
unique_from_screen, _, _ = unique_value(screen_domain)
if (self._is_empty(record)
and not is_required
and not is_invisible
and not unique_from_screen):
pass
elif unique: