Divisonal loss adjustment in purchase receipt

This commit is contained in:
Nabin Hait
2015-08-21 14:13:55 +05:30
parent ac35b8af55
commit 597a402dff

View File

@@ -334,22 +334,21 @@ class PurchaseReceipt(BuyingController):
})) }))
# divisional loss adjustment # divisional loss adjustment
if not self.get("taxes"): sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor), self.precision("base_net_amount", d))
self.precision("base_net_amount", d))
distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \ distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \
flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) + flt(d.item_tax_amount)
divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d)) divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d))
if divisional_loss: if divisional_loss:
gl_entries.append(self.get_gl_dict({ gl_entries.append(self.get_gl_dict({
"account": stock_rbnb, "account": stock_rbnb,
"against": warehouse_account[d.warehouse], "against": warehouse_account[d.warehouse],
"cost_center": d.cost_center, "cost_center": d.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"), "remarks": self.get("remarks") or _("Accounting Entry for Stock"),
"debit": divisional_loss "debit": divisional_loss
})) }))
elif d.warehouse not in warehouse_with_no_account or \ elif d.warehouse not in warehouse_with_no_account or \
d.rejected_warehouse not in warehouse_with_no_account: d.rejected_warehouse not in warehouse_with_no_account: