mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
Merge pull request #48535 from ljain112/fix-dda
fix: handle cases where distributed discount amount is not set
This commit is contained in:
@@ -1947,6 +1947,15 @@ class AccountsController(TransactionBase):
|
||||
and self.get("discount_amount")
|
||||
and self.get("additional_discount_account")
|
||||
):
|
||||
# cases where distributed_discount_amount is not patched
|
||||
if not hasattr(self, "__has_distributed_discount_set"):
|
||||
self.__has_distributed_discount_set = any(
|
||||
i.distributed_discount_amount for i in self.get("items")
|
||||
)
|
||||
|
||||
if not self.__has_distributed_discount_set:
|
||||
return item.amount, item.base_amount
|
||||
|
||||
amount += item.distributed_discount_amount
|
||||
base_amount += flt(
|
||||
item.distributed_discount_amount * self.get("conversion_rate"),
|
||||
|
||||
Reference in New Issue
Block a user