aii: default account from company

This commit is contained in:
Nabin Hait
2013-03-19 18:18:52 +05:30
parent fbafced1e4
commit 80abad2ee0
11 changed files with 130 additions and 50 deletions

View File

@@ -444,6 +444,9 @@ class DocType(BuyingController):
# item gl entries
stock_item_and_auto_inventory_accounting = False
if auto_inventory_accounting:
stock_acocunt = self.get_default_account("stock_received_but_not_billed")
for item in self.doclist.get({"parentfield": "entries"}):
if auto_inventory_accounting and item.item_code in self.stock_items:
if flt(item.valuation_rate):
@@ -455,7 +458,7 @@ class DocType(BuyingController):
gl_entries.append(
self.get_gl_dict({
"account": "Stock Received But Not Billed - %s" % (self.company_abbr,),
"account": stock_acocunt,
"against": self.doc.credit_to,
"debit": flt(item.valuation_rate) * flt(item.conversion_factor) \
* flt(item.qty),
@@ -480,7 +483,7 @@ class DocType(BuyingController):
# this will balance out valuation amount included in cost of goods sold
gl_entries.append(
self.get_gl_dict({
"account": "Expenses Included In Valuation - %s" % (self.company_abbr,),
"account": self.get_default_account("expenses_included_in_valuation"),
"cost_center": "Auto Inventory Accounting - %s" % self.company_abbr,
"against": self.doc.credit_to,
"credit": valuation_tax,

View File

@@ -704,9 +704,9 @@ class DocType(SellingController):
if auto_inventory_accounting:
if cint(self.doc.is_pos) and cint(self.doc.update_stock):
stock_account = self.get_stock_in_hand_account()
stock_account = self.get_default_account("stock_in_hand_account")
else:
stock_account = "Stock Delivered But Not Billed - %s" % (self.company_abbr,)
stock_account = self.get_default_account("stock_delivered_but_not_billed")
for item in self.doclist.get({"parentfield": "entries"}):
# income account gl entries
@@ -794,7 +794,8 @@ class DocType(SellingController):
stock_ledger_entries = item_sales_bom = None
for item in self.doclist.get({"parentfield": "entries"}):
if item.item_code in self.stock_items:
if item.item_code in self.stock_items or \
(item_sales_bom and item_sales_bom.get(item.item_code)):
item.buying_amount = self.get_item_buying_amount(item, stock_ledger_entries,
item_sales_bom)
webnotes.conn.set_value("Sales Invoice Item", item.name,