buying - update valuation rate when item row has item_code and quantity, else set valuation rate as 0

This commit is contained in:
Anand Doshi
2013-02-28 19:17:46 +05:30
parent 5b56e78580
commit 1bfec3a6c8
2 changed files with 4 additions and 2 deletions

View File

@@ -331,7 +331,9 @@ class BuyingController(AccountsController):
# update valuation rate
def update_valuation_rate(self, parentfield):
for d in self.doclist.get({"parentfield": parentfield}):
if d.qty:
if d.item_code and d.qty:
# if no item code, which is sometimes the case in purchase invoice,
# then it is not possible to track valuation against it
d.valuation_rate = (flt(d.purchase_rate or d.rate)
+ (flt(d.item_tax_amount) + flt(d.rm_supp_cost)) / flt(d.qty)
) / flt(d.conversion_factor)