Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
7bc4ffdc by Cédric Krier at 2023-02-11T18:07:06+01:00
Enforce unique value for invisible field
Closes #12034
- - - - -
4 changed files:
- sao/CHANGELOG
- sao/src/model.js
- tryton/CHANGELOG
- tryton/tryton/gui/window/view_form/model/field.py
Changes:
=====================================
sao/CHANGELOG
=====================================
@@ -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
=====================================
sao/src/model.js
=====================================
@@ -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) {
=====================================
tryton/CHANGELOG
=====================================
@@ -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
=====================================
tryton/tryton/gui/window/view_form/model/field.py
=====================================
@@ -97,6 +97,7 @@
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 @@
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:
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/7bc4ffdc6580c99dd796651b95f67110ca7108a7
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/7bc4ffdc6580c99dd796651b95f67110ca7108a7
You're receiving this email because of your account on foss.heptapod.net.