Skip to content

Commit

Permalink
[Karthi] | BAH-3611 | Refactor. Discount issue has been fixed (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeyansp91 authored Mar 6, 2024
1 parent 1ee3833 commit cc42f16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bahmni_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _compute_amounts(self):
amount_tax += line.price_tax
amount_total = amount_untaxed + amount_tax

if order.discount_percentage:
if order.discount_type == 'percentage':
tot_discount = amount_total * order.discount_percentage / 100
else:
tot_discount = order.discount
Expand Down
7 changes: 3 additions & 4 deletions bahmni_sale/views/sale_order_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@
options="{'currency_field': 'currency_id'}"/>
<field name="discount_type" required="1" attrs="{'invisible': [('amount_untaxed', '=', 0.00)]}"/>

<field name="discount_percentage" widget='monetary'
options="{'currency_field': 'currency_id'}"
<field name="discount_percentage" widget='monetary' force_save = "1"
attrs="{'readonly': [('discount_type', '=', 'fixed')],'invisible': [('discount_type', 'in', ('fixed','none'))]}"/>

<field name="discount" widget='monetary'
<field name="discount" widget='monetary' force_save = "1"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly': [('discount_type', '=', 'percentage')],'invisible': [('discount_type', 'in', ('none'))]}"/>

<field name="disc_acc_id"
<field name="disc_acc_id" force_save = "1"
attrs="{'required': [('discount', '!=', 0.0)],'invisible': ['|', ('discount_type', '=', 'none'),('discount', '=', 0.0)]}"/>

<field name="round_off_amount" widget='monetary'
Expand Down

0 comments on commit cc42f16

Please sign in to comment.