[FIX] tests: Handle attrs containing numbers instead of bool
The Form class already handles cases for attrs that contain boolean
values, e.g.:
`attrs="{'readonly': True}"`
But it doesnt for integers, e.g.:
`attrs="{'readonly': 1}"`
This commit changes the expected non-domain value from boolean to
integer, because both are valid cases and the former is a subset of the
latter.
[1] https://github.com/odoo/odoo/blob/b3d4938ba6b1/addons/repair/views/repair_views.xml#L54
closes odoo/odoo#56612
X-original-commit: 782534a429f10e7b114c838687d38aa4080a920c
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Luis González [Vauxoo] <luisg123v@users.noreply.github.com>
This commit is contained in:
@@ -125,7 +125,7 @@
|
||||
<field name="f2" attrs="{'readonly': [['f1', '=', '63'], ['f3', '=', 5]]}"/>
|
||||
<field name="f3"/>
|
||||
<field name="f4"/>
|
||||
<field name="f5" readonly="1"/>
|
||||
<field name="f5" attrs="{'readonly': 1}"/>
|
||||
<field name="f6" readonly="1" force_save="1"/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -1676,7 +1676,7 @@ class Form(object):
|
||||
order.append(fname)
|
||||
|
||||
modifiers[fname] = {
|
||||
modifier: domain if isinstance(domain, bool) else normalize_domain(domain)
|
||||
modifier: bool(domain) if isinstance(domain, int) else normalize_domain(domain)
|
||||
for modifier, domain in json.loads(f.get('modifiers', '{}')).items()
|
||||
}
|
||||
ctx = f.get('context')
|
||||
|
||||
Reference in New Issue
Block a user