Skip to content

Commit

Permalink
fix: update free item qty while adding same item in seperate row
Browse files Browse the repository at this point in the history
(cherry picked from commit 8bce382)
  • Loading branch information
venkat102 authored and mergify[bot] committed Dec 11, 2024
1 parent f3cf28a commit ad3094f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion erpnext/accounts/doctype/pricing_rule/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,16 @@ def get_product_discount_rule(pricing_rule, item_details, args=None, doc=None):

qty = pricing_rule.free_qty or 1
if pricing_rule.is_recursive:
transaction_qty = (args.get("qty") if args else doc.total_qty) - pricing_rule.apply_recursion_over
transaction_qty = sum(
[
row.qty
for row in doc.items
if not row.is_free_item
and row.item_code == args.item_code
and row.pricing_rules == args.pricing_rules
]
)
transaction_qty = (transaction_qty or doc.total_qty) - pricing_rule.apply_recursion_over
if transaction_qty:
qty = flt(transaction_qty) * qty / pricing_rule.recurse_for
if pricing_rule.round_free_qty:
Expand Down

0 comments on commit ad3094f

Please sign in to comment.