summaryrefslogtreecommitdiff
path: root/addons/product/views/product_pricelist_views.xml
blob: b19577ef475b0c96fb1249211ff3fd5b4b983851 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>

        <record model="ir.ui.view" id="product_pricelist_item_view_search">
            <field name="name">product.pricelist.item.search</field>
            <field name="model">product.pricelist.item</field>
            <field name="arch" type="xml">
                <search string="Products Price Rules Search">
                    <filter name="Product Rule" domain="[('applied_on', '=', '1_product')]"/>
                    <filter name="Variant Rule" domain="[('applied_on', '=', '0_product_variant')]" groups="product.group_product_variant"/>
                    <separator/>
                    <field name="pricelist_id"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                    <field name="currency_id" groups="base.group_multi_currency"/>
                    <filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
                    <group expand="0" string="Group By">
                        <filter string="Product" name="groupby_product" domain="[]" context="{'group_by': 'product_tmpl_id'}"/>
                        <filter string="Variant"
                          name="groupby_product_variant"
                          domain="[('applied_on', '=', '0_product_variant')]"
                          context="{'group_by': 'product_tmpl_id'}"
                          groups="product.group_product_variant"/>
                        <filter string="Pricelist"
                          name="groupby_vendor"
                          domain="[]"
                          context="{'group_by': 'pricelist_id'}"
                          groups="product.group_product_pricelist"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="product_pricelist_item_tree_view" model="ir.ui.view">
          <field name="name">product.pricelist.item.tree</field>
          <field name="model">product.pricelist.item</field>
          <field name="priority">10</field>
          <field name="arch" type="xml">
            <tree string="Price Rules">
              <field name="pricelist_id"/>
              <field name="name" string="Applied On"/>
              <field name="price"/>
              <field name="min_quantity" colspan="4"/>
              <field name="date_start" optional="hide"/>
              <field name="date_end" optional="hide"/>
              <field name="company_id" groups="base.group_multi_company" optional="show"/>
            </tree>
          </field>
        </record>

        <record id="product_pricelist_item_tree_view_from_product" model="ir.ui.view">
            <!-- Access and edit price rules from a given product/product variant -->
            <field name="name">product.pricelist.item.tree</field>
            <field name="model">product.pricelist.item</field>
            <field name="priority">100</field>
            <field name="arch" type="xml">
                <tree string="Pricelist Items" editable="bottom">
                    <!-- Scope = coming from a product/product template -->
                    <field name="pricelist_id" string="Pricelist" options="{'no_create_edit':1, 'no_open': 1}"/>
                    <field name="name" string="Applied On"/>
                    <field name="categ_id" invisible="1"/>
                    <field name="product_tmpl_id"
                      invisible="context.get('active_model')!='product.category'"
                      attrs="{'required': [('applied_on', '=', '1_product')]}"
                      domain="[('categ_id', '=', context.get('default_categ_id', True)), '|', ('company_id', '=', company_id), ('company_id', '=', False)]"
                      options="{'no_create_edit':1, 'no_open': 1}"/>
                    <field name="product_id"
                      groups="product.group_product_variant"
                      invisible="context.get('product_without_variants', False)"
                      readonly="context.get('active_model')=='product.product'"
                      attrs="{'required': [('applied_on', '=', '0_product_variant')]}"
                      domain="['|', '|',
                        ('id', '=', context.get('default_product_id', 0)),
                        ('product_tmpl_id', '=', context.get('default_product_tmpl_id', 0)),
                        ('categ_id', '=', context.get('default_categ_id', 0)), '|', ('company_id', '=', company_id), ('company_id', '=', False)
                      ]"
                      options="{'no_create_edit':1, 'no_open': 1}"
                      />
                    <field name="min_quantity" colspan="4"/>
                    <field name="currency_id" invisible="1"/>
                    <field name="fixed_price" string="Price" required='1'/>
                    <field name="date_start" optional="show"/>
                    <field name="date_end" optional="show"/>
                    <field name="applied_on" invisible="1"/>
                    <field name="company_id" groups="base.group_multi_company" optional="show" options="{'no_create_edit':1, 'no_open': 1}"/>
                </tree>
            </field>
        </record>

        <record id="product_pricelist_item_form_view" model="ir.ui.view">
            <field name="name">product.pricelist.item.form</field>
            <field name="model">product.pricelist.item</field>
            <field name="arch" type="xml">
                <form string="Pricelist Items">
                    <sheet>
                      <h1><field name="name"/></h1>
                      <group>
                          <group name="pricelist_rule_target">
                              <field name="applied_on" widget="radio"/>
                              <field name="categ_id" attrs="{
                                  'invisible':[('applied_on', '!=', '2_product_category')],
                                  'required':[('applied_on', '=', '2_product_category')]}"
                                options="{'no_create':1}"/>
                              <field name="product_tmpl_id" attrs="{
                                'invisible':[('applied_on', '!=', '1_product')],
                                'required':[('applied_on', '=', '1_product')]}"
                                options="{'no_create':1}"/>
                              <field name="product_id" attrs="{
                                'invisible':[('applied_on', '!=', '0_product_variant')],
                                'required':[('applied_on', '=', '0_product_variant')]}"
                                options="{'no_create':1}"/>
                          </group>
                          <group name="pricelist_rule_limits">
                              <field name="min_quantity"/>
                              <field name="date_start"/>
                              <field name="date_end"/>
                          </group>
                          <group name="pricelist_rule_related" groups="base.group_no_one">
                              <!-- Infos from the pricelist for UI rendering (monetary fields, ...) -->
                              <field name="pricelist_id" invisible="1"/>
                              <field name="currency_id" groups="base.group_multi_currency"/>
                              <field name="company_id" groups="base.group_multi_company"/>
                          </group>
                      </group>
                      <group string="Price Computation" name="pricelist_rule_computation" groups="product.group_sale_pricelist">
                          <group name="pricelist_rule_method">
                              <field name="compute_price" string="Compute Price" widget="radio"/>
                          </group>
                          <group name="pricelist_rule_base">
                              <field name="fixed_price" attrs="{'invisible':[('compute_price', '!=', 'fixed')]}"/>
                              <label for="percent_price" attrs="{'invisible':[('compute_price', '!=', 'percentage')]}"/>
                              <div attrs="{'invisible':[('compute_price', '!=', 'percentage')]}">
                                  <field name="percent_price"
                                    class="oe_inline"
                                    attrs="{'invisible':[('compute_price', '!=', 'percentage')]}"/>
                                  %%
                              </div>
                              <field name="base" attrs="{'invisible':[('compute_price', '!=', 'formula')]}"/>
                              <field name="base_pricelist_id" attrs="{
                                'invisible': ['|', ('compute_price', '!=', 'formula'), ('base', '!=', 'pricelist')],
                                'required': [('compute_price', '=', 'formula'), ('base', '=', 'pricelist')],
                                'readonly': [('base', '!=', 'pricelist')]}"/>
                          </group>
                      </group>
                      <div class="oe_grey" groups="uom.group_uom">
                          <p>The computed price is expressed in the default Unit of Measure of the product.</p>
                      </div>
                      <group name="pricelist_rule_advanced" col="6" attrs="{'invisible':[('compute_price', '!=', 'formula')]}" groups="product.group_sale_pricelist">
                          <label for="base" string="New Price = "/>
                          <div>
                              <span attrs="{'invisible':[('base', '!=', 'list_price')]}">Sales Price  -  </span>
                              <span attrs="{'invisible':[('base', '!=', 'standard_price')]}">Cost  -  </span>
                              <span attrs="{'invisible':[('base', '!=', 'pricelist')]}">Other Pricelist  -  </span>
                          </div>
                          <label for="price_discount"/>
                          <div class="o_row">
                              <field name="price_discount"/>
                              <span>%%</span>
                          </div>
                          <label string=" + " for="price_surcharge"/>
                          <field name="price_surcharge" nolabel="1"/>

                          <field name="price_round" string="Rounding Method"/>
                          <field name="price_min_margin" string="Min. Margin"/>
                          <field name="price_max_margin" string="Max. Margin"/>
                      </group>
                    </sheet>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="product_pricelist_view_search">
            <field name="name">product.pricelist.search</field>
            <field name="model">product.pricelist</field>
            <field name="arch" type="xml">
                <search string="Products Price Search">
                    <field name="name" string="Products Price"/>
                    <field name="currency_id" groups="base.group_multi_currency"/>
                    <filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
                </search>
            </field>
        </record>


        <record id="product_pricelist_view_tree" model="ir.ui.view">
            <field name="name">product.pricelist.tree</field>
            <field name="model">product.pricelist</field>
            <field name="arch" type="xml">
                <tree string="Products Price List" sample="1">
                    <field name="sequence" widget="handle" />
                    <field name="name"/>
                    <field name="discount_policy" groups="product.group_discount_per_so_line"/>
                    <field name="currency_id" groups="base.group_multi_currency"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                </tree>
            </field>
        </record>

        <record id="product_pricelist_view_kanban" model="ir.ui.view">
            <field name="name">product.pricelist.kanban</field>
            <field name="model">product.pricelist</field>
            <field name="arch" type="xml">
                <kanban class="o_kanban_mobile" sample="1">
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_global_click">
                                <div id="product_pricelist" class="o_kanban_record_top mb0">
                                    <div class="o_kanban_record_headings">
                                        <strong class="o_kanban_record_title"><span><field name="name"/></span></strong>
                                    </div>
                                    <strong><i class="fa fa-money" role="img" aria-label="Currency" title="Currency"></i> <field name="currency_id"/></strong>
                                </div>
                                <field name="discount_policy" groups="product.group_discount_per_so_line"/>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>

        <record id="product_pricelist_view" model="ir.ui.view">
            <field name="name">product.pricelist.form</field>
            <field name="model">product.pricelist</field>
            <field name="arch" type="xml">
                <form string="Products Price List">
                    <sheet>
                        <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
                        <div class="oe_title">
                            <h1><field name="name" placeholder="e.g. USD Retailers"/></h1>
                        </div>
                        <group>
                          <group name="pricelist_settings">
                              <field name="currency_id" groups="base.group_multi_currency"/>
                              <field name="active" invisible="1"/>
                              <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
                          </group>
                        </group>
                        <notebook>
                            <page name="pricelist_rules" string="Price Rules">
                              <field name="item_ids" nolabel="1" context="{'default_base':'list_price'}">
                                  <tree string="Pricelist Items" editable="bottom">
                                      <field name="product_tmpl_id" string="Products" required="1"/>
                                      <field name="product_id" string="Variants"
                                        groups="product.group_product_variant"
                                        domain="[('product_tmpl_id', '=', product_tmpl_id)]"
                                        options="{'no_create':1}"/>
                                      <field name="min_quantity"/>
                                      <field name="fixed_price" string="Price"/>
                                      <field name="currency_id" invisible="1"/>
                                      <field name="pricelist_id" invisible="1"/>
                                      <!-- Pricelist ID is here only for related fields to be correctly computed -->
                                      <field name="date_start"/>
                                      <field name="date_end"/>
                                      <field name="base" invisible="1"/>
                                      <field name="applied_on" invisible="1"/>
                                      <field name="company_id" invisible="1"/>
                                  </tree>
                              </field>
                            </page>
                            <page name="pricelist_config" string="Configuration">
                                <group>
                                    <group name="pricelist_availability" string="Availability">
                                        <field name="country_group_ids" widget="many2many_tags"/>
                                    </group>
                                    <group name="pricelist_discounts" groups="product.group_discount_per_so_line" string="Discounts">
                                        <field name="discount_policy" widget="radio"/>
                                    </group>
                                </group>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>

        <record id="product_pricelist_view_inherit" model="ir.ui.view">
            <field name="name">product.pricelist.form.inherit</field>
            <field name="model">product.pricelist</field>
            <field name="inherit_id" ref="product.product_pricelist_view"/>
            <field name="groups_id" eval="[(4, ref('product.group_sale_pricelist'))]"/>
            <field name="arch" type="xml">
                <!-- When in advanced pricelist mode : pricelist rules
                  Should open in a form view and not be editable inline anymore.
                -->
                <field name="item_ids" position="replace">
                  <field name="item_ids" nolabel="1" context="{'default_base':'list_price'}" groups="product.group_product_pricelist">
                      <tree string="Pricelist Items">
                          <field name="name" string="Applicable On"/>
                          <field name="min_quantity"/>
                          <field name="price" string="Price"/>
                          <field name="date_start"/>
                          <field name="date_end"/>
                          <field name="base" invisible="1"/>
                          <field name="price_discount" invisible="1"/>
                          <field name="applied_on" invisible="1"/>
                          <field name="compute_price" invisible="1"/>
                      </tree>
                  </field>
                </field>
            </field>
        </record>

        <record model="ir.ui.view" id="inherits_website_sale_country_group_form">
            <field name="name">website_sale.country_group.form</field>
            <field name="model">res.country.group</field>
            <field name="inherit_id" ref="base.view_country_group_form"/>
            <field name="arch" type="xml">
                <group name="country_group" position="after">
                    <field name="pricelist_ids"/>
                </group>
            </field>
        </record>
        <record id="product_pricelist_action2" model="ir.actions.act_window">
            <field name="name">Pricelists</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.pricelist</field>
            <field name="view_mode">tree,kanban,form</field>
            <field name="search_view_id" ref="product_pricelist_view_search" />
            <field name="context">{"default_base":'list_price'}</field>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Create a new pricelist
              </p><p>
                A price is a set of sales prices or rules to compute the price of sales order lines based on products, product categories, dates and ordered quantities.
                This is the perfect tool to handle several pricings, seasonal discounts, etc.
              </p><p>
                You can assign pricelists to your customers or select one when creating a new sales quotation.
              </p>
            </field>
        </record>

        <record id="product_pricelist_item_action" model="ir.actions.act_window">
            <field name="name">Price Rules</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.pricelist.item</field>
            <field name="view_mode">tree,form</field>
        </record>
    </data>
</odoo>