Merge branch '1310' of github.com:webnotes/erpnext
Conflicts: setup/doctype/setup_control/setup_control.py stock/doctype/stock_entry/stock_entry.py utilities/demo/demo_docs/Price_List.csv
This commit is contained in:
commit
daaa14c079
@ -135,17 +135,18 @@ def check_freezing_date(posting_date, adv_adj=False):
|
||||
|
||||
def update_outstanding_amt(account, against_voucher_type, against_voucher, on_cancel=False):
|
||||
# get final outstanding amt
|
||||
bal = flt(webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry`
|
||||
bal = flt(webnotes.conn.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry`
|
||||
where against_voucher_type=%s and against_voucher=%s and account = %s""",
|
||||
(against_voucher_type, against_voucher, account))[0][0] or 0.0)
|
||||
|
||||
if against_voucher_type == 'Purchase Invoice':
|
||||
bal = -bal
|
||||
elif against_voucher_type == "Journal Voucher":
|
||||
against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit)
|
||||
against_voucher_amount = flt(webnotes.conn.sql("""
|
||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
|
||||
and account = %s""", (against_voucher, account))[0][0])
|
||||
|
||||
bal = against_voucher_amount + bal
|
||||
if against_voucher_amount < 0:
|
||||
bal = -bal
|
||||
|
@ -457,11 +457,16 @@ class DocType(BuyingController):
|
||||
def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
# expense account can be any Debit account,
|
||||
# but can also be a Liability account with account_type='Expense Account' in special circumstances.
|
||||
# Hence the first condition is an "OR"
|
||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.debit_or_credit="Debit"
|
||||
or tabAccount.account_type = "Expense Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
|
@ -897,11 +897,16 @@ def get_bank_cash_account(mode_of_payment):
|
||||
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
# income account can be any Credit account,
|
||||
# but can also be a Asset account with account_type='Income Account' in special circumstances.
|
||||
# Hence the first condition is an "OR"
|
||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.debit_or_credit="Credit"
|
||||
or tabAccount.account_type = "Income Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
|
@ -7,7 +7,7 @@ wn.require("app/js/controllers/accounts.js");
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.doctype === "Sales Taxes and Charges Master")
|
||||
erpnext.add_for_territory();
|
||||
erpnext.add_applicable_territory();
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:22:14",
|
||||
"modified": "2013-10-31 19:25:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -94,7 +94,7 @@
|
||||
"fieldname": "valid_for_territories",
|
||||
"fieldtype": "Table",
|
||||
"label": "Valid for Territories",
|
||||
"options": "For Territory",
|
||||
"options": "Applicable Territory",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ test_records = [
|
||||
"rate": 6.36,
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "All Territories"
|
||||
}
|
||||
@ -113,7 +113,7 @@ test_records = [
|
||||
"row_id": 7
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory India"
|
||||
}
|
||||
@ -141,7 +141,7 @@ test_records = [
|
||||
"rate": 4,
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "All Territories"
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function() {
|
||||
erpnext.add_for_territory();
|
||||
erpnext.add_applicable_territory();
|
||||
}
|
||||
});
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-25 11:48:03",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:55:00",
|
||||
"modified": "2013-10-31 19:24:50",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -87,7 +87,7 @@
|
||||
"fieldname": "valid_for_territories",
|
||||
"fieldtype": "Table",
|
||||
"label": "Valid For Territories",
|
||||
"options": "For Territory",
|
||||
"options": "Applicable Territory",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ test_records = [
|
||||
"shipping_amount": 0.0
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory"
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ def get_tax_accounts(item_list, columns):
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
for item, tax_amount in item_wise_tax_detail.items():
|
||||
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
|
||||
flt(tax_amount[1])
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
|
||||
except ValueError:
|
||||
continue
|
||||
|
@ -83,7 +83,7 @@ def get_tax_accounts(item_list, columns):
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
for item, tax_amount in item_wise_tax_detail.items():
|
||||
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
|
||||
flt(tax_amount[1])
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
|
@ -6,7 +6,7 @@ import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list")
|
||||
webnotes.reload_doc("setup", "doctype", "item_price")
|
||||
webnotes.reload_doc("stock", "doctype", "item_price")
|
||||
|
||||
for t in [
|
||||
("Supplier Quotation", "price_list_name", "buying_price_list"),
|
||||
|
@ -7,8 +7,8 @@ from webnotes.utils import cint
|
||||
import MySQLdb
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("setup", "doctype", "price_list")
|
||||
webnotes.reload_doc("setup", "doctype", "item_price")
|
||||
webnotes.reload_doc("stock", "doctype", "price_list")
|
||||
webnotes.reload_doc("stock", "doctype", "item_price")
|
||||
|
||||
try:
|
||||
for price_list in webnotes.conn.sql_list("""select name from `tabPrice List`"""):
|
||||
|
@ -4,8 +4,8 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("setup", "doctype", "for_territory")
|
||||
webnotes.reload_doc("setup", "doctype", "price_list")
|
||||
webnotes.reload_doc("setup", "doctype", "applicable_territory")
|
||||
webnotes.reload_doc("stock", "doctype", "price_list")
|
||||
webnotes.reload_doc("accounts", "doctype", "sales_taxes_and_charges_master")
|
||||
webnotes.reload_doc("accounts", "doctype", "shipping_rule")
|
||||
|
||||
@ -14,12 +14,12 @@ def execute():
|
||||
|
||||
for parenttype in ["Sales Taxes and Charges Master", "Price List", "Shipping Rule"]:
|
||||
for name in webnotes.conn.sql_list("""select name from `tab%s` main
|
||||
where not exists (select parent from `tabFor Territory` territory
|
||||
where not exists (select parent from `tabApplicable Territory` territory
|
||||
where territory.parenttype=%s and territory.parent=main.name)""" % \
|
||||
(parenttype, "%s"), (parenttype,)):
|
||||
|
||||
doc = webnotes.doc({
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"__islocal": 1,
|
||||
"parenttype": parenttype,
|
||||
"parentfield": "valid_for_territories",
|
||||
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("setup", "doctype", "item_price")
|
||||
webnotes.reload_doc("stock", "doctype", "item_price")
|
||||
|
||||
webnotes.conn.sql("""update `tabItem Price` ip, `tabItem` i
|
||||
set ip.item_name=i.item_name, ip.item_description=i.description
|
||||
|
23
patches/october_2013/p07_rename_for_territory.py
Normal file
23
patches/october_2013/p07_rename_for_territory.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes, os
|
||||
|
||||
def execute():
|
||||
from webnotes.utils import get_base_path
|
||||
webnotes.reload_doc("core", "doctype", "doctype")
|
||||
|
||||
tables = webnotes.conn.sql_list("show tables")
|
||||
|
||||
if "tabApplicable Territory" not in tables:
|
||||
webnotes.rename_doc("DocType", "For Territory", "Applicable Territory", force=True)
|
||||
|
||||
webnotes.reload_doc("setup", "doctype", "applicable_territory")
|
||||
|
||||
path = os.path.join(get_base_path(), "app", "setup", "doctype", "for_territory")
|
||||
if os.path.exists(path):
|
||||
os.system("rm -rf {path}".format(path=path))
|
||||
|
||||
if webnotes.conn.exists("DocType", "For Territory"):
|
||||
webnotes.delete_doc("DocType", "For Territory")
|
@ -161,7 +161,6 @@ patch_list = [
|
||||
"execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')",
|
||||
"patches.june_2013.p05_remove_unused_doctypes",
|
||||
"patches.june_2013.p06_drop_unused_tables",
|
||||
"patches.june_2013.p07_taxes_price_list_for_territory",
|
||||
"patches.june_2013.p08_shopping_cart_settings",
|
||||
"patches.june_2013.p09_update_global_defaults",
|
||||
"patches.june_2013.p10_lead_address",
|
||||
@ -235,4 +234,6 @@ patch_list = [
|
||||
"patches.october_2013.p04_update_report_permission",
|
||||
"patches.october_2013.p05_delete_gl_entries_for_cancelled_vouchers",
|
||||
"patches.october_2013.p06_update_control_panel_and_global_defaults",
|
||||
"patches.october_2013.p07_rename_for_territory",
|
||||
"patches.june_2013.p07_taxes_price_list_for_territory",
|
||||
]
|
@ -5,8 +5,8 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("setup", "doctype", "price_list")
|
||||
webnotes.reload_doc("setup", "doctype", "item_price")
|
||||
webnotes.reload_doc("stock", "doctype", "price_list")
|
||||
webnotes.reload_doc("stock", "doctype", "item_price")
|
||||
webnotes.reload_doc("stock", "doctype", "item")
|
||||
|
||||
webnotes.conn.sql("""update `tabItem Price` set parenttype='Price List',
|
||||
|
@ -28,10 +28,10 @@ $.extend(erpnext, {
|
||||
}
|
||||
},
|
||||
|
||||
add_for_territory: function() {
|
||||
add_applicable_territory: function() {
|
||||
if(cur_frm.doc.__islocal &&
|
||||
wn.model.get_doclist(cur_frm.doc.doctype, cur_frm.doc.name).length === 1) {
|
||||
var territory = wn.model.add_child(cur_frm.doc, "For Territory",
|
||||
var territory = wn.model.add_child(cur_frm.doc, "Applicable Territory",
|
||||
"valid_for_territories");
|
||||
territory.territory = wn.defaults.get_default("territory");
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class DocType(DocListController):
|
||||
# make a map of territory: [list of names]
|
||||
# if list against each territory has more than one element, raise exception
|
||||
territory_name = webnotes.conn.sql("""select `territory`, `parent`
|
||||
from `tabFor Territory`
|
||||
from `tabApplicable Territory`
|
||||
where `parenttype`=%s and `parent` in (%s)""" %
|
||||
("%s", ", ".join(["%s"]*len(names))), tuple([parenttype] + names))
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
# MIT License. See license.txt
|
||||
|
||||
# For license information, please see license.txt
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-20 12:48:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 14:54:09",
|
||||
"modified": "2013-10-31 18:56:54",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -20,7 +20,7 @@
|
||||
"label": "Territory",
|
||||
"name": "__common__",
|
||||
"options": "Territory",
|
||||
"parent": "For Territory",
|
||||
"parent": "Applicable Territory",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
@ -28,7 +28,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "For Territory"
|
||||
"name": "Applicable Territory"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField"
|
@ -108,7 +108,7 @@ def create_price_lists(args):
|
||||
"currency": args["currency"]
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "All Territories"
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-02 16:29:48",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-10-21 15:11:20",
|
||||
"modified": "2013-10-31 12:59:02",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,7 +14,7 @@
|
||||
"icon": "icon-flag",
|
||||
"in_create": 0,
|
||||
"istable": 0,
|
||||
"module": "Setup",
|
||||
"module": "Stock",
|
||||
"name": "__common__",
|
||||
"read_only": 0
|
||||
},
|
@ -3,7 +3,7 @@
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function() {
|
||||
erpnext.add_for_territory();
|
||||
erpnext.add_applicable_territory();
|
||||
},
|
||||
|
||||
refresh: function() {
|
@ -18,7 +18,7 @@ class DocType(DocListController):
|
||||
# if no territory, set default territory
|
||||
if webnotes.defaults.get_user_default("territory"):
|
||||
self.doclist.append({
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": webnotes.defaults.get_user_default("territory")
|
||||
})
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-25 11:35:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-10-18 13:33:07",
|
||||
"modified": "2013-10-31 19:24:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -17,7 +17,7 @@
|
||||
"document_type": "Master",
|
||||
"icon": "icon-tags",
|
||||
"max_attachments": 1,
|
||||
"module": "Setup",
|
||||
"module": "Stock",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
@ -81,7 +81,7 @@
|
||||
"fieldname": "valid_for_territories",
|
||||
"fieldtype": "Table",
|
||||
"label": "Valid for Territories",
|
||||
"options": "For Territory",
|
||||
"options": "Applicable Territory",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
@ -15,7 +15,7 @@ test_records = [
|
||||
"buying_or_selling": "Selling"
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "All Territories"
|
||||
},
|
||||
@ -28,7 +28,7 @@ test_records = [
|
||||
"buying_or_selling": "Selling"
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory Rest of the World"
|
||||
}
|
||||
@ -41,7 +41,7 @@ test_records = [
|
||||
"buying_or_selling": "Selling"
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory India"
|
||||
}
|
||||
@ -54,12 +54,12 @@ test_records = [
|
||||
"buying_or_selling": "Selling"
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory Rest of the World"
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory United States"
|
||||
}
|
Loading…
Reference in New Issue
Block a user