Merge branch 'master' into edge
This commit is contained in:
commit
79b2375de0
@ -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"
|
||||
})
|
||||
)
|
||||
|
@ -191,11 +191,11 @@ class DocType(SellingController):
|
||||
self.doc.fields[fieldname] = pos.get(fieldname)
|
||||
|
||||
# set pos values in items
|
||||
for doc in self.doclist.get({"parentfield": "entries"}):
|
||||
if doc.fields.get('item_code'):
|
||||
for fieldname, val in self.apply_pos_settings(doc.fields).items():
|
||||
if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)):
|
||||
doc.fields[fieldname] = val
|
||||
for item in self.doclist.get({"parentfield": "entries"}):
|
||||
if item.fields.get('item_code'):
|
||||
for fieldname, val in self.apply_pos_settings(item.fields).items():
|
||||
if (not for_validate) or (for_validate and not item.fields.get(fieldname)):
|
||||
item.fields[fieldname] = val
|
||||
|
||||
# fetch terms
|
||||
if self.doc.tc_name and not self.doc.terms:
|
||||
|
@ -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
|
||||
|
||||
|
@ -34,7 +34,8 @@ class DocType:
|
||||
last_name = sql("""select max(name) from `tabBOM`
|
||||
where name like "BOM/%s/%%" """ % cstr(self.doc.item).replace('"', '\\"'))
|
||||
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:
|
||||
idx = 1
|
||||
self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)
|
||||
|
Loading…
x
Reference in New Issue
Block a user