mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-30 03:58:26 +00:00
merge
This commit is contained in:
@@ -58,3 +58,43 @@ cur_frm.fields_dict.receivables_group.get_query = function(doc) {
|
||||
cur_frm.fields_dict.payables_group.get_query = function(doc) {
|
||||
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) {
|
||||
return {
|
||||
"query": "accounts.utils.get_account_list",
|
||||
"filters": {
|
||||
"is_pl_account": "No",
|
||||
"debit_or_credit": "Debit",
|
||||
"company": doc.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
|
||||
return {
|
||||
"query": "accounts.utils.get_account_list",
|
||||
"filters": {
|
||||
"is_pl_account": "Yes",
|
||||
"debit_or_credit": "Debit",
|
||||
"company": doc.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict["expenses_included_in_valuation"].get_query =
|
||||
cur_frm.fields_dict["stock_adjustment_account"].get_query;
|
||||
|
||||
cur_frm.fields_dict["stock_delivered_but_not_billed"].get_query =
|
||||
cur_frm.fields_dict["stock_in_hand_account"].get_query;
|
||||
|
||||
cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
|
||||
return {
|
||||
"query": "accounts.utils.get_account_list",
|
||||
"filters": {
|
||||
"is_pl_account": "No",
|
||||
"debit_or_credit": "Credit",
|
||||
"company": doc.name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, set_default
|
||||
from webnotes.utils import cstr
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.model.code import get_obj
|
||||
import webnotes.defaults
|
||||
@@ -47,10 +47,11 @@ class DocType:
|
||||
['Loans and Advances (Assets)','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Securities and Deposits','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Earnest Money','Securities and Deposits','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Stock In Hand','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Stock','Stock In Hand','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Stock Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Stock In Hand','Stock Assets','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Stock Delivered But Not Billed', 'Stock Assets', 'Ledger',
|
||||
'No', '', 'Debit', self.doc.name, ''],
|
||||
['Tax Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Stock Delivered But Not Billed','Current Assets','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Fixed Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
|
||||
['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
|
||||
['Computers','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
|
||||
@@ -62,9 +63,10 @@ class DocType:
|
||||
['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Expenses','','Group','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Direct Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Cost of Goods Sold','Direct Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Expenses Included In Valuation','Direct Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Stock Adjustment','Direct Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Stock Expenses','Direct Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Cost of Goods Sold','Stock Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Stock Adjustment','Stock Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Expenses Included In Valuation', "Stock Expenses", 'Ledger', 'Yes', 'Expense Account', 'Debit', self.doc.name, ''],
|
||||
['Indirect Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Advertising and Publicity','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
|
||||
['Bad Debts Written Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
@@ -101,12 +103,14 @@ class DocType:
|
||||
['Shareholders Funds','Capital Account','Group','No','','Credit',self.doc.name,''],
|
||||
['Current Liabilities','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Accounts Payable','Current Liabilities','Group','No','','Credit',self.doc.name,''],
|
||||
['Stock Liabilities','Current Liabilities','Group','No','','Credit',self.doc.name,''],
|
||||
['Stock Received But Not Billed', 'Stock Liabilities', 'Ledger',
|
||||
'No', '', 'Credit', self.doc.name, ''],
|
||||
['Duties and Taxes','Current Liabilities','Group','No','','Credit',self.doc.name,''],
|
||||
['Loans (Liabilities)','Current Liabilities','Group','No','','Credit',self.doc.name,''],
|
||||
['Secured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Unsecured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Bank Overdraft Account','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Stock Received But Not Billed','Current Liabilities','Ledger','No','','Credit',self.doc.name,''],
|
||||
['Temporary Accounts (Liabilities)','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Temporary Account (Liabilities)','Temporary Accounts (Liabilities)','Ledger','No','','Credit',self.doc.name,'']
|
||||
]
|
||||
@@ -186,14 +190,35 @@ class DocType:
|
||||
|
||||
self.doc.letter_head = header
|
||||
|
||||
# Set default AR and AP group
|
||||
# ---------------------------------------------------
|
||||
def set_default_groups(self):
|
||||
if not self.doc.receivables_group:
|
||||
webnotes.conn.set(self.doc, 'receivables_group', 'Accounts Receivable - '+self.doc.abbr)
|
||||
if not self.doc.payables_group:
|
||||
webnotes.conn.set(self.doc, 'payables_group', 'Accounts Payable - '+self.doc.abbr)
|
||||
def set_default_accounts(self):
|
||||
if not self.doc.receivables_group and webnotes.conn.exists('Account',
|
||||
'Accounts Receivable - ' + self.doc.abbr):
|
||||
webnotes.conn.set(self.doc, 'receivables_group', 'Accounts Receivable - ' +
|
||||
self.doc.abbr)
|
||||
|
||||
if not self.doc.payables_group and webnotes.conn.exists('Account',
|
||||
'Accounts Payable - ' + self.doc.abbr):
|
||||
webnotes.conn.set(self.doc, 'payables_group', 'Accounts Payable - ' + self.doc.abbr)
|
||||
|
||||
if not self.doc.stock_delivered_but_not_billed and webnotes.conn.exists("Account",
|
||||
"Stock Delivered But Not Billed - " + self.doc.abbr):
|
||||
webnotes.conn.set(self.doc, "stock_delivered_but_not_billed",
|
||||
"Stock Delivered But Not Billed - " + self.doc.abbr)
|
||||
|
||||
if not self.doc.stock_received_but_not_billed and webnotes.conn.exists("Account",
|
||||
"Stock Received But Not Billed - " + self.doc.abbr):
|
||||
webnotes.conn.set(self.doc, "stock_received_but_not_billed",
|
||||
"Stock Received But Not Billed - " + self.doc.abbr)
|
||||
|
||||
if not self.doc.stock_adjustment_account and webnotes.conn.exists("Account",
|
||||
"Stock Adjustment - " + self.doc.abbr):
|
||||
webnotes.conn.set(self.doc, "stock_adjustment_account", "Stock Adjustment - " +
|
||||
self.doc.abbr)
|
||||
|
||||
if not self.doc.expenses_included_in_valuation and webnotes.conn.exists("Account",
|
||||
"Expenses Included In Valuation - " + self.doc.abbr):
|
||||
webnotes.conn.set(self.doc, "expenses_included_in_valuation",
|
||||
"Expenses Included In Valuation - " + self.doc.abbr)
|
||||
|
||||
# Create default cost center
|
||||
# ---------------------------------------------------
|
||||
@@ -228,7 +253,7 @@ class DocType:
|
||||
self.doc.name)
|
||||
if not ac:
|
||||
self.create_default_accounts()
|
||||
self.set_default_groups()
|
||||
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:
|
||||
self.create_default_cost_center()
|
||||
@@ -258,9 +283,6 @@ class DocType:
|
||||
#update value as blank for tabSingles Global Defaults
|
||||
sql("update `tabSingles` set value = '' where doctype='Global Defaults' and field = 'default_company' and value = %s", self.doc.name)
|
||||
|
||||
|
||||
# on rename
|
||||
# ---------
|
||||
def on_rename(self,newdn,olddn):
|
||||
sql("update `tabCompany` set company_name = '%s' where name = '%s'" %(newdn,olddn))
|
||||
sql("update `tabSingles` set value = %s where doctype='Global Defaults' and field = 'default_company' and value = %s", (newdn, olddn))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-22 01:27:54",
|
||||
"creation": "2013-02-27 09:38:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-02-26 10:57:39",
|
||||
"modified": "2013-03-19 12:52:00",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -124,17 +124,6 @@
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.__islocal",
|
||||
"description": "This account will be used to maintain value of available stock",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_in_hand_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Stock In Hand Account",
|
||||
"no_copy": 1,
|
||||
"options": "Account",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
@@ -181,6 +170,57 @@
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nWarn\nIgnore\nStop"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.__islocal && sys_defaults.auto_inventory_accounting",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "auto_inventory_accounting_settings",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Auto Inventory Accounting Settings"
|
||||
},
|
||||
{
|
||||
"description": "This account will be used to maintain value of available stock",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_in_hand_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Stock In Hand Account",
|
||||
"no_copy": 1,
|
||||
"options": "Account",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_adjustment_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Stock Adjustment Account",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "expenses_included_in_valuation",
|
||||
"fieldtype": "Link",
|
||||
"label": "Expenses Included In Valuation",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "col_break23",
|
||||
"fieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_delivered_but_not_billed",
|
||||
"fieldtype": "Link",
|
||||
"label": "Stock Delivered But Not Billed",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_received_but_not_billed",
|
||||
"fieldtype": "Link",
|
||||
"label": "Stock Received But Not Billed",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"description": "For reference only.",
|
||||
"doctype": "DocField",
|
||||
|
||||
@@ -44,6 +44,7 @@ keydict = {
|
||||
'maintain_same_rate' : 'maintain_same_rate',
|
||||
'session_expiry': 'session_expiry',
|
||||
'disable_rounded_total': 'disable_rounded_total',
|
||||
"update_stock": "update_stock",
|
||||
}
|
||||
|
||||
class DocType:
|
||||
|
||||
@@ -260,6 +260,13 @@
|
||||
"fieldname": "column_break4",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"description": "If checked, then in POS Sales Invoice, Update Stock gets checked by default",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "update_stock",
|
||||
"fieldtype": "Check",
|
||||
"label": "Update Stock when using POS Sales Invoice"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account_info",
|
||||
@@ -414,7 +421,7 @@
|
||||
"fieldname": "emp_created_by",
|
||||
"fieldtype": "Select",
|
||||
"label": "Employee Records to be created by ",
|
||||
"options": "\nNaming Series\nEmployee Number"
|
||||
"options": "Naming Series\nEmployee Number"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
|
||||
Reference in New Issue
Block a user