forked from pierrelocus/odoo-attrs-replace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testfile.xml
53 lines (53 loc) · 2.76 KB
/
testfile.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<form>
<xpath expr="//">
<!-- readonly should give: -->
<!-- (field1 == 'yes' and field2 == 'yes') or (field3 == 'yes' or field4 == 'yes') or field5 == 'yes' and field6 == 'yes' -->
<field attrs="{'invisible': True, 'readonly': ['|', '|', '&', ('field1', '=', 'yes'), ('field2', '=', 'yes'), '|', ('field3', '=', 'yes'), ('field4', '=', 'yes'), ('field5', '=', 'yes'), ('field6', '=', 'yes')], 'required': [('field', 'in', ['a', 'b', 'c'])], 'column_invisible': 0}" name="name"/>
</xpath>
<xpath expr="//." position="attributes">
<attribute name="attrs">{'invisible': True, 'readonly': [('otherfield', '=', 'yes')], 'required': [('field', 'in', ['a', 'b', 'c'])], 'column_invisible': 0}</attribute>
</xpath>
<xpath expr="//test_states_simple_case">
<field states="draft,done"/>
</xpath>
<xpath expr="//test_states_attrs_simple_case">
<attribute name="states">draft</attribute>
</xpath>
<xpath expr="//test_states_with_invisible_existing">
<field states="draft,done" attrs="{'invisible': [('testfield', '=', 'hello world')]}"/>
</xpath>
<xpath expr="//test_states_attrs_with_invisible_existing" position="attributes">
<attribute name="attrs">{
'invisible': [
'|',
'|',
'&',
('test1', 'in', [1, 2, 3]),
('test2', 'in', [2, 3, 4]),
('test3', '=', 'hello'),
('test4', 'in', [%('testmodule.test_xml_id')d, %('testmodule.test_xml_id_2')d])
]
}</attribute>
<attribute name="states">draft,done</attribute>
</xpath>
<xpath expr="//test_states_attrs_with_invisible_existing_and_invisible_single_and">
<attribute name="attrs">{'invisible': ['&', ('test8', '=', True)]}</attribute>
<attribute name="states">draft,done</attribute>
</xpath>
<field name="test" attrs="{
'invisible': [
'|',
'|',
'&',
('test1', 'in', [1, 2, 3]),
('test2', 'in', [2, 3, 4]),
('test3', '=', 'hello'),
('test4', 'in', [%('testmodule.test_xml_id')d, %(testmodule.test_xml_id_2)d])
]
}"/>
<!-- Case given by odoo, single '|' with states - can cause bug while should be accepted -->
<button name="action_open_action_coupon_program" attrs="{'invisible': ['|', ('allow_modification', '=', False)]}" context="{'enable_add_temporary': 1}" class="btn btn-secondary" string="Actions" type="object" states="draft,sent,sale"/>
</form>
</odoo>