|
2 | 2 | <odoo> |
3 | 3 | <record model="ir.actions.act_window" id="mrp.mrp_bom_form_action"> |
4 | 4 | <field name="domain">['|',('active','=',True),('active','=',False)]</field> |
| 5 | + <field name="context">{'active_test': False}</field> |
5 | 6 | </record> |
6 | 7 |
|
7 | 8 | <record model="ir.ui.view" id="mrp_bom_version_tree_view"> |
8 | 9 | <field name="model">mrp.bom</field> |
9 | 10 | <field name="inherit_id" ref="mrp.mrp_bom_tree_view" /> |
10 | 11 | <field name="arch" type="xml"> |
11 | | - <tree position="attributes"> |
| 12 | + <list position="attributes"> |
12 | 13 | <attribute name="decoration-muted">not active</attribute> |
13 | | - </tree> |
| 14 | + </list> |
14 | 15 | <field name="code" position="after"> |
15 | 16 | <field name="version" /> |
16 | 17 | <field name="state" /> |
|
20 | 21 | type="object" |
21 | 22 | title="Draft" |
22 | 23 | groups="mrp_bom_version.group_mrp_bom_version" |
23 | | - attrs="{'invisible':[('state','!=','active')]}" |
| 24 | + invisible="state != 'active'" |
24 | 25 | icon="fa-plus-square" |
25 | 26 | /> |
26 | 27 | <button |
27 | 28 | name="button_activate" |
28 | 29 | type="object" |
29 | 30 | title="Activate" |
30 | | - attrs="{'invisible':[('state','not in',(False, 'draft'))]}" |
| 31 | + invisible="state not in (False, 'draft')" |
31 | 32 | icon="fa-check-square" |
32 | 33 | confirm="You will activate the BoM, then you won't be able to edit it after this. Are you sure you want to proceed?" |
33 | 34 | /> |
34 | 35 | <button |
35 | 36 | name="button_new_version" |
36 | 37 | type="object" |
37 | 38 | title="New version" |
38 | | - attrs="{'invisible':[('state','==','historical')]}" |
| 39 | + invisible="state == 'historical'" |
39 | 40 | icon="fa-gears" |
40 | 41 | confirm="You are going to create a new version of this BoM. Are you sure?" |
41 | 42 | /> |
42 | 43 | <button |
43 | 44 | name="button_historical" |
44 | 45 | type="object" |
45 | 46 | title="Historical" |
46 | | - attrs="{'invisible':[('state','!=','active')]}" |
| 47 | + invisible="state != 'active'" |
47 | 48 | icon="fa-history" |
48 | 49 | confirm="You are going to historize an BoM. Doing, not be able to unlock it unless you make a copy. Are you sure you want to proceed?" |
49 | 50 | /> |
|
57 | 58 | <field name="arch" type="xml"> |
58 | 59 | <sheet position="before"> |
59 | 60 | <header> |
| 61 | + <field name="sequence" invisible="1" /> |
60 | 62 | <button |
61 | 63 | name="button_draft" |
62 | 64 | type="object" |
63 | 65 | string="Draft" |
64 | 66 | groups="mrp_bom_version.group_mrp_bom_version" |
65 | | - attrs="{'invisible':[('state','!=','active')]}" |
| 67 | + invisible="state != 'active'" |
66 | 68 | class="oe_highlight" |
67 | 69 | /> |
68 | 70 | <button |
69 | 71 | name="button_activate" |
70 | 72 | type="object" |
71 | 73 | string="Activate" |
72 | | - attrs="{'invisible':[('state','not in',(False, 'draft'))]}" |
| 74 | + invisible="state not in (False, 'draft')" |
73 | 75 | class="oe_highlight" |
74 | | - confirm="YYou will activate the BoM, then you won't be able to edit it after this. Are you sure you want to proceed?" |
| 76 | + confirm="You will activate the BoM, then you won't be able to edit it after this. Are you sure you want to proceed?" |
75 | 77 | /> |
76 | 78 | <button |
77 | 79 | name="button_new_version" |
78 | 80 | type="object" |
79 | 81 | string="New version" |
80 | | - attrs="{'invisible':[('state','=','historical')]}" |
| 82 | + invisible="state == 'historical'" |
81 | 83 | class="oe_highlight" |
82 | 84 | confirm="You are going to create a new version of this BoM. Are you sure?" |
83 | 85 | /> |
84 | 86 | <button |
85 | 87 | name="button_historical" |
86 | 88 | type="object" |
87 | 89 | string="Historical" |
88 | | - attrs="{'invisible':[('state','!=','active')]}" |
| 90 | + invisible="state != 'active'" |
89 | 91 | class="oe_highlight" |
90 | 92 | confirm="You are going to historize an BoM. Doing, not be able to unlock it unless you make a copy. Are you sure you want to proceed?" |
91 | 93 | /> |
|
97 | 99 | </header> |
98 | 100 | </sheet> |
99 | 101 | <field name="company_id" position="before"> |
100 | | - <field name="version" /> |
101 | | - <field |
102 | | - name="historical_date" |
103 | | - attrs="{'invisible': [('state','!=','historical')]}" |
104 | | - /> |
| 102 | + <field name="version" readonly="state == 'historical'" /> |
| 103 | + <field name="historical_date" invisible="state != 'historical'" /> |
105 | 104 | </field> |
106 | 105 | <notebook position="inside"> |
107 | 106 | <page string="Versions"> |
108 | 107 | <field name="old_versions" /> |
109 | 108 | </page> |
110 | 109 | </notebook> |
| 110 | + <xpath |
| 111 | + expr="//group/group[2]/field[@name='company_id']" |
| 112 | + position="attributes" |
| 113 | + > |
| 114 | + <attribute name="readonly">state == 'historical'</attribute> |
| 115 | + </xpath> |
| 116 | + <field name="product_tmpl_id" position="attributes"> |
| 117 | + <attribute |
| 118 | + name="readonly" |
| 119 | + >state != 'draft' and not context.get('test_enable', False)</attribute> |
| 120 | + </field> |
| 121 | + <field name="product_id" position="attributes"> |
| 122 | + <attribute name="readonly">state != 'draft'</attribute> |
| 123 | + </field> |
| 124 | + <field name="product_qty" position="attributes"> |
| 125 | + <attribute name="readonly">state != 'draft'</attribute> |
| 126 | + </field> |
| 127 | + <field name="code" position="attributes"> |
| 128 | + <attribute name="readonly">state == 'historical'</attribute> |
| 129 | + </field> |
| 130 | + <field name="type" position="attributes"> |
| 131 | + <attribute name="readonly">state == 'historical'</attribute> |
| 132 | + </field> |
| 133 | + <field name="product_uom_id" position="attributes"> |
| 134 | + <attribute name="readonly">state == 'historical'</attribute> |
| 135 | + </field> |
| 136 | + <field name="bom_line_ids" position="attributes"> |
| 137 | + <attribute |
| 138 | + name="readonly" |
| 139 | + >state != 'draft' and not context.get('test_enable', False)</attribute> |
| 140 | + </field> |
| 141 | + <field name="byproduct_ids" position="attributes"> |
| 142 | + <attribute name="readonly">state != 'draft'</attribute> |
| 143 | + </field> |
| 144 | + <field name="sequence" position="attributes"> |
| 145 | + <attribute name="readonly">state == 'historical'</attribute> |
| 146 | + </field> |
| 147 | + <field name="operation_ids" position="attributes"> |
| 148 | + <attribute name="readonly">state != 'draft'</attribute> |
| 149 | + </field> |
| 150 | + <field name="ready_to_produce" position="attributes"> |
| 151 | + <attribute name="readonly">state == 'historical'</attribute> |
| 152 | + </field> |
| 153 | + <field name="picking_type_id" position="attributes"> |
| 154 | + <attribute name="readonly">state == 'historical'</attribute> |
| 155 | + </field> |
| 156 | + <field name="consumption" position="attributes"> |
| 157 | + <attribute name="readonly">state == 'historical'</attribute> |
| 158 | + </field> |
111 | 159 | </field> |
112 | 160 | </record> |
113 | 161 |
|
|
0 commit comments