[fix] gross profit

This commit is contained in:
Anand Doshi 2015-11-12 11:07:32 +05:30
parent fe85b2ea17
commit c5c6c0669f

View File

@ -98,16 +98,17 @@ class GrossProfitGenerator(object):
row.base_amount = flt(row.base_net_amount) row.base_amount = flt(row.base_net_amount)
product_bundles = []
if row.update_stock: if row.update_stock:
product_bundles = self.product_bundles.get(row.parenttype, {}).get(row.parent, frappe._dict()) product_bundles = self.product_bundles.get(row.parenttype, {}).get(row.parent, frappe._dict())
elif row.dn_detail: elif row.dn_detail:
product_bundles = self.product_bundles.get("Delivery Note", {})\ product_bundles = self.product_bundles.get("Delivery Note", {})\
.get(row.delivery_note, frappe._dict()) .get(row.delivery_note, frappe._dict())
row.item_row = row.dn_detail row.item_row = row.dn_detail
# get buying amount # get buying amount
if row.item_code in product_bundles: if row.item_code in product_bundles:
row.buying_amount = self.get_buying_amount_from_product_bundle(row, row.buying_amount = self.get_buying_amount_from_product_bundle(row,
product_bundles[row.item_code]) product_bundles[row.item_code])
else: else:
row.buying_amount = self.get_buying_amount(row, row.item_code) row.buying_amount = self.get_buying_amount(row, row.item_code)
@ -184,7 +185,7 @@ class GrossProfitGenerator(object):
parenttype, parent = row.parenttype, row.parent parenttype, parent = row.parenttype, row.parent
if row.dn_detail: if row.dn_detail:
parenttype, parent = "Delivery Note", row.delivery_note parenttype, parent = "Delivery Note", row.delivery_note
for i, sle in enumerate(my_sle): for i, sle in enumerate(my_sle):
# find the stock valution rate from stock ledger entry # find the stock valution rate from stock ledger entry
if sle.voucher_type == parenttype and parent == sle.voucher_no and \ if sle.voucher_type == parenttype and parent == sle.voucher_no and \