summaryrefslogtreecommitdiff
path: root/indoteknik_custom/views
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/views')
-rwxr-xr-xindoteknik_custom/views/sale_order.xml21
-rwxr-xr-xindoteknik_custom/views/voucher.xml33
2 files changed, 41 insertions, 13 deletions
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 91ce1463..f2cab699 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -26,7 +26,17 @@
<field name="delivery_amt"/>
<field name="fee_third_party"/>
<field name="total_percent_margin"/>
- <field name="voucher_id" readonly="1" />
+ <label for="voucher_id"/>
+ <div class="o_row">
+ <field name="voucher_id" id="voucher_id" attrs="{'readonly': ['|', ('state', 'not in', ['draft', 'sent']), ('applied_voucher_id', '!=', False)]}"/>
+ <field name="applied_voucher_id" invisible="1" />
+ <button name="action_apply_voucher" type="object" string="Apply" confirm="Anda yakin untuk menggunakan voucher?" help="Apply the selected voucher" class="btn-link mb-1 px-0" icon="fa-plus"
+ attrs="{'invisible': ['|', '|', ('voucher_id', '=', False), ('state', 'not in', ['draft', 'sent']), ('applied_voucher_id', '!=', False)]}"
+ />
+ <button name="cancel_voucher" type="object" string="Cancel" confirm="Anda yakin untuk membatalkan penggunaan voucher?" help="Cancel applied voucher" class="btn-link mb-1 px-0" icon="fa-times"
+ attrs="{'invisible': ['|', ('applied_voucher_id', '=', False), ('state', 'not in', ['draft','sent'])]}"
+ />
+ </div>
</field>
<field name="source_id" position="attributes">
<attribute name="invisible">1</attribute>
@@ -49,6 +59,11 @@
<field name="date_doc_kirim" readonly="1"/>
<field name="notification" readonly="1"/>
</field>
+ <xpath expr="//form/sheet/notebook/page/field[@name='order_line']" position="attributes">
+ <attribute name="attrs">
+ {'readonly': ['|', ('applied_voucher_id', '!=', False), ('state', 'in', ('done','cancel'))]}
+ </attribute>
+ </xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="attributes">
<attribute name="attrs">
{
@@ -75,7 +90,7 @@
<field name="item_percent_margin"/>
<field name="note_procurement" optional="hide"/>
<field name="vendor_subtotal" optional="hide"/>
- <field name="amount_voucher_disc" string="Voucher" optional="hide"/>
+ <field name="amount_voucher_disc" string="Voucher" readonly="1" optional="hide"/>
<field name="program_line_id" optional="1" />
</xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" position="before">
@@ -85,7 +100,7 @@
<field name="grand_total"/>
<label for="amount_voucher_disc" string="Voucher" />
<div>
- <field class="mb-0" name="amount_voucher_disc" string="Voucher"/>
+ <field class="mb-0" name="amount_voucher_disc" string="Voucher" readonly="1"/>
<div class="text-right mb-2"><small>*Hanya informasi</small></div>
</div>
<field name="total_margin"/>
diff --git a/indoteknik_custom/views/voucher.xml b/indoteknik_custom/views/voucher.xml
index 7b181c62..97634d7d 100755
--- a/indoteknik_custom/views/voucher.xml
+++ b/indoteknik_custom/views/voucher.xml
@@ -28,8 +28,16 @@
<group>
<field name="image" widget="image" width="120"/>
<field name="name" required="1" />
+ <field name="code" required="1" />
+ <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="excl_pricelist_ids" widget="many2many_tags" domain="[('id', 'in', [4, 15037, 15038, 15039])]"/>
</group>
- <group string="Discount Settings">
+ <group string="Discount Settings" attrs="{'invisible': [('apply_type', '!=', 'all')]}">
<field name="min_purchase_amount" widget="monetary" required="1" />
<field name="discount_type" required="1" />
@@ -52,21 +60,26 @@
<field name="max_discount_amount" widget="monetary" required="1" attrs="{'invisible': [('discount_type', '!=', 'percentage')]}"/>
</group>
- <group string="Rules">
- <field name="code" required="1" />
- <field name="visibility" required="1" />
- <field name="start_time" required="1"/>
- <field name="end_time" required="1"/>
- <field name="limit" required="1"/>
- <field name="manufacture_ids" widget="many2many_tags"/>
- <field name="excl_pricelist_ids" widget="many2many_tags" domain="[('id', 'in', [4, 15037, 15038, 15039])]"/>
- </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>