Merge branch 'master' of github.com:webnotes/erpnext into wsgi

Conflicts:
	accounts/doctype/account/account.py
	accounts/doctype/gl_entry/gl_entry.py
	accounts/doctype/period_closing_voucher/period_closing_voucher.py
	stock/doctype/delivery_note/delivery_note.py
	stock/doctype/landed_cost_wizard/landed_cost_wizard.py
	stock/doctype/purchase_receipt/purchase_receipt.py
	stock/doctype/stock_ledger/stock_ledger.py
	stock/doctype/warehouse/warehouse.py
	stock/stock_ledger.py
This commit is contained in:
Anand Doshi
2013-09-25 19:55:41 +05:30
242 changed files with 3879 additions and 3910 deletions

View File

@@ -90,18 +90,7 @@ cur_frm.fields_dict.cost_center.get_query = function(doc) {
}
}
if (sys_defaults.auto_inventory_accounting) {
cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) {
return {
"filters": {
"is_pl_account": "No",
"debit_or_credit": "Debit",
"company": doc.name,
'group_or_ledger': "Ledger"
}
}
}
if (sys_defaults.auto_accounting_for_stock) {
cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
return {
"filters": {
@@ -126,10 +115,4 @@ if (sys_defaults.auto_inventory_accounting) {
}
}
}
cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) {
return {
"filters": {"company": doc.name}
}
}
}

View File

