mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 20:05:09 +00:00
Co-authored-by: V Shankar <shankarv292002@gmail.com> fix: re-calculate taxes and totals after resetting bundle item rate (#53342)
This commit is contained in:
@@ -339,11 +339,19 @@ def update_product_bundle_rate(parent_items_price, pi_row, item_row):
|
|||||||
|
|
||||||
def set_product_bundle_rate_amount(doc, parent_items_price):
|
def set_product_bundle_rate_amount(doc, parent_items_price):
|
||||||
"Set cumulative rate and amount in bundle item."
|
"Set cumulative rate and amount in bundle item."
|
||||||
|
rate_updated = False
|
||||||
for item in doc.get("items"):
|
for item in doc.get("items"):
|
||||||
bundle_rate = parent_items_price.get((item.item_code, item.name))
|
bundle_rate = parent_items_price.get((item.item_code, item.name))
|
||||||
if bundle_rate and bundle_rate != item.rate:
|
if bundle_rate and bundle_rate != item.rate:
|
||||||
item.rate = bundle_rate
|
item.rate = bundle_rate
|
||||||
item.amount = flt(bundle_rate * item.qty)
|
item.amount = flt(bundle_rate * item.qty)
|
||||||
|
item.margin_rate_or_amount = 0
|
||||||
|
item.discount_percentage = 0
|
||||||
|
item.discount_amount = 0
|
||||||
|
rate_updated = True
|
||||||
|
if rate_updated:
|
||||||
|
doc.calculate_taxes_and_totals()
|
||||||
|
doc.set_total_in_words()
|
||||||
|
|
||||||
|
|
||||||
def on_doctype_update():
|
def on_doctype_update():
|
||||||
|
|||||||
Reference in New Issue
Block a user