From 9283b6c59d764335b7473f557c794c44ca7203e2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 14:58:45 +0530 Subject: [PATCH 01/27] [demo] [minor] fixes in make demo --- utilities/demo/make_demo.py | 10 +++------- utilities/demo/make_erpnext_demo.py | 18 +++++++++--------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/utilities/demo/make_demo.py b/utilities/demo/make_demo.py index 6f18f76f9a..4383d32129 100644 --- a/utilities/demo/make_demo.py +++ b/utilities/demo/make_demo.py @@ -30,7 +30,6 @@ prob = { } def make(reset=False, simulate=True): - webnotes.connect() #webnotes.print_messages = True webnotes.mute_emails = True webnotes.rollback_on_exception = True @@ -38,7 +37,7 @@ def make(reset=False, simulate=True): if reset: setup() if simulate: - simulate() + _simulate() def setup(): install() @@ -50,7 +49,7 @@ def setup(): # make_opening_stock() # make_opening_accounts() -def simulate(): +def _simulate(): global runs_for current_date = webnotes.utils.getdate(start_date) @@ -411,7 +410,4 @@ def import_data(dt, submit=False): if submit: webnotes.form_dict["params"] = json.dumps({"_submit": 1}) webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv") - upload() - -if __name__=="__main__": - make() \ No newline at end of file + upload() \ No newline at end of file diff --git a/utilities/demo/make_erpnext_demo.py b/utilities/demo/make_erpnext_demo.py index db1d25bd82..9e56839fb8 100644 --- a/utilities/demo/make_erpnext_demo.py +++ b/utilities/demo/make_erpnext_demo.py @@ -6,7 +6,14 @@ import webnotes, os import utilities.demo.make_demo def make_demo_app(): - + webnotes.mute_emails = 1 + webnotes.connect() + utilities.demo.make_demo.make(reset=True, simulate=False) + # setup demo user etc so that the site it up faster, while the data loads + make_demo_user() + make_demo_login_page() + make_demo_on_login_script() + utilities.demo.make_demo.make(reset=False, simulate=True) def make_demo_user(): roles = ["Accounts Manager", "Analytics", "Expense Approver", "Accounts User", @@ -111,11 +118,4 @@ def make_demo_on_login_script(): webnotes.conn.commit() if __name__=="__main__": - # webnotes.connect() - webnotes.mute_emails = 1 - utilities.demo.make_demo.make(reset=True, simulate=False) - # setup demo user etc so that the site it up faster, while the data loads - make_demo_user() - make_demo_login_page() - make_demo_on_login_script() - utilities.demo.make_demo.make(reset=False, simulate=True) \ No newline at end of file + make_demo_app() \ No newline at end of file From e527c11e1ed508e18dec1baee8eb474f127ad80f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 15:03:04 +0530 Subject: [PATCH 02/27] [docs] [minor] templatifed docs --- docs/templates/docs.html | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 docs/templates/docs.html diff --git a/docs/templates/docs.html b/docs/templates/docs.html new file mode 100644 index 0000000000..ef3cf8e9f8 --- /dev/null +++ b/docs/templates/docs.html @@ -0,0 +1,51 @@ +{% extends "lib/core/doctype/documentation_tool/docs.html" %} + +{% block navbar %} + +{% endblock %} + +{% block footer %} +
+ +{% endblock %} \ No newline at end of file From 04c4e2aea38755a7b865978c0a76c93b9901cf91 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 15:33:37 +0530 Subject: [PATCH 03/27] [minor] removed erpnext namespaces/branding --- public/js/toolbar.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/public/js/toolbar.js b/public/js/toolbar.js index d2ca512fa6..2566fcb6a3 100644 --- a/public/js/toolbar.js +++ b/public/js/toolbar.js @@ -20,20 +20,6 @@ erpnext.toolbar.setup = function() { '+wn._('Live Chat')+''); } - erpnext.toolbar.set_new_comments(); - $("#toolbar-tools").append('
  • \ Latest Updates
  • '); -} - -erpnext.toolbar.set_new_comments = function(new_comments) { - return; - var navbar_nc = $('.navbar-new-comments'); - if(cint(new_comments)) { - navbar_nc.addClass('navbar-new-comments-true') - navbar_nc.text(new_comments); - } else { - navbar_nc.removeClass('navbar-new-comments-true'); - navbar_nc.text(0); - } } \ No newline at end of file From 215c901a0d856d659c742bd5571daa32c55ad49d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 15:38:53 +0530 Subject: [PATCH 04/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- controllers/selling_controller.py | 9 ++++-- patches/patch_list.py | 1 + patches/september_2013/__init__.py | 0 .../p01_fix_buying_amount_gl_entries.py | 31 +++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 patches/september_2013/__init__.py create mode 100644 patches/september_2013/p01_fix_buying_amount_gl_entries.py diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py index a13d747279..5605ccf3a2 100644 --- a/controllers/selling_controller.py +++ b/controllers/selling_controller.py @@ -99,6 +99,8 @@ class SellingController(StockController): for item in self.doclist.get({"parentfield": self.fname}): if item.item_code in self.stock_items or \ (item_sales_bom and item_sales_bom.get(item.item_code)): + + buying_amount = 0 if item.item_code in self.stock_items: buying_amount = get_buying_amount(self.doc.doctype, self.doc.name, item.name, stock_ledger_entries.get((item.item_code, @@ -108,9 +110,10 @@ class SellingController(StockController): self.doc.doctype, self.doc.name, item.name, stock_ledger_entries, item_sales_bom) - item.buying_amount = buying_amount >= 0.01 and buying_amount or 0 - webnotes.conn.set_value(item.doctype, item.name, "buying_amount", - item.buying_amount) + # buying_amount >= 0.01 so that gl entry doesn't get created for such small amounts + item.buying_amount = buying_amount >= 0.01 and buying_amount or 0 + webnotes.conn.set_value(item.doctype, item.name, "buying_amount", + item.buying_amount) def check_expense_account(self, item): if item.buying_amount and not item.expense_account: diff --git a/patches/patch_list.py b/patches/patch_list.py index 1d382a56bd..2db62cf3a8 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -257,4 +257,5 @@ patch_list = [ "execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-08-16", "patches.august_2013.p06_fix_sle_against_stock_entry", "execute:webnotes.bean('Style Settings').save() #2013-08-20", + "patches.september_2013.p01_fix_buying_amount_gl_entries", ] \ No newline at end of file diff --git a/patches/september_2013/__init__.py b/patches/september_2013/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py new file mode 100644 index 0000000000..b32317469d --- /dev/null +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -0,0 +1,31 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes +import webnotes.defaults +from webnotes.utils import cint + +def execute(): + if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")): + return + + # fix delivery note + for dn in webnotes.conn.sql_list("""select name from `tabDelivery Note` where docstatus=1 + and posting_date >= "2013-08-06" """): + recreate_gl_entries("Delivery Note", dn) + + # fix sales invoice + for si in webnotes.conn.sql_list("""select name from `tabSales Invoice` where docstatus=1 + and update_stock=1 and posting_date >= "2013-08-06" """): + recreate_gl_entries("Sales Invoice", si) + +def recreate_gl_entries(doctype, name): + # remove gl entries + webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s + and voucher_no=%s""", (doctype, name)) + + # calculate buying amount and make gl entries + bean = webnotes.bean(doctype, name) + bean.run_method("set_buying_amount") + bean.run_method("make_gl_entries") \ No newline at end of file From d22a9cae90fb7c815197789f9813bb1b38d655cc Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 15:54:52 +0530 Subject: [PATCH 05/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- .../p01_fix_buying_amount_gl_entries.py | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index b32317469d..1fe3b4623d 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -13,14 +13,14 @@ def execute(): # fix delivery note for dn in webnotes.conn.sql_list("""select name from `tabDelivery Note` where docstatus=1 and posting_date >= "2013-08-06" """): - recreate_gl_entries("Delivery Note", dn) + recreate_gl_entries("Delivery Note", dn, "delivery_note_details") # fix sales invoice for si in webnotes.conn.sql_list("""select name from `tabSales Invoice` where docstatus=1 and update_stock=1 and posting_date >= "2013-08-06" """): - recreate_gl_entries("Sales Invoice", si) + recreate_gl_entries("Sales Invoice", si, "entries") -def recreate_gl_entries(doctype, name): +def recreate_gl_entries(doctype, name, parentfield): # remove gl entries webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", (doctype, name)) @@ -28,4 +28,20 @@ def recreate_gl_entries(doctype, name): # calculate buying amount and make gl entries bean = webnotes.bean(doctype, name) bean.run_method("set_buying_amount") + + # update missing expense account and cost center + for item in bean.doclist.get({"parentfield": parentfield}): + if item.buying_amount and not (item.expense_account and item.cost_center): + item_values = webnotes.conn.get_value("Item", item.item_code, + ["purchase_account", "default_sales_cost_center"]) + company_values = webnotes.conn.get_value("Company", bean.doc.company, + ["default_expense_account", "cost_center"]) + if not item.expense_account: + item.expense_account = (item_values and item_values[0]) or (company_values and company_values[0]) + if not item.cost_center: + item.cost_center = (item_values and item_values[1]) or (company_values and company_values[1]) + + webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) + webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) + bean.run_method("make_gl_entries") \ No newline at end of file From c81eabe07b431a61cfcafceedb0cef17d49ce424 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 16:27:34 +0530 Subject: [PATCH 06/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- .../p01_fix_buying_amount_gl_entries.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 1fe3b4623d..160aa15e54 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -35,11 +35,26 @@ def recreate_gl_entries(doctype, name, parentfield): item_values = webnotes.conn.get_value("Item", item.item_code, ["purchase_account", "default_sales_cost_center"]) company_values = webnotes.conn.get_value("Company", bean.doc.company, - ["default_expense_account", "cost_center"]) + ["default_expense_account", "cost_center", "stock_adjustment_cost_center"]) if not item.expense_account: item.expense_account = (item_values and item_values[0]) or (company_values and company_values[0]) + if not item.cost_center: - item.cost_center = (item_values and item_values[1]) or (company_values and company_values[1]) + item.cost_center = (item_values and item_values[1]) or \ + (company_values and (company_values[1] or company_values[2])) + + if not (item.expense_account and item.cost_center): + res = webnotes.conn.sql("""select expense_account, cost_center + from `tab%s` child where docstatus=1 and item_code=%s + ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' + and (select company from `tab%s` parent where parent.name=child.parent)=%s + order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"), + (item.item_code, bean.doc.company)) + if res: + if not item.expense_account: + item.expense_account = res[0][0] + if not item.cost_center: + item.cost_center = res[0][1] webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) From d09039ae43d8915ad59f5570511ecb3ec05a2ddb Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 16:29:52 +0530 Subject: [PATCH 07/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- patches/september_2013/p01_fix_buying_amount_gl_entries.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 160aa15e54..22017b4c44 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -45,9 +45,9 @@ def recreate_gl_entries(doctype, name, parentfield): if not (item.expense_account and item.cost_center): res = webnotes.conn.sql("""select expense_account, cost_center - from `tab%s` child where docstatus=1 and item_code=%s - ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' - and (select company from `tab%s` parent where parent.name=child.parent)=%s + from `tab%s` child where docstatus=1 and item_code=%s and + ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and + (select company from `tab%s` parent where parent.name=child.parent)=%s order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"), (item.item_code, bean.doc.company)) if res: From fe73c38867849b52c4380c921396eee8c668bf30 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 16:34:49 +0530 Subject: [PATCH 08/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- .../p01_fix_buying_amount_gl_entries.py | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 22017b4c44..7379c302a9 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -32,29 +32,17 @@ def recreate_gl_entries(doctype, name, parentfield): # update missing expense account and cost center for item in bean.doclist.get({"parentfield": parentfield}): if item.buying_amount and not (item.expense_account and item.cost_center): - item_values = webnotes.conn.get_value("Item", item.item_code, - ["purchase_account", "default_sales_cost_center"]) - company_values = webnotes.conn.get_value("Company", bean.doc.company, - ["default_expense_account", "cost_center", "stock_adjustment_cost_center"]) - if not item.expense_account: - item.expense_account = (item_values and item_values[0]) or (company_values and company_values[0]) - - if not item.cost_center: - item.cost_center = (item_values and item_values[1]) or \ - (company_values and (company_values[1] or company_values[2])) - - if not (item.expense_account and item.cost_center): - res = webnotes.conn.sql("""select expense_account, cost_center - from `tab%s` child where docstatus=1 and item_code=%s and - ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and - (select company from `tab%s` parent where parent.name=child.parent)=%s - order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"), - (item.item_code, bean.doc.company)) - if res: - if not item.expense_account: - item.expense_account = res[0][0] - if not item.cost_center: - item.cost_center = res[0][1] + res = webnotes.conn.sql("""select expense_account, cost_center + from `tab%s` child where docstatus=1 and item_code=%s and + ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and + (select company from `tab%s` parent where parent.name=child.parent)=%s + order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"), + (item.item_code, bean.doc.company)) + if res: + if not item.expense_account: + item.expense_account = res[0][0] + if not item.cost_center: + item.cost_center = res[0][1] webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) From 79401717e0e0527ba90446e015b604cbb058be62 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 16:44:09 +0530 Subject: [PATCH 09/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- .../p01_fix_buying_amount_gl_entries.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 7379c302a9..7812a2aaaa 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -21,10 +21,6 @@ def execute(): recreate_gl_entries("Sales Invoice", si, "entries") def recreate_gl_entries(doctype, name, parentfield): - # remove gl entries - webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s - and voucher_no=%s""", (doctype, name)) - # calculate buying amount and make gl entries bean = webnotes.bean(doctype, name) bean.run_method("set_buying_amount") @@ -35,16 +31,20 @@ def recreate_gl_entries(doctype, name, parentfield): res = webnotes.conn.sql("""select expense_account, cost_center from `tab%s` child where docstatus=1 and item_code=%s and ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and - (select company from `tab%s` parent where parent.name=child.parent)=%s - order by creation desc limit 1""" % (item.doctype, "%s", doctype, "%s"), - (item.item_code, bean.doc.company)) + (select company from `tabAccount` ac where ac.name=child.expense_account)=%s and + (select company from `tabCost Center` cc where cc.name=child.cost_center)=%s + order by creation desc limit 1""" % (item.doctype, "%s", "%s", "%s"), + (item.item_code, bean.doc.company, bean.doc.company)) if res: if not item.expense_account: item.expense_account = res[0][0] if not item.cost_center: item.cost_center = res[0][1] - webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) - webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) - + webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) + webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) + + # remove gl entries + webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s + and voucher_no=%s""", (doctype, name)) bean.run_method("make_gl_entries") \ No newline at end of file From 9bb928f595aa54baa28366ff93c57d6126ce5c01 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 17:02:00 +0530 Subject: [PATCH 10/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- .../p01_fix_buying_amount_gl_entries.py | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 7812a2aaaa..0a25cd4faf 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -12,12 +12,12 @@ def execute(): # fix delivery note for dn in webnotes.conn.sql_list("""select name from `tabDelivery Note` where docstatus=1 - and posting_date >= "2013-08-06" """): + and posting_date >= "2013-08-06" order by posting_date"""): recreate_gl_entries("Delivery Note", dn, "delivery_note_details") # fix sales invoice for si in webnotes.conn.sql_list("""select name from `tabSales Invoice` where docstatus=1 - and update_stock=1 and posting_date >= "2013-08-06" """): + and update_stock=1 and posting_date >= "2013-08-06" order by posting_date"""): recreate_gl_entries("Sales Invoice", si, "entries") def recreate_gl_entries(doctype, name, parentfield): @@ -27,24 +27,34 @@ def recreate_gl_entries(doctype, name, parentfield): # update missing expense account and cost center for item in bean.doclist.get({"parentfield": parentfield}): - if item.buying_amount and not (item.expense_account and item.cost_center): + if item.buying_amount and not validate_item_values(item, bean.doc.company): res = webnotes.conn.sql("""select expense_account, cost_center from `tab%s` child where docstatus=1 and item_code=%s and ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and (select company from `tabAccount` ac where ac.name=child.expense_account)=%s and - (select company from `tabCost Center` cc where cc.name=child.cost_center)=%s + (select company from `tabCost Center` cc where cc.name=child.cost_center)=%s and order by creation desc limit 1""" % (item.doctype, "%s", "%s", "%s"), (item.item_code, bean.doc.company, bean.doc.company)) if res: - if not item.expense_account: - item.expense_account = res[0][0] - if not item.cost_center: - item.cost_center = res[0][1] - + item.expense_account = res[0][0] + item.cost_center = res[0][1] + webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) # remove gl entries webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", (doctype, name)) - bean.run_method("make_gl_entries") \ No newline at end of file + bean.run_method("make_gl_entries") + +def validate_item_values(item, company): + if item.expense_account and \ + webnotes.conn.get_value("Account", item.expense_account, "company")!=company: + return False + elif item.cost_center and \ + webnotes.conn.get_value("Cost Center", item.cost_center, "company")!=company: + return False + elif not (item.expense_account and item.cost_center): + return False + + return True \ No newline at end of file From dc30890b790c6fb7b8a6200d754258252c8ec595 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 17:03:38 +0530 Subject: [PATCH 11/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- patches/september_2013/p01_fix_buying_amount_gl_entries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 0a25cd4faf..011180a58a 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -32,7 +32,7 @@ def recreate_gl_entries(doctype, name, parentfield): from `tab%s` child where docstatus=1 and item_code=%s and ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and (select company from `tabAccount` ac where ac.name=child.expense_account)=%s and - (select company from `tabCost Center` cc where cc.name=child.cost_center)=%s and + (select company from `tabCost Center` cc where cc.name=child.cost_center)=%s order by creation desc limit 1""" % (item.doctype, "%s", "%s", "%s"), (item.item_code, bean.doc.company, bean.doc.company)) if res: From 96690ebd0f2c02dc122eb49e927dd7b3f17f7c7d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 17:04:27 +0530 Subject: [PATCH 12/27] [communication] [minor] cleaed model --- buying/doctype/supplier/supplier.py | 3 --- buying/doctype/supplier/supplier.txt | 10 +++++++++- hr/doctype/job_applicant/get_job_applications.py | 2 +- hr/doctype/job_applicant/job_applicant.py | 3 --- hr/doctype/job_applicant/job_applicant.txt | 10 +++++++++- selling/doctype/customer/customer.py | 5 +---- selling/doctype/customer/customer.txt | 11 ++++++++++- selling/doctype/lead/get_leads.py | 7 +++++-- selling/doctype/lead/lead.py | 1 - selling/doctype/lead/lead.txt | 10 +++++++++- selling/doctype/opportunity/opportunity.py | 3 --- selling/doctype/opportunity/opportunity.txt | 10 +++++++++- selling/doctype/quotation/quotation.py | 3 --- selling/doctype/quotation/quotation.txt | 10 +++++++++- setup/doctype/sales_person/sales_person.txt | 10 +++++++++- .../doctype/support_ticket/get_support_mails.py | 2 +- support/doctype/support_ticket/support_ticket.py | 5 +---- support/doctype/support_ticket/support_ticket.txt | 10 +++++++++- utilities/doctype/contact/contact.py | 3 --- utilities/doctype/contact/contact.txt | 10 +++++++++- utilities/transaction_base.py | 15 +-------------- 21 files changed, 92 insertions(+), 51 deletions(-) diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py index c646fdbdb5..75b2e03762 100644 --- a/buying/doctype/supplier/supplier.py +++ b/buying/doctype/supplier/supplier.py @@ -18,9 +18,6 @@ class DocType(TransactionBase): self.doc = doc self.doclist = doclist - def onload(self): - self.add_communication_list() - def autoname(self): supp_master_name = webnotes.defaults.get_global_default('supp_master_name') diff --git a/buying/doctype/supplier/supplier.txt b/buying/doctype/supplier/supplier.txt index 8fa70679f9..50202dcae2 100644 --- a/buying/doctype/supplier/supplier.txt +++ b/buying/doctype/supplier/supplier.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:11", "docstatus": 0, - "modified": "2013-08-08 14:22:08", + "modified": "2013-09-02 16:25:44", "modified_by": "Administrator", "owner": "Administrator" }, @@ -204,6 +204,14 @@ "oldfieldname": "website", "oldfieldtype": "Data" }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication" + }, { "cancel": 0, "create": 0, diff --git a/hr/doctype/job_applicant/get_job_applications.py b/hr/doctype/job_applicant/get_job_applications.py index 9bec43e5e8..2e01328915 100644 --- a/hr/doctype/job_applicant/get_job_applications.py +++ b/hr/doctype/job_applicant/get_job_applications.py @@ -37,7 +37,7 @@ class JobsMailbox(POP3Mailbox): mail.save_attachments_in_doc(applicant.doc) make(content=mail.content, sender=mail.from_email, - doctype="Job Applicant", name=applicant.doc.name, set_lead=False) + doctype="Job Applicant", name=applicant.doc.name) def get_job_applications(): if cint(webnotes.conn.get_value('Jobs Email Settings', None, 'extract_emails')): diff --git a/hr/doctype/job_applicant/job_applicant.py b/hr/doctype/job_applicant/job_applicant.py index e9b12b0f78..04b6da9568 100644 --- a/hr/doctype/job_applicant/job_applicant.py +++ b/hr/doctype/job_applicant/job_applicant.py @@ -11,9 +11,6 @@ class DocType(TransactionBase): def __init__(self, d, dl): self.doc, self.doclist = d, dl - def onload(self): - self.add_communication_list() - def get_sender(self, comm): return webnotes.conn.get_value('Jobs Email Settings',None,'email_id') diff --git a/hr/doctype/job_applicant/job_applicant.txt b/hr/doctype/job_applicant/job_applicant.txt index ebf95f68bb..62b1d807bc 100644 --- a/hr/doctype/job_applicant/job_applicant.txt +++ b/hr/doctype/job_applicant/job_applicant.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-29 19:25:37", "docstatus": 0, - "modified": "2013-07-05 14:43:11", + "modified": "2013-09-02 16:26:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -89,6 +89,14 @@ "fieldtype": "HTML", "label": "Thread HTML" }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication" + }, { "doctype": "DocPerm" } diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py index 2eabf12dde..cb19d4f931 100644 --- a/selling/doctype/customer/customer.py +++ b/selling/doctype/customer/customer.py @@ -17,10 +17,7 @@ class DocType(TransactionBase): def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist - - def onload(self): - self.add_communication_list() - + def autoname(self): cust_master_name = webnotes.defaults.get_global_default('cust_master_name') if cust_master_name == 'Customer Name': diff --git a/selling/doctype/customer/customer.txt b/selling/doctype/customer/customer.txt index 7da29d2adb..94bd8fceb4 100644 --- a/selling/doctype/customer/customer.txt +++ b/selling/doctype/customer/customer.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-11 14:26:44", "docstatus": 0, - "modified": "2013-08-08 14:22:13", + "modified": "2013-09-02 16:25:13", "modified_by": "Administrator", "owner": "Administrator" }, @@ -348,6 +348,15 @@ "options": "Customer Discount", "permlevel": 0 }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication", + "permlevel": 0 + }, { "amend": 0, "cancel": 0, diff --git a/selling/doctype/lead/get_leads.py b/selling/doctype/lead/get_leads.py index c63468e2f0..91ffd70070 100644 --- a/selling/doctype/lead/get_leads.py +++ b/selling/doctype/lead/get_leads.py @@ -12,6 +12,9 @@ def add_sales_communication(subject, content, sender, real_name, mail=None, lead_name = webnotes.conn.get_value("Lead", {"email_id": sender}) contact_name = webnotes.conn.get_value("Contact", {"email_id": sender}) + parent_doctype = "Contact" if contact_name else "Lead" + parent_name = contact_name or lead_name + if not (lead_name or contact_name): # none, create a new Lead lead = webnotes.bean({ @@ -26,11 +29,11 @@ def add_sales_communication(subject, content, sender, real_name, mail=None, lead_name = lead.doc.name message = make(content=content, sender=sender, subject=subject, - lead=lead_name, contact=contact_name, date=date) + doctype = parent_doctype, name = parent_name, date=date) if mail: # save attachments to parent if from mail - bean = webnotes.bean("Contact" if contact_name else "Lead", contact_name or lead_name) + bean = webnotes.bean(parent_doctype, parent_name) mail.save_attachments_in_doc(bean.doc) class SalesMailbox(POP3Mailbox): diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 2bf1aa3845..063c5f0d09 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -24,7 +24,6 @@ class DocType(SellingController): }) def onload(self): - self.add_communication_list() customer = webnotes.conn.get_value("Customer", {"lead_name": self.doc.name}) if customer: self.doc.fields["__is_customer"] = customer diff --git a/selling/doctype/lead/lead.txt b/selling/doctype/lead/lead.txt index d66c6a0269..156b61ec7b 100644 --- a/selling/doctype/lead/lead.txt +++ b/selling/doctype/lead/lead.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-10 11:45:37", "docstatus": 0, - "modified": "2013-08-08 14:22:14", + "modified": "2013-09-02 16:16:14", "modified_by": "Administrator", "owner": "Administrator" }, @@ -410,6 +410,14 @@ "fieldtype": "Check", "label": "Blog Subscriber" }, + { + "doctype": "DocField", + "fieldname": "communcations", + "fieldtype": "Table", + "hidden": 1, + "label": "Communcations", + "options": "Communication" + }, { "cancel": 1, "doctype": "DocPerm", diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py index 906e5470b0..a3ef1976d9 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -25,9 +25,6 @@ class DocType(TransactionBase): "contact_by": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_by") if \ (not cint(self.doc.fields.get("__islocal"))) else None, }) - - def onload(self): - self.add_communication_list() def get_item_details(self, item_code): item = sql("""select item_name, stock_uom, description_html, description, item_group, brand diff --git a/selling/doctype/opportunity/opportunity.txt b/selling/doctype/opportunity/opportunity.txt index 5b1d93f962..4ca1564c7d 100644 --- a/selling/doctype/opportunity/opportunity.txt +++ b/selling/doctype/opportunity/opportunity.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 18:50:30", "docstatus": 0, - "modified": "2013-08-08 14:22:15", + "modified": "2013-09-02 16:27:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -442,6 +442,14 @@ "read_only": 1, "width": "150px" }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication" + }, { "doctype": "DocPerm", "role": "Sales User" diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index b6ff1d7fd9..c1b529ca69 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -20,9 +20,6 @@ class DocType(SellingController): self.doclist = doclist self.tname = 'Quotation Item' self.fname = 'quotation_details' - - def onload(self): - self.add_communication_list() # Get contact person details based on customer selected # ------------------------------------------------------ diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt index c3b24347ff..9d47259d80 100644 --- a/selling/doctype/quotation/quotation.txt +++ b/selling/doctype/quotation/quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:08", "docstatus": 0, - "modified": "2013-08-09 14:46:11", + "modified": "2013-09-02 16:25:01", "modified_by": "Administrator", "owner": "Administrator" }, @@ -835,6 +835,14 @@ "read_only": 0, "width": "40px" }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication" + }, { "amend": 1, "cancel": 1, diff --git a/setup/doctype/sales_person/sales_person.txt b/setup/doctype/sales_person/sales_person.txt index 77ba6afd4e..d78b5c8d27 100644 --- a/setup/doctype/sales_person/sales_person.txt +++ b/setup/doctype/sales_person/sales_person.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-08-05 18:11:22", + "modified": "2013-09-02 16:26:54", "modified_by": "Administrator", "owner": "Administrator" }, @@ -160,6 +160,14 @@ "options": "Budget Distribution", "search_index": 0 }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication" + }, { "cancel": 0, "create": 0, diff --git a/support/doctype/support_ticket/get_support_mails.py b/support/doctype/support_ticket/get_support_mails.py index 7e09846dda..fb26e570d7 100644 --- a/support/doctype/support_ticket/get_support_mails.py +++ b/support/doctype/support_ticket/get_support_mails.py @@ -46,7 +46,7 @@ class SupportMailbox(POP3Mailbox): make(content=mail.content, sender=mail.from_email, subject = ticket.doc.subject, doctype="Support Ticket", name=ticket.doc.name, - lead = ticket.doc.lead, contact=ticket.doc.contact, date=mail.date) + date=mail.date) if new_ticket and cint(self.email_settings.send_autoreply) and \ "mailer-daemon" not in mail.from_email.lower(): diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index 2b8fe85c98..8e723ee3c1 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -11,9 +11,6 @@ class DocType(TransactionBase): def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist - - def onload(self): - self.add_communication_list() def get_sender(self, comm): return webnotes.conn.get_value('Email Settings',None,'support_email') @@ -53,7 +50,7 @@ class DocType(TransactionBase): if not self.doc.company: self.doc.company = webnotes.conn.get_value("Lead", self.doc.lead, "company") or \ webnotes.conn.get_default("company") - + def on_trash(self): webnotes.conn.sql("""update `tabCommunication` set support_ticket=NULL where support_ticket=%s""", (self.doc.name,)) diff --git a/support/doctype/support_ticket/support_ticket.txt b/support/doctype/support_ticket/support_ticket.txt index dcb45204fd..01d0e35388 100644 --- a/support/doctype/support_ticket/support_ticket.txt +++ b/support/doctype/support_ticket/support_ticket.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-01 10:36:25", "docstatus": 0, - "modified": "2013-08-28 18:29:06", + "modified": "2013-09-02 16:24:24", "modified_by": "Administrator", "owner": "Administrator" }, @@ -261,6 +261,14 @@ "hidden": 1, "label": "Content Type" }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication" + }, { "cancel": 0, "doctype": "DocPerm", diff --git a/utilities/doctype/contact/contact.py b/utilities/doctype/contact/contact.py index 961bb52153..9997cabea5 100644 --- a/utilities/doctype/contact/contact.py +++ b/utilities/doctype/contact/contact.py @@ -12,9 +12,6 @@ class DocType(TransactionBase): self.doc = doc self.doclist = doclist - def onload(self): - self.add_communication_list() - def on_communication_sent(self, comm): webnotes.conn.set(self.doc, 'status', 'Replied') diff --git a/utilities/doctype/contact/contact.txt b/utilities/doctype/contact/contact.txt index 63d02521db..d3c7d889fd 100644 --- a/utilities/doctype/contact/contact.txt +++ b/utilities/doctype/contact/contact.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:32", "docstatus": 0, - "modified": "2013-07-05 14:32:19", + "modified": "2013-09-02 16:26:13", "modified_by": "Administrator", "owner": "Administrator" }, @@ -225,6 +225,14 @@ "oldfieldtype": "Small Text", "read_only": 1 }, + { + "doctype": "DocField", + "fieldname": "communications", + "fieldtype": "Table", + "hidden": 1, + "label": "Communications", + "options": "Communication" + }, { "cancel": 1, "doctype": "DocPerm", diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index aace0cb78e..22bc531851 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -229,20 +229,7 @@ class TransactionBase(StatusUpdater): if int(webnotes.conn.get_value("Notification Control", None, dt) or 0): self.doc.fields["__notification_message"] = \ webnotes.conn.get_value("Notification Control", None, dt + "_message") - - def add_communication_list(self): - # remove communications if present - self.doclist = webnotes.doclist(self.doclist).get({ - "doctype": ["!=", "Communcation"]}) - - comm_list = webnotes.conn.sql("""select * from tabCommunication - where %s=%s order by modified desc limit 20""" \ - % (self.doc.doctype.replace(" ", "_").lower(), "%s"), - self.doc.name, as_dict=1, update={"doctype":"Communication"}) - - self.doclist.extend(webnotes.doclist([webnotes.doc(fielddata=d) \ - for d in comm_list])) - + def validate_posting_time(self): if not self.doc.posting_time: self.doc.posting_time = now_datetime().strftime('%H:%M:%S') From 0b8254e69b9ce90391b56f774c3fa8a6f1c10ccf Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Sep 2013 17:17:48 +0530 Subject: [PATCH 13/27] [fix] [minor] recreate gl entries when using auto inventory accounting to fix bug introduced due to commit - 5dd6b1d082d180133813c1c661d5e72076a19491 --- .../september_2013/p01_fix_buying_amount_gl_entries.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/patches/september_2013/p01_fix_buying_amount_gl_entries.py index 011180a58a..369a2914f1 100644 --- a/patches/september_2013/p01_fix_buying_amount_gl_entries.py +++ b/patches/september_2013/p01_fix_buying_amount_gl_entries.py @@ -25,6 +25,9 @@ def recreate_gl_entries(doctype, name, parentfield): bean = webnotes.bean(doctype, name) bean.run_method("set_buying_amount") + company_values = webnotes.conn.get_value("Company", bean.doc.company, ["default_expense_account", + "stock_adjustment_account", "cost_center", "stock_adjustment_cost_center"]) + # update missing expense account and cost center for item in bean.doclist.get({"parentfield": parentfield}): if item.buying_amount and not validate_item_values(item, bean.doc.company): @@ -38,9 +41,12 @@ def recreate_gl_entries(doctype, name, parentfield): if res: item.expense_account = res[0][0] item.cost_center = res[0][1] + elif company_values: + item.expense_account = company_values[0] or company_values[1] + item.cost_center = company_values[2] or company_values[3] - webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) - webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) + webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account) + webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center) # remove gl entries webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s From 8f04d119bbc4698db6e7f55e15334a57d282b2c8 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 17:39:59 +0530 Subject: [PATCH 14/27] [communication] [minor --- patches/patch_list.py | 1 + patches/september_2013/__init__.py | 0 patches/september_2013/p01_update_communication.py | 10 ++++++++++ selling/doctype/lead/lead.txt | 6 +++--- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 patches/september_2013/__init__.py create mode 100644 patches/september_2013/p01_update_communication.py diff --git a/patches/patch_list.py b/patches/patch_list.py index 1d382a56bd..b515339b49 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -257,4 +257,5 @@ patch_list = [ "execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-08-16", "patches.august_2013.p06_fix_sle_against_stock_entry", "execute:webnotes.bean('Style Settings').save() #2013-08-20", + "patches.september_2013.p01_update_communication" ] \ No newline at end of file diff --git a/patches/september_2013/__init__.py b/patches/september_2013/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/patches/september_2013/p01_update_communication.py b/patches/september_2013/p01_update_communication.py new file mode 100644 index 0000000000..c3bd61b402 --- /dev/null +++ b/patches/september_2013/p01_update_communication.py @@ -0,0 +1,10 @@ +import webnotes + +def execute(): + for doctype in ("Contact", "Lead", "Job Applicant", "Supplier", "Customer", "Quotation", "Sales Person", "Support Ticket"): + fieldname = doctype.replace(" ", '_').lower() + webnotes.conn.sql("""update tabCommunication + set parenttype=%s, parentfield='communications', + parent=`%s` + where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype) + \ No newline at end of file diff --git a/selling/doctype/lead/lead.txt b/selling/doctype/lead/lead.txt index 156b61ec7b..9402259ac7 100644 --- a/selling/doctype/lead/lead.txt +++ b/selling/doctype/lead/lead.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-10 11:45:37", "docstatus": 0, - "modified": "2013-09-02 16:16:14", + "modified": "2013-09-02 17:25:59", "modified_by": "Administrator", "owner": "Administrator" }, @@ -412,10 +412,10 @@ }, { "doctype": "DocField", - "fieldname": "communcations", + "fieldname": "communications", "fieldtype": "Table", "hidden": 1, - "label": "Communcations", + "label": "Communications", "options": "Communication" }, { From 2e131e26d42ddb8623643e474f460f9c521d112d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 2 Sep 2013 18:07:53 +0530 Subject: [PATCH 15/27] [fix] [minor] Taxes and charges added/deducted only if category in "Valuation and Total" or "Total" --- buying/doctype/purchase_common/purchase_common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 67ba33c245..5785b1a9d5 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -333,10 +333,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ // other charges added/deducted if(tax_count) { this.frm.doc.other_charges_added = wn.utils.sum($.map(this.frm.tax_doclist, - function(tax) { return tax.add_deduct_tax == "Add" ? tax.tax_amount : 0.0; })); + function(tax) { return (tax.add_deduct_tax == "Add" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; })); this.frm.doc.other_charges_deducted = wn.utils.sum($.map(this.frm.tax_doclist, - function(tax) { return tax.add_deduct_tax == "Deduct" ? tax.tax_amount : 0.0; })); + function(tax) { return (tax.add_deduct_tax == "Deduct" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; })); wn.model.round_floats_in(this.frm.doc, ["other_charges_added", "other_charges_deducted"]); From a2d0da8840ceda8aaefdcc0a838e91ebdd8d6e80 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 18:27:29 +0530 Subject: [PATCH 16/27] [communication] [minor] --- hr/doctype/job_applicant/job_applicant.js | 2 +- .../p01_update_communication.py | 5 ++ selling/doctype/lead/lead.js | 85 ++++++++++++++++++- .../doctype/support_ticket/support_ticket.js | 10 +-- 4 files changed, 93 insertions(+), 9 deletions(-) diff --git a/hr/doctype/job_applicant/job_applicant.js b/hr/doctype/job_applicant/job_applicant.js index 9aff605764..f82da11f07 100644 --- a/hr/doctype/job_applicant/job_applicant.js +++ b/hr/doctype/job_applicant/job_applicant.js @@ -16,7 +16,7 @@ cur_frm.cscript = { }, make_listing: function(doc) { cur_frm.communication_view = new wn.views.CommunicationList({ - list: wn.model.get("Communication", {"job_applicant": doc.name}), + list: wn.model.get("Communication", {"parent": doc.name, "parenttype": "Job Applicant"}), parent: cur_frm.fields_dict['thread_html'].wrapper, doc: doc, recipients: doc.email_id diff --git a/patches/september_2013/p01_update_communication.py b/patches/september_2013/p01_update_communication.py index c3bd61b402..d840c801f9 100644 --- a/patches/september_2013/p01_update_communication.py +++ b/patches/september_2013/p01_update_communication.py @@ -7,4 +7,9 @@ def execute(): set parenttype=%s, parentfield='communications', parent=`%s` where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype) + + webnotes.reload_doc("core", "doctype", "communication") + + webnotes.conn.sql("""update tabCommunication set communication_date = creation where + ifnull(communication_date, '')='' """) \ No newline at end of file diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 4088739388..3bc357c474 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -36,7 +36,90 @@ erpnext.LeadController = wn.ui.form.Controller.extend({ this.frm.dashboard.reset(doc); if(!doc.__islocal) { - if(doc.status=="Converted") { + if(doc.status=="Converted") {// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +// License: GNU General Public License v3. See license.txt + +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.customer_query" } } + +wn.provide("erpnext.support"); +// TODO commonify this code +erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({ + customer: function() { + var me = this; + if(this.frm.doc.customer) { + return this.frm.call({ + doc: this.frm.doc, + method: "set_customer_defaults", + }); + } + } +}); + +$.extend(cur_frm.cscript, new erpnext.support.CustomerIssue({frm: cur_frm})); + +$.extend(cur_frm.cscript, { + onload: function(doc, dt, dn) { + if(in_list(user_roles,'System Manager')) { + cur_frm.footer.help_area.innerHTML = '

    Email Settings
    \ + Integrate incoming support emails to Support Ticket

    '; + } + }, + + refresh: function(doc) { + erpnext.hide_naming_series(); + cur_frm.cscript.make_listing(doc); + if(!doc.__islocal) { + if(cur_frm.fields_dict.status.get_status()=="Write") { + if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']); + if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']); + } + + cur_frm.toggle_enable(["subject", "raised_by"], false); + cur_frm.toggle_display("description", false); + } + refresh_field('status'); + }, + + make_listing: function(doc) { + var wrapper = cur_frm.fields_dict['thread_html'].wrapper; + + var comm_list = wn.model.get("Communication", {"parent": doc.name, "parenttype":"Lead"}) + + cur_frm.communication_view = new wn.views.CommunicationList({ + list: comm_list, + parent: wrapper, + doc: doc, + recipients: doc.raised_by + }) + + }, + + 'Close Ticket': function() { + cur_frm.cscript.set_status("Closed"); + }, + + 'Re-Open Ticket': function() { + cur_frm.cscript.set_status("Open"); + }, + + set_status: function(status) { + return wn.call({ + method:"support.doctype.support_ticket.support_ticket.set_status", + args: { + name: cur_frm.doc.name, + status: status + }, + callback: function(r) { + if(!r.exc) cur_frm.reload_doc(); + } + }) + + } + +}) + + this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign"); } else { this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign"); diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index 2c1f3322f3..78c3ce5bb8 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -46,16 +46,12 @@ $.extend(cur_frm.cscript, { make_listing: function(doc) { var wrapper = cur_frm.fields_dict['thread_html'].wrapper; - var comm_list = wn.model.get("Communication", {"support_ticket": doc.name}) - - var sortfn = function (a, b) { return (b.creation > a.creation) ? 1 : -1; } - comm_list = comm_list.sort(sortfn); + var comm_list = wn.model.get("Communication", {"parent": doc.name, "parenttype":"Support Ticket"}) - if(!comm_list.length || (comm_list[comm_list.length - 1].sender != doc.raised_by)) { + if(!comm_list.length) { comm_list.push({ "sender": doc.raised_by, - "creation": doc.creation, - "modified": doc.creation, + "communication_date": doc.creation, "content": doc.description}); } From 81284b73ef73a456dd7e7331e231c14a59f9195d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 18:37:28 +0530 Subject: [PATCH 17/27] [communication] [minor] --- support/doctype/support_ticket/support_ticket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index 78c3ce5bb8..0e61273439 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -51,7 +51,7 @@ $.extend(cur_frm.cscript, { if(!comm_list.length) { comm_list.push({ "sender": doc.raised_by, - "communication_date": doc.creation, + "creation": doc.creation, "content": doc.description}); } From 57e47cd93d07a879b94dfd6e9dad812f64bbcc2c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 18:45:11 +0530 Subject: [PATCH 18/27] [communication] [minor] --- selling/doctype/lead/get_leads.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selling/doctype/lead/get_leads.py b/selling/doctype/lead/get_leads.py index 91ffd70070..3305a3b9f6 100644 --- a/selling/doctype/lead/get_leads.py +++ b/selling/doctype/lead/get_leads.py @@ -12,9 +12,6 @@ def add_sales_communication(subject, content, sender, real_name, mail=None, lead_name = webnotes.conn.get_value("Lead", {"email_id": sender}) contact_name = webnotes.conn.get_value("Contact", {"email_id": sender}) - parent_doctype = "Contact" if contact_name else "Lead" - parent_name = contact_name or lead_name - if not (lead_name or contact_name): # none, create a new Lead lead = webnotes.bean({ @@ -28,6 +25,9 @@ def add_sales_communication(subject, content, sender, real_name, mail=None, lead.insert() lead_name = lead.doc.name + parent_doctype = "Contact" if contact_name else "Lead" + parent_name = contact_name or lead_name + message = make(content=content, sender=sender, subject=subject, doctype = parent_doctype, name = parent_name, date=date) From 0f2b684a453d7a7ce08a31aca1b7f2b268f5e68a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 18:47:34 +0530 Subject: [PATCH 19/27] [communication] [minor] --- selling/doctype/lead/lead.js | 85 +----------------------------------- 1 file changed, 1 insertion(+), 84 deletions(-) diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 3bc357c474..4088739388 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -36,90 +36,7 @@ erpnext.LeadController = wn.ui.form.Controller.extend({ this.frm.dashboard.reset(doc); if(!doc.__islocal) { - if(doc.status=="Converted") {// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -// License: GNU General Public License v3. See license.txt - -cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { - return{ query:"controllers.queries.customer_query" } } - -wn.provide("erpnext.support"); -// TODO commonify this code -erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({ - customer: function() { - var me = this; - if(this.frm.doc.customer) { - return this.frm.call({ - doc: this.frm.doc, - method: "set_customer_defaults", - }); - } - } -}); - -$.extend(cur_frm.cscript, new erpnext.support.CustomerIssue({frm: cur_frm})); - -$.extend(cur_frm.cscript, { - onload: function(doc, dt, dn) { - if(in_list(user_roles,'System Manager')) { - cur_frm.footer.help_area.innerHTML = '

    Email Settings
    \ - Integrate incoming support emails to Support Ticket

    '; - } - }, - - refresh: function(doc) { - erpnext.hide_naming_series(); - cur_frm.cscript.make_listing(doc); - if(!doc.__islocal) { - if(cur_frm.fields_dict.status.get_status()=="Write") { - if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']); - if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']); - } - - cur_frm.toggle_enable(["subject", "raised_by"], false); - cur_frm.toggle_display("description", false); - } - refresh_field('status'); - }, - - make_listing: function(doc) { - var wrapper = cur_frm.fields_dict['thread_html'].wrapper; - - var comm_list = wn.model.get("Communication", {"parent": doc.name, "parenttype":"Lead"}) - - cur_frm.communication_view = new wn.views.CommunicationList({ - list: comm_list, - parent: wrapper, - doc: doc, - recipients: doc.raised_by - }) - - }, - - 'Close Ticket': function() { - cur_frm.cscript.set_status("Closed"); - }, - - 'Re-Open Ticket': function() { - cur_frm.cscript.set_status("Open"); - }, - - set_status: function(status) { - return wn.call({ - method:"support.doctype.support_ticket.support_ticket.set_status", - args: { - name: cur_frm.doc.name, - status: status - }, - callback: function(r) { - if(!r.exc) cur_frm.reload_doc(); - } - }) - - } - -}) - - + if(doc.status=="Converted") { this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign"); } else { this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign"); From 98429afe91214cd17dae463f17c74582d941b331 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Sep 2013 18:52:27 +0530 Subject: [PATCH 20/27] [communication] [minor] --- selling/doctype/lead/lead.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 4088739388..9a86b22d63 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -51,7 +51,7 @@ erpnext.LeadController = wn.ui.form.Controller.extend({ } cur_frm.communication_view = new wn.views.CommunicationList({ - list: wn.model.get("Communication", {"lead": this.frm.doc.name}), + list: wn.model.get("Communication", {"parenttype": "Lead", "parent":this.frm.doc.name}), parent: this.frm.fields_dict.communication_html.wrapper, doc: this.frm.doc, recipients: this.frm.doc.email_id From d2b87268c9341536bd4b21a413f91ffa74eecffe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 2 Sep 2013 20:12:53 +0530 Subject: [PATCH 21/27] [fix] [minor] in fetching pos settings --- utilities/transaction_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 22bc531851..ea807c248e 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -87,7 +87,7 @@ class TransactionBase(StatusUpdater): if self.meta.get_field(fieldname): self.doc.fields[fieldname] = val - if self.meta.get_field("sales_team"): + if self.meta.get_field("sales_team") and self.doc.customer: self.set_sales_team_for_customer() def set_sales_team_for_customer(self): From b15e5de78eed4dfcda653683ef5b0930247a2e90 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 3 Sep 2013 10:19:10 +0530 Subject: [PATCH 22/27] [docs] moved into folders --- docs/{ => dev}/docs.dev.api.md | 0 docs/dev/docs.dev.client_script.md | 10 ++++++++++ docs/{ => dev}/docs.dev.docs.md | 0 docs/{ => dev}/docs.dev.install.md | 0 docs/{ => dev}/docs.dev.install.restore_from_backup.md | 0 docs/{ => dev}/docs.dev.md | 3 ++- docs/{ => dev}/docs.dev.modules.md | 0 docs/{ => dev}/docs.dev.translate.md | 0 docs/{ => user/accounts}/docs.user.accounts.closing.md | 0 .../accounts}/docs.user.accounts.journal_voucher.md | 0 docs/{ => user/accounts}/docs.user.accounts.md | 0 .../{ => user/accounts}/docs.user.accounts.payments.md | 0 docs/{ => user/accounts}/docs.user.accounts.pos.md | 0 .../accounts}/docs.user.accounts.purchase_invoice.md | 0 docs/{ => user/accounts}/docs.user.accounts.reports.md | 0 docs/{ => user/accounts}/docs.user.accounts.returns.md | 0 .../accounts}/docs.user.accounts.sales_invoice.md | 0 .../buying}/docs.user.buying.material_request.md | 0 docs/{ => user/buying}/docs.user.buying.md | 0 .../buying}/docs.user.buying.purchase_order.md | 0 docs/{ => user/buying}/docs.user.buying.supplier.md | 0 .../buying}/docs.user.buying.supplier_quotation.md | 0 .../customize}/docs.user.customize.custom_field.md | 0 .../customize}/docs.user.customize.custom_form.md | 0 docs/{ => user/customize}/docs.user.customize.md | 0 .../customize}/docs.user.customize.modules.md | 0 .../customize}/docs.user.customize.print_format.md | 0 docs/{ => user}/docs.user.help.md | 0 docs/{ => user}/docs.user.md | 0 docs/{ => user}/docs.user.projects.md | 0 docs/{ => user}/docs.user.reports.builder.md | 0 docs/{ => user}/docs.user.reports.md | 0 docs/{ => user/hr}/docs.user.hr.appraisal.md | 0 docs/{ => user/hr}/docs.user.hr.employee.md | 0 docs/{ => user/hr}/docs.user.hr.expense_claim.md | 0 docs/{ => user/hr}/docs.user.hr.leave.md | 0 docs/{ => user/hr}/docs.user.hr.md | 0 docs/{ => user/hr}/docs.user.hr.payroll.md | 0 docs/{ => user/hr}/docs.user.hr.setup.md | 0 docs/{ => user/intro}/docs.user.implement.concepts.md | 0 docs/{ => user/intro}/docs.user.implement.md | 0 docs/{ => user/intro}/docs.user.implement.strategy.md | 0 docs/{ => user/intro}/docs.user.intro.md | 0 docs/{ => user/intro}/docs.user.intro.open_source.md | 0 docs/{ => user/intro}/docs.user.intro.try.md | 0 docs/{ => user/mfg}/docs.user.mfg.bom.md | 0 docs/{ => user/mfg}/docs.user.mfg.md | 0 docs/{ => user/mfg}/docs.user.mfg.planning.md | 0 docs/{ => user/mfg}/docs.user.mfg.production_order.md | 0 docs/{ => user/selling}/docs.user.selling.customer.md | 0 docs/{ => user/selling}/docs.user.selling.lead.md | 0 docs/{ => user/selling}/docs.user.selling.md | 0 .../selling}/docs.user.selling.opportunity.md | 0 docs/{ => user/selling}/docs.user.selling.quotation.md | 0 .../selling}/docs.user.selling.sales_order.md | 0 docs/{ => user/setup}/docs.user.setup.accounting.md | 0 docs/{ => user/setup}/docs.user.setup.codification.md | 0 docs/{ => user/setup}/docs.user.setup.cost_centers.md | 0 docs/{ => user/setup}/docs.user.setup.data_import.md | 0 docs/{ => user/setup}/docs.user.setup.email.md | 0 docs/{ => user/setup}/docs.user.setup.first.md | 0 docs/{ => user/setup}/docs.user.setup.letter_head.md | 0 docs/{ => user/setup}/docs.user.setup.masters.md | 0 docs/{ => user/setup}/docs.user.setup.md | 0 docs/{ => user/setup}/docs.user.setup.opening.md | 0 docs/{ => user/setup}/docs.user.setup.permissions.md | 0 docs/{ => user/setup}/docs.user.setup.price_list.md | 0 docs/{ => user/setup}/docs.user.setup.series.md | 0 docs/{ => user/setup}/docs.user.setup.taxes.md | 0 docs/{ => user/stock}/docs.user.stock.delivery_note.md | 0 docs/{ => user/stock}/docs.user.stock.item.md | 0 docs/{ => user/stock}/docs.user.stock.md | 0 .../stock}/docs.user.stock.purchase_receipt.md | 0 docs/{ => user/stock}/docs.user.stock.serialized.md | 0 docs/{ => user/stock}/docs.user.stock.stock_entry.md | 0 .../stock}/docs.user.stock.sub_contracting.md | 0 docs/{ => user/stock}/docs.user.stock.valuation.md | 0 .../support}/docs.user.support.customer_issue.md | 0 .../support}/docs.user.support.maintenance_schedule.md | 0 .../support}/docs.user.support.maintenance_visit.md | 0 docs/{ => user/support}/docs.user.support.md | 0 .../support}/docs.user.support.support_ticket.md | 0 docs/{ => user/tools}/docs.user.tools.calendar.md | 0 docs/{ => user/tools}/docs.user.tools.form_tools.md | 0 docs/{ => user/tools}/docs.user.tools.md | 0 docs/{ => user/tools}/docs.user.tools.messages.md | 0 docs/{ => user/tools}/docs.user.tools.notes.md | 0 docs/{ => user/tools}/docs.user.tools.todo.md | 0 docs/{ => user/website}/docs.user.website.blog.md | 0 docs/{ => user/website}/docs.user.website.md | 0 docs/{ => user/website}/docs.user.website.setup.md | 0 docs/{ => user/website}/docs.user.website.style.md | 0 docs/{ => user/website}/docs.user.website.web_page.md | 0 93 files changed, 12 insertions(+), 1 deletion(-) rename docs/{ => dev}/docs.dev.api.md (100%) create mode 100644 docs/dev/docs.dev.client_script.md rename docs/{ => dev}/docs.dev.docs.md (100%) rename docs/{ => dev}/docs.dev.install.md (100%) rename docs/{ => dev}/docs.dev.install.restore_from_backup.md (100%) rename docs/{ => dev}/docs.dev.md (96%) rename docs/{ => dev}/docs.dev.modules.md (100%) rename docs/{ => dev}/docs.dev.translate.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.closing.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.journal_voucher.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.payments.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.pos.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.purchase_invoice.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.reports.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.returns.md (100%) rename docs/{ => user/accounts}/docs.user.accounts.sales_invoice.md (100%) rename docs/{ => user/buying}/docs.user.buying.material_request.md (100%) rename docs/{ => user/buying}/docs.user.buying.md (100%) rename docs/{ => user/buying}/docs.user.buying.purchase_order.md (100%) rename docs/{ => user/buying}/docs.user.buying.supplier.md (100%) rename docs/{ => user/buying}/docs.user.buying.supplier_quotation.md (100%) rename docs/{ => user/customize}/docs.user.customize.custom_field.md (100%) rename docs/{ => user/customize}/docs.user.customize.custom_form.md (100%) rename docs/{ => user/customize}/docs.user.customize.md (100%) rename docs/{ => user/customize}/docs.user.customize.modules.md (100%) rename docs/{ => user/customize}/docs.user.customize.print_format.md (100%) rename docs/{ => user}/docs.user.help.md (100%) rename docs/{ => user}/docs.user.md (100%) rename docs/{ => user}/docs.user.projects.md (100%) rename docs/{ => user}/docs.user.reports.builder.md (100%) rename docs/{ => user}/docs.user.reports.md (100%) rename docs/{ => user/hr}/docs.user.hr.appraisal.md (100%) rename docs/{ => user/hr}/docs.user.hr.employee.md (100%) rename docs/{ => user/hr}/docs.user.hr.expense_claim.md (100%) rename docs/{ => user/hr}/docs.user.hr.leave.md (100%) rename docs/{ => user/hr}/docs.user.hr.md (100%) rename docs/{ => user/hr}/docs.user.hr.payroll.md (100%) rename docs/{ => user/hr}/docs.user.hr.setup.md (100%) rename docs/{ => user/intro}/docs.user.implement.concepts.md (100%) rename docs/{ => user/intro}/docs.user.implement.md (100%) rename docs/{ => user/intro}/docs.user.implement.strategy.md (100%) rename docs/{ => user/intro}/docs.user.intro.md (100%) rename docs/{ => user/intro}/docs.user.intro.open_source.md (100%) rename docs/{ => user/intro}/docs.user.intro.try.md (100%) rename docs/{ => user/mfg}/docs.user.mfg.bom.md (100%) rename docs/{ => user/mfg}/docs.user.mfg.md (100%) rename docs/{ => user/mfg}/docs.user.mfg.planning.md (100%) rename docs/{ => user/mfg}/docs.user.mfg.production_order.md (100%) rename docs/{ => user/selling}/docs.user.selling.customer.md (100%) rename docs/{ => user/selling}/docs.user.selling.lead.md (100%) rename docs/{ => user/selling}/docs.user.selling.md (100%) rename docs/{ => user/selling}/docs.user.selling.opportunity.md (100%) rename docs/{ => user/selling}/docs.user.selling.quotation.md (100%) rename docs/{ => user/selling}/docs.user.selling.sales_order.md (100%) rename docs/{ => user/setup}/docs.user.setup.accounting.md (100%) rename docs/{ => user/setup}/docs.user.setup.codification.md (100%) rename docs/{ => user/setup}/docs.user.setup.cost_centers.md (100%) rename docs/{ => user/setup}/docs.user.setup.data_import.md (100%) rename docs/{ => user/setup}/docs.user.setup.email.md (100%) rename docs/{ => user/setup}/docs.user.setup.first.md (100%) rename docs/{ => user/setup}/docs.user.setup.letter_head.md (100%) rename docs/{ => user/setup}/docs.user.setup.masters.md (100%) rename docs/{ => user/setup}/docs.user.setup.md (100%) rename docs/{ => user/setup}/docs.user.setup.opening.md (100%) rename docs/{ => user/setup}/docs.user.setup.permissions.md (100%) rename docs/{ => user/setup}/docs.user.setup.price_list.md (100%) rename docs/{ => user/setup}/docs.user.setup.series.md (100%) rename docs/{ => user/setup}/docs.user.setup.taxes.md (100%) rename docs/{ => user/stock}/docs.user.stock.delivery_note.md (100%) rename docs/{ => user/stock}/docs.user.stock.item.md (100%) rename docs/{ => user/stock}/docs.user.stock.md (100%) rename docs/{ => user/stock}/docs.user.stock.purchase_receipt.md (100%) rename docs/{ => user/stock}/docs.user.stock.serialized.md (100%) rename docs/{ => user/stock}/docs.user.stock.stock_entry.md (100%) rename docs/{ => user/stock}/docs.user.stock.sub_contracting.md (100%) rename docs/{ => user/stock}/docs.user.stock.valuation.md (100%) rename docs/{ => user/support}/docs.user.support.customer_issue.md (100%) rename docs/{ => user/support}/docs.user.support.maintenance_schedule.md (100%) rename docs/{ => user/support}/docs.user.support.maintenance_visit.md (100%) rename docs/{ => user/support}/docs.user.support.md (100%) rename docs/{ => user/support}/docs.user.support.support_ticket.md (100%) rename docs/{ => user/tools}/docs.user.tools.calendar.md (100%) rename docs/{ => user/tools}/docs.user.tools.form_tools.md (100%) rename docs/{ => user/tools}/docs.user.tools.md (100%) rename docs/{ => user/tools}/docs.user.tools.messages.md (100%) rename docs/{ => user/tools}/docs.user.tools.notes.md (100%) rename docs/{ => user/tools}/docs.user.tools.todo.md (100%) rename docs/{ => user/website}/docs.user.website.blog.md (100%) rename docs/{ => user/website}/docs.user.website.md (100%) rename docs/{ => user/website}/docs.user.website.setup.md (100%) rename docs/{ => user/website}/docs.user.website.style.md (100%) rename docs/{ => user/website}/docs.user.website.web_page.md (100%) diff --git a/docs/docs.dev.api.md b/docs/dev/docs.dev.api.md similarity index 100% rename from docs/docs.dev.api.md rename to docs/dev/docs.dev.api.md diff --git a/docs/dev/docs.dev.client_script.md b/docs/dev/docs.dev.client_script.md new file mode 100644 index 0000000000..fc82f9d5ff --- /dev/null +++ b/docs/dev/docs.dev.client_script.md @@ -0,0 +1,10 @@ +--- +{ + "_label": "Client Scripts: Custoimzing ERPNext" + +} +--- + + + + diff --git a/docs/docs.dev.docs.md b/docs/dev/docs.dev.docs.md similarity index 100% rename from docs/docs.dev.docs.md rename to docs/dev/docs.dev.docs.md diff --git a/docs/docs.dev.install.md b/docs/dev/docs.dev.install.md similarity index 100% rename from docs/docs.dev.install.md rename to docs/dev/docs.dev.install.md diff --git a/docs/docs.dev.install.restore_from_backup.md b/docs/dev/docs.dev.install.restore_from_backup.md similarity index 100% rename from docs/docs.dev.install.restore_from_backup.md rename to docs/dev/docs.dev.install.restore_from_backup.md diff --git a/docs/docs.dev.md b/docs/dev/docs.dev.md similarity index 96% rename from docs/docs.dev.md rename to docs/dev/docs.dev.md index 3f645d84fe..285f1767c7 100644 --- a/docs/docs.dev.md +++ b/docs/dev/docs.dev.md @@ -5,8 +5,9 @@ "docs.dev.install", "docs.dev.quickstart", "docs.dev.framework", - "docs.dev.api", "docs.dev.modules", + "docs.dev.client_script", + "docs.dev.api", "docs.dev.translate", "docs.dev.docs" ] diff --git a/docs/docs.dev.modules.md b/docs/dev/docs.dev.modules.md similarity index 100% rename from docs/docs.dev.modules.md rename to docs/dev/docs.dev.modules.md diff --git a/docs/docs.dev.translate.md b/docs/dev/docs.dev.translate.md similarity index 100% rename from docs/docs.dev.translate.md rename to docs/dev/docs.dev.translate.md diff --git a/docs/docs.user.accounts.closing.md b/docs/user/accounts/docs.user.accounts.closing.md similarity index 100% rename from docs/docs.user.accounts.closing.md rename to docs/user/accounts/docs.user.accounts.closing.md diff --git a/docs/docs.user.accounts.journal_voucher.md b/docs/user/accounts/docs.user.accounts.journal_voucher.md similarity index 100% rename from docs/docs.user.accounts.journal_voucher.md rename to docs/user/accounts/docs.user.accounts.journal_voucher.md diff --git a/docs/docs.user.accounts.md b/docs/user/accounts/docs.user.accounts.md similarity index 100% rename from docs/docs.user.accounts.md rename to docs/user/accounts/docs.user.accounts.md diff --git a/docs/docs.user.accounts.payments.md b/docs/user/accounts/docs.user.accounts.payments.md similarity index 100% rename from docs/docs.user.accounts.payments.md rename to docs/user/accounts/docs.user.accounts.payments.md diff --git a/docs/docs.user.accounts.pos.md b/docs/user/accounts/docs.user.accounts.pos.md similarity index 100% rename from docs/docs.user.accounts.pos.md rename to docs/user/accounts/docs.user.accounts.pos.md diff --git a/docs/docs.user.accounts.purchase_invoice.md b/docs/user/accounts/docs.user.accounts.purchase_invoice.md similarity index 100% rename from docs/docs.user.accounts.purchase_invoice.md rename to docs/user/accounts/docs.user.accounts.purchase_invoice.md diff --git a/docs/docs.user.accounts.reports.md b/docs/user/accounts/docs.user.accounts.reports.md similarity index 100% rename from docs/docs.user.accounts.reports.md rename to docs/user/accounts/docs.user.accounts.reports.md diff --git a/docs/docs.user.accounts.returns.md b/docs/user/accounts/docs.user.accounts.returns.md similarity index 100% rename from docs/docs.user.accounts.returns.md rename to docs/user/accounts/docs.user.accounts.returns.md diff --git a/docs/docs.user.accounts.sales_invoice.md b/docs/user/accounts/docs.user.accounts.sales_invoice.md similarity index 100% rename from docs/docs.user.accounts.sales_invoice.md rename to docs/user/accounts/docs.user.accounts.sales_invoice.md diff --git a/docs/docs.user.buying.material_request.md b/docs/user/buying/docs.user.buying.material_request.md similarity index 100% rename from docs/docs.user.buying.material_request.md rename to docs/user/buying/docs.user.buying.material_request.md diff --git a/docs/docs.user.buying.md b/docs/user/buying/docs.user.buying.md similarity index 100% rename from docs/docs.user.buying.md rename to docs/user/buying/docs.user.buying.md diff --git a/docs/docs.user.buying.purchase_order.md b/docs/user/buying/docs.user.buying.purchase_order.md similarity index 100% rename from docs/docs.user.buying.purchase_order.md rename to docs/user/buying/docs.user.buying.purchase_order.md diff --git a/docs/docs.user.buying.supplier.md b/docs/user/buying/docs.user.buying.supplier.md similarity index 100% rename from docs/docs.user.buying.supplier.md rename to docs/user/buying/docs.user.buying.supplier.md diff --git a/docs/docs.user.buying.supplier_quotation.md b/docs/user/buying/docs.user.buying.supplier_quotation.md similarity index 100% rename from docs/docs.user.buying.supplier_quotation.md rename to docs/user/buying/docs.user.buying.supplier_quotation.md diff --git a/docs/docs.user.customize.custom_field.md b/docs/user/customize/docs.user.customize.custom_field.md similarity index 100% rename from docs/docs.user.customize.custom_field.md rename to docs/user/customize/docs.user.customize.custom_field.md diff --git a/docs/docs.user.customize.custom_form.md b/docs/user/customize/docs.user.customize.custom_form.md similarity index 100% rename from docs/docs.user.customize.custom_form.md rename to docs/user/customize/docs.user.customize.custom_form.md diff --git a/docs/docs.user.customize.md b/docs/user/customize/docs.user.customize.md similarity index 100% rename from docs/docs.user.customize.md rename to docs/user/customize/docs.user.customize.md diff --git a/docs/docs.user.customize.modules.md b/docs/user/customize/docs.user.customize.modules.md similarity index 100% rename from docs/docs.user.customize.modules.md rename to docs/user/customize/docs.user.customize.modules.md diff --git a/docs/docs.user.customize.print_format.md b/docs/user/customize/docs.user.customize.print_format.md similarity index 100% rename from docs/docs.user.customize.print_format.md rename to docs/user/customize/docs.user.customize.print_format.md diff --git a/docs/docs.user.help.md b/docs/user/docs.user.help.md similarity index 100% rename from docs/docs.user.help.md rename to docs/user/docs.user.help.md diff --git a/docs/docs.user.md b/docs/user/docs.user.md similarity index 100% rename from docs/docs.user.md rename to docs/user/docs.user.md diff --git a/docs/docs.user.projects.md b/docs/user/docs.user.projects.md similarity index 100% rename from docs/docs.user.projects.md rename to docs/user/docs.user.projects.md diff --git a/docs/docs.user.reports.builder.md b/docs/user/docs.user.reports.builder.md similarity index 100% rename from docs/docs.user.reports.builder.md rename to docs/user/docs.user.reports.builder.md diff --git a/docs/docs.user.reports.md b/docs/user/docs.user.reports.md similarity index 100% rename from docs/docs.user.reports.md rename to docs/user/docs.user.reports.md diff --git a/docs/docs.user.hr.appraisal.md b/docs/user/hr/docs.user.hr.appraisal.md similarity index 100% rename from docs/docs.user.hr.appraisal.md rename to docs/user/hr/docs.user.hr.appraisal.md diff --git a/docs/docs.user.hr.employee.md b/docs/user/hr/docs.user.hr.employee.md similarity index 100% rename from docs/docs.user.hr.employee.md rename to docs/user/hr/docs.user.hr.employee.md diff --git a/docs/docs.user.hr.expense_claim.md b/docs/user/hr/docs.user.hr.expense_claim.md similarity index 100% rename from docs/docs.user.hr.expense_claim.md rename to docs/user/hr/docs.user.hr.expense_claim.md diff --git a/docs/docs.user.hr.leave.md b/docs/user/hr/docs.user.hr.leave.md similarity index 100% rename from docs/docs.user.hr.leave.md rename to docs/user/hr/docs.user.hr.leave.md diff --git a/docs/docs.user.hr.md b/docs/user/hr/docs.user.hr.md similarity index 100% rename from docs/docs.user.hr.md rename to docs/user/hr/docs.user.hr.md diff --git a/docs/docs.user.hr.payroll.md b/docs/user/hr/docs.user.hr.payroll.md similarity index 100% rename from docs/docs.user.hr.payroll.md rename to docs/user/hr/docs.user.hr.payroll.md diff --git a/docs/docs.user.hr.setup.md b/docs/user/hr/docs.user.hr.setup.md similarity index 100% rename from docs/docs.user.hr.setup.md rename to docs/user/hr/docs.user.hr.setup.md diff --git a/docs/docs.user.implement.concepts.md b/docs/user/intro/docs.user.implement.concepts.md similarity index 100% rename from docs/docs.user.implement.concepts.md rename to docs/user/intro/docs.user.implement.concepts.md diff --git a/docs/docs.user.implement.md b/docs/user/intro/docs.user.implement.md similarity index 100% rename from docs/docs.user.implement.md rename to docs/user/intro/docs.user.implement.md diff --git a/docs/docs.user.implement.strategy.md b/docs/user/intro/docs.user.implement.strategy.md similarity index 100% rename from docs/docs.user.implement.strategy.md rename to docs/user/intro/docs.user.implement.strategy.md diff --git a/docs/docs.user.intro.md b/docs/user/intro/docs.user.intro.md similarity index 100% rename from docs/docs.user.intro.md rename to docs/user/intro/docs.user.intro.md diff --git a/docs/docs.user.intro.open_source.md b/docs/user/intro/docs.user.intro.open_source.md similarity index 100% rename from docs/docs.user.intro.open_source.md rename to docs/user/intro/docs.user.intro.open_source.md diff --git a/docs/docs.user.intro.try.md b/docs/user/intro/docs.user.intro.try.md similarity index 100% rename from docs/docs.user.intro.try.md rename to docs/user/intro/docs.user.intro.try.md diff --git a/docs/docs.user.mfg.bom.md b/docs/user/mfg/docs.user.mfg.bom.md similarity index 100% rename from docs/docs.user.mfg.bom.md rename to docs/user/mfg/docs.user.mfg.bom.md diff --git a/docs/docs.user.mfg.md b/docs/user/mfg/docs.user.mfg.md similarity index 100% rename from docs/docs.user.mfg.md rename to docs/user/mfg/docs.user.mfg.md diff --git a/docs/docs.user.mfg.planning.md b/docs/user/mfg/docs.user.mfg.planning.md similarity index 100% rename from docs/docs.user.mfg.planning.md rename to docs/user/mfg/docs.user.mfg.planning.md diff --git a/docs/docs.user.mfg.production_order.md b/docs/user/mfg/docs.user.mfg.production_order.md similarity index 100% rename from docs/docs.user.mfg.production_order.md rename to docs/user/mfg/docs.user.mfg.production_order.md diff --git a/docs/docs.user.selling.customer.md b/docs/user/selling/docs.user.selling.customer.md similarity index 100% rename from docs/docs.user.selling.customer.md rename to docs/user/selling/docs.user.selling.customer.md diff --git a/docs/docs.user.selling.lead.md b/docs/user/selling/docs.user.selling.lead.md similarity index 100% rename from docs/docs.user.selling.lead.md rename to docs/user/selling/docs.user.selling.lead.md diff --git a/docs/docs.user.selling.md b/docs/user/selling/docs.user.selling.md similarity index 100% rename from docs/docs.user.selling.md rename to docs/user/selling/docs.user.selling.md diff --git a/docs/docs.user.selling.opportunity.md b/docs/user/selling/docs.user.selling.opportunity.md similarity index 100% rename from docs/docs.user.selling.opportunity.md rename to docs/user/selling/docs.user.selling.opportunity.md diff --git a/docs/docs.user.selling.quotation.md b/docs/user/selling/docs.user.selling.quotation.md similarity index 100% rename from docs/docs.user.selling.quotation.md rename to docs/user/selling/docs.user.selling.quotation.md diff --git a/docs/docs.user.selling.sales_order.md b/docs/user/selling/docs.user.selling.sales_order.md similarity index 100% rename from docs/docs.user.selling.sales_order.md rename to docs/user/selling/docs.user.selling.sales_order.md diff --git a/docs/docs.user.setup.accounting.md b/docs/user/setup/docs.user.setup.accounting.md similarity index 100% rename from docs/docs.user.setup.accounting.md rename to docs/user/setup/docs.user.setup.accounting.md diff --git a/docs/docs.user.setup.codification.md b/docs/user/setup/docs.user.setup.codification.md similarity index 100% rename from docs/docs.user.setup.codification.md rename to docs/user/setup/docs.user.setup.codification.md diff --git a/docs/docs.user.setup.cost_centers.md b/docs/user/setup/docs.user.setup.cost_centers.md similarity index 100% rename from docs/docs.user.setup.cost_centers.md rename to docs/user/setup/docs.user.setup.cost_centers.md diff --git a/docs/docs.user.setup.data_import.md b/docs/user/setup/docs.user.setup.data_import.md similarity index 100% rename from docs/docs.user.setup.data_import.md rename to docs/user/setup/docs.user.setup.data_import.md diff --git a/docs/docs.user.setup.email.md b/docs/user/setup/docs.user.setup.email.md similarity index 100% rename from docs/docs.user.setup.email.md rename to docs/user/setup/docs.user.setup.email.md diff --git a/docs/docs.user.setup.first.md b/docs/user/setup/docs.user.setup.first.md similarity index 100% rename from docs/docs.user.setup.first.md rename to docs/user/setup/docs.user.setup.first.md diff --git a/docs/docs.user.setup.letter_head.md b/docs/user/setup/docs.user.setup.letter_head.md similarity index 100% rename from docs/docs.user.setup.letter_head.md rename to docs/user/setup/docs.user.setup.letter_head.md diff --git a/docs/docs.user.setup.masters.md b/docs/user/setup/docs.user.setup.masters.md similarity index 100% rename from docs/docs.user.setup.masters.md rename to docs/user/setup/docs.user.setup.masters.md diff --git a/docs/docs.user.setup.md b/docs/user/setup/docs.user.setup.md similarity index 100% rename from docs/docs.user.setup.md rename to docs/user/setup/docs.user.setup.md diff --git a/docs/docs.user.setup.opening.md b/docs/user/setup/docs.user.setup.opening.md similarity index 100% rename from docs/docs.user.setup.opening.md rename to docs/user/setup/docs.user.setup.opening.md diff --git a/docs/docs.user.setup.permissions.md b/docs/user/setup/docs.user.setup.permissions.md similarity index 100% rename from docs/docs.user.setup.permissions.md rename to docs/user/setup/docs.user.setup.permissions.md diff --git a/docs/docs.user.setup.price_list.md b/docs/user/setup/docs.user.setup.price_list.md similarity index 100% rename from docs/docs.user.setup.price_list.md rename to docs/user/setup/docs.user.setup.price_list.md diff --git a/docs/docs.user.setup.series.md b/docs/user/setup/docs.user.setup.series.md similarity index 100% rename from docs/docs.user.setup.series.md rename to docs/user/setup/docs.user.setup.series.md diff --git a/docs/docs.user.setup.taxes.md b/docs/user/setup/docs.user.setup.taxes.md similarity index 100% rename from docs/docs.user.setup.taxes.md rename to docs/user/setup/docs.user.setup.taxes.md diff --git a/docs/docs.user.stock.delivery_note.md b/docs/user/stock/docs.user.stock.delivery_note.md similarity index 100% rename from docs/docs.user.stock.delivery_note.md rename to docs/user/stock/docs.user.stock.delivery_note.md diff --git a/docs/docs.user.stock.item.md b/docs/user/stock/docs.user.stock.item.md similarity index 100% rename from docs/docs.user.stock.item.md rename to docs/user/stock/docs.user.stock.item.md diff --git a/docs/docs.user.stock.md b/docs/user/stock/docs.user.stock.md similarity index 100% rename from docs/docs.user.stock.md rename to docs/user/stock/docs.user.stock.md diff --git a/docs/docs.user.stock.purchase_receipt.md b/docs/user/stock/docs.user.stock.purchase_receipt.md similarity index 100% rename from docs/docs.user.stock.purchase_receipt.md rename to docs/user/stock/docs.user.stock.purchase_receipt.md diff --git a/docs/docs.user.stock.serialized.md b/docs/user/stock/docs.user.stock.serialized.md similarity index 100% rename from docs/docs.user.stock.serialized.md rename to docs/user/stock/docs.user.stock.serialized.md diff --git a/docs/docs.user.stock.stock_entry.md b/docs/user/stock/docs.user.stock.stock_entry.md similarity index 100% rename from docs/docs.user.stock.stock_entry.md rename to docs/user/stock/docs.user.stock.stock_entry.md diff --git a/docs/docs.user.stock.sub_contracting.md b/docs/user/stock/docs.user.stock.sub_contracting.md similarity index 100% rename from docs/docs.user.stock.sub_contracting.md rename to docs/user/stock/docs.user.stock.sub_contracting.md diff --git a/docs/docs.user.stock.valuation.md b/docs/user/stock/docs.user.stock.valuation.md similarity index 100% rename from docs/docs.user.stock.valuation.md rename to docs/user/stock/docs.user.stock.valuation.md diff --git a/docs/docs.user.support.customer_issue.md b/docs/user/support/docs.user.support.customer_issue.md similarity index 100% rename from docs/docs.user.support.customer_issue.md rename to docs/user/support/docs.user.support.customer_issue.md diff --git a/docs/docs.user.support.maintenance_schedule.md b/docs/user/support/docs.user.support.maintenance_schedule.md similarity index 100% rename from docs/docs.user.support.maintenance_schedule.md rename to docs/user/support/docs.user.support.maintenance_schedule.md diff --git a/docs/docs.user.support.maintenance_visit.md b/docs/user/support/docs.user.support.maintenance_visit.md similarity index 100% rename from docs/docs.user.support.maintenance_visit.md rename to docs/user/support/docs.user.support.maintenance_visit.md diff --git a/docs/docs.user.support.md b/docs/user/support/docs.user.support.md similarity index 100% rename from docs/docs.user.support.md rename to docs/user/support/docs.user.support.md diff --git a/docs/docs.user.support.support_ticket.md b/docs/user/support/docs.user.support.support_ticket.md similarity index 100% rename from docs/docs.user.support.support_ticket.md rename to docs/user/support/docs.user.support.support_ticket.md diff --git a/docs/docs.user.tools.calendar.md b/docs/user/tools/docs.user.tools.calendar.md similarity index 100% rename from docs/docs.user.tools.calendar.md rename to docs/user/tools/docs.user.tools.calendar.md diff --git a/docs/docs.user.tools.form_tools.md b/docs/user/tools/docs.user.tools.form_tools.md similarity index 100% rename from docs/docs.user.tools.form_tools.md rename to docs/user/tools/docs.user.tools.form_tools.md diff --git a/docs/docs.user.tools.md b/docs/user/tools/docs.user.tools.md similarity index 100% rename from docs/docs.user.tools.md rename to docs/user/tools/docs.user.tools.md diff --git a/docs/docs.user.tools.messages.md b/docs/user/tools/docs.user.tools.messages.md similarity index 100% rename from docs/docs.user.tools.messages.md rename to docs/user/tools/docs.user.tools.messages.md diff --git a/docs/docs.user.tools.notes.md b/docs/user/tools/docs.user.tools.notes.md similarity index 100% rename from docs/docs.user.tools.notes.md rename to docs/user/tools/docs.user.tools.notes.md diff --git a/docs/docs.user.tools.todo.md b/docs/user/tools/docs.user.tools.todo.md similarity index 100% rename from docs/docs.user.tools.todo.md rename to docs/user/tools/docs.user.tools.todo.md diff --git a/docs/docs.user.website.blog.md b/docs/user/website/docs.user.website.blog.md similarity index 100% rename from docs/docs.user.website.blog.md rename to docs/user/website/docs.user.website.blog.md diff --git a/docs/docs.user.website.md b/docs/user/website/docs.user.website.md similarity index 100% rename from docs/docs.user.website.md rename to docs/user/website/docs.user.website.md diff --git a/docs/docs.user.website.setup.md b/docs/user/website/docs.user.website.setup.md similarity index 100% rename from docs/docs.user.website.setup.md rename to docs/user/website/docs.user.website.setup.md diff --git a/docs/docs.user.website.style.md b/docs/user/website/docs.user.website.style.md similarity index 100% rename from docs/docs.user.website.style.md rename to docs/user/website/docs.user.website.style.md diff --git a/docs/docs.user.website.web_page.md b/docs/user/website/docs.user.website.web_page.md similarity index 100% rename from docs/docs.user.website.web_page.md rename to docs/user/website/docs.user.website.web_page.md From 36b63a44b9d74a010df1f6878cd4a812e64ca761 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Sep 2013 15:33:56 +0530 Subject: [PATCH 23/27] [fix] [minor] profile query --- accounts/doctype/pos_setting/pos_setting.js | 2 +- controllers/queries.py | 29 +------------------ hr/doctype/employee/employee.js | 2 +- public/js/queries.js | 2 +- selling/doctype/lead/lead.js | 4 +-- .../authorization_rule/authorization_rule.js | 4 +-- 6 files changed, 8 insertions(+), 35 deletions(-) diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index 18f555b919..641b3ef1cf 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -70,5 +70,5 @@ cur_frm.fields_dict["expense_account"].get_query = function(doc) { } cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) { - return{ query:"controllers.queries.profile_query"} + return{ query:"core.doctype.profile.profile.profile_query"} } diff --git a/controllers/queries.py b/controllers/queries.py index 0e23d5cd1e..81040a25e3 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import webnotes +from webnotes.widgets.reportview import get_match_cond def get_filters_cond(doctype, filters, conditions): if filters: @@ -22,34 +23,6 @@ def get_filters_cond(doctype, filters, conditions): cond = '' return cond -def get_match_cond(doctype, searchfield = 'name'): - from webnotes.widgets.reportview import build_match_conditions - cond = build_match_conditions(doctype) - - if cond: - cond = ' and ' + cond - else: - cond = '' - return cond - - # searches for enabled profiles -def profile_query(doctype, txt, searchfield, start, page_len, filters): - return webnotes.conn.sql("""select name, concat_ws(' ', first_name, middle_name, last_name) - from `tabProfile` - where ifnull(enabled, 0)=1 - and docstatus < 2 - and name not in ('Administrator', 'Guest') - and (%(key)s like "%(txt)s" - or concat_ws(' ', first_name, middle_name, last_name) like "%(txt)s") - %(mcond)s - order by - case when name like "%(txt)s" then 0 else 1 end, - case when concat_ws(' ', first_name, middle_name, last_name) like "%(txt)s" - then 0 else 1 end, - name asc - limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt, - 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) - # searches for active employees def employee_query(doctype, txt, searchfield, start, page_len, filters): return webnotes.conn.sql("""select name, employee_name from `tabEmployee` diff --git a/hr/doctype/employee/employee.js b/hr/doctype/employee/employee.js index 9ee7c618e6..05aec3efa3 100644 --- a/hr/doctype/employee/employee.js +++ b/hr/doctype/employee/employee.js @@ -6,7 +6,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({ setup: function() { this.setup_leave_approver_select(); this.frm.fields_dict.user_id.get_query = function(doc,cdt,cdn) { - return { query:"controllers.queries.profile_query"} } + return { query:"core.doctype.profile.profile.profile_query"} } this.frm.fields_dict.reports_to.get_query = function(doc,cdt,cdn) { return{ query:"controllers.queries.employee_query"} } }, diff --git a/public/js/queries.js b/public/js/queries.js index fbd294757f..d0346e0cbd 100644 --- a/public/js/queries.js +++ b/public/js/queries.js @@ -5,7 +5,7 @@ wn.provide("erpnext.queries"); $.extend(erpnext.queries, { profile: function() { - return { query: "controllers.queries.profile_query" }; + return { query: "core.doctype.profile.profile.profile_query" }; }, lead: function() { diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 9a86b22d63..a3ae783867 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -14,12 +14,12 @@ erpnext.LeadController = wn.ui.form.Controller.extend({ onload: function() { if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) { cur_frm.fields_dict.lead_owner.get_query = function(doc,cdt,cdn) { - return { query:"controllers.queries.profile_query" } } + return { query:"core.doctype.profile.profile.profile_query" } } } if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) { cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) { - return { query:"controllers.queries.profile_query" } } + return { query:"core.doctype.profile.profile.profile_query" } } } if(in_list(user_roles,'System Manager')) { diff --git a/setup/doctype/authorization_rule/authorization_rule.js b/setup/doctype/authorization_rule/authorization_rule.js index 02747a0351..00f5260b38 100644 --- a/setup/doctype/authorization_rule/authorization_rule.js +++ b/setup/doctype/authorization_rule/authorization_rule.js @@ -69,10 +69,10 @@ cur_frm.cscript.transaction = function(doc,cdt,cdn){ cur_frm.fields_dict.system_user.get_query = function(doc,cdt,cdn) { - return{ query:"controllers.queries.profile_query" } } + return{ query:"core.doctype.profile.profile.profile_query" } } cur_frm.fields_dict.approving_user.get_query = function(doc,cdt,cdn) { - return{ query:"controllers.queries.profile_query" } } + return{ query:"core.doctype.profile.profile.profile_query" } } cur_frm.fields_dict['approving_role'].get_query = cur_frm.fields_dict['system_role'].get_query; From 627c42bdb6ad73bf7a9952244659ba40ecfa404d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Sep 2013 15:34:24 +0530 Subject: [PATCH 24/27] [fix] [minor] quotation to sales order, if not able to create customer, show message --- selling/doctype/customer/customer.py | 3 +-- selling/doctype/quotation/quotation.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py index cb19d4f931..fb3c0062a7 100644 --- a/selling/doctype/customer/customer.py +++ b/selling/doctype/customer/customer.py @@ -40,8 +40,7 @@ class DocType(TransactionBase): def validate_values(self): if webnotes.defaults.get_global_default('cust_master_name') == 'Naming Series' and not self.doc.naming_series: - msgprint("Series is Mandatory.") - raise Exception + webnotes.throw("Series is Mandatory.", webnotes.MandatoryError) def validate(self): self.validate_values() diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index c1b529ca69..6ac254298c 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -7,7 +7,7 @@ import webnotes from webnotes.utils import cstr, getdate from webnotes.model.bean import getlist from webnotes.model.code import get_obj -from webnotes import msgprint +from webnotes import _, msgprint sql = webnotes.conn.sql @@ -276,5 +276,8 @@ def _make_customer(source_name, ignore_permissions=False): customer.doc.name += "-" + lead_name customer.insert() return customer + elif webnotes.MandatoryError: + msgprint(_("You will need to make Customer from Lead") + (" - %s" % lead_name)) + return else: raise e From 3139973662f1e6426dc8fc1fb678077bd1e9264b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Sep 2013 15:41:31 +0530 Subject: [PATCH 25/27] [fix] [minor] quotation to sales order, if not able to create customer, show message --- selling/doctype/quotation/quotation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 6ac254298c..588d8d6e1f 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -276,8 +276,9 @@ def _make_customer(source_name, ignore_permissions=False): customer.doc.name += "-" + lead_name customer.insert() return customer - elif webnotes.MandatoryError: - msgprint(_("You will need to make Customer from Lead") + (" - %s" % lead_name)) - return else: raise e + except webnotes.MandatoryError: + from webnotes.utils import get_url_to_form + webnotes.throw(_("Before proceeding, please create Customer from Lead") + \ + (" - %s" % get_url_to_form("Lead", lead_name))) From 1dadf35fc739c79f3f5af0d2df8462fbf6e5187d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Sep 2013 16:21:01 +0530 Subject: [PATCH 26/27] [fix] [minor] [query] sales invoice from delivery note --- accounts/doctype/sales_invoice/sales_invoice.js | 1 - controllers/queries.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 109d9f8a07..0c8fc3714c 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -80,7 +80,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte source_doctype: "Delivery Note", get_query: function() { var filters = { - docstatus: 1, company: cur_frm.doc.company }; if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer; diff --git a/controllers/queries.py b/controllers/queries.py index 81040a25e3..02c992b729 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -169,10 +169,12 @@ def get_price_list_currency(doctype, txt, searchfield, start, page_len, filters) def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters): return webnotes.conn.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name from `tabDelivery Note` - where `tabDelivery Note`.`%(key)s` like %(txt)s %(fcond)s and + where `tabDelivery Note`.`%(key)s` like %(txt)s and + `tabDelivery Note`.docstatus = 1 %(fcond)s and (ifnull((select sum(qty) from `tabDelivery Note Item` where `tabDelivery Note Item`.parent=`tabDelivery Note`.name), 0) > ifnull((select sum(qty) from `tabSales Invoice Item` where + `tabSales Invoice Item`.docstatus = 1 and `tabSales Invoice Item`.delivery_note=`tabDelivery Note`.name), 0)) %(mcond)s order by `tabDelivery Note`.`%(key)s` asc limit %(start)s, %(page_len)s""" % { From 4263344cd2a71ef2c743fd78695ea47f0323afab Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Sep 2013 16:21:21 +0530 Subject: [PATCH 27/27] [fix] [minor] customer-wise discount --- selling/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selling/utils.py b/selling/utils.py index 53ebbeef34..ca995125d1 100644 --- a/selling/utils.py +++ b/selling/utils.py @@ -161,7 +161,7 @@ def _get_item_discount(item_group, customer): FROM `tabItem Group` AS node, `tabItem Group` AS parent WHERE parent.lft <= node.lft and parent.rgt >= node.rgt and node.name = %s GROUP BY parent.name - ORDER BY parent.lft desc""", item_group)] + ORDER BY parent.lft desc""", (item_group,))] discount = 0 for d in parent_item_groups: