diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-05 14:08:02 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-05 14:08:02 +0700 |
| commit | 7f9971a4c838b84fb1223845ccdb8256eb08b72d (patch) | |
| tree | da3a7818b5fc3085bbd82ca85abc17fd372189d4 /indoteknik_custom/models | |
| parent | d860aa7969e27717dd4f838961024a909fa016c8 (diff) | |
Fix bug apply voucher on create sale order API
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index e201496a..728c0bba 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -421,8 +421,8 @@ class SaleOrder(models.Model): order.grand_total = order.amount_total def action_apply_voucher(self): - for order in self.order_line: - if order.program_line_id: + for line in self.order_line: + if line.order_promotion_id: raise UserError('Voucher tidak dapat digabung dengan promotion program') voucher = self.voucher_id @@ -472,8 +472,10 @@ class SaleOrder(models.Model): line_contribution = line.price_subtotal / used_total line_voucher = used_discount * line_contribution line_voucher_item = line_voucher / line.product_uom_qty - line_discount_item = line.price_unit * line.discount / 100 + line_voucher_item - line_voucher_item = line_discount_item / line.price_unit * 100 + + line_price_unit = line.price_unit / 1.11 if any(tax.id == 23 for tax in line.tax_id) else line.price_unit + line_discount_item = line_price_unit * line.discount / 100 + line_voucher_item + line_voucher_item = line_discount_item / line_price_unit * 100 line.amount_voucher_disc = line_voucher line.discount = line_voucher_item |