@@ -5,7 +5,7 @@ from __future__ import unicode_literals
import webnotes
from webnotes import _, msgprint
from webnotes.utils import cstr
from webnotes.utils import cstr, cint
from webnotes.model.doc import Document
from webnotes.model.code import get_obj
import webnotes.defaults
@@ -58,14 +58,17 @@ class DocType:
def create_default_warehouses(self):
for whname in ("Stores", "Work In Progress", "Finished Goods"):
webnotes.bean({
"doctype":"Warehouse",
"warehouse_name": whname,
"company": self.doc.name
}).insert()
if not webnotes.conn.exists("Warehouse", whname + " - " + self.doc.abbr):
webnotes.bean({
"doctype":"Warehouse",
"warehouse_name": whname,
"company": self.doc.name,
"create_account_under": "Stock Assets - " + self.doc.abbr
}).insert()
def create_default_web_page(self):
if not webnotes.conn.get_value("Website Settings", None, "home_page"):
if not webnotes.conn.get_value("Website Settings", None, "home_page") and \
not webnotes.conn.sql("select name from tabCompany where name!=%s", self.doc.name):
import os
with open(os.path.join(os.path.dirname(__file__), "sample_home_page.html"), "r") as webfile:
webpage = webnotes.bean({
@@ -112,7 +115,6 @@ class DocType:
['Securities and Deposits','Current Assets','Group','No','','Debit',self.doc.name,''],
['Earnest Money','Securities and Deposits','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,''],
['Tax Assets','Current Assets','Group','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,''],
@@ -242,8 +244,8 @@ class DocType:
"default_expense_account": "Cost of Goods Sold",
"receivables_group": "Accounts Receivable",
"payables_group": "Accounts Payable",
"default_cash_account": "Cash",
"stock_received_but_not_billed": "Stock Received But Not Billed",
"stock_in_hand_account": "Stock In Hand",
"stock_adjustment_account": "Stock Adjustment",
"expenses_included_in_valuation": "Expenses Included In Valuation"
}
@@ -253,9 +255,6 @@ class DocType:
if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
webnotes.conn.set(self.doc, a, account_name)
if not self.doc.stock_adjustment_cost_center:
webnotes.conn.set(self.doc, "stock_adjustment_cost_center", self.doc.cost_center)
def create_default_cost_center(self):
cc_list = [
{
@@ -275,10 +274,9 @@ class DocType:
cc.update({"doctype": "Cost Center"})
cc_bean = webnotes.bean(cc)
cc_bean.ignore_permissions = True
if cc.get("cost_center_name") == self.doc.name:
cc_bean.ignore_mandatory = True
cc_bean.insert()
webnotes.conn.set(self.doc, "cost_center", "Main - " + self.doc.abbr)
@@ -287,11 +285,8 @@ class DocType:
"""
Trash accounts and cost centers for this company if no gl entry exists
"""
rec = webnotes.conn.sql("SELECT name from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'No' and company = %s", self.doc.name)
rec = webnotes.conn.sql("SELECT name from `tabGL Entry` where company = %s", self.doc.name)
if not rec:
# delete gl entry
webnotes.conn.sql("delete from `tabGL Entry` where company = %s", self.doc.name)
#delete tabAccount
webnotes.conn.sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)
@@ -300,6 +295,9 @@ class DocType:
#delete cost center
webnotes.conn.sql("delete from `tabCost Center` WHERE company = %s order by lft desc, rgt desc", self.doc.name)
if not webnotes.conn.get_value("Stock Ledger Entry", {"company": self.doc.name}):
webnotes.conn.sql("""delete from `tabWarehouse` where company=%s""", self.doc.name)
webnotes.defaults.clear_default("company", value=self.doc.name)
webnotes.conn.sql("""update `tabSingles` set value=""

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-10 08:35:39",
"docstatus": 0,
"modified": "2013-08-05 15:39:36",
"modified": "2013-08-28 19:15:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -221,19 +221,9 @@
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "auto_inventory_accounting_settings",
"fieldname": "auto_accounting_for_stock_settings",
"fieldtype": "Section Break",
"label": "Auto Inventory Accounting Settings",
"read_only": 0
},
{
"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",
"label": "Auto Accounting For Stock Settings",
"read_only": 0
},
{
@@ -245,13 +235,6 @@
"options": "Account",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break23",
"fieldtype": "Column Break",
"read_only": 0,
"width": "50%"
},
{
"doctype": "DocField",
"fieldname": "stock_adjustment_account",
@@ -270,15 +253,6 @@
"options": "Account",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "stock_adjustment_cost_center",
"fieldtype": "Link",
"label": "Stock Adjustment Cost Center",
"no_copy": 1,
"options": "Cost Center",
"read_only": 0
},
{
"description": "For reference only.",
"doctype": "DocField",

View File

@@ -362,8 +362,8 @@ class DocType(DocListController):
gl_entries = webnotes.conn.sql("""select `account`,
ifnull(credit, 0) as credit, ifnull(debit, 0) as debit, `against`
from `tabGL Entry`
where company=%s and ifnull(is_cancelled, "No")="No" and
posting_date <= %s %s""" % ("%s", "%s",
where company=%s
and posting_date <= %s %s""" % ("%s", "%s",
from_date and "and posting_date>='%s'" % from_date or ""),
(self.doc.company, to_date or self.to_date), as_dict=1)

View File

@@ -105,8 +105,9 @@ class DocType:
})
global_defaults.save()
webnotes.conn.set_value("Accounts Settings", None, "auto_inventory_accounting", 1)
webnotes.conn.set_default("auto_inventory_accounting", 1)
accounts_settings = webnotes.bean("Accounts Settings")
accounts_settings.doc.auto_accounting_for_stock = 1
accounts_settings.save()
stock_settings = webnotes.bean("Stock Settings")
stock_settings.doc.item_naming_by = "Item Code"

0
setup/report/__init__.py Normal file
View File

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-09-25 10:29:04",
"docstatus": 0,
"modified": "2013-09-25 10:29:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"json": "{\"filters\":[[\"Item Price\",\"item_code\",\"like\",\"%\"],[\"Price List\",\"price_list_name\",\"like\",\"%\"]],\"columns\":[[\"item_code\",\"Item Price\"],[\"price_list_name\",\"Price List\"],[\"currency\",\"Price List\"],[\"ref_rate\",\"Item Price\"],[\"buying_or_selling\",\"Price List\"],[\"name\",\"Price List\"]],\"sort_by\":\"Price List.modified\",\"sort_order\":\"desc\",\"sort_by_next\":\"\",\"sort_order_next\":\"desc\"}",
"name": "__common__",
"ref_doctype": "Price List",
"report_name": "Item-Wise Price List",
"report_type": "Report Builder"
},
{
"doctype": "Report",
"name": "Item-Wise Price List"
}
]

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-09-25 10:21:15",
"docstatus": 0,
"modified": "2013-09-25 10:24:57",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"json": "{\"filters\":[[\"Item Price\",\"item_code\",\"like\",\"%\"],[\"Price List\",\"price_list_name\",\"like\",\"%\"]],\"columns\":[[\"item_code\",\"Item Price\"],[\"price_list_name\",\"Price List\"],[\"currency\",\"Price List\"],[\"ref_rate\",\"Item Price\"],[\"buying_or_selling\",\"Price List\"],[\"name\",\"Price List\"]],\"sort_by\":\"Price List.modified\",\"sort_order\":\"desc\",\"sort_by_next\":\"\",\"sort_order_next\":\"desc\"}",
"name": "__common__",
"ref_doctype": "Price List",
"report_name": "Item-wise Price List Rate",
"report_type": "Report Builder"
},
{
"doctype": "Report",
"name": "Item-wise Price List Rate"
}
]