diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-31 16:09:15 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-31 16:09:15 +0700 |
| commit | f5d3b28344f3b992377efbba556306b423bdf723 (patch) | |
| tree | 75dfa7e7a661ba563d702c9b209b094508510f45 /indoteknik_custom/views | |
| parent | 4fec661573ebac160f0b928fbccc2ef9d6d1f969 (diff) | |
Add apply voucher function on sale order
Update sale order view
Diffstat (limited to 'indoteknik_custom/views')
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 14f3663f..bbfc9e3b 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="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"/> |
