Merge pull request #33192 from deepeshgarg007/bundle_item_rates
fix: Bundle item rates
This commit is contained in:
commit
26adbc6282
@ -48,7 +48,7 @@ def make_packing_list(doc):
|
||||
update_packed_item_from_cancelled_doc(item_row, bundle_item, pi_row, doc)
|
||||
|
||||
if set_price_from_children: # create/update bundle item wise price dict
|
||||
update_product_bundle_rate(parent_items_price, pi_row)
|
||||
update_product_bundle_rate(parent_items_price, pi_row, item_row)
|
||||
|
||||
if parent_items_price:
|
||||
set_product_bundle_rate_amount(doc, parent_items_price) # set price in bundle item
|
||||
@ -247,7 +247,7 @@ def get_cancelled_doc_packed_item_details(old_packed_items):
|
||||
return prev_doc_packed_items_map
|
||||
|
||||
|
||||
def update_product_bundle_rate(parent_items_price, pi_row):
|
||||
def update_product_bundle_rate(parent_items_price, pi_row, item_row):
|
||||
"""
|
||||
Update the price dict of Product Bundles based on the rates of the Items in the bundle.
|
||||
|
||||
@ -259,7 +259,7 @@ def update_product_bundle_rate(parent_items_price, pi_row):
|
||||
if not rate:
|
||||
parent_items_price[key] = 0.0
|
||||
|
||||
parent_items_price[key] += flt(pi_row.rate)
|
||||
parent_items_price[key] += flt((pi_row.rate * pi_row.qty) / item_row.stock_qty)
|
||||
|
||||
|
||||
def set_product_bundle_rate_amount(doc, parent_items_price):
|
||||
|
@ -126,8 +126,8 @@ class TestPackedItem(FrappeTestCase):
|
||||
so.packed_items[1].rate = 200
|
||||
so.save()
|
||||
|
||||
self.assertEqual(so.items[0].rate, 350)
|
||||
self.assertEqual(so.items[0].amount, 700)
|
||||
self.assertEqual(so.items[0].rate, 700)
|
||||
self.assertEqual(so.items[0].amount, 1400)
|
||||
|
||||
def test_newly_mapped_doc_packed_items(self):
|
||||
"Test impact on packed items in newly mapped DN from SO."
|
||||
|
Loading…
x
Reference in New Issue
Block a user