mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 19:49:18 +00:00
fix: distributed discounts on si
This commit is contained in:
@@ -1654,8 +1654,11 @@ class AccountsController(TransactionBase):
|
||||
and self.get("discount_amount")
|
||||
and self.get("additional_discount_account")
|
||||
):
|
||||
amount = item.amount
|
||||
base_amount = item.base_amount
|
||||
amount += item.distributed_discount_amount
|
||||
base_amount += flt(
|
||||
item.distributed_discount_amount * self.get("conversion_rate"),
|
||||
item.precision("distributed_discount_amount"),
|
||||
)
|
||||
|
||||
return amount, base_amount
|
||||
|
||||
|
||||
@@ -684,6 +684,9 @@ class calculate_taxes_and_totals:
|
||||
)
|
||||
|
||||
item.net_amount = flt(item.net_amount - distributed_amount, item.precision("net_amount"))
|
||||
item.distributed_discount_amount = flt(
|
||||
distributed_amount, item.precision("distributed_discount_amount")
|
||||
)
|
||||
net_total += item.net_amount
|
||||
|
||||
# discount amount rounding loss adjustment if no taxes
|
||||
@@ -700,6 +703,10 @@ class calculate_taxes_and_totals:
|
||||
item.net_amount = flt(
|
||||
item.net_amount + discount_amount_loss, item.precision("net_amount")
|
||||
)
|
||||
item.distributed_discount_amount = flt(
|
||||
distributed_amount + discount_amount_loss,
|
||||
item.precision("distributed_discount_amount"),
|
||||
)
|
||||
|
||||
item.net_rate = (
|
||||
flt(item.net_amount / item.qty, item.precision("net_rate")) if item.qty else 0
|
||||
|
||||
Reference in New Issue
Block a user