[fixes] float precision for pur invoice
This commit is contained in:
parent
f377402592
commit
e1b2ae5739
@ -464,15 +464,17 @@ class DocType(BuyingController):
|
||||
# if auto inventory accounting enabled and stock item,
|
||||
# then do stock related gl entries
|
||||
# expense will be booked in sales invoice
|
||||
|
||||
stock_item_and_auto_inventory_accounting = True
|
||||
|
||||
valuation_amt = (flt(item.amount, self.precision.item.amount) +
|
||||
flt(item.item_tax_amount, self.precision.item.item_tax_amount) +
|
||||
flt(item.rm_supp_cost, self.precision.item.rm_supp_cost))
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": stock_account,
|
||||
"against": self.doc.credit_to,
|
||||
"debit": flt(item.valuation_rate) * flt(item.conversion_factor) \
|
||||
* flt(item.qty),
|
||||
"debit": valuation_amt,
|
||||
"remarks": self.doc.remarks or "Accounting Entry for Stock"
|
||||
})
|
||||
)
|
||||
|
@ -367,9 +367,13 @@ class BuyingController(StockController):
|
||||
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)
|
||||
d.valuation_rate = flt((flt(d.purchase_rate, self.precision.item.purchase_rate) or
|
||||
flt(d.rate, self.precision.item.rate) +
|
||||
(flt(d.item_tax_amount, self.precision.item.item_tax_amount) +
|
||||
flt(d.rm_supp_cost, self.precision.item.rm_supp_cost)) /
|
||||
flt(d.qty, self.precision.item.qty)) /
|
||||
flt(d.conversion_factor, self.precision.item.conversion_factor),
|
||||
self.precision.item.valuation_rate)
|
||||
else:
|
||||
d.valuation_rate = 0.0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user