Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
ce85145779
@ -464,15 +464,17 @@ class DocType(BuyingController):
|
|||||||
# if auto inventory accounting enabled and stock item,
|
# if auto inventory accounting enabled and stock item,
|
||||||
# then do stock related gl entries
|
# then do stock related gl entries
|
||||||
# expense will be booked in sales invoice
|
# expense will be booked in sales invoice
|
||||||
|
|
||||||
stock_item_and_auto_inventory_accounting = True
|
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(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": stock_account,
|
"account": stock_account,
|
||||||
"against": self.doc.credit_to,
|
"against": self.doc.credit_to,
|
||||||
"debit": flt(item.valuation_rate) * flt(item.conversion_factor) \
|
"debit": valuation_amt,
|
||||||
* flt(item.qty),
|
|
||||||
"remarks": self.doc.remarks or "Accounting Entry for Stock"
|
"remarks": self.doc.remarks or "Accounting Entry for Stock"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@ -367,9 +367,13 @@ class BuyingController(StockController):
|
|||||||
if d.item_code and d.qty:
|
if d.item_code and d.qty:
|
||||||
# if no item code, which is sometimes the case in purchase invoice,
|
# if no item code, which is sometimes the case in purchase invoice,
|
||||||
# then it is not possible to track valuation against it
|
# then it is not possible to track valuation against it
|
||||||
d.valuation_rate = (flt(d.purchase_rate or d.rate)
|
d.valuation_rate = flt((flt(d.purchase_rate, self.precision.item.purchase_rate) or
|
||||||
+ (flt(d.item_tax_amount) + flt(d.rm_supp_cost)) / flt(d.qty)
|
flt(d.rate, self.precision.item.rate) +
|
||||||
) / flt(d.conversion_factor)
|
(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:
|
else:
|
||||||
d.valuation_rate = 0.0
|
d.valuation_rate = 0.0
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,8 @@ class DocType:
|
|||||||
last_name = sql("""select max(name) from `tabBOM`
|
last_name = sql("""select max(name) from `tabBOM`
|
||||||
where name like "BOM/%s/%%" """ % cstr(self.doc.item).replace('"', '\\"'))
|
where name like "BOM/%s/%%" """ % cstr(self.doc.item).replace('"', '\\"'))
|
||||||
if last_name:
|
if last_name:
|
||||||
idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
|
idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
idx = 1
|
idx = 1
|
||||||
self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)
|
self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user