summaryrefslogtreecommitdiff
path: root/indoteknik_custom/views/voucher.xml
blob: 78e42969989dec2cc19343d4b6e7906afbe01c56 (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
<odoo>
    <data>
        <record id="voucher_action" model="ir.actions.act_window">
            <field name="name">Voucher</field>
            <field name="res_model">voucher</field>
            <field name="view_mode">tree,form</field>
        </record>

        <record id="voucher_tree" model="ir.ui.view">
            <field name="name">Voucher</field>
            <field name="model">voucher</field>
            <field name="arch" type="xml">
                <tree>
                    <field name="name"/>
                    <field name="code"/>
                    <field name="description"/>
                </tree>
            </field>
        </record>

        <record id="voucher_form" model="ir.ui.view">
            <field name="name">Voucher</field>
            <field name="model">voucher</field>
            <field name="arch" type="xml">
                <form>
                    <sheet>
                        <group>
                            <group>
                                <field name="image" widget="image" width="120"/>
                                <field name="name" required="1"/>
                                <field name="code" required="1"/>
                                <field name="voucher_category" widget="many2many"/>
                                <field name="visibility" required="1"/>
                                <field name="start_time" required="1"/>
                                <field name="end_time" required="1"/>
                                <field name="limit" required="1"/>
                                <field name="limit_user" required="1"/>
                                <field name="apply_type" required="1"/>
                                <field name="account_type" required="1"/>
                                <field name="show_on_email"/>
                                <field name="excl_pricelist_ids" widget="many2many_tags"
                                       domain="[('id', 'in', [4, 15037, 15038, 15039, 17023, 17024, 17025, 17026,17027])]"/>
                            </group>
                            <group string="Discount Settings"
                                   attrs="{'invisible': [('apply_type', 'not in', ['all', 'shipping'])]}">
                                <field name="min_purchase_amount" widget="monetary" required="1"/>
                                <field name="discount_type"
                                       attrs="{'invisible': [('apply_type','not in', ['all', 'shipping'])], 'required': [('apply_type', 'in', ['all', 'shipping'])]}"/>

                                <label for="max_discount_amount" string="Discount Amount"/>
                                <div class="d-flex align-items-center">
                                    <span
                                            class="mr-1 font-weight-bold"
                                            attrs="{'invisible': [('discount_type', '!=', 'fixed_price')]}"
                                    >
                                        Rp
                                    </span>
                                    <field class="mb-0" name="discount_amount" required="1"/>
                                    <span
                                            class="ml-1 font-weight-bold"
                                            attrs="{'invisible': [('discount_type', '!=', 'percentage')]}"
                                    >
                                        %
                                    </span>
                                </div>

                                <field name="max_discount_amount" widget="monetary" required="1"
                                       attrs="{'invisible': [('discount_type', '!=', 'percentage')]}"/>
                            </group>
                        </group>
                        <notebook>
                            <page name="voucher_line" string="Voucher Line"
                                  attrs="{'invisible': [('apply_type', '!=', 'brand')]}">
                                <field name="voucher_line">
                                    <tree editable="bottom">
                                        <field name="manufacture_id" required="1"/>
                                        <field name="min_purchase_amount" required="1"/>
                                        <field name="discount_type" required="1"/>
                                        <field name="discount_amount" required="1"/>
                                        <field name="max_discount_amount" required="1"
                                               attrs="{'readonly': [('discount_type', '!=', 'percentage')]}"/>
                                    </tree>
                                </field>
                            </page>
                            <page name="description" string="Description">
                                <label for="description" string="Max 120 characters:"
                                       class="font-weight-normal mb-2 oe_edit_only"/>
                                <field name="description" placeholder="Insert short description..."/>
                            </page>
                            <page name="terms_conditions" string="Terms and Conditions">
                                <field name="terms_conditions"/>
                            </page>
                            <page name="order_page" string="Orders">
                                <field name="order_ids" readonly="1"/>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>

        <menuitem id="voucher"
                  name="Voucher"
                  parent="website_sale.menu_catalog"
                  sequence="1"
                  action="voucher_action"
        />
    </data>
</odoo>