aii: patches and default values fetching
This commit is contained in:
parent
57916252d9
commit
557d858d89
@ -48,15 +48,17 @@ class DocType:
|
||||
from tabAccount where name =%s""", self.doc.parent_account)
|
||||
if not par:
|
||||
msgprint("Parent account does not exists", raise_exception=1)
|
||||
elif par and par[0][0] == self.doc.name:
|
||||
elif par[0][0] == self.doc.name:
|
||||
msgprint("You can not assign itself as parent account", raise_exception=1)
|
||||
elif par and par[0][1] != 'Group':
|
||||
elif par[0][1] != 'Group':
|
||||
msgprint("Parent account can not be a ledger", raise_exception=1)
|
||||
elif par and self.doc.debit_or_credit and par[0][3] != self.doc.debit_or_credit:
|
||||
elif self.doc.debit_or_credit and par[0][3] != self.doc.debit_or_credit:
|
||||
msgprint("You can not move a %s account under %s account" %
|
||||
(self.doc.debit_or_credit, par[0][3]), raise_exception=1)
|
||||
elif par and not self.doc.is_pl_account:
|
||||
|
||||
if not self.doc.is_pl_account:
|
||||
self.doc.is_pl_account = par[0][2]
|
||||
if not self.doc.debit_or_credit:
|
||||
self.doc.debit_or_credit = par[0][3]
|
||||
|
||||
def validate_max_root_accounts(self):
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:07",
|
||||
"creation": "2013-01-24 11:03:29",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-22 16:55:20",
|
||||
"modified": "2013-03-25 15:27:52",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -140,6 +140,14 @@
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "expense_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Expense Account",
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse",
|
||||
|
@ -27,8 +27,6 @@ from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import _, msgprint
|
||||
|
||||
session = webnotes.session
|
||||
|
||||
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
|
||||
|
||||
|
||||
@ -156,46 +154,57 @@ class DocType(SellingController):
|
||||
|
||||
def set_pos_fields(self):
|
||||
"""Set retail related fields from pos settings"""
|
||||
pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
|
||||
if not pos:
|
||||
pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
|
||||
pos = self.pos_details
|
||||
|
||||
if pos:
|
||||
val = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
|
||||
val = webnotes.conn.sql("""select name from `tabAccount`
|
||||
where name = %s and docstatus != 2""",
|
||||
(cstr(self.doc.customer) + " - " + self.get_company_abbr()))
|
||||
|
||||
val = val and val[0][0] or ''
|
||||
if not val: val = pos and pos[0]['customer_account'] or ''
|
||||
if not val: val = pos[0]['customer_account'] or ''
|
||||
|
||||
if not self.doc.debit_to:
|
||||
webnotes.conn.set(self.doc,'debit_to',val)
|
||||
|
||||
lst = ['territory','naming_series','currency','charge','letter_head','tc_name','price_list_name','company','select_print_heading','cash_bank_account']
|
||||
lst = ['territory', 'naming_series', 'currency', 'charge', 'letter_head', 'tc_name',
|
||||
'price_list_name', 'company', 'select_print_heading', 'cash_bank_account']
|
||||
|
||||
for i in lst:
|
||||
val = pos and pos[0][i] or ''
|
||||
self.doc.fields[i] = val
|
||||
self.doc.fields[i] = pos[0][i] or ''
|
||||
|
||||
self.set_pos_item_values()
|
||||
|
||||
val = pos and flt(pos[0]['conversion_rate']) or 0
|
||||
self.doc.conversion_rate = val
|
||||
self.doc.conversion_rate = flt(pos[0]['conversion_rate']) or 0
|
||||
|
||||
#fetch terms
|
||||
if self.doc.tc_name: self.get_tc_details()
|
||||
if self.doc.tc_name:
|
||||
self.get_tc_details()
|
||||
|
||||
#fetch charges
|
||||
if self.doc.charge: self.get_other_charges()
|
||||
if self.doc.charge:
|
||||
self.get_other_charges()
|
||||
|
||||
|
||||
def set_pos_item_values(self):
|
||||
"""Set default values related to pos for previously created sales invoice."""
|
||||
if cint(self.doc.is_pos) ==1:
|
||||
dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
|
||||
if not dtl:
|
||||
dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
|
||||
if cint(self.doc.is_pos) == 1:
|
||||
dtl = self.pos_details
|
||||
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
# overwrite if mentioned in item
|
||||
item = webnotes.conn.sql("select default_income_account, default_sales_cost_center, default_warehouse from tabItem where name = '%s'" %(d.item_code), as_dict=1)
|
||||
d.income_account = item and item[0]['default_income_account'] or dtl and dtl[0]['income_account'] or d.income_account
|
||||
d.cost_center = item and item[0]['default_sales_cost_center'] or dtl and dtl[0]['cost_center'] or d.cost_center
|
||||
d.warehouse = item and item[0]['default_warehouse'] or dtl and dtl[0]['warehouse'] or d.warehouse
|
||||
|
||||
item = webnotes.conn.sql("""select default_income_account,
|
||||
default_sales_cost_center, default_warehouse, purchase_account
|
||||
from tabItem where name = %s""", (d.item_code,), as_dict=1)
|
||||
|
||||
d.income_account = (item and item[0]['default_income_account']) \
|
||||
or (dtl and dtl[0]['income_account']) or d.income_account
|
||||
d.cost_center = (item and item[0]['default_sales_cost_center']) \
|
||||
or (dtl and dtl[0]['cost_center']) or d.cost_center
|
||||
d.warehouse = (item and item[0]['default_warehouse']) \
|
||||
or (dtl and dtl[0]['warehouse']) or d.warehouse
|
||||
d.expense_account = (item and item[0].purchase_account) \
|
||||
or (dtl and dtl[0].expense_account) or d.expense_account
|
||||
|
||||
def get_customer_account(self):
|
||||
"""Get Account Head to which amount needs to be Debited based on Customer"""
|
||||
@ -276,15 +285,13 @@ class DocType(SellingController):
|
||||
for d in getlist(self.doclist, doctype):
|
||||
if d.item_code:
|
||||
item = webnotes.conn.get_value("Item", d.item_code, ["default_income_account",
|
||||
"default_sales_cost_center", "purchase_account", "cost_center"], as_dict=True)
|
||||
"default_sales_cost_center", "purchase_account"], as_dict=True)
|
||||
d.income_account = item['default_income_account'] or ""
|
||||
d.cost_center = item['default_sales_cost_center'] or ""
|
||||
|
||||
if cint(webnotes.defaults.get_global_default("auto_inventory_accounting")) \
|
||||
and cint(self.doc.is_pos) and cint(self.doc.update_stock):
|
||||
d.expense_account = item['purchase_account'] or ""
|
||||
d.purchase_cost_center = item['cost_center'] or ""
|
||||
|
||||
|
||||
def get_item_details(self, args=None):
|
||||
import json
|
||||
@ -301,7 +308,6 @@ class DocType(SellingController):
|
||||
'cost_center': doc.fields.get('cost_center'),
|
||||
'warehouse': doc.fields.get('warehouse'),
|
||||
'expense_account': doc.fields.get('expense_account'),
|
||||
'purchase_cost_center': doc.fields.get('purchase_cost_center')
|
||||
}
|
||||
|
||||
ret = self.get_pos_details(arg)
|
||||
@ -309,14 +315,27 @@ class DocType(SellingController):
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
@property
|
||||
def pos_details(self):
|
||||
if not hasattr(self, "_pos_details"):
|
||||
dtl = webnotes.conn.sql("""select income_account, warehouse, cost_center,
|
||||
expense_account from `tabPOS Setting` where user = %s and company = %s""",
|
||||
(webnotes.session['user'], self.doc.company), as_dict=1)
|
||||
if not dtl:
|
||||
dtl = webnotes.conn.sql("""select income_account, warehouse, cost_center,
|
||||
expense_account from `tabPOS Setting` where ifnull(user,'') = ''
|
||||
and company = %s""", self.doc.company, as_dict=1)
|
||||
self._pos_details = dtl
|
||||
|
||||
return self._pos_details
|
||||
|
||||
def get_pos_details(self, args, ret = {}):
|
||||
if args['item_code'] and cint(self.doc.is_pos) == 1:
|
||||
dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
|
||||
if not dtl:
|
||||
dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
|
||||
dtl = self.pos_details
|
||||
|
||||
item = webnotes.conn.sql("select default_income_account, default_sales_cost_center, default_warehouse from tabItem where name = '%s'" %(args['item_code']), as_dict=1)
|
||||
item = webnotes.conn.sql("""select default_income_account, default_sales_cost_center,
|
||||
default_warehouse, purchase_account from tabItem where name = %s""",
|
||||
args['item_code'], as_dict=1)
|
||||
|
||||
ret['income_account'] = item and item[0].get('default_income_account') \
|
||||
or (dtl and dtl[0].get('income_account') or args.get('income_account'))
|
||||
@ -326,9 +345,14 @@ class DocType(SellingController):
|
||||
|
||||
ret['warehouse'] = item and item[0].get('default_warehouse') \
|
||||
or (dtl and dtl[0].get('warehouse') or args.get('warehouse'))
|
||||
|
||||
ret['expense_account'] = item and item[0].get('purchase_account') \
|
||||
or (dtl and dtl[0].get('expense_account') or args.get('expense_account'))
|
||||
|
||||
if ret['warehouse']:
|
||||
actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], ret['warehouse']))
|
||||
actual_qty = webnotes.conn.sql("""select actual_qty from `tabBin`
|
||||
where item_code = %s and warehouse = %s""",
|
||||
(args['item_code'], ret['warehouse']))
|
||||
ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
|
||||
return ret
|
||||
|
||||
@ -545,7 +569,7 @@ class DocType(SellingController):
|
||||
|
||||
|
||||
def get_warehouse(self):
|
||||
w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
|
||||
w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (webnotes.session['user'], self.doc.company))
|
||||
w = w and w[0][0] or ''
|
||||
if not w:
|
||||
ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-07 11:42:55",
|
||||
"creation": "2013-03-25 15:35:04",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-22 18:40:48",
|
||||
"modified": "2013-03-25 15:35:23",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -215,6 +215,7 @@
|
||||
"label": "Expense Account",
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
@ -232,17 +233,6 @@
|
||||
"reqd": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"label": "Purchase Cost Center",
|
||||
"options": "Cost Center",
|
||||
"print_hide": 1,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "serial_no",
|
||||
|
@ -65,4 +65,4 @@ class SellingController(StockController):
|
||||
def check_expense_account(self, item):
|
||||
if item.buying_amount and not item.expense_account:
|
||||
msgprint(_("""Expense account is mandatory for item: """) + item.item_code,
|
||||
raise_exception=1)
|
||||
raise_exception=1)
|
26
patches/march_2013/p08_create_aii_accounts.py
Normal file
26
patches/march_2013/p08_create_aii_accounts.py
Normal file
@ -0,0 +1,26 @@
|
||||
import webnotes
|
||||
def execute():
|
||||
accounts_to_add = [
|
||||
["Stock Assets", "Current Assets", "Group", ""],
|
||||
["Stock In Hand", "Stock Assets", "Ledger", ""],
|
||||
["Stock Debit But Not Billed", "Stock Assets", "Ledger", ""],
|
||||
["Stock Expenses", "Direct Expenses", "Group", "Expense Account"],
|
||||
["Cost of Goods Sold", "Stock Expenses", "Ledger", "Expense Account"],
|
||||
["Stock Adjustment", "Stock Expenses", "Ledger", "Expense Account"],
|
||||
["Expenses Included In Valuation", "Stock Expenses", "Ledger", "Expense Account"],
|
||||
["Stock Liabilities", "Current Liabilities", "Group", ""],
|
||||
["Stock Received But Not Billed", "Stock Liabilities", "Ledger", ""],
|
||||
]
|
||||
|
||||
for company, abbr in webnotes.conn.sql_list("""select name, abbr from `tabCompany`"""):
|
||||
for account_name, parent_account_name, group_or_ledger, account_type in accounts_to_add:
|
||||
if not webnotes.conn.exists("Account", "%s - %s" % (account_name, abbr)):
|
||||
account = webnotes.bean({
|
||||
"doctype": "Account",
|
||||
"account_name": account_name,
|
||||
"parent_account": "%s - %s" % (parent_account_name, abbr),
|
||||
"group_or_ledger": group_or_ledger,
|
||||
"account_type": account_type,
|
||||
"company": company
|
||||
})
|
||||
account.insert()
|
@ -127,29 +127,40 @@ class DocType(TransactionBase):
|
||||
if not obj.doc.price_list_name:
|
||||
msgprint("Please Select Price List before selecting Items")
|
||||
raise Exception
|
||||
item = webnotes.conn.sql("select description, item_name, brand, item_group, stock_uom, default_warehouse, default_income_account, default_sales_cost_center, purchase_account, cost_center, description_html, barcode from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life > now() or end_of_life = '0000-00-00') and (is_sales_item = 'Yes' or is_service_item = 'Yes')" % (args['item_code']), as_dict=1)
|
||||
tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , args['item_code'])
|
||||
item = webnotes.conn.sql("""select description, item_name, brand, item_group, stock_uom,
|
||||
default_warehouse, default_income_account, default_sales_cost_center,
|
||||
purchase_account, description_html, barcode from `tabItem`
|
||||
where name = %s and (ifnull(end_of_life,'')='' or end_of_life > now()
|
||||
or end_of_life = '0000-00-00') and (is_sales_item = 'Yes'
|
||||
or is_service_item = 'Yes')""", args['item_code'], as_dict=1)
|
||||
tax = webnotes.conn.sql("""select tax_type, tax_rate from `tabItem Tax`
|
||||
where parent = %s""", args['item_code'])
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
ret = {
|
||||
'description' : item and item[0]['description_html'] or item[0]['description'],
|
||||
'barcode' : item and item[0]['barcode'] or '',
|
||||
'item_group' : item and item[0]['item_group'] or '',
|
||||
'item_name' : item and item[0]['item_name'] or '',
|
||||
'brand' : item and item[0]['brand'] or '',
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
|
||||
'warehouse' : item and item[0]['default_warehouse'] or args.get('warehouse'),
|
||||
'income_account' : item and item[0]['default_income_account'] or args.get('income_account'),
|
||||
'expense_account' : item and item[0]['purchase_account'] or args.get('expense_account'),
|
||||
'cost_center' : item and item[0]['default_sales_cost_center'] or args.get('cost_center'),
|
||||
'purchase_cost_center' : item and item[0]['cost_center'] or args.get('purchase_cost_center'),
|
||||
'qty' : 1.00, # this is done coz if item once fetched is fetched again thn its qty shld be reset to 1
|
||||
'adj_rate' : 0,
|
||||
'amount' : 0,
|
||||
'export_amount' : 0,
|
||||
'item_tax_rate' : json.dumps(t),
|
||||
'batch_no' : ''
|
||||
'description': item and item[0]['description_html'] or \
|
||||
item[0]['description'],
|
||||
'barcode': item and item[0]['barcode'] or '',
|
||||
'item_group': item and item[0]['item_group'] or '',
|
||||
'item_name': item and item[0]['item_name'] or '',
|
||||
'brand': item and item[0]['brand'] or '',
|
||||
'stock_uom': item and item[0]['stock_uom'] or '',
|
||||
'reserved_warehouse': item and item[0]['default_warehouse'] or '',
|
||||
'warehouse': item and item[0]['default_warehouse'] or \
|
||||
args.get('warehouse'),
|
||||
'income_account': item and item[0]['default_income_account'] or \
|
||||
args.get('income_account'),
|
||||
'expense_account': item and item[0]['purchase_account'] or \
|
||||
args.get('expense_account'),
|
||||
'cost_center': item and item[0]['default_sales_cost_center'] or \
|
||||
args.get('cost_center'),
|
||||
# this is done coz if item once fetched is fetched again than its qty shld be reset to 1
|
||||
'qty': 1.00,
|
||||
'adj_rate': 0,
|
||||
'amount': 0,
|
||||
'export_amount': 0,
|
||||
'item_tax_rate': json.dumps(t),
|
||||
'batch_no': ''
|
||||
}
|
||||
if(obj.doc.price_list_name and item): #this is done to fetch the changed BASIC RATE and REF RATE based on PRICE LIST
|
||||
base_ref_rate = self.get_ref_rate(args['item_code'], obj.doc.price_list_name, obj.doc.price_list_currency, obj.doc.plc_conversion_rate)
|
||||
@ -174,14 +185,18 @@ class DocType(TransactionBase):
|
||||
|
||||
|
||||
def get_item_defaults(self, args):
|
||||
item = webnotes.conn.sql("""select default_warehouse, default_income_account, default_sales_cost_center from `tabItem`
|
||||
where name = '%s' and (ifnull(end_of_life,'') = '' or end_of_life > now() or end_of_life = '0000-00-00')
|
||||
and (is_sales_item = 'Yes' or is_service_item = 'Yes') """ % (args['item_code']), as_dict=1)
|
||||
item = webnotes.conn.sql("""select default_warehouse, default_income_account,
|
||||
default_sales_cost_center, purchase_account from `tabItem` where name = %s
|
||||
and (ifnull(end_of_life,'') = '' or end_of_life > now() or end_of_life = '0000-00-00')
|
||||
and (is_sales_item = 'Yes' or is_service_item = 'Yes') """,
|
||||
(args['item_code']), as_dict=1)
|
||||
ret = {
|
||||
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
|
||||
'warehouse' : item and item[0]['default_warehouse'] or args.get('warehouse'),
|
||||
'income_account' : item and item[0]['default_income_account'] or args.get('income_account'),
|
||||
'cost_center' : item and item[0]['default_sales_cost_center'] or args.get('cost_center')
|
||||
'reserved_warehouse': item and item[0]['default_warehouse'] or '',
|
||||
'warehouse': item and item[0]['default_warehouse'] or args.get('warehouse'),
|
||||
'income_account': item and item[0]['default_income_account'] or \
|
||||
args.get('income_account'),
|
||||
'expense_account': item and item[0]['purchase_account'] or args.get('expense_account'),
|
||||
'cost_center': item and item[0]['default_sales_cost_center'] or args.get('cost_center'),
|
||||
}
|
||||
|
||||
return ret
|
||||
|
@ -249,15 +249,17 @@ class DocType:
|
||||
|
||||
def on_update(self):
|
||||
self.set_letter_head()
|
||||
ac = sql("select name from tabAccount where company=%s and docstatus<2 limit 1",
|
||||
self.doc.name)
|
||||
if not ac:
|
||||
|
||||
if not webnotes.conn.sql("""select name from tabAccount
|
||||
where company=%s and docstatus<2 limit 1""", self.doc.name):
|
||||
self.create_default_accounts()
|
||||
self.set_default_accounts()
|
||||
cc = sql("select name from `tabCost Center` where cost_center_name = 'Root' and company_name = '%s'"%(self.doc.name))
|
||||
if not cc:
|
||||
|
||||
if not webnotes.conn.sql("""select name from `tabCost Center`
|
||||
where cost_center_name = 'Root' and company_name = %s""", self.doc.name):
|
||||
self.create_default_cost_center()
|
||||
|
||||
self.set_default_accounts()
|
||||
|
||||
if self.doc.default_currency:
|
||||
webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
test_ignore = ["Account"]
|
||||
test_ignore = ["Account", "Cost Center"]
|
||||
|
||||
test_records = [
|
||||
[{
|
||||
|
@ -323,7 +323,7 @@ cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').g
|
||||
}
|
||||
|
||||
// cost center
|
||||
cur_frm.fields_dict["delivery_note_details"].grid.get_field("cost_center").get_query = function(doc) {
|
||||
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
query: "accounts.utils.get_cost_center_list",
|
||||
filters: { company_name: doc.company}
|
||||
|
@ -85,8 +85,11 @@ class DocType(SellingController):
|
||||
obj = get_obj('Sales Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||
arg = {
|
||||
'item_code':doc.fields.get('item_code'),
|
||||
'expense_account':doc.fields.get('expense_account'),
|
||||
'cost_center': doc.fields.get('cost_center'),
|
||||
'warehouse': doc.fields.get('warehouse')};
|
||||
ret = obj.get_item_defaults(arg)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-07 11:42:59",
|
||||
"creation": "2013-03-25 11:55:16",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-22 18:43:10",
|
||||
"modified": "2013-03-25 15:43:04",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -253,14 +253,15 @@
|
||||
"no_copy": 1,
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_cost_center",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"label": "Purchase Cost Center",
|
||||
"label": "Cost Center",
|
||||
"no_copy": 1,
|
||||
"options": "Cost Center",
|
||||
"print_hide": 1,
|
||||
|
@ -27,7 +27,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
|
||||
if (sys_defaults.auto_inventory_accounting && !this.frm.doc.expense_adjustment_account) {
|
||||
if (this.frm.doc.purpose == "Sales Return")
|
||||
account_for = "stock_delivered_but_not_billed";
|
||||
account_for = "stock_in_hand_account";
|
||||
else if (this.frm.doc.purpose == "Purchase Return")
|
||||
account_for = "stock_received_but_not_billed";
|
||||
else account_for = "stock_adjustment_account";
|
||||
|
Loading…
x
Reference in New Issue
Block a user