mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 13:38:27 +00:00
commonified some purchase code, added test case for auto inventory accounting for purchase invoice
This commit is contained in:
@@ -86,4 +86,11 @@ class AccountsController(TransactionBase):
|
||||
from `tabItem` where name in (%s) and is_stock_item='Yes'""" % \
|
||||
(", ".join((["%s"]*len(item_codes))),), item_codes)]
|
||||
|
||||
return self._stock_items
|
||||
return self._stock_items
|
||||
|
||||
@property
|
||||
def company_abbr(self):
|
||||
if not hasattr(self, "_abbr"):
|
||||
self._abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
|
||||
|
||||
return self._abbr
|
||||
@@ -232,7 +232,7 @@ class BuyingController(AccountsController):
|
||||
else:
|
||||
self.doc.grand_total = flt(self.doc.net_total,
|
||||
self.precision.main.grand_total)
|
||||
self.doc.grand_total_print = flt(
|
||||
self.doc.grand_total_import = flt(
|
||||
self.doc.grand_total / self.doc.conversion_rate,
|
||||
self.precision.main.grand_total_import)
|
||||
|
||||
@@ -327,6 +327,16 @@ class BuyingController(AccountsController):
|
||||
item.item_code in self.stock_items:
|
||||
item.item_tax_amount += flt(current_tax_amount,
|
||||
self.precision.item.item_tax_amount)
|
||||
|
||||
# update valuation rate
|
||||
def update_valuation_rate(self, parentfield):
|
||||
for d in self.doclist.get({"parentfield": parentfield}):
|
||||
if d.qty:
|
||||
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)
|
||||
else:
|
||||
d.valuation_rate = 0.0
|
||||
|
||||
@property
|
||||
def precision(self):
|
||||
|
||||
Reference in New Issue
Block a user