Set default accounts in company related to perpetual inventory, only it is enabled
This commit is contained in:
parent
aeb68b2899
commit
68b0d54b4b
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _, msgprint
|
from webnotes import _, msgprint
|
||||||
|
|
||||||
from webnotes.utils import cstr
|
from webnotes.utils import cstr, cint
|
||||||
import webnotes.defaults
|
import webnotes.defaults
|
||||||
|
|
||||||
|
|
||||||
@ -237,21 +237,28 @@ class DocType:
|
|||||||
account.insert()
|
account.insert()
|
||||||
|
|
||||||
def set_default_accounts(self):
|
def set_default_accounts(self):
|
||||||
accounts = {
|
def _set_default_accounts(accounts):
|
||||||
|
for a in accounts:
|
||||||
|
account_name = accounts[a] + " - " + self.doc.abbr
|
||||||
|
if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
|
||||||
|
webnotes.conn.set(self.doc, a, account_name)
|
||||||
|
|
||||||
|
_set_default_accounts({
|
||||||
"default_income_account": "Sales",
|
"default_income_account": "Sales",
|
||||||
"default_expense_account": "Cost of Goods Sold",
|
"default_expense_account": "Cost of Goods Sold",
|
||||||
"receivables_group": "Accounts Receivable",
|
"receivables_group": "Accounts Receivable",
|
||||||
"payables_group": "Accounts Payable",
|
"payables_group": "Accounts Payable",
|
||||||
"default_cash_account": "Cash",
|
"default_cash_account": "Cash"
|
||||||
"stock_received_but_not_billed": "Stock Received But Not Billed",
|
})
|
||||||
"stock_adjustment_account": "Stock Adjustment",
|
|
||||||
"expenses_included_in_valuation": "Expenses Included In Valuation"
|
if cint(webnotes.conn.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
|
||||||
}
|
_set_default_accounts({
|
||||||
|
"stock_received_but_not_billed": "Stock Received But Not Billed",
|
||||||
|
"stock_adjustment_account": "Stock Adjustment",
|
||||||
|
"expenses_included_in_valuation": "Expenses Included In Valuation"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
for a in accounts:
|
|
||||||
account_name = accounts[a] + " - " + self.doc.abbr
|
|
||||||
if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
|
|
||||||
webnotes.conn.set(self.doc, a, account_name)
|
|
||||||
|
|
||||||
def create_default_cost_center(self):
|
def create_default_cost_center(self):
|
||||||
cc_list = [
|
cc_list = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user