From 7b4bbbd6bd1dc474257ce262994820e7e16e24ce Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 24 Jun 2013 15:00:21 +0530 Subject: [PATCH 01/27] [reload doctype and page] --- patches/patch_list.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patches/patch_list.py b/patches/patch_list.py index a5c4d805e4d..8aba224092a 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -19,7 +19,8 @@ patch_list = [ "execute:webnotes.reload_doc('core', 'doctype', 'docfield')", "execute:webnotes.reload_doc('core', 'doctype', 'docperm') # 2013-04-07", "execute:webnotes.reload_doc('core', 'doctype', 'report')", - "execute:webnotes.reload_doc('core', 'doctype', 'doctype')", + "execute:webnotes.reload_doc('core', 'doctype', 'doctype') # 2013-06-24", + "execute:webnotes.reload_doc('core', 'doctype', 'page') # 2013-06-24", "patches.mar_2012.so_rv_mapper_fix", "patches.mar_2012.clean_property_setter", "patches.april_2012.naming_series_patch", From 85cbe16f523b134fc166556a4b06b107a244ab5e Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 24 Jun 2013 15:16:50 +0530 Subject: [PATCH 02/27] [patch] reload sales partner for webpage --- patches/patch_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/patch_list.py b/patches/patch_list.py index 8aba224092a..8d44c08f22d 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -201,6 +201,7 @@ patch_list = [ "execute:webnotes.reload_doc('setup', 'doctype', 'item_group') #2013-03-25", "execute:webnotes.reload_doc('website', 'doctype', 'blog_post') #2013-03-25", "execute:webnotes.reload_doc('website', 'doctype', 'web_page') #2013-03-25", + "execute:webnotes.reload_doc('setup', 'doctype', 'sales_partner') #2013-06-24", "execute:webnotes.bean('Style Settings').save() #2013-03-25", "execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)", "patches.march_2013.p09_unset_user_type_partner", From 028755941eeb1d31a5d3672c290caf5b11f22e85 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 8 Jul 2013 18:45:55 +0530 Subject: [PATCH 03/27] get_query to server side --- accounts/doctype/account/account.js | 8 +- accounts/doctype/c_form/c_form.js | 8 +- accounts/doctype/cost_center/cost_center.js | 20 +- .../journal_voucher/journal_voucher.js | 23 ++- .../payment_to_invoice_matching_tool.js | 25 +-- .../payment_to_invoice_matching_tool.py | 16 ++ .../period_closing_voucher.js | 11 +- accounts/doctype/pos_setting/pos_setting.js | 49 ++++- .../purchase_invoice/purchase_invoice.js | 87 +++++++-- .../purchase_taxes_and_charges_master.js | 25 ++- .../doctype/sales_invoice/sales_invoice.js | 135 +++++++++---- .../sales_taxes_and_charges_master.js | 15 +- .../doctype/purchase_order/purchase_order.js | 32 +++- .../quality_inspection/quality_inspection.js | 29 ++- .../supplier_quotation/supplier_quotation.js | 34 ++-- controllers/queries.py | 180 ++++++++++++++++++ manufacturing/doctype/bom/bom.js | 35 ++-- manufacturing/doctype/bom/bom.py | 10 +- 18 files changed, 587 insertions(+), 155 deletions(-) create mode 100644 controllers/queries.py diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js index c12c2d69640..44f7abd5de6 100644 --- a/accounts/doctype/account/account.js +++ b/accounts/doctype/account/account.js @@ -132,7 +132,9 @@ cur_frm.fields_dict['master_name'].get_query = function(doc) { cur_frm.fields_dict['parent_account'].get_query = function(doc) { return { - query: "accounts.doctype.account.account.get_parent_account", - filters: { "company": doc.company} + filters: { + "group_or_ledger": "Group", + "company": doc.company + } } -} +} \ No newline at end of file diff --git a/accounts/doctype/c_form/c_form.js b/accounts/doctype/c_form/c_form.js index d8c7d81f14d..35656e9daf0 100644 --- a/accounts/doctype/c_form/c_form.js +++ b/accounts/doctype/c_form/c_form.js @@ -18,10 +18,12 @@ // ----------------------------- cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = function(doc) { return { - query: "accounts.doctype.c_form.c_form.get_invoice_nos", filters: { - customer: doc.customer, - company: doc.company + "docstatus": 1, + "customer": doc.customer, + "company": doc.company, + "c_form_applicable": 'Yes', + "c_form_no": '' } } } diff --git a/accounts/doctype/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js index 2a98a960c77..094904d6fe8 100644 --- a/accounts/doctype/cost_center/cost_center.js +++ b/accounts/doctype/cost_center/cost_center.js @@ -36,11 +36,27 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { //Account filtering for cost center cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) { var mydoc = locals[this.doctype][this.docname]; - return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company_name + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'; + return{ + filters:[ + ['Account', 'company', '=', doc.company_name], + ['Account', 'is_pl_account', '=', 'Yes'], + ['Account', 'debit_or_credit', '=', 'Debit'], + ['Account', 'group_or_ledger', '!=', 'Group'], + ['Account', 'group_or_ledger', 'is not', 'NULL'] + ] + } + // return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company_name + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'; } cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){ - return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company_name="'+ doc.company_name+'" AND `tabCost Center`.company_name is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50'; + return{ + filters:[ + ['Cost Center', 'group_or_ledger', '=', 'Group'], + ['Cost Center', 'company', '=', doc.company_name], + ['Cost Center', 'company_name', 'is not', 'NULL'] + ] + } + // return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company_name="'+ doc.company_name+'" AND `tabCost Center`.company_name is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50'; } //parent cost center diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js index dbe666881a4..2afea1bce25 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.js +++ b/accounts/doctype/journal_voucher/journal_voucher.js @@ -196,24 +196,35 @@ cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(do cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - query: "accounts.utils.get_cost_center_list", - filters: { company_name: doc.company} + // query: "accounts.utils.get_cost_center_list", + filters: { + 'company_name': doc.company, + 'group_or_ledger': 'Ledger' + } } } cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = function(doc) { var d = locals[this.doctype][this.docname]; return { - query: "accounts.doctype.journal_voucher.journal_voucher.get_against_purchase_invoice", - filters: { account: d.account } + // query: "accounts.doctype.journal_voucher.journal_voucher.get_against_purchase_invoice", + filters: [ + ['Purchase Invoice', 'credit_to', '=', d.account], + ['Purchase Invoice', 'docstatus', '=', 1], + ['Purchase Invoice', 'outstanding_amount', '>', 0] + ] } } cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = function(doc) { var d = locals[this.doctype][this.docname]; return { - query: "accounts.doctype.journal_voucher.journal_voucher.get_against_sales_invoice", - filters: { account: d.account } + // query: "accounts.doctype.journal_voucher.journal_voucher.get_against_sales_invoice", + filters: [ + ['Sales Invoice', 'debit_to', '=', d.account], + ['Sales Invoice', 'docstatus', '=', 1], + ['Sales Invoice', 'outstanding_amount', '>', 0] + ] } } diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js index ac7d9d2d14e..ad0c1d05128 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js @@ -36,25 +36,12 @@ cur_frm.fields_dict.voucher_no.get_query = function(doc) { // TO-do: check for pos, it should not come if (!doc.account) msgprint("Please select Account first"); else { - return repl("select gle.voucher_no, gle.posting_date, gle.%(account_type)s \ - from `tabGL Entry` gle \ - where gle.account = '%(acc)s' \ - and gle.voucher_type = '%(dt)s' \ - and gle.voucher_no like '%s' \ - and ifnull(gle.is_cancelled, 'No') = 'No' \ - and (ifnull(gle.against_voucher, '') = '' \ - or ifnull(gle.against_voucher, '') = gle.voucher_no ) \ - and ifnull(gle.%(account_type)s, 0) > 0 \ - and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0) \ - from `tabGL Entry` \ - where against_voucher_type = '%(dt)s' \ - and against_voucher = gle.voucher_no \ - and voucher_no != gle.voucher_no \ - and account = gle.account \ - and ifnull(is_cancelled, 'No') = 'No') != \ - abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) \ - ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50", - {dt:doc.voucher_type, acc:doc.account, account_type: doc.account_type}); + query: "accounts.doctype.payment_to_invoice_matching_tool.payment_to_invoice_matching_tool.gl_entry_details", + filters: { + "dt": doc.voucher_type, + "acc": doc.account, + "account_type": doc.account_type + } } } diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index ba4dec37151..633bdd1590c 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -139,3 +139,19 @@ class DocType: msgprint("Successfully allocated.") else: msgprint("No amount allocated.", raise_exception=1) + +def gl_entry_details(doctype, txt, searchfield, start, page_len, filters): + ("""select gle.voucher_no, gle.posting_date, gle.%(account_type)s + from `tabGL Entry` gle + where gle.account = '%(acc)s' and gle.voucher_type = '%(dt)s' + and gle.voucher_no like '%s' and ifnull(gle.is_cancelled, 'No') = 'No' + and (ifnull(gle.against_voucher, '') = '' or ifnull(gle.against_voucher, '') = gle.voucher_no ) + and ifnull(gle.%(account_type)s, 0) > 0 + and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0) + from `tabGL Entry` + where against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no + and voucher_no != gle.voucher_no + and ifnull(is_cancelled, 'No') = 'No') != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) + ORDER BY gle.posting_date DESC, gle.voucher_no DESC limit %(start)s, %(page_len)s"""% + {dt:filters["dt"], acc:filters["acc"], account_type: filters['account_type'], "start": start, + "page_len": page_len}) \ No newline at end of file diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/accounts/doctype/period_closing_voucher/period_closing_voucher.js index 830092b284c..c24f06b2a8a 100644 --- a/accounts/doctype/period_closing_voucher/period_closing_voucher.js +++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.js @@ -23,5 +23,14 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { // ***************** Get Account Head ***************** cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) { - return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND ifnull(`tabAccount`.freeze_account, "No") = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50'; + return{ + filters:{ + 'is_pl_account': "No", + "debit_or_credit": "Credit", + "company": doc.company, + "freeze_account": "No", + "group_or_ledger": "Ledger" + } + } + // return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND ifnull(`tabAccount`.freeze_account, "No") = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50'; } diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index 3ba60b46443..a51d93edce5 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -25,41 +25,74 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){ //cash bank account //------------------------------------ cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' + return{ + filters:{ + 'debit_or_credit': "Debit", + 'is_pl_account': "No", + 'group_or_ledger': "Ledger", + 'company': doc.company + } + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } // Income Account // -------------------------------- cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"' + return{ + filters:{ + 'debit_or_credit': "Credit", + 'group_or_ledger': "Ledger", + 'company': doc.company, + 'account_type': "Income Account" + } + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"' } // Cost Center // ----------------------------- cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; + return{ + filters:{ + 'company_name': doc.company, + 'group_or_ledger': "Ledger", + } + } + // return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; } //get query select Territory //================================================================= cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters:{ + 'is_group': "No" + } + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } // ------------------ Get Print Heading ------------------------------------ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) { - return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; + return{ + filters:[ + ['Print Heading', 'docstatus', '!=', 2] + ] + } + // return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; } cur_frm.fields_dict["expense_account"].get_query = function(doc) { return { - "query": "accounts.utils.get_account_list", - "filters": { + // "query": "accounts.utils.get_account_list", + filters: { "is_pl_account": "Yes", "debit_or_credit": "Debit", - "company": doc.company + "company": doc.company, + "group_or_ledger": "Ledger" } } } diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 0e461f1ba19..1b952ddcbc5 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -132,11 +132,17 @@ cur_frm.cscript.make_bank_voucher = function() { cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{'supplier': doc.supplier} + } + // return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{'supplier': doc.supplier} + } + // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { @@ -146,32 +152,73 @@ cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function( } cur_frm.fields_dict['credit_to'].get_query = function(doc) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' + return{ + filters:{ + 'debit_or_credit': 'Credit', + 'is_pl_account': 'No', + 'group_or_ledger': 'Ledger', + 'company': doc.company + } + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) { + var filter = [ + ['Purchase Order', 'docstatus', '=', 1], + ['Purchase Order', 'status', '!=', 'Stopped'], + ['Purchase Order', 'per_billed', '<', 99.99], + ['Purchase Order', 'company', '=', doc.company] + ]; + var cond = []; if (doc.supplier){ - return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 99.99 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50' - } else { - return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`, 0) < 99.99 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50' + cond = ['Purchase Order', 'supplier', '=', doc.supplier]; + // return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 99.99 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50' + } + filter.push(cond); + return{ + filters: filter } } cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) { + var filter = [ + ['Purchase Receipt', 'docstatus', '=', 1], + ['Purchase Receipt', 'status', '!=', 'Stopped'], + ['Purchase Receipt', 'per_billed', '<', 99.99], + ['Purchase Receipt', 'company', '=', doc.company] + ]; + var cond = []; if (doc.supplier){ - return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 99.99 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50' - } else { - return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 99.99 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50' + ['Purchase Receipt', 'supplier', '=', doc.supplier]; + // return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 99.99 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50' + } + filter.push(cond); + return{ + filters: filter } } // Get Print Heading cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) { - return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; +return{ + filters:[ + ['Print Heading', 'docstatus', '!=', 2] + ] + } + // return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; } cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) { - return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'; + return{ + filters:{ + 'debit_or_credit':'Debit', + 'account_type': 'Expense Account', + 'group_or_ledger': 'Ledger', + 'company': doc.company + } + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'; } cur_frm.cscript.expense_head = function(doc, cdt, cdn){ var d = locals[cdt][cdn]; @@ -186,8 +233,11 @@ cur_frm.cscript.expense_head = function(doc, cdt, cdn){ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - query: "accounts.utils.get_cost_center_list", - filters: { company_name: doc.company} + // query: "accounts.utils.get_cost_center_list", + filters: { + 'company_name': doc.company, + 'group_or_ledger': 'Ledger' + } } } @@ -228,9 +278,14 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) { } cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { - return 'SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; + return{ + filters:[ + ['Project', 'status', 'not in', 'Completed, Cancelled'] + ] + } + // return 'SELECT `tabProject`.name FROM `tabProject` \ + // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ + // AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; } diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js index f04f895baf2..e27f0b53e96 100644 --- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js +++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js @@ -127,15 +127,26 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) { refresh_field('row_id',d.name,'purchase_tax_details'); } -/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/ - -cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type in ("Tax", "Chargeable", "Expense Account") or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.company = "' + doc.company + '" AND tabAccount.name LIKE "%s"' -} - +cur_frm.set_query("account_head", "purchase_tax_details", function() { + return { + filters: [ + ["Account", "group_or_ledger", "=", "Ledger"], + ["Account", "docstatus", "!=", 2], + ["Account", "account_type", "in", "Tax, Chargeable, Expense Account"], + ["Account", "is_pl_account", "=", "Yes"], + ["Account", "debit_or_credit", "=", "Debit"], + ["Account", "company", "=", doc.company] + ] + } +}); cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) { - return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; + return { + filters: { + 'company_name': doc.company, + 'group_or_ledger': "Ledger" + } + } } diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index ecfa9a8ffe1..2c07eafd8eb 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -241,38 +241,75 @@ cur_frm.cscript.make_bank_voucher = function() { } cur_frm.fields_dict.debit_to.get_query = function(doc) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' + return{ + filters: { + 'debit_or_credit': 'Debit', + 'is_pl_account': 'No', + 'group_or_ledger': 'Ledger', + 'company': doc.company + } + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } cur_frm.fields_dict.cash_bank_account.get_query = function(doc) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' + return{ + filters: { + 'debit_or_credit': 'Debit', + 'is_pl_account': 'No', + 'group_or_ledger': 'Ledger', + 'company': doc.company + } + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } cur_frm.fields_dict.write_off_account.get_query = function(doc) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' + return{ + filters:{ + 'debit_or_credit': 'Debit', + 'is_pl_account': 'Yes', + 'group_or_ledger': 'Ledger', + 'company': doc.company + } + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } // Write off cost center //----------------------- cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) { - return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"' + return{ + filters:{ + 'group_or_ledger': 'Ledger', + 'company_name': doc.company + } + } + // return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"' } //project name //-------------------------- cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) { - var cond = ''; - if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND'; - return repl('SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND %(cond)s `tabProject`.name LIKE "%s" \ - ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond}); + return{ + query: "controllers.queries.get_project_name", + filters: {'customer': doc.customer} + } + // var cond = ''; + // if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND'; + // return repl('SELECT `tabProject`.name FROM `tabProject` \ + // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ + // AND %(cond)s `tabProject`.name LIKE "%s" \ + // ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond}); } //Territory //----------------------------- cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters: {'is_group': 'NO'} + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } // Income Account in Details Table @@ -285,11 +322,12 @@ cur_frm.set_query("income_account", "entries", function(doc) { if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) { return { - "query": "accounts.utils.get_account_list", - "filters": { - "is_pl_account": "Yes", - "debit_or_credit": "Debit", - "company": doc.company + // "query": "accounts.utils.get_account_list", + filters: { + 'is_pl_account': 'Yes', + 'debit_or_credit': 'Debit', + 'company': doc.company, + 'group_or_ledger': 'Ledger' } } } @@ -299,45 +337,66 @@ if (sys_defaults.auto_inventory_accounting) { //---------------------------- cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50"; + return{ + filters:[ + ['Bin', 'item_code', '=', d.item_code], + ['Bin', 'actual_qty', '>', 0] + ] + } + // return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50"; } // Cost Center in Details Table // ----------------------------- cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - query: "accounts.utils.get_cost_center_list", - filters: { company_name: doc.company} + // query: "accounts.utils.get_cost_center_list", + filters: { + 'company_name': doc.company, + 'group_or_ledger': 'Ledger' + } } } // Sales Order // ----------- cur_frm.fields_dict.sales_order_main.get_query = function(doc) { - if (doc.customer) - return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 99.99 and `tabSales Order`.`customer` = "' + doc.customer + '" and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50'; - else - return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 99.99 and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50'; + var filter = [ + ['Sales Order','company','=',doc.company], + ['Sales Order','docstatus','=',1], + ['Sales Order','status','!=','Stopped'], + ['Sales Order','per_billed','<',99.99] + ]; + var cond = []; + if (doc.customer) cond = ['Sales Order', 'customer', '=', doc.customer]; + // return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 99.99 and `tabSales Order`.`customer` = "' + doc.customer + '" and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50'; + filter.push(cond); + return{ + filters: filter + } } // Delivery Note // -------------- cur_frm.fields_dict.delivery_note_main.get_query = function(doc) { - if (doc.customer) - return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` \ - WHERE `tabDelivery Note`.company = "' + doc.company - + '" and `tabDelivery Note`.`docstatus` = 1 and \ - ifnull(`tabDelivery Note`.per_billed,0) < 99.99 and \ - `tabDelivery Note`.`customer` = "' - + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" \ - ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50'; - else - return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` \ - WHERE `tabDelivery Note`.company = "' + doc.company - + '" and `tabDelivery Note`.`docstatus` = 1 and \ - ifnull(`tabDelivery Note`.per_billed,0) < 99.99 and \ - `tabDelivery Note`.%(key)s LIKE "%s" \ - ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50'; + var filter = [ + ['Delivery Note', 'company', '=', doc.company], + ['Delivery Note', 'docstatus', '=', 1], + ['Delivery Note', 'per_billed', '<', 99.99] + ]; + var cond = []; + if (doc.customer) ['Delivery Note', 'customer', '=', doc.customer]; + // return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` \ + // WHERE `tabDelivery Note`.company = "' + doc.company + // + '" and `tabDelivery Note`.`docstatus` = 1 and \ + // ifnull(`tabDelivery Note`.per_billed,0) < 99.99 and \ + // `tabDelivery Note`.`customer` = "' + // + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" \ + // ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50'; + filter.push(cond); + return{ + filters: filter + } } diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index 57874273391..81a5c709f06 100644 --- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -137,11 +137,22 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) { /*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/ cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.account_type in ("Tax", "Chargeable", "Income Account") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"' + return{ + filters:[ + ['Account', 'group_or_ledger', '=', 'Ledger'], + ['Account', 'account_type', 'in', 'Tax, Chargeable, Income Account'], + ['Account', 'company', '=', doc.company] + ] + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.account_type in ("Tax", "Chargeable", "Income Account") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"' } cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) { - return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; + return{ + 'company_name': doc.company, + 'group_or_ledger': "Ledger" + } + // return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; } diff --git a/buying/doctype/purchase_order/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js index 4c2298242c5..ae91e39e4aa 100644 --- a/buying/doctype/purchase_order/purchase_order.js +++ b/buying/doctype/purchase_order/purchase_order.js @@ -80,25 +80,37 @@ cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc } cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return { + filters: {'supplier': doc.supplier} + } + // return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return { + filters: {'supplier': doc.supplier} + } + // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { - return 'SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; + return { + filters:[ + ['Project', 'status', 'not in', 'Completed, Cancelled'] + ] + } } cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return 'SELECT DISTINCT `name` FROM `tabMaterial Request` \ - WHERE material_request_type="Purchase" and company = "' + doc.company - + '" and `docstatus` = 1 and `status` != "Stopped" \ - and ifnull(`per_ordered`,0) < 99.99 and %(key)s LIKE "%s" \ - ORDER BY `name` DESC LIMIT 50'; + return{ + filters:[ + ['Material Request', 'material_request_type', '=', 'Purchase'], + ['Material Request', 'company', '=', doc.company], + ['Material Request', 'docstatus', '=', '1'], + ['Material Request', 'status', '!=', 'Stopped'], + ['Material Request', 'per_ordered', '<', 99.99] + ] + } } cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){ diff --git a/buying/doctype/quality_inspection/quality_inspection.js b/buying/doctype/quality_inspection/quality_inspection.js index 2dbb2854fdd..1c12f3a8a5a 100644 --- a/buying/doctype/quality_inspection/quality_inspection.js +++ b/buying/doctype/quality_inspection/quality_inspection.js @@ -43,18 +43,33 @@ cur_frm.cscript.refresh = cur_frm.cscript.inspection_type; // item code based on GRN/DN cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { + filter = {}; if (doc.purchase_receipt_no) - return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Item` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; + filter:{ + 'parent': doc.purchase_receipt_no + } + // return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Item` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; else if (doc.delivery_note_no) - return 'SELECT item_code, item_name, description FROM `tabDelivery Note Item` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; - else - return 'SELECT name, item_name, description FROM tabItem WHERE docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; + filter:{ + 'parent': doc.delivery_note_no + } + // return 'SELECT item_code, item_name, description FROM `tabDelivery Note Item` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; + return{ + filters: filter + } } // Serial No based on item_code cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) { + filter = {}; if (doc.item_code) - return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; + filter:{ + 'item_code': doc.item_code, + 'status': "In Store" + } + // return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; else - return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; -} + filter:{ 'status': "In Store" } + // return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ filters: filter } +} \ No newline at end of file diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js index 8ecb6ea230e..ffa23d8f4b4 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/buying/doctype/supplier_quotation/supplier_quotation.js @@ -56,18 +56,23 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) { cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { - return "select `tabProject`.name from `tabProject` \ - where `tabProject`.status not in (\"Completed\", \"Cancelled\") \ - and `tabProject`.name like \"%s\" \ - order by `tabProject`.name ASC LIMIT 50"; + return{ + filters:[ + ['Project', 'status', 'not in', 'Completed, Cancelled'], + ] + } } cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return "select distinct `name` from `tabMaterial Request` \ - where material_request_type='Purchase' and company = \"" + doc.company + - "\" and `docstatus` = 1 and `status` != \"Stopped\" and \ - ifnull(`per_ordered`,0) < 99.99 and \ - %(key)s LIKE \"%s\" order by `name` desc limit 50"; + return{ + filters:[ + ['Material Request', 'material_request_type', '=', 'Purchase'], + ['Material Request', 'company', '=', doc.company], + ['Material Request', 'docstatus', '=', 1], + ['Material Request', 'status', '!=', 'Stopped'], + ['Material Request', 'per_ordered', '<', 99.99] + ] + } } cur_frm.cscript.supplier_address = function(doc, dt, dn) { @@ -79,12 +84,13 @@ cur_frm.cscript.supplier_address = function(doc, dt, dn) { cur_frm.cscript.contact_person = cur_frm.cscript.supplier_address; cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { - return "SELECT name, address_line1, city FROM tabAddress WHERE supplier = \"" + doc.supplier - + "\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50"; + return { + filters:{'supplier': doc.supplier} + } } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return "SELECT name, CONCAT(first_name, \" \", ifnull(last_name,\"\")) As FullName, \ - department, designation FROM tabContact WHERE supplier = \"" + doc.supplier - +"\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50"; + return { + filters:{'supplier': doc.supplier} + } } diff --git a/controllers/queries.py b/controllers/queries.py new file mode 100644 index 00000000000..896147fb2b1 --- /dev/null +++ b/controllers/queries.py @@ -0,0 +1,180 @@ + # ERPNext - web based ERP (http://erpnext.com) + # Copyright (C) 2012 Web Notes Technologies Pvt Ltd + + # This program is free software: you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation, either version 3 of the License, or + # (at your option) any later version. + + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + + # You should have received a copy of the GNU General Public License + # along with this program. If not, see . + +from __future__ import unicode_literals +import webnotes + +def get_filters_cond(doctype, filters, conditions): + if filters: + if isinstance(filters, dict): + filters = map(lambda f: [doctype, f[0], "=", f[1]], filters.items()) + + from webnotes.widgets.reportview import build_filter_conditions + build_filter_conditions(filters, conditions) + cond = ' and ' + ' and '.join(conditions) + else: + cond = '' + return cond + +def get_match_cond(doctype, searchfield = 'name'): + meta = webnotes.get_doctype(doctype) + from webnotes.widgets.search import get_std_fields_list + fields = get_std_fields_list(meta, searchfield) + + from webnotes.widgets.reportview import build_match_conditions + cond = build_match_conditions(doctype, fields) + 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` + where status = 'Active' and docstatus < 2 and + (%(key)s like "%(txt)s" or employee_name like "%(txt)s") %(mcond)s + order by + case when name like "%(txt)s" then 0 else 1 end, + case when employee_name like "%(txt)s" then 0 else 1 end, + name 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 leads which are not converted +def lead_query(doctype, txt, searchfield, start, page_len, filters): + return webnotes.conn.sql("""select name, lead_name, company_name from `tabLead` + where docstatus < 2 and ifnull(status, '') != 'Converted' and + (%(key)s like "%(txt)s" or lead_name like "%(txt)s" or company_name like "%(txt)s") %(mcond)s + order by + case when name like "%(txt)s" then 0 else 1 end, + case when lead_name like "%(txt)s" then 0 else 1 end, + case when company_name like "%(txt)s" then 0 else 1 end, + lead_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 customer +def customer_query(doctype, txt, searchfield, start, page_len, filters): + cust_master_name = webnotes.defaults.get_user_default("cust_master_name") + if cust_master_name == "Customer Name": + fields = ["name", "customer_group", "territory"] + else: + fields = ["name", "customer_name", "customer_group", "territory"] + fields = ", ".join(fields) + + return webnotes.conn.sql("""select %(field)s from `tabCustomer` where docstatus < 2 and + (%(key)s like "%(txt)s" or customer_name like "%(txt)s") %(mcond)s + order by + case when name like "%(txt)s" then 0 else 1 end, + case when customer_name like "%(txt)s" then 0 else 1 end, + name, customer_name limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield, + 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) + +# searches for supplier +def supplier_query(doctype, txt, searchfield, start, page_len, filters): + supp_master_name = webnotes.defaults.get_user_default("supp_master_name") + if supp_master_name == "Supplier Name": + fields = ["name", "supplier_type"] + else: + fields = ["name", "supplier_name", "supplier_type"] + fields = ", ".join(fields) + + return webnotes.conn.sql("""select %(field)s from `tabSupplier` where docstatus < 2 and \ + (%(key)s like "%(txt)s" or supplier_name like "%(txt)s") %(mcond)s + order by + case when name like "%(txt)s" then 0 else 1 end, + case when supplier_name like "%(txt)s" then 0 else 1 end, + name, supplier_name limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield, + 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 'start': start, + 'page_len': page_len}) + +def item_std(doctype, txt, searchfield, start, page_len, filters): + return webnotes.conn.sql("""select tabItem.name, + if(length(tabItem.item_name) > 40, + concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name, + if(length(tabItem.description) > 40, + concat(substr(tabItem.description, 1, 40), "..."), description) as decription + FROM tabItem + WHERE tabItem.docstatus!=2 + AND tabItem.%(key)s LIKE "%(txt)s" %(mcond)s limit %(start)s, %(page_len)s """ % + {'key': searchfield, 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) + +def account_query(doctype, txt, searchfield, start, page_len, filters): + conditions = [] + if not filters: + filters = {} + if not filters.group_or_ledger: + filters.group_or_ledger = "Ledger" + + return webnotes.conn.sql("""select tabAccount.name, tabAccount.parent_account, + tabAccount.debit_or_credit from tabAccount + where tabAccount.docstatus!=2 and tabAccount.%(key)s LIKE "%(txt)s" + %(fcond)s %(mcond)s limit %(start)s, %(page_len)s""" % {'key': searchfield, + 'txt': "%%%s%%" % txt, 'fcond': get_filters_cond(doctype, filters, conditions), + 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) + +def item_query(doctype, txt, searchfield, start, page_len, filters): + conditions = [] + return webnotes.conn.sql("""select tabItem.name, + if(length(tabItem.item_name) > 40, + concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name, + if(length(tabItem.description) > 40, \ + concat(substr(tabItem.description, 1, 40), "..."), description) as decription + FROM tabItem + WHERE tabItem.docstatus!=2 + AND (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00") + OR `tabItem`.`end_of_life` > NOW()) + AND (tabItem.%(key)s LIKE "%(txt)s" OR tabItem.item_name LIKE "%(txt)s") %(fcond)s + %(mcond)s limit %(start)s,%(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, + 'fcond': get_filters_cond(doctype, filters, conditions), + 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) + +def bom(doctype, txt, searchfield, start, page_len, filters): + conditions = [] + return webnotes.conn.sql("""select tabBOM.name, tabBOM.item + from tabBOM + where tabBOM.docstatus=1 and tabBOM.is_active=1 + and tabBOM.%(key)s like "%s" %(fcond)s %(mcond)s limit %(start)s, + %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, + 'fcond': get_filters_cond(doctype, filters, conditions), 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) + +# erpnext.queries.task = function() { +# return { query: "projects.utils.query_task" }; +# }; + +def get_project_name(doctype, txt, searchfield, start, page_len, filters): + cond = '' + if filters['customer']: + cond = '(`tabProject`.customer = filter[customer] or ifnull(`tabProject`.customer,"")="") ' + return webnotes.conn.sql("""select `tabProject`.name from `tabProject` + where `tabProject`.status not in ("Completed", "Cancelled") and %(cond)s %(mcond)s + `tabProject`.name like "%(txt)s" order by `tabProject`.name asc limit %(start)s, %(page_len)s """ % + {'cond': cond,'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) \ No newline at end of file diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js index d14590cb080..acb770d2f1b 100644 --- a/manufacturing/doctype/bom/bom.js +++ b/manufacturing/doctype/bom/bom.js @@ -169,30 +169,37 @@ var calculate_total = function(doc) { cur_frm.fields_dict['item'].get_query = function(doc) { - return erpnext.queries.item({ - 'ifnull(tabItem.is_manufactured_item, "No")': 'Yes', - }) + return{ + query:"controllers.queries.item_query", + filters:{ + 'has_serial_no': 'Yes' + } + } } cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) { - return 'SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; + return{ + filters:[ + ['Project', 'status', 'not in', 'Completed, Cancelled'] + ] + } } cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) { - return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` \ - WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" \ - OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" \ - ORDER BY `tabItem`.`name` LIMIT 50'; + return{ + query:"controllers.queries.item_query" + } } cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - return 'SELECT DISTINCT `tabBOM`.`name`, `tabBOM`.`remarks` FROM `tabBOM` \ - WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = 1 AND \ - `tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" \ - ORDER BY `tabBOM`.`name` LIMIT 50'; + return{ + filters:{ + 'item': d.item_code, + 'is_active': 1, + 'docstatus': 1 + } + } } cur_frm.cscript.validate = function(doc, dt, dn) { diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py index 5f641486b52..00523c55de0 100644 --- a/manufacturing/doctype/bom/bom.py +++ b/manufacturing/doctype/bom/bom.py @@ -85,10 +85,10 @@ class DocType: msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1) def set_bom_material_details(self): - for item in self.doclist.get({"parentfield": "bom_materials"}): - ret = self.get_bom_material_detail({ "item_code": item.item_code, "bom_no": item.bom_no, - "qty": item.qty }) - + for item in self.doclist.get({"parentfield": "bom_materials"}): + ret = self.get_bom_material_detail({"item_code": item.item_code, "bom_no": item.bom_no, + "qty": item.qty}) + for r in ret: if not item.fields.get(r): item.fields[r] = ret[r] @@ -100,7 +100,7 @@ class DocType: args = webnotes.form_dict.get('args') import json args = json.loads(args) - + item = self.get_item_det(args['item_code']) self.validate_rm_item(item) From ab462d2000cfd11196214fb7977e2bd22f8fd4ec Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 9 Jul 2013 16:18:52 +0530 Subject: [PATCH 04/27] [get_query]to server side --- accounts/doctype/pos_setting/pos_setting.js | 4 +- .../purchase_invoice/purchase_invoice.js | 9 ++- .../doctype/sales_invoice/sales_invoice.js | 41 ----------- controllers/queries.py | 6 +- hr/doctype/appraisal/appraisal.js | 6 +- hr/doctype/attendance/attendance.js | 6 +- hr/doctype/employee/employee.js | 6 +- hr/doctype/expense_claim/expense_claim.js | 6 +- .../leave_allocation/leave_allocation.js | 6 +- hr/doctype/salary_slip/salary_slip.js | 6 +- .../salary_structure/salary_structure.js | 6 +- .../production_order/production_order.js | 16 +++-- .../production_planning_tool.js | 13 +++- projects/doctype/project/project.js | 6 +- projects/doctype/task/task.js | 6 +- projects/doctype/task/task.py | 9 +++ selling/doctype/customer/customer.js | 11 ++- .../installation_note/installation_note.js | 37 +++++++--- selling/doctype/lead/lead.js | 9 ++- selling/doctype/opportunity/opportunity.js | 54 +++++++++----- selling/doctype/opportunity/opportunity.py | 11 ++- selling/doctype/quotation/quotation.js | 56 +++++---------- selling/doctype/quotation/quotation.py | 31 +++++++- selling/doctype/sales_bom/sales_bom.js | 9 ++- selling/doctype/sales_bom/sales_bom.py | 10 +++ selling/doctype/sales_common/sales_common.js | 3 +- selling/doctype/sales_order/sales_order.js | 16 +++-- .../authorization_rule/authorization_rule.js | 44 +++++++++--- setup/doctype/company/company.js | 50 ++++++++----- .../contact_control/contact_control.js | 7 +- .../doctype/customer_group/customer_group.js | 14 ++-- setup/doctype/item_group/item_group.js | 8 ++- setup/doctype/sales_partner/sales_partner.js | 5 +- setup/doctype/sales_person/sales_person.js | 16 ++++- setup/doctype/territory/territory.js | 13 +++- stock/doctype/batch/batch.js | 9 ++- stock/doctype/delivery_note/delivery_note.js | 32 +++++---- stock/doctype/item/item.js | 53 ++++++++++---- .../landed_cost_wizard/landed_cost_wizard.js | 10 ++- stock/doctype/packing_slip/packing_slip.js | 14 ++-- stock/doctype/packing_slip/packing_slip.py | 11 ++- .../purchase_receipt/purchase_receipt.js | 32 ++++++--- stock/doctype/serial_no/serial_no.js | 26 +++++-- stock/doctype/stock_entry/stock_entry.js | 49 ++++++++----- stock/doctype/stock_entry/stock_entry.py | 32 +++++++-- .../stock_reconciliation.js | 4 +- .../stock_uom_replace_utility.js | 4 +- .../doctype/customer_issue/customer_issue.js | 70 ++++++++++++------- .../maintenance_schedule.js | 27 +++++-- .../maintenance_schedule.py | 14 +++- .../maintenance_visit/maintenance_visit.js | 60 +++++++++++----- .../doctype/support_ticket/support_ticket.js | 3 +- 52 files changed, 692 insertions(+), 314 deletions(-) diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index a51d93edce5..59c4e01d0c0 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -97,4 +97,6 @@ cur_frm.fields_dict["expense_account"].get_query = function(doc) { } } -cur_frm.fields_dict.user.get_query = erpnext.utils.profile_query; \ No newline at end of file +cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.profile_query"} +} \ No newline at end of file diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 27ca6fcf62f..60f0c4f5caa 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -166,9 +166,12 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { } cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return erpnext.queries.item({ - 'ifnull(tabItem.is_purchase_item, "No")': 'Yes' - }) + return { + query:"controllers.queries.item_query", + filters:{ + 'is_purchase_item': 'Yes' + } + } } cur_frm.fields_dict['credit_to'].get_query = function(doc) { diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 7203a1ce9ee..947574fe023 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -366,47 +366,6 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio } } -// Sales Order -// ----------- -cur_frm.fields_dict.sales_order_main.get_query = function(doc) { - var filter = [ - ['Sales Order','company','=',doc.company], - ['Sales Order','docstatus','=',1], - ['Sales Order','status','!=','Stopped'], - ['Sales Order','per_billed','<',99.99] - ]; - var cond = []; - if (doc.customer) cond = ['Sales Order', 'customer', '=', doc.customer]; - // return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 99.99 and `tabSales Order`.`customer` = "' + doc.customer + '" and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50'; - filter.push(cond); - return{ - filters: filter - } -} - -// Delivery Note -// -------------- -cur_frm.fields_dict.delivery_note_main.get_query = function(doc) { - var filter = [ - ['Delivery Note', 'company', '=', doc.company], - ['Delivery Note', 'docstatus', '=', 1], - ['Delivery Note', 'per_billed', '<', 99.99] - ]; - var cond = []; - if (doc.customer) ['Delivery Note', 'customer', '=', doc.customer]; - // return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` \ - // WHERE `tabDelivery Note`.company = "' + doc.company - // + '" and `tabDelivery Note`.`docstatus` = 1 and \ - // ifnull(`tabDelivery Note`.per_billed,0) < 99.99 and \ - // `tabDelivery Note`.`customer` = "' - // + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" \ - // ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50'; - filter.push(cond); - return{ - filters: filter - } -} - cur_frm.cscript.income_account = function(doc, cdt, cdn){ cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account"); } diff --git a/controllers/queries.py b/controllers/queries.py index 896147fb2b1..ac8ab251221 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -173,8 +173,8 @@ def bom(doctype, txt, searchfield, start, page_len, filters): def get_project_name(doctype, txt, searchfield, start, page_len, filters): cond = '' if filters['customer']: - cond = '(`tabProject`.customer = filter[customer] or ifnull(`tabProject`.customer,"")="") ' + cond = '(`tabProject`.customer = "' + filters['customer'] + '" or ifnull(`tabProject`.customer,"")="") and' return webnotes.conn.sql("""select `tabProject`.name from `tabProject` - where `tabProject`.status not in ("Completed", "Cancelled") and %(cond)s %(mcond)s - `tabProject`.name like "%(txt)s" order by `tabProject`.name asc limit %(start)s, %(page_len)s """ % + where `tabProject`.status not in ("Completed", "Cancelled") and %(cond)s + `tabProject`.name like "%(txt)s" %(mcond)s order by `tabProject`.name asc limit %(start)s, %(page_len)s """ % {'cond': cond,'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) \ No newline at end of file diff --git a/hr/doctype/appraisal/appraisal.js b/hr/doctype/appraisal/appraisal.js index 601f3fc3cbb..ac2b1234d20 100644 --- a/hr/doctype/appraisal/appraisal.js +++ b/hr/doctype/appraisal/appraisal.js @@ -83,4 +83,8 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){ refresh_field('total_score'); } -cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file +cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.employee_query" + } +} \ No newline at end of file diff --git a/hr/doctype/attendance/attendance.js b/hr/doctype/attendance/attendance.js index 3ba986891b9..94b32a36c02 100644 --- a/hr/doctype/attendance/attendance.js +++ b/hr/doctype/attendance/attendance.js @@ -22,4 +22,8 @@ cur_frm.cscript.employee = function(doc,cdt,cdn){ refresh_field('employee_name'); } -cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file +cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.employee_query" + } +} \ No newline at end of file diff --git a/hr/doctype/employee/employee.js b/hr/doctype/employee/employee.js index 5a2dbab87f7..3c19548bc59 100644 --- a/hr/doctype/employee/employee.js +++ b/hr/doctype/employee/employee.js @@ -18,8 +18,10 @@ wn.provide("erpnext.hr"); erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({ setup: function() { this.setup_leave_approver_select(); - this.frm.fields_dict.user_id.get_query = erpnext.utils.profile_query; - this.frm.fields_dict.reports_to.get_query = erpnext.utils.employee_query; + this.frm.fields_dict.user_id.get_query = function(doc,cdt,cdn) { + return { query:"controllers.queries.profile_query"} } + this.frm.fields_dict.reports_to.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.employee_query"} } }, onload: function() { diff --git a/hr/doctype/expense_claim/expense_claim.js b/hr/doctype/expense_claim/expense_claim.js index 5b136d0a2e1..406b57a1e73 100644 --- a/hr/doctype/expense_claim/expense_claim.js +++ b/hr/doctype/expense_claim/expense_claim.js @@ -35,7 +35,11 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){ } }); - cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; + cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.employee_query" + } + } } cur_frm.cscript.clear_sanctioned = function(doc) { diff --git a/hr/doctype/leave_allocation/leave_allocation.js b/hr/doctype/leave_allocation/leave_allocation.js index a26d211bbde..80445c159c8 100755 --- a/hr/doctype/leave_allocation/leave_allocation.js +++ b/hr/doctype/leave_allocation/leave_allocation.js @@ -79,4 +79,8 @@ calculate_total_leaves_allocated = function(doc, dt, dn) { } } -cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file +cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.employee_query" + } +} \ No newline at end of file diff --git a/hr/doctype/salary_slip/salary_slip.js b/hr/doctype/salary_slip/salary_slip.js index fc582713364..9885763ff29 100644 --- a/hr/doctype/salary_slip/salary_slip.js +++ b/hr/doctype/salary_slip/salary_slip.js @@ -139,4 +139,8 @@ cur_frm.cscript.validate = function(doc, dt, dn) { calculate_all(doc, dt, dn); } -cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file +cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.employee_query" + } +} \ No newline at end of file diff --git a/hr/doctype/salary_structure/salary_structure.js b/hr/doctype/salary_structure/salary_structure.js index 29792431732..065bb47711e 100644 --- a/hr/doctype/salary_structure/salary_structure.js +++ b/hr/doctype/salary_structure/salary_structure.js @@ -72,4 +72,8 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) { calculate_totals(doc, cdt, cdn); } -cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file +cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.employee_query" + } +} \ No newline at end of file diff --git a/manufacturing/doctype/production_order/production_order.js b/manufacturing/doctype/production_order/production_order.js index 77dce03d587..e3518591b3b 100644 --- a/manufacturing/doctype/production_order/production_order.js +++ b/manufacturing/doctype/production_order/production_order.js @@ -101,13 +101,21 @@ cur_frm.cscript.make_se = function(doc, purpose) { } cur_frm.fields_dict['production_item'].get_query = function(doc) { - return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50'; + return { + filters:[ + ['Item', 'is_pro_applicable', '=', 'Yes'] + ] + } + // return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50'; } cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) { - return 'SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; + return{ + filters:['Project', 'status', 'not in', 'Completed, Cancelled'] + } + // return 'SELECT `tabProject`.name FROM `tabProject` \ + // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ + // AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; } diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.js b/manufacturing/doctype/production_planning_tool/production_planning_tool.js index 95b84b20784..91587483921 100644 --- a/manufacturing/doctype/production_planning_tool/production_planning_tool.js +++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.js @@ -53,11 +53,18 @@ cur_frm.fields_dict['pp_details'].grid.get_field('item_code').get_query = functi cur_frm.fields_dict['pp_details'].grid.get_field('bom_no').get_query = function(doc) { var d = locals[this.doctype][this.docname]; if (d.item_code) { - return erpnext.queries.bom({item: cstr(d.item_code)}); + return { + query:"controllers.queries.bom", + filters:{'item': cstr(d.item_code)} + } } else msgprint(" Please enter Item first"); } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.customer_query" + } +} cur_frm.fields_dict.pp_so_details.grid.get_field("customer").get_query = - erpnext.utils.customer_query; \ No newline at end of file + cur_frm.fields_dict.customer.get_query; \ No newline at end of file diff --git a/projects/doctype/project/project.js b/projects/doctype/project/project.js index a6f32cb2db3..9d04477a293 100644 --- a/projects/doctype/project/project.js +++ b/projects/doctype/project/project.js @@ -28,4 +28,8 @@ cur_frm.cscript.refresh = function(doc) { } } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; \ No newline at end of file +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.customer_query" + } +} \ No newline at end of file diff --git a/projects/doctype/task/task.js b/projects/doctype/task/task.js index 131b5fdfb5b..097119ffb66 100644 --- a/projects/doctype/task/task.js +++ b/projects/doctype/task/task.js @@ -21,9 +21,9 @@ cur_frm.add_fetch("project", "company", "company"); erpnext.projects.Task = wn.ui.form.Controller.extend({ setup: function() { this.frm.fields_dict.project.get_query = function() { - return "select name from `tabProject` \ - where %(key)s like \"%s\" \ - order by name asc limit 50"; + return { + query: "projects.doctype.tast.task.get_project" + } }; }, diff --git a/projects/doctype/task/task.py b/projects/doctype/task/task.py index 1df8547690c..1dfcdc1af1e 100644 --- a/projects/doctype/task/task.py +++ b/projects/doctype/task/task.py @@ -92,3 +92,12 @@ def get_events(start, end, filters=None): }, as_dict=True, update={"allDay": 0}) return data + +def get_project(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + return webnotes.conn.sql(""" select name from `tabProject` + where %(key)s like %(txt)s %(mcond)s + order by name limit %(start)s, %(page_len)s + """ % {'key': searchfield, 'txt': "%%%s%%" % txt, + 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) \ No newline at end of file diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js index 914836c934a..f92a2a90e66 100644 --- a/selling/doctype/customer/customer.js +++ b/selling/doctype/customer/customer.js @@ -122,8 +122,15 @@ cur_frm.cscript.make_contact = function() { } cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) { - return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; + return{ + filters:{'is_group': 'No'} + } + // return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; } -cur_frm.fields_dict.lead_name.get_query = erpnext.utils.lead_query; \ No newline at end of file +cur_frm.fields_dict.lead_name.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.lead_query" + } +} \ No newline at end of file diff --git a/selling/doctype/installation_note/installation_note.js b/selling/doctype/installation_note/installation_note.js index 4fd8678eafc..8574da31233 100644 --- a/selling/doctype/installation_note/installation_note.js +++ b/selling/doctype/installation_note/installation_note.js @@ -62,16 +62,27 @@ cur_frm.cscript.onload = function(doc, dt, dn) { cur_frm.fields_dict['delivery_note_no'].get_query = function(doc) { doc = locals[this.doctype][this.docname]; - var cond = ''; - if(doc.customer) { - cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND'; + var filter = { + 'company': doc.company, + 'docstatus': 1, + 'per_installed': 99.99 + }; + if(doc.customer) filter['customer'] = doc.customer; + return{ + filters:filter } - return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name FROM `tabDelivery Note`, `tabDelivery Note Item` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 99.99 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond}); + // { + // cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND'; + // } + // return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name FROM `tabDelivery Note`, `tabDelivery Note Item` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 99.99 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond}); } cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters{ 'is_group': "No" } + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { @@ -79,11 +90,21 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc } cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters: { 'customer': doc.customer } + } + // return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters: { 'customer': doc.customer } + } + // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; \ No newline at end of file +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.customer_query" + } +} \ No newline at end of file diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 40cf454f01c..a20b3314a4b 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -20,16 +20,19 @@ wn.require('app/setup/doctype/contact_control/contact_control.js'); wn.provide("erpnext"); erpnext.LeadController = wn.ui.form.Controller.extend({ setup: function() { - this.frm.fields_dict.customer.get_query = erpnext.utils.customer_query; + this.frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return { query:"controllers.queries.customer_query" } } }, onload: function() { if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) { - cur_frm.fields_dict.lead_owner.get_query = erpnext.utils.profile_query; + cur_frm.fields_dict.lead_owner.get_query = function(doc,cdt,cdn) { + return { query:"controllers.queries.profile_query" } } } if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) { - cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query; + cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) { + return { query:"controllers.queries.profile_query" } } } if(in_list(user_roles,'System Manager')) { diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js index bc10c9b0bb2..f88402d882c 100644 --- a/selling/doctype/opportunity/opportunity.js +++ b/selling/doctype/opportunity/opportunity.js @@ -109,7 +109,8 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) { - cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query; + cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) { + return { query:"controllers.queries.profile_query" } } } if(doc.customer && !doc.customer_name) cur_frm.cscript.customer(doc); @@ -153,23 +154,30 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc } cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name, address_line1, city FROM tabAddress \ - WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \ - %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; + return { + filters:{'customer':doc.customer} + } + // return 'SELECT name, address_line1, city FROM tabAddress \ + // WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \ + // %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { if (!doc.customer) msgprint("Please select customer first"); else { - return 'SELECT name, CONCAT(first_name," ",ifnull(last_name,"")) As FullName, \ - department, designation FROM tabContact WHERE customer = "'+ doc.customer + - '" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; + filters:{'customer':doc.customer} + // return 'SELECT name, CONCAT(first_name," ",ifnull(last_name,"")) As FullName, \ + // department, designation FROM tabContact WHERE customer = "'+ doc.customer + + // '" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; } } // lead cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){ - return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50'; + return { + query: "selling.doctype.opportunity.opportunity.get_lead" + } + // return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50'; } cur_frm.cscript.lead = function(doc, cdt, cdn) { @@ -185,14 +193,17 @@ cur_frm.cscript.lead = function(doc, cdt, cdn) { } cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { - if (doc.enquiry_type == 'Maintenance') - return erpnext.queries.item({ - 'ifnull(tabItem.is_service_item, "No")': 'Yes' - }); - else - return erpnext.queries.item({ - 'ifnull(tabItem.is_sales_item, "No")': 'Yes' - }); + if (doc.enquiry_type == 'Maintenance') { + return { + query:"controllers.queries.item_query", + filters:{ 'is_service_item': 'Yes' } + } + } else { + return { + query:"controllers.queries.item_query", + filters:{ 'is_sales_item': 'Yes' } + } + } } cur_frm.cscript['Declare Opportunity Lost'] = function(){ @@ -229,8 +240,13 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){ //get query select Territory cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';} + return{ + filters:{'is_group': 'No'} + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';} -cur_frm.fields_dict.lead.get_query = erpnext.utils.lead_query; +cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) { + return { query:"controllers.queries.lead_query" } } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; \ No newline at end of file +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return { query:"controllers.queries.customer_query" } } \ No newline at end of file diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py index cced9abfa86..6217821499a 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -202,4 +202,13 @@ def make_quotation(source_name, target_doclist=None): } }, target_doclist) - return [d.fields for d in doclist] \ No newline at end of file + return [d.fields for d in doclist] + +def get_lead(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + return webnotes.conn.sql ("""select `tabLead`.name, `tabLead`.lead_name FROM `tabLead` + where `tabLead`.%(key)s like "%(txt)s" %(mcond)s + order by `tabLead`.`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}) \ No newline at end of file diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index 877f65c2528..ccb4998eaf8 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -118,7 +118,8 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc }),'', doc, dt, dn, 1); } -cur_frm.fields_dict.lead.get_query = erpnext.utils.lead_query; +cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.lead_query" } } cur_frm.cscript.lead = function(doc, cdt, cdn) { if(doc.lead) { @@ -186,45 +187,22 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= if(doc.customer) { var export_rate_field = wn.meta.get_docfield(cdt, 'export_rate', cdn); var precision = (export_rate_field && export_rate_field.fieldtype) === 'Float' ? 6 : 2; - return repl("\ - select \ - item.name, \ - ( \ - select concat('Last Quote @ ', q.currency, ' ', \ - format(q_item.export_rate, %(precision)s)) \ - from `tabQuotation` q, `tabQuotation Item` q_item \ - where \ - q.name = q_item.parent \ - and q_item.item_code = item.name \ - and q.docstatus = 1 \ - and q.customer = \"%(cust)s\" \ - order by q.transaction_date desc \ - limit 1 \ - ) as quote_rate, \ - ( \ - select concat('Last Sale @ ', si.currency, ' ', \ - format(si_item.basic_rate, %(precision)s)) \ - from `tabSales Invoice` si, `tabSales Invoice Item` si_item \ - where \ - si.name = si_item.parent \ - and si_item.item_code = item.name \ - and si.docstatus = 1 \ - and si.customer = \"%(cust)s\" \ - order by si.posting_date desc \ - limit 1 \ - ) as sales_rate, \ - item.item_name, item.description \ - from `tabItem` item \ - where \ - item.%(key)s like \"%s\" \ - %(cond)s \ - limit 25", { - cust: doc.customer, - cond: cond, - precision: precision - }); + return { + query: "selling.doctype.quotation.quotation.quotation_details", + filters:{ + cust: doc.customer, + cond: cond, + precision: precision + } + } } else { - return repl("SELECT name, item_name, description FROM `tabItem` item WHERE item.%(key)s LIKE '%s' %(cond)s ORDER BY item.item_code DESC LIMIT 50", {cond:cond}); + return { + query: 'selling.doctype.quotation.quotation.quotation_details', + filters:{ + cond: cond, + } + } + // return repl("SELECT name, item_name, description FROM `tabItem` item WHERE item.%(key)s LIKE '%s' %(cond)s ORDER BY item.item_code DESC LIMIT 50", {cond:cond}); } } diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 3f0974ed0c5..152e909a2b5 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -259,4 +259,33 @@ def make_sales_order(source_name, target_doclist=None): # postprocess: fetch shipping address, set missing values - return [d.fields for d in doclist] \ No newline at end of file + return [d.fields for d in doclist] + +def quotation_details(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + + if filters.has_key('cust') and filters.has_key('precision'): + return webnotes.conn.sql("""select item.name, + (select concat('Last Quote @ ', q.currency, ' ', format(q_item.export_rate, %(precision)s)) + from `tabQuotation` q, `tabQuotation Item` q_item + where q.name = q_item.parent and q_item.item_code = item.name + and q.docstatus = 1 and q.customer = "%(cust)s" + order by q.transaction_date desc + limit 1) as quote_rate, + (select concat('Last Sale @ ', si.currency, ' ', format(si_item.basic_rate, %(precision)s)) + from `tabSales Invoice` si, `tabSales Invoice Item` si_item + where si.name = si_item.parent and si_item.item_code = item.name + and si.docstatus = 1 and si.customer ="%(cust)s" + order by si.posting_date desc + limit 1) as sales_rate, + item.item_name, item.description + from `tabItem` item + where %(cond)s %(mcond)s and item.%(searchfield)s like '%(txt)s' order by item.name desc limit %(start)s, + %(page_len)s """ % {'precision': filters["precision"], 'cust': filters['cust'], + 'cond': filters['cond'], 'searchfield': searchfield, 'txt': "%%%s%%" % txt, + 'mcond': get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) + + else: + webnotes.conn.sql(""" select name, item_name, description from `tabItem` item + where %s %s and %s like %s order by name desc limit %s, %s""" % + ("%s", get_match_cond(doctype, searchfield), searchfield, "%s", "%s", "%s"), (filters["cond"], "%%%s%%" % txt, start, page_len)) \ No newline at end of file diff --git a/selling/doctype/sales_bom/sales_bom.js b/selling/doctype/sales_bom/sales_bom.js index b6ba77953fa..f60b6e31227 100644 --- a/selling/doctype/sales_bom/sales_bom.js +++ b/selling/doctype/sales_bom/sales_bom.js @@ -24,9 +24,12 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } cur_frm.fields_dict.new_item_code.get_query = function() { - return 'select name, description from tabItem where is_stock_item="No" and is_sales_item="Yes"\ - and name not in (select name from `tabSales BOM`)\ - and `%(key)s` like "%s"' + return{ + query: "selling.doctype.sales_bom.sales_bom.get_new_item_code" + } + // return 'select name, description from tabItem where is_stock_item="No" and is_sales_item="Yes"\ + // and name not in (select name from `tabSales BOM`)\ + // and `%(key)s` like "%s"' } cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Stock Item" is "No" \ and "Is Sales Item" is "Yes" and there is no other Sales BOM'; diff --git a/selling/doctype/sales_bom/sales_bom.py b/selling/doctype/sales_bom/sales_bom.py index 03479ebb95d..13f68aa78cc 100644 --- a/selling/doctype/sales_bom/sales_bom.py +++ b/selling/doctype/sales_bom/sales_bom.py @@ -83,3 +83,13 @@ class DocType: if l not in l2: return 0 return 1 + +def get_new_item_code(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + + return webnotes.conn.sql("""select name, description from tabItem + where is_stock_item="No" and is_sales_item="Yes" + and name not in (select name from `tabSales BOM`) and %s like "%s" + %s limit %s, %s""" % (searchfield, "%s", + get_match_cond(doctype, searchfield),"%s", "%s"), + ("%%%s%%" % txt, start, page_len)) \ No newline at end of file diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index cf757a6ceae..02db55a29dc 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -59,7 +59,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }); } - this.frm.fields_dict.customer.get_query = erpnext.utils.customer_query; + this.frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.customer_query" } } this.frm.fields_dict.lead && this.frm.set_query("lead", erpnext.utils.lead_query); diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js index 27db426eb7e..509ecf709f3 100644 --- a/selling/doctype/sales_order/sales_order.js +++ b/selling/doctype/sales_order/sales_order.js @@ -154,12 +154,12 @@ cur_frm.cscript.new_contact = function(){ } cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) { - var cond = ''; - if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND'; - return repl('SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND %(cond)s `tabProject`.name LIKE "%s" \ - ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond}); + return { + query: "controllers.queries.get_project_name", + filters: { + 'customer': doc.customer + } + } } cur_frm.cscript['Stop Sales Order'] = function() { @@ -193,7 +193,9 @@ cur_frm.cscript['Unstop Sales Order'] = function() { } cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters:{ 'is_group': "No"} + } } cur_frm.cscript.on_submit = function(doc, cdt, cdn) { diff --git a/setup/doctype/authorization_rule/authorization_rule.js b/setup/doctype/authorization_rule/authorization_rule.js index 184c761b9d9..76a87080c39 100644 --- a/setup/doctype/authorization_rule/authorization_rule.js +++ b/setup/doctype/authorization_rule/authorization_rule.js @@ -81,32 +81,56 @@ cur_frm.cscript.transaction = function(doc,cdt,cdn){ } -cur_frm.fields_dict.system_user.get_query = erpnext.utils.profile_query; +cur_frm.fields_dict.system_user.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.profile_query" } } -cur_frm.fields_dict.approving_user.get_query = erpnext.utils.profile_query; +cur_frm.fields_dict.approving_user.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.profile_query" } } + +cur_frm.fields_dict['approving_role'].get_query = cur_frm.fields_dict['system_role'].get_query; // System Role Trigger // ----------------------- cur_frm.fields_dict['system_role'].get_query = function(doc) { - return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50' + return{ + filters:[ + ['Role', 'name', 'not in', 'Administrator, Guest, All'] + ] + } + + // return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50' } // Approving Role Trigger // ----------------------- -cur_frm.fields_dict['approving_role'].get_query = function(doc) { - return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50' -} +// cur_frm.fields_dict['approving_role'].get_query = function(doc) { +// return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50' +// } // Master Name Trigger // -------------------- cur_frm.fields_dict['master_name'].get_query = function(doc){ if(doc.based_on == 'Customerwise Discount') - return 'SELECT `tabCustomer`.`name` FROM `tabCustomer` WHERE `tabCustomer`.docstatus !=2 and `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` DESC LIMIT 50'; + return { + filters:[ + ['Customer', 'docstatus', '!=', 2] + ] + } + // return 'SELECT `tabCustomer`.`name` FROM `tabCustomer` WHERE `tabCustomer`.docstatus !=2 and `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` DESC LIMIT 50'; else if(doc.based_on == 'Itemwise Discount') - return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50'; + return { + query: "controllers.queries.item_query" + } + // return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50'; else - return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50'; + return { + filters: [ + ['Item', 'name', '=', 'cheating done to avoid null'] + ] + } + // return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50'; } -cur_frm.fields_dict.to_emp.get_query = erpnext.utils.employee_query; \ No newline at end of file +cur_frm.fields_dict.to_emp.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.employee_query" } } \ No newline at end of file diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js index 489ed0ce68b..60a32ae10aa 100644 --- a/setup/doctype/company/company.js +++ b/setup/doctype/company/company.js @@ -45,43 +45,60 @@ cur_frm.cscript.abbr = function(doc){ } } +cur_frm.fields_dict.default_cash_account.get_query = cur_frm.fields_dict.default_bank_account.get_query; + cur_frm.fields_dict.default_bank_account.get_query = function(doc) { - return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; + return{ + filters:{ + 'company': doc.name, + 'group_or_ledger': "Ledger", + 'account_type': "Bank or Cash" + } + } + // return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } -cur_frm.fields_dict.default_cash_account.get_query = function(doc) { - return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; -} +// cur_frm.fields_dict.default_cash_account.get_query = function(doc) { +// return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; +// } +cur_frm.fields_dict.payables_group.get_query = cur_frm.fields_dict.receivables_group.get_query; cur_frm.fields_dict.receivables_group.get_query = function(doc) { - return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; + return{ + filters:{ + 'company': doc.name, + 'group_or_ledger': "Group" + } + } + // return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } - -cur_frm.fields_dict.payables_group.get_query = function(doc) { - return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; -} +// cur_frm.fields_dict.payables_group.get_query = function(doc) { +// return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; +// } if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) { return { - "query": "accounts.utils.get_account_list", + // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "No", "debit_or_credit": "Debit", - "company": doc.name + "company": doc.name, + 'group_or_ledger': "Ledger" } } } cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) { return { - "query": "accounts.utils.get_account_list", + // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "Yes", "debit_or_credit": "Debit", - "company": doc.name + "company": doc.name, + 'group_or_ledger': "Ledger" } } } @@ -91,18 +108,19 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) { return { - "query": "accounts.utils.get_account_list", + // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "No", "debit_or_credit": "Credit", - "company": doc.name + "company": doc.name, + 'group_or_ledger': "Ledger" } } } cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) { return { - "query": "accounts.utils.get_cost_center_list", + // "query": "accounts.utils.get_cost_center_list", "filters": {"company": doc.name} } } diff --git a/setup/doctype/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js index c427ec09fd0..9d4d8bf94c7 100755 --- a/setup/doctype/contact_control/contact_control.js +++ b/setup/doctype/contact_control/contact_control.js @@ -24,7 +24,12 @@ cur_frm.cscript.country = function(doc, dt, dn) { // --------------------------- if(cur_frm.fields_dict['territory']){ cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return { + filters: { + 'is_group' = "No" + } + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } } diff --git a/setup/doctype/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js index af0c6f0b44b..18931eb0713 100644 --- a/setup/doctype/customer_group/customer_group.js +++ b/setup/doctype/customer_group/customer_group.js @@ -30,8 +30,14 @@ cur_frm.cscript.set_root_readonly = function(doc) { //get query select Customer Group cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` \ - FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND \ - `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" \ - ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; + return{ + searchfield:['name', 'parent_customer_group'], + filters: { + 'is_group': "Yes" + } + } + // return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` \ + // FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND \ + // `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" \ + // ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; } \ No newline at end of file diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js index 6bb6fe309d9..581039370bd 100644 --- a/setup/doctype/item_group/item_group.js +++ b/setup/doctype/item_group/item_group.js @@ -34,5 +34,11 @@ cur_frm.cscript.set_root_readonly = function(doc) { //get query select item group cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50'; + return{ + filters:[ + ['Item Group', 'is_group', '=', 'Yes'], + ['Item Group', 'naem', '!=', doc.item_group_name] + ] + } + // return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50'; } \ No newline at end of file diff --git a/setup/doctype/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js index c5f0dba7dd0..5db60c5951a 100644 --- a/setup/doctype/sales_partner/sales_partner.js +++ b/setup/doctype/sales_partner/sales_partner.js @@ -97,5 +97,8 @@ cur_frm.cscript.make_contact = function() { } cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_query = function(doc, dt, dn) { - return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' + return{ + filters:{ 'is_group': "No" } + } + // return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } \ No newline at end of file diff --git a/setup/doctype/sales_person/sales_person.js b/setup/doctype/sales_person/sales_person.js index c52948803f2..e0d06395e0c 100644 --- a/setup/doctype/sales_person/sales_person.js +++ b/setup/doctype/sales_person/sales_person.js @@ -35,11 +35,21 @@ cur_frm.cscript.onload = function(){ //get query select sales person cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY `tabSales Person`.`name` ASC LIMIT 50'; + return{ + filters:[ + ['Sales Person', 'is_group', '=', 'Yes'], + ['Sales Person', 'name', '!=', doc.sales_person_name] + ] + } + // return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY `tabSales Person`.`name` ASC LIMIT 50'; } cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { - return 'SELECT `tabItem Group`.name FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' + return{ + filters:{ 'is_group': "No" } + } + // return 'SELECT `tabItem Group`.name FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } -cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file +cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.employee_query" } } \ No newline at end of file diff --git a/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js index 2932006013b..3164ba279d3 100644 --- a/setup/doctype/territory/territory.js +++ b/setup/doctype/territory/territory.js @@ -30,11 +30,20 @@ cur_frm.cscript.set_root_readonly = function(doc) { //get query select territory cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters:[ + ['Territory', 'is_group', '=', 'Yes'], + ['Territory', 'name', '!=', doc.territory_name] + ] + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } // ******************** ITEM Group ******************************** cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { - return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' + return{ + filters:{ 'is_group': "No"} + } +// return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } diff --git a/stock/doctype/batch/batch.js b/stock/doctype/batch/batch.js index 93979da5b55..8b26d548cd6 100644 --- a/stock/doctype/batch/batch.js +++ b/stock/doctype/batch/batch.js @@ -15,7 +15,10 @@ // along with this program. If not, see . cur_frm.fields_dict['item'].get_query = function(doc, cdt, cdn) { - return erpnext.queries.item({ - 'ifnull(tabItem.is_stock_item, "No")': 'Yes' - }) + return { + query:"controllers.queries.item_query", + filters:{ + 'is_stock_item': 'Yes' + } + } } \ No newline at end of file diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index 117e77eacb2..1ecafd10b30 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -104,12 +104,12 @@ cur_frm.cscript.new_contact = function(){ // ***************** Get project name ***************** cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) { - var cond = ''; - if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND'; - return repl('SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND %(cond)s `tabProject`.name LIKE "%s" \ - ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond}); + return { + query: "controllers.queries.get_project_name", + filters: { + 'customer': doc.customer + } + } } cur_frm.cscript.serial_no = function(doc, cdt, cdn) { @@ -120,7 +120,9 @@ cur_frm.cscript.serial_no = function(doc, cdt, cdn) { } cur_frm.fields_dict['transporter_name'].get_query = function(doc) { - return 'SELECT DISTINCT `tabSupplier`.`name` FROM `tabSupplier` WHERE `tabSupplier`.supplier_type = "transporter" AND `tabSupplier`.docstatus != 2 AND `tabSupplier`.%(key)s LIKE "%s" ORDER BY `tabSupplier`.`name` LIMIT 50'; + return{ + filters: { 'supplier_type': "transporter" } + } } cur_frm.cscript['Make Packing Slip'] = function() { @@ -133,7 +135,9 @@ cur_frm.cscript['Make Packing Slip'] = function() { //get query select Territory cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters: { 'is_group': "No" } + } } var set_print_hide= function(doc, cdt, cdn){ @@ -221,11 +225,11 @@ if (sys_defaults.auto_inventory_accounting) { // expense account cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) { return { - "query": "accounts.utils.get_account_list", - "filters": { + filters: { "is_pl_account": "Yes", "debit_or_credit": "Debit", - "company": doc.company + "company": doc.company, + "group_or_ledger": "Ledger" } } } @@ -244,8 +248,10 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) { return { - query: "accounts.utils.get_cost_center_list", - filters: { company_name: doc.company} + filters: { + 'company_name': doc.company, + 'group_or_ledger': "Ledger" + } } } } \ No newline at end of file diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index 7a731d28ecf..a0937fb285c 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -51,39 +51,65 @@ cur_frm.cscript.item_code = function(doc) { cur_frm.fields_dict['default_bom'].get_query = function(doc) { //var d = locals[this.doctype][this.docname]; - return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + doc.item_code + '" AND ifnull(`tabBOM`.`is_active`, 0) = 0 and `tabBOM`.docstatus != 2 AND `tabBOM`.%(key)s LIKE "%s" ORDER BY `tabBOM`.`name` LIMIT 50' + return{ + filters:{ + 'item': doc.item_code, + 'is_active': 0 + } + } + // return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + doc.item_code + '" AND ifnull(`tabBOM`.`is_active`, 0) = 0 and `tabBOM`.docstatus != 2 AND `tabBOM`.%(key)s LIKE "%s" ORDER BY `tabBOM`.`name` LIMIT 50' } // Expense Account // --------------------------------- cur_frm.fields_dict['purchase_account'].get_query = function(doc){ - return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Debit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50' + return{ + filters:{ + 'debit_or_credit': "Debit", + 'group_or_ledger': "Ledger" + } + } } // Income Account // -------------------------------- cur_frm.fields_dict['default_income_account'].get_query = function(doc) { - return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Credit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.`account_type` ="Income Account" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50' + return{ + filters:{ + 'debit_or_credit': "Credit", + 'group_or_ledger': "Ledger", + 'account_type': "Income Account" + } + } } // Purchase Cost Center // ----------------------------- cur_frm.fields_dict['cost_center'].get_query = function(doc) { - return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50' + return{ + filters:{ 'group_or_ledger': "Ledger" } + } } // Sales Cost Center // ----------------------------- cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) { - return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50' + return{ + filters:{ 'group_or_ledger': "Ledger" } + } } cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) { - return 'SELECT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`account_type` in ("Tax", "Chargeable") and `tabAccount`.`docstatus` != 2 and `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` DESC LIMIT 50' + return{ + filters:[ + ['Account', 'account_type', 'in', 'Tax, Chargeable'], + ['Account', 'docstatus', '!=', 2] + ] + } } cur_frm.cscript.tax_type = function(doc, cdt, cdn){ @@ -94,10 +120,11 @@ cur_frm.cscript.tax_type = function(doc, cdt, cdn){ //get query select item group cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` \ - FROM `tabItem Group` WHERE `tabItem Group`.`docstatus`!= 2 AND \ - `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` \ - ASC LIMIT 50' + return { + filters: [ + ['Item Group', 'docstatus', '!=', 2] + ] + } } // for description from attachment @@ -137,10 +164,12 @@ cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){ } cur_frm.fields_dict.item_customer_details.grid.get_field("customer_name").get_query = - erpnext.utils.customer_query; +function(doc,cdt,cdn) { + return{ query:"controllers.queries.customer_query" } } cur_frm.fields_dict.item_supplier_details.grid.get_field("supplier").get_query = - erpnext.utils.supplier_query; + function(doc,cdt,cdn) { + return{ query:"controllers.queries.supplier_query" } } cur_frm.cscript.on_remove_attachment = function(doc) { if(!inList(cur_frm.fields_dict.image.df.options.split("\n"), doc.image)) { diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js index eb0c3df0a30..86787cac65f 100644 --- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js +++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js @@ -20,5 +20,13 @@ if(!doc.currency){doc.currency = sys_defaults.currency;} cur_frm.fields_dict['landed_cost_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"'; +return{ + filters:[ + ['Account', 'group_or_ledger', '=', 'Ledger'], + ['Account', 'account_type', 'in', 'Tax, Chargeable'], + ['Account', 'is_pl_account', '=', 'Yes'], + ['Account', 'debit_or_credit', '=', 'Debit'] + ] + } + // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"'; } diff --git a/stock/doctype/packing_slip/packing_slip.js b/stock/doctype/packing_slip/packing_slip.js index 18a248660dd..b658220a1ca 100644 --- a/stock/doctype/packing_slip/packing_slip.js +++ b/stock/doctype/packing_slip/packing_slip.js @@ -15,17 +15,19 @@ // along with this program. If not, see . cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) { - return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=0 AND %(key)s LIKE "%s"'; + return{ + filters:{ 'docstatus': 0} + } + // return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=0 AND %(key)s LIKE "%s"'; } cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { - var query = 'SELECT name, item_name, description FROM `tabItem` WHERE name IN ( \ - SELECT item_code FROM `tabDelivery Note Item` dnd \ - WHERE parent="' + doc.delivery_note + '" AND IFNULL(qty, 0) > IFNULL(packed_qty, 0)) \ - AND %(key)s LIKE "%s" LIMIT 50'; - return query; + return { + query: "stock.doctype.packing_slip.packing_slip.item_details", + filters:{ 'delivery_note': doc.delivery_note} + } } cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { diff --git a/stock/doctype/packing_slip/packing_slip.py b/stock/doctype/packing_slip/packing_slip.py index 1375108fa86..a46d77c6961 100644 --- a/stock/doctype/packing_slip/packing_slip.py +++ b/stock/doctype/packing_slip/packing_slip.py @@ -171,4 +171,13 @@ class DocType: ch.item_name = item.item_name ch.stock_uom = item.stock_uom ch.qty = flt(item.qty) - flt(item.packed_qty) - self.update_item_details() \ No newline at end of file + self.update_item_details() + +def item_details(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + return webnotes.conn.sql("""select name, item_name, description from `tabItem` + where name in ( select item_code FROM `tabDelivery Note Item` + where parent= %s and ifnull(qty, 0) > ifnull(packed_qty, 0)) + and %s like "%s" %s limit %s, %s """ % ("%s", searchfield, "%s", + get_match_cond(doctype, searchfield), "%s", "%s"), + (filters["delivery_note"], "%%%s%%" % txt, start, page_len)) \ No newline at end of file diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js index 852a9c60796..e21d6a34650 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/stock/doctype/purchase_receipt/purchase_receipt.js @@ -116,11 +116,15 @@ cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc } cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{ 'supplier': doc.supplier} + } } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{ 'supplier': doc.supplier} + } } cur_frm.cscript.new_contact = function(){ @@ -131,15 +135,19 @@ cur_frm.cscript.new_contact = function(){ } cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { - return 'SELECT `tabProject`.name FROM `tabProject` \ - WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; + return{ + filters:[ + ['project', 'status', 'not in', 'Completed, Cancelled'] + ] + } } cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('batch_no').get_query= function(doc, cdt, cdn) { var d = locals[cdt][cdn]; if(d.item_code){ - return "SELECT tabBatch.name, tabBatch.description FROM tabBatch WHERE tabBatch.docstatus != 2 AND tabBatch.item = '"+ d.item_code +"' AND `tabBatch`.`name` like '%s' ORDER BY `tabBatch`.`name` DESC LIMIT 50" + return{ + filters:{'item': d.item_code} + } } else{ alert("Please enter Item Code."); @@ -156,11 +164,19 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){ } cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) { - return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; + return{ + filters:[ + ['Print Heading', 'docstatus', '!=', '2'] + ] + } } cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query = function(doc) { - return 'SELECT `tabQuality Inspection`.name FROM `tabQuality Inspection` WHERE `tabQuality Inspection`.docstatus = 1 AND `tabQuality Inspection`.%(key)s LIKE "%s"'; + return { + filters: { + 'docstatus': 1 + } + } } cur_frm.cscript.on_submit = function(doc, cdt, cdn) { diff --git a/stock/doctype/serial_no/serial_no.js b/stock/doctype/serial_no/serial_no.js index 9e1426c6a4d..df7058a9519 100644 --- a/stock/doctype/serial_no/serial_no.js +++ b/stock/doctype/serial_no/serial_no.js @@ -46,7 +46,10 @@ cur_frm.add_fetch('customer', 'territory', 'territory') // territory // ---------- cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters:{'is_group': "No"} + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } // Supplier @@ -59,11 +62,22 @@ cur_frm.cscript.supplier = function(doc,dt,dn) { //item code //---------- cur_frm.fields_dict['item_code'].get_query = function(doc,cdt,cdn) { - return erpnext.queries.item({ - 'ifnull(tabItem.has_serial_no, "No")': 'Yes' - }); + return{ + query:"controllers.queries.item_query", + filters:{ + 'has_serial_no': 'Yes' + } + } } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.customer_query" + } +} -cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query; \ No newline at end of file +cur_frm.fields_dict.supplier.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.supplier_query" + } +} \ No newline at end of file diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js index 1f4aafa9e51..1a4c225328a 100644 --- a/stock/doctype/stock_entry/stock_entry.js +++ b/stock/doctype/stock_entry/stock_entry.js @@ -56,7 +56,9 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ this.frm.fields_dict.delivery_note_no.get_query; this.frm.fields_dict.purchase_receipt_no.get_query = function() { - return { query: "stock.doctype.stock_entry.stock_entry.query_purchase_return_doc" }; + return { + filters:{ 'docstatus': 1 } + }; }; this.frm.fields_dict.mtn_details.grid.get_field('item_code').get_query = function() { @@ -81,8 +83,10 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ this.frm.fields_dict["expense_adjustment_account"].get_query = function() { return { - "query": "accounts.utils.get_account_list", - "filters": { "company": me.frm.doc.company } + filters: { + "company": me.frm.doc.company, + "group_or_ledger": "Ledger" + } } } } @@ -278,9 +282,12 @@ cur_frm.cscript.supplier = function(doc,cdt,cdn){ } cur_frm.fields_dict['production_order'].get_query = function(doc) { - return 'select name from `tabProduction Order` \ - where docstatus = 1 and qty > ifnull(produced_qty,0) AND %(key)s like "%s%%" \ - order by name desc limit 50'; + return{ + filters:[ + ['Production Order', 'docstatus', '=', 1], + ['Production Order', 'qty', '>','`tabProduction Order`.produced_qty'] + ] + } } cur_frm.cscript.purpose = function(doc, cdt, cdn) { @@ -305,17 +312,21 @@ cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = functi var d = locals[cdt][cdn]; if(d.item_code) { if (d.s_warehouse) { - return "select batch_no from `tabStock Ledger Entry` sle \ - where item_code = '" + d.item_code + "' and warehouse = '" + d.s_warehouse + - "' and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%s' \ - and exists(select * from `tabBatch` where \ - name = sle.batch_no and expiry_date >= '" + doc.posting_date + - "' and docstatus != 2) group by batch_no having sum(actual_qty) > 0 \ - order by batch_no desc limit 50"; + return{ + query: "stock.doctype.stock_entry.stock_entry.get_batch_no", + filters:{ + 'item_code': d.item_code, + 's_warehouse': d.s_warehouse, + 'posting_date': doc.posting_date + } + } } else { - return "SELECT name FROM tabBatch WHERE docstatus != 2 AND item = '" + - d.item_code + "' and expiry_date >= '" + doc.posting_date + - "' AND name like '%s' ORDER BY name DESC LIMIT 50"; + return{ + filters:[ + ['Batch', 'item', '=', d.item_code], + ['Batch', 'expiry_date', '>=', doc.posting_date] + ] + } } } else { msgprint("Please enter Item Code to get batch no"); @@ -372,6 +383,8 @@ cur_frm.cscript.validate_items = function(doc) { } } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.customer_query" } } -cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query; \ No newline at end of file +cur_frm.fields_dict.supplier.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.supplier_query" } } \ No newline at end of file diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index c8babffad9f..fc4fadcf183 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -25,6 +25,7 @@ from webnotes.model.code import get_obj from webnotes import msgprint, _ from stock.utils import get_incoming_rate from stock.stock_ledger import get_previous_sle +from controllers.queries import get_match_cond import json sql = webnotes.conn.sql @@ -709,24 +710,29 @@ def get_production_order_details(production_order): return result and result[0] or {} def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond conditions = "" if doctype == "Sales Invoice": conditions = "and update_stock=1" return webnotes.conn.sql("""select name, customer, customer_name from `tab%s` where docstatus = 1 - and (`%s` like %%(txt)s or `customer` like %%(txt)s) %s + and (`%s` like %%(txt)s or `customer` like %%(txt)s) %s %s order by name, customer, customer_name - limit %s""" % (doctype, searchfield, conditions, "%(start)s, %(page_len)s"), - {"txt": "%%%s%%" % txt, "start": start, "page_len": page_len}, as_list=True) + limit %s""" % (doctype, searchfield, conditions, + get_match_cond(doctype, searchfield), "%(start)s, %(page_len)s"), + {"txt": "%%%s%%" % txt, "start": start, "page_len": page_len}, + as_list=True) def query_purchase_return_doc(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond return webnotes.conn.sql("""select name, supplier, supplier_name from `tab%s` where docstatus = 1 - and (`%s` like %%(txt)s or `supplier` like %%(txt)s) + and (`%s` like %%(txt)s or `supplier` like %%(txt)s) %s order by name, supplier, supplier_name - limit %s""" % (doctype, searchfield, "%(start)s, %(page_len)s"), - {"txt": "%%%s%%" % txt, "start": start, "page_len": page_len}, as_list=True) + limit %s""" % (doctype, searchfield, get_match_cond(doctype, searchfield), + "%(start)s, %(page_len)s"), {"txt": "%%%s%%" % txt, "start": + start, "page_len": page_len}, as_list=True) def query_return_item(doctype, txt, searchfield, start, page_len, filters): txt = txt.replace("%", "") @@ -752,6 +758,20 @@ def query_return_item(doctype, txt, searchfield, start, page_len, filters): return result[start:start+page_len] +def get_batch_no(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + + return webnotes.conn.sql("""select batch_no from `tabStock Ledger Entry` sle + where item_code = '%(item_code)s' and warehouse = '%(s_warehouse)s' + and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%(txt)s' + and exists(select * from `tabBatch` where name = sle.batch_no + and expiry_date >= %(posting_date)s and docstatus != 2) %(mcond)s + group by batch_no having sum(actual_qty) > 0 + order by batch_no desc limit %(start)s, %(page_len)s """ + % {'item_code': filters['item_code'], 's_warehouse': filters['s_warehouse'], + 'posting_date': filters['posting_date'], 'txt': "%%%s%%" % txt, + 'mcond':get_match_cond(doctype, searchfield),"start": start, "page_len": page_len}) + def get_stock_items_for_return(ref_doclist, parentfields): """return item codes filtered from doclist, which are stock items""" if isinstance(parentfields, basestring): diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.js b/stock/doctype/stock_reconciliation/stock_reconciliation.js index dd496833b56..b003e05745c 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -46,9 +46,9 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({ this.frm.fields_dict["expense_account"].get_query = function() { return { - "query": "accounts.utils.get_account_list", "filters": { - "company": me.frm.doc.company + 'company': me.frm.doc.company, + 'group_or_ledger': 'Ledger' } } } diff --git a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js index e022bb7c9a6..94b3bf0a7bc 100644 --- a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js +++ b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js @@ -15,7 +15,9 @@ // along with this program. If not, see . cur_frm.fields_dict['item_code'].get_query = function(doc) { - return erpnext.queries.item_std(); + return { + query: "controllers.queries.item_std" + } } //==================== Get Items Stock UOM ===================================================== diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js index 558ef321b48..1f686026849 100644 --- a/support/doctype/customer_issue/customer_issue.js +++ b/support/doctype/customer_issue/customer_issue.js @@ -65,24 +65,34 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc } cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer + - '" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{ 'customer': doc.customer} + } + // return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer + + // '" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation \ - FROM tabContact WHERE customer = "' + doc.customer + - '" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{ 'customer': doc.customer} + } + // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation \ + // FROM tabContact WHERE customer = "' + doc.customer + + // '" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) { - var cond = ''; - if(doc.item_code) cond = ' AND `tabSerial No`.item_code = "'+ doc.item_code +'"'; - if(doc.customer) cond += ' AND `tabSerial No`.customer = "' + doc.customer + '"'; - return 'SELECT `tabSerial No`.name, `tabSerial No`.description \ - FROM `tabSerial No` \ - WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.status = "Delivered" \ - AND `tabSerial No`.name LIKE "%s" ' + cond + ' ORDER BY `tabSerial No`.name ASC LIMIT 50'; + var cond = []; + var filter = [ + ['Serial No', 'docstatus', '!=', 2], + ['Serial No', 'status', '=', "Delivered"] + ]; + if(doc.item_code) cond = ['Serial No', 'item_code', '=', doc.item_code]; + if(doc.customer) cond = ['Serial No', 'customer', '=', doc.customer]; + filter.push(cond); + return{ + filters:filter + } } cur_frm.add_fetch('serial_no', 'item_code', 'item_code'); @@ -97,15 +107,23 @@ cur_frm.add_fetch('serial_no', 'delivery_address', 'customer_address'); cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { if(doc.serial_no) { - return 'SELECT `tabSerial No`.item_code, `tabSerial No`.description \ - FROM `tabSerial No` \ - WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name = "' + doc.serial_no + - '" AND `tabSerial No`.item_code LIKE "%s" ORDER BY `tabSerial No`.item_code ASC LIMIT 50'; + return{ + filters:{ 'serial_no': doc.serial_no} + } + // return 'SELECT `tabSerial No`.item_code, `tabSerial No`.description \ + // FROM `tabSerial No` \ + // WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name = "' + doc.serial_no + + // '" AND `tabSerial No`.item_code LIKE "%s" ORDER BY `tabSerial No`.item_code ASC LIMIT 50'; } else{ - return 'SELECT `tabItem`.name, `tabItem`.item_name, `tabItem`.description \ - FROM `tabItem` \ - WHERE `tabItem`.docstatus != 2 AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.name ASC LIMIT 50'; + return{ + filters:[ + ['Item', 'docstatus', '!=', 2] + ] + } + // return 'SELECT `tabItem`.name, `tabItem`.item_name, `tabItem`.description \ + // FROM `tabItem` \ + // WHERE `tabItem`.docstatus != 2 AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.name ASC LIMIT 50'; } } @@ -113,10 +131,14 @@ cur_frm.add_fetch('item_code', 'item_name', 'item_name'); cur_frm.add_fetch('item_code', 'description', 'description'); cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` \ - FROM `tabTerritory` \ - WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 \ - AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters:{ 'is_group': "No"} + } + // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` \ + // FROM `tabTerritory` \ + // WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 \ + // AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; \ No newline at end of file +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.customer_query" } } \ No newline at end of file diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.js b/support/doctype/maintenance_schedule/maintenance_schedule.js index ec75289290f..a4f954bfe5a 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -62,16 +62,22 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc } cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{ 'customer': doc.customer} + } } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{ 'customer': doc.customer} + } } // cur_frm.fields_dict['item_maintenance_detail'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'; + return{ + filters:{ 'is_service_item': "Yes"} + } } cur_frm.cscript.item_code = function(doc, cdt, cdn) { @@ -88,7 +94,13 @@ cur_frm.fields_dict['sales_order_no'].get_query = function(doc) { if(doc.customer) { cond = '`tabSales Order`.customer = "'+doc.customer+'" AND'; } - return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond}); + return{ + query:"support.doctype.maintenance_schedule.maintenance_schedule.get_sales_order_no", + filters: { + 'cond': cond, + 'company': doc.company + } + } } cur_frm.cscript.periodicity = function(doc, cdt, cdn){ @@ -118,7 +130,10 @@ cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) { } cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters:{ 'is_group': "No"} + } } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; \ No newline at end of file +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.customer_query" } } \ No newline at end of file diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.py b/support/doctype/maintenance_schedule/maintenance_schedule.py index ee7f45a852c..6260acd74ba 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -331,4 +331,16 @@ def make_maintenance_visit(source_name, target_doclist=None): } }, target_doclist) - return [d.fields for d in doclist] \ No newline at end of file + return [d.fields for d in doclist] +def get_sales_order_no(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + + return webnotes.conn.sql(""" select distinct `tabSales Order`.name from `tabSales Order`, + `tabSales Order Item`, `tabItem` + where `tabSales Order`.company = "%(company)s" and `tabSales Order`.docstatus = 1 + and `tabSales Order Item`.parent = `tabSales Order`.name + and `tabSales Order Item`.item_code = `tabItem`.name + and `tabItem`.is_service_item = "Yes" and %(cond)s `tabSales Order`.name LIKE "%(txt)s" %(mcond)s + ORDER BY `tabSales Order`.name desc LIMIT %(start)s, %(page_len)s""" + % 'company': filters["company"], 'cond': filters['cond'], 'txt': "%%%s%%" % txt, + 'mcond':get_match_cond(doctype, searchfield), "start": start, "page_len": page_len}) \ No newline at end of file diff --git a/support/doctype/maintenance_visit/maintenance_visit.js b/support/doctype/maintenance_visit/maintenance_visit.js index 6c282c01ad0..f8039174890 100644 --- a/support/doctype/maintenance_visit/maintenance_visit.js +++ b/support/doctype/maintenance_visit/maintenance_visit.js @@ -77,11 +77,15 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc } cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{'customer': doc.customer} + } } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return{ + filters:{'customer': doc.customer} + } } cur_frm.cscript.get_items = function(doc, dt, dn) { @@ -93,7 +97,9 @@ cur_frm.cscript.get_items = function(doc, dt, dn) { } cur_frm.fields_dict['maintenance_visit_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'; + return{ + filters:{ 'is_service_item': "Yes"} + } } cur_frm.cscript.item_code = function(doc, cdt, cdn) { @@ -110,30 +116,52 @@ cur_frm.fields_dict['sales_order_no'].get_query = function(doc) { if(doc.customer) { cond = '`tabSales Order`.customer = "'+doc.customer+'" AND'; } - return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond}); + return{ + query:"support.doctype.maintenance_schedule.maintenance_schedule.get_sales_order_no", + filters: { + 'cond': cond, + 'company': doc.company + } + } } cur_frm.fields_dict['customer_issue_no'].get_query = function(doc) { doc = locals[this.doctype][this.docname]; - var cond = ''; - if(doc.customer) { - cond = '`tabCustomer Issue`.customer = "'+doc.customer+'" AND'; - } - return repl('SELECT `tabCustomer Issue`.name FROM `tabCustomer Issue` WHERE `tabCustomer Issue`.company = "%(company)s" AND %(cond)s `tabCustomer Issue`.docstatus = 1 AND (`tabCustomer Issue`.status = "Open" OR `tabCustomer Issue`.status = "Work In Progress") AND `tabCustomer Issue`.name LIKE "%s" ORDER BY `tabCustomer Issue`.name DESC LIMIT 50', {company:doc.company, cond:cond}); + var cond = []; + var filter = [ + ['Customer Issue', 'company', '=', doc.company], + ['Customer Issue', 'docstatus', '=', 1], + ['Customer Issue', 'status', 'in', 'Open, Work In Progress'] + ]; + if(doc.customer) cond = ['Customer Issue', 'customer', '=', doc.customer]; + filter.push(cond); + return { + filters:filter + } } cur_frm.fields_dict['maintenance_schedule'].get_query = function(doc) { doc = locals[this.doctype][this.docname]; - var cond = ''; - if(doc.customer) { - cond = '`tabMaintenance Schedule`.customer = "'+doc.customer+'" AND'; - } - return repl('SELECT `tabMaintenance Schedule`.name FROM `tabMaintenance Schedule` WHERE `tabMaintenance Schedule`.company = "%(company)s" AND %(cond)s `tabMaintenance Schedule`.docstatus = 1 AND `tabMaintenance Schedule`.name LIKE "%s" ORDER BY `tabMaintenance Schedule`.name DESC LIMIT 50', {company:doc.company, cond:cond}); + var cond = []; + var filter = [ + ['Maintenance Schedule', 'company', '=', doc.company], + ['Maintenance Schedule', 'docstatus', '=', 1] + ]; + if(doc.customer) cond = ['Maintenance Schedule', 'customer', '=', doc.customer]; + filter.push(cond); + return{ + filters:filter + } } //get query select Territory cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; + return{ + filters:{ + 'is_group': "No" + } + } } -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; \ No newline at end of file +cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + return{ query:"controllers.queries.customer_query" } } \ No newline at end of file diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index 903f41cd584..bd7e6ccf1f9 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; +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 From 2e3c06e66d06244bd1493c346691ce00d56e2603 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 9 Jul 2013 18:20:49 +0530 Subject: [PATCH 05/27] [get_query]to server side --- accounts/doctype/cost_center/cost_center.js | 4 +- .../journal_voucher/journal_voucher.js | 3 -- .../period_closing_voucher.js | 1 - accounts/doctype/pos_setting/pos_setting.js | 6 --- .../purchase_invoice/purchase_invoice.js | 45 ------------------- .../doctype/sales_invoice/sales_invoice.js | 13 ------ .../sales_taxes_and_charges_master.js | 2 - .../doctype/purchase_order/purchase_order.js | 14 ------ .../quality_inspection/quality_inspection.js | 2 - .../supplier_quotation/supplier_quotation.js | 14 +----- hr/doctype/appraisal/appraisal.js | 4 +- .../salary_structure/salary_structure.js | 4 +- .../production_order/production_order.js | 4 -- projects/doctype/task/task.js | 2 +- projects/doctype/task/task.py | 2 +- selling/doctype/customer/customer.js | 1 - .../installation_note/installation_note.js | 21 +++------ selling/doctype/opportunity/opportunity.js | 8 ---- selling/doctype/quotation/quotation.js | 1 - selling/doctype/sales_bom/sales_bom.js | 3 -- .../authorization_rule/authorization_rule.js | 5 --- setup/doctype/company/company.js | 14 ------ .../contact_control/contact_control.js | 3 +- .../doctype/customer_group/customer_group.js | 4 -- setup/doctype/item_group/item_group.js | 1 - setup/doctype/sales_partner/sales_partner.js | 1 - setup/doctype/sales_person/sales_person.js | 2 - setup/doctype/territory/territory.js | 2 - stock/doctype/item/item.js | 1 - .../landed_cost_wizard/landed_cost_wizard.js | 1 - stock/doctype/packing_slip/packing_slip.js | 1 - stock/doctype/serial_no/serial_no.js | 1 - .../doctype/customer_issue/customer_issue.js | 16 ------- 33 files changed, 13 insertions(+), 193 deletions(-) diff --git a/accounts/doctype/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js index ad3a16237e4..d273e53e56f 100644 --- a/accounts/doctype/cost_center/cost_center.js +++ b/accounts/doctype/cost_center/cost_center.js @@ -45,8 +45,7 @@ cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = func ['Account', 'group_or_ledger', 'is not', 'NULL'] ] } - // return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company_name + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'; - } +} cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){ return{ @@ -56,7 +55,6 @@ cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){ ['Cost Center', 'company_name', 'is not', 'NULL'] ] } - // return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company_name="'+ doc.company_name+'" AND `tabCost Center`.company_name is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50'; } //parent cost center diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js index 2afea1bce25..ea077981789 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.js +++ b/accounts/doctype/journal_voucher/journal_voucher.js @@ -196,7 +196,6 @@ cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(do cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - // query: "accounts.utils.get_cost_center_list", filters: { 'company_name': doc.company, 'group_or_ledger': 'Ledger' @@ -207,7 +206,6 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = function(doc) { var d = locals[this.doctype][this.docname]; return { - // query: "accounts.doctype.journal_voucher.journal_voucher.get_against_purchase_invoice", filters: [ ['Purchase Invoice', 'credit_to', '=', d.account], ['Purchase Invoice', 'docstatus', '=', 1], @@ -219,7 +217,6 @@ cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = fun cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = function(doc) { var d = locals[this.doctype][this.docname]; return { - // query: "accounts.doctype.journal_voucher.journal_voucher.get_against_sales_invoice", filters: [ ['Sales Invoice', 'debit_to', '=', d.account], ['Sales Invoice', 'docstatus', '=', 1], diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/accounts/doctype/period_closing_voucher/period_closing_voucher.js index c24f06b2a8a..fd458417835 100644 --- a/accounts/doctype/period_closing_voucher/period_closing_voucher.js +++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.js @@ -32,5 +32,4 @@ cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) "group_or_ledger": "Ledger" } } - // return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND ifnull(`tabAccount`.freeze_account, "No") = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50'; } diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index b15ec3e04aa..aa9cf11539c 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -33,7 +33,6 @@ cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } // Income Account @@ -47,7 +46,6 @@ cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) { 'account_type': "Income Account" } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"' } @@ -60,7 +58,6 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) { 'group_or_ledger': "Ledger", } } - // return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; } //get query select Territory @@ -71,7 +68,6 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { 'is_group': "No" } } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } @@ -82,12 +78,10 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) ['Print Heading', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; } cur_frm.fields_dict["expense_account"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", filters: { "is_pl_account": "Yes", "debit_or_credit": "Debit", diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 2e41d70af0f..efe0c2a990e 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -155,14 +155,12 @@ cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { return{ filters:{'supplier': doc.supplier} } - // return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return{ filters:{'supplier': doc.supplier} } - // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { @@ -183,43 +181,6 @@ cur_frm.fields_dict['credit_to'].get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' -} - -cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) { - var filter = [ - ['Purchase Order', 'docstatus', '=', 1], - ['Purchase Order', 'status', '!=', 'Stopped'], - ['Purchase Order', 'per_billed', '<', 99.99], - ['Purchase Order', 'company', '=', doc.company] - ]; - var cond = []; - if (doc.supplier){ - cond = ['Purchase Order', 'supplier', '=', doc.supplier]; - // return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 99.99 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50' - } - filter.push(cond); - return{ - filters: filter - } -} - -cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) { - var filter = [ - ['Purchase Receipt', 'docstatus', '=', 1], - ['Purchase Receipt', 'status', '!=', 'Stopped'], - ['Purchase Receipt', 'per_billed', '<', 99.99], - ['Purchase Receipt', 'company', '=', doc.company] - ]; - var cond = []; - if (doc.supplier){ - ['Purchase Receipt', 'supplier', '=', doc.supplier]; - // return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 99.99 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50' - } - filter.push(cond); - return{ - filters: filter - } } // Get Print Heading @@ -229,7 +190,6 @@ return{ ['Print Heading', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; } cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) { @@ -241,7 +201,6 @@ cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = functi 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'; } cur_frm.cscript.expense_head = function(doc, cdt, cdn){ var d = locals[cdt][cdn]; @@ -256,7 +215,6 @@ cur_frm.cscript.expense_head = function(doc, cdt, cdn){ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - // query: "accounts.utils.get_cost_center_list", filters: { 'company_name': doc.company, 'group_or_ledger': 'Ledger' @@ -307,9 +265,6 @@ cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = functi ['Project', 'status', 'not in', 'Completed, Cancelled'] ] } - // return 'SELECT `tabProject`.name FROM `tabProject` \ - // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - // AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; } diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index ef4b67816c3..1487ec98728 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -257,7 +257,6 @@ cur_frm.fields_dict.debit_to.get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } cur_frm.fields_dict.cash_bank_account.get_query = function(doc) { @@ -269,7 +268,6 @@ cur_frm.fields_dict.cash_bank_account.get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } cur_frm.fields_dict.write_off_account.get_query = function(doc) { @@ -281,7 +279,6 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } // Write off cost center @@ -294,7 +291,6 @@ cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) { 'company_name': doc.company } } - // return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"' } //project name @@ -304,12 +300,6 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) { query: "controllers.queries.get_project_name", filters: {'customer': doc.customer} } - // var cond = ''; - // if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND'; - // return repl('SELECT `tabProject`.name FROM `tabProject` \ - // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - // AND %(cond)s `tabProject`.name LIKE "%s" \ - // ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond}); } //Territory @@ -318,7 +308,6 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { return{ filters: {'is_group': 'NO'} } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } // Income Account in Details Table @@ -352,14 +341,12 @@ cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(d ['Bin', 'actual_qty', '>', 0] ] } - // return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50"; } // Cost Center in Details Table // ----------------------------- cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - // query: "accounts.utils.get_cost_center_list", filters: { 'company_name': doc.company, 'group_or_ledger': 'Ledger' diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index 81a5c709f06..9ec574ed33d 100644 --- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -144,7 +144,6 @@ cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = ['Account', 'company', '=', doc.company] ] } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.account_type in ("Tax", "Chargeable", "Income Account") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"' } cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) { @@ -152,7 +151,6 @@ cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = f 'company_name': doc.company, 'group_or_ledger': "Ledger" } - // return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; } diff --git a/buying/doctype/purchase_order/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js index 1283ebc434f..bccd4a9559e 100644 --- a/buying/doctype/purchase_order/purchase_order.js +++ b/buying/doctype/purchase_order/purchase_order.js @@ -113,14 +113,12 @@ cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { return { filters: {'supplier': doc.supplier} } - // return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return { filters: {'supplier': doc.supplier} } - // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { @@ -131,18 +129,6 @@ cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = fun } } -cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return{ - filters:[ - ['Material Request', 'material_request_type', '=', 'Purchase'], - ['Material Request', 'company', '=', doc.company], - ['Material Request', 'docstatus', '=', '1'], - ['Material Request', 'status', '!=', 'Stopped'], - ['Material Request', 'per_ordered', '<', 99.99] - ] - } -} - cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){ $c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', function(r, rt) { refresh_field(cur_frm.cscript.fname); diff --git a/buying/doctype/quality_inspection/quality_inspection.js b/buying/doctype/quality_inspection/quality_inspection.js index 1c12f3a8a5a..72eaecb5a12 100644 --- a/buying/doctype/quality_inspection/quality_inspection.js +++ b/buying/doctype/quality_inspection/quality_inspection.js @@ -48,12 +48,10 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { filter:{ 'parent': doc.purchase_receipt_no } - // return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Item` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; else if (doc.delivery_note_no) filter:{ 'parent': doc.delivery_note_no } - // return 'SELECT item_code, item_name, description FROM `tabDelivery Note Item` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; return{ filters: filter } diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js index d0f1948ef03..54ef722885f 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/buying/doctype/supplier_quotation/supplier_quotation.js @@ -72,18 +72,6 @@ cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query } } -cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return{ - filters:[ - ['Material Request', 'material_request_type', '=', 'Purchase'], - ['Material Request', 'company', '=', doc.company], - ['Material Request', 'docstatus', '=', 1], - ['Material Request', 'status', '!=', 'Stopped'], - ['Material Request', 'per_ordered', '<', 99.99] - ] - } -} - cur_frm.cscript.supplier_address = function(doc, dt, dn) { if (doc.supplier) { get_server_fields("get_supplier_address", JSON.stringify({supplier: doc.supplier, @@ -102,4 +90,4 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return { filters:{'supplier': doc.supplier} } -} +} \ No newline at end of file diff --git a/hr/doctype/appraisal/appraisal.js b/hr/doctype/appraisal/appraisal.js index ac2b1234d20..2289064baa8 100644 --- a/hr/doctype/appraisal/appraisal.js +++ b/hr/doctype/appraisal/appraisal.js @@ -84,7 +84,5 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){ } cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { - return{ - query:"controllers.queries.employee_query" - } + return{ query:"controllers.queries.employee_query" } } \ No newline at end of file diff --git a/hr/doctype/salary_structure/salary_structure.js b/hr/doctype/salary_structure/salary_structure.js index 065bb47711e..60c159dd467 100644 --- a/hr/doctype/salary_structure/salary_structure.js +++ b/hr/doctype/salary_structure/salary_structure.js @@ -73,7 +73,5 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) { } cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { - return{ - query:"controllers.queries.employee_query" - } + return{ query:"controllers.queries.employee_query" } } \ No newline at end of file diff --git a/manufacturing/doctype/production_order/production_order.js b/manufacturing/doctype/production_order/production_order.js index e3518591b3b..7dc905a5369 100644 --- a/manufacturing/doctype/production_order/production_order.js +++ b/manufacturing/doctype/production_order/production_order.js @@ -106,16 +106,12 @@ cur_frm.fields_dict['production_item'].get_query = function(doc) { ['Item', 'is_pro_applicable', '=', 'Yes'] ] } - // return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50'; } cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) { return{ filters:['Project', 'status', 'not in', 'Completed, Cancelled'] } - // return 'SELECT `tabProject`.name FROM `tabProject` \ - // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - // AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; } diff --git a/projects/doctype/task/task.js b/projects/doctype/task/task.js index 097119ffb66..cb2c539d633 100644 --- a/projects/doctype/task/task.js +++ b/projects/doctype/task/task.js @@ -22,7 +22,7 @@ erpnext.projects.Task = wn.ui.form.Controller.extend({ setup: function() { this.frm.fields_dict.project.get_query = function() { return { - query: "projects.doctype.tast.task.get_project" + query: "projects.doctype.task.task.get_project" } }; }, diff --git a/projects/doctype/task/task.py b/projects/doctype/task/task.py index 1dfcdc1af1e..0072b1f70de 100644 --- a/projects/doctype/task/task.py +++ b/projects/doctype/task/task.py @@ -96,7 +96,7 @@ def get_events(start, end, filters=None): def get_project(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond return webnotes.conn.sql(""" select name from `tabProject` - where %(key)s like %(txt)s %(mcond)s + where %(key)s like "%(txt)s" %(mcond)s order by name limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js index f92a2a90e66..cd530a25bad 100644 --- a/selling/doctype/customer/customer.js +++ b/selling/doctype/customer/customer.js @@ -125,7 +125,6 @@ cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) { return{ filters:{'is_group': 'No'} } - // return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; } diff --git a/selling/doctype/installation_note/installation_note.js b/selling/doctype/installation_note/installation_note.js index 8574da31233..4cbd67d729a 100644 --- a/selling/doctype/installation_note/installation_note.js +++ b/selling/doctype/installation_note/installation_note.js @@ -62,27 +62,20 @@ cur_frm.cscript.onload = function(doc, dt, dn) { cur_frm.fields_dict['delivery_note_no'].get_query = function(doc) { doc = locals[this.doctype][this.docname]; + var filter = { - 'company': doc.company, - 'docstatus': 1, - 'per_installed': 99.99 + 'company': doc.company, + 'docstatus': 1, + 'per_installed': 99.99 }; if(doc.customer) filter['customer'] = doc.customer; - return{ - filters:filter - } - // { - // cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND'; - // } - // return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name FROM `tabDelivery Note`, `tabDelivery Note Item` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 99.99 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond}); + return { filters: filter } } - cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { return{ - filters{ 'is_group': "No" } + filters: { 'is_group': "No" } } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { @@ -93,14 +86,12 @@ cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { return{ filters: { 'customer': doc.customer } } - // return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return{ filters: { 'customer': doc.customer } } - // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js index f88402d882c..b87fee196d7 100644 --- a/selling/doctype/opportunity/opportunity.js +++ b/selling/doctype/opportunity/opportunity.js @@ -157,18 +157,12 @@ cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { return { filters:{'customer':doc.customer} } - // return 'SELECT name, address_line1, city FROM tabAddress \ - // WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \ - // %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { if (!doc.customer) msgprint("Please select customer first"); else { filters:{'customer':doc.customer} - // return 'SELECT name, CONCAT(first_name," ",ifnull(last_name,"")) As FullName, \ - // department, designation FROM tabContact WHERE customer = "'+ doc.customer + - // '" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; } } @@ -177,7 +171,6 @@ cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){ return { query: "selling.doctype.opportunity.opportunity.get_lead" } - // return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50'; } cur_frm.cscript.lead = function(doc, cdt, cdn) { @@ -243,7 +236,6 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { return{ filters:{'is_group': 'No'} } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';} cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) { return { query:"controllers.queries.lead_query" } } diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index ccb4998eaf8..cfaf61172aa 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -202,7 +202,6 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= cond: cond, } } - // return repl("SELECT name, item_name, description FROM `tabItem` item WHERE item.%(key)s LIKE '%s' %(cond)s ORDER BY item.item_code DESC LIMIT 50", {cond:cond}); } } diff --git a/selling/doctype/sales_bom/sales_bom.js b/selling/doctype/sales_bom/sales_bom.js index f60b6e31227..7d793406781 100644 --- a/selling/doctype/sales_bom/sales_bom.js +++ b/selling/doctype/sales_bom/sales_bom.js @@ -27,9 +27,6 @@ cur_frm.fields_dict.new_item_code.get_query = function() { return{ query: "selling.doctype.sales_bom.sales_bom.get_new_item_code" } - // return 'select name, description from tabItem where is_stock_item="No" and is_sales_item="Yes"\ - // and name not in (select name from `tabSales BOM`)\ - // and `%(key)s` like "%s"' } cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Stock Item" is "No" \ and "Is Sales Item" is "Yes" and there is no other Sales BOM'; diff --git a/setup/doctype/authorization_rule/authorization_rule.js b/setup/doctype/authorization_rule/authorization_rule.js index 76a87080c39..1866cbcc5d6 100644 --- a/setup/doctype/authorization_rule/authorization_rule.js +++ b/setup/doctype/authorization_rule/authorization_rule.js @@ -97,8 +97,6 @@ cur_frm.fields_dict['system_role'].get_query = function(doc) { ['Role', 'name', 'not in', 'Administrator, Guest, All'] ] } - - // return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50' } // Approving Role Trigger @@ -117,19 +115,16 @@ cur_frm.fields_dict['master_name'].get_query = function(doc){ ['Customer', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabCustomer`.`name` FROM `tabCustomer` WHERE `tabCustomer`.docstatus !=2 and `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` DESC LIMIT 50'; else if(doc.based_on == 'Itemwise Discount') return { query: "controllers.queries.item_query" } - // return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50'; else return { filters: [ ['Item', 'name', '=', 'cheating done to avoid null'] ] } - // return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50'; } cur_frm.fields_dict.to_emp.get_query = function(doc,cdt,cdn) { diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js index 60a32ae10aa..dfe8e2ae876 100644 --- a/setup/doctype/company/company.js +++ b/setup/doctype/company/company.js @@ -55,13 +55,8 @@ cur_frm.fields_dict.default_bank_account.get_query = function(doc) { 'account_type': "Bank or Cash" } } - // return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } -// cur_frm.fields_dict.default_cash_account.get_query = function(doc) { -// return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; -// } - cur_frm.fields_dict.payables_group.get_query = cur_frm.fields_dict.receivables_group.get_query; cur_frm.fields_dict.receivables_group.get_query = function(doc) { @@ -71,17 +66,11 @@ cur_frm.fields_dict.receivables_group.get_query = function(doc) { 'group_or_ledger': "Group" } } - // return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } -// cur_frm.fields_dict.payables_group.get_query = function(doc) { -// return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; -// } - if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "No", "debit_or_credit": "Debit", @@ -93,7 +82,6 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "Yes", "debit_or_credit": "Debit", @@ -108,7 +96,6 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "No", "debit_or_credit": "Credit", @@ -120,7 +107,6 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) { return { - // "query": "accounts.utils.get_cost_center_list", "filters": {"company": doc.name} } } diff --git a/setup/doctype/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js index 9d4d8bf94c7..db0ed91bfdc 100755 --- a/setup/doctype/contact_control/contact_control.js +++ b/setup/doctype/contact_control/contact_control.js @@ -26,10 +26,9 @@ if(cur_frm.fields_dict['territory']){ cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) { return { filters: { - 'is_group' = "No" + 'is_group': "No" } } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } } diff --git a/setup/doctype/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js index 18931eb0713..e865860a249 100644 --- a/setup/doctype/customer_group/customer_group.js +++ b/setup/doctype/customer_group/customer_group.js @@ -36,8 +36,4 @@ cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) { 'is_group': "Yes" } } - // return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` \ - // FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND \ - // `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" \ - // ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; } \ No newline at end of file diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js index 581039370bd..b642735215c 100644 --- a/setup/doctype/item_group/item_group.js +++ b/setup/doctype/item_group/item_group.js @@ -40,5 +40,4 @@ cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) { ['Item Group', 'naem', '!=', doc.item_group_name] ] } - // return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50'; } \ No newline at end of file diff --git a/setup/doctype/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js index 5db60c5951a..acf6b312bdc 100644 --- a/setup/doctype/sales_partner/sales_partner.js +++ b/setup/doctype/sales_partner/sales_partner.js @@ -100,5 +100,4 @@ cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_q return{ filters:{ 'is_group': "No" } } - // return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } \ No newline at end of file diff --git a/setup/doctype/sales_person/sales_person.js b/setup/doctype/sales_person/sales_person.js index e0d06395e0c..fd03a441ee0 100644 --- a/setup/doctype/sales_person/sales_person.js +++ b/setup/doctype/sales_person/sales_person.js @@ -41,14 +41,12 @@ cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) { ['Sales Person', 'name', '!=', doc.sales_person_name] ] } - // return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY `tabSales Person`.`name` ASC LIMIT 50'; } cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { return{ filters:{ 'is_group': "No" } } - // return 'SELECT `tabItem Group`.name FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { diff --git a/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js index 3164ba279d3..7fdfee54d62 100644 --- a/setup/doctype/territory/territory.js +++ b/setup/doctype/territory/territory.js @@ -36,7 +36,6 @@ cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) { ['Territory', 'name', '!=', doc.territory_name] ] } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } @@ -45,5 +44,4 @@ cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = f return{ filters:{ 'is_group': "No"} } -// return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index a0937fb285c..3d427ad3116 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -57,7 +57,6 @@ cur_frm.fields_dict['default_bom'].get_query = function(doc) { 'is_active': 0 } } - // return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + doc.item_code + '" AND ifnull(`tabBOM`.`is_active`, 0) = 0 and `tabBOM`.docstatus != 2 AND `tabBOM`.%(key)s LIKE "%s" ORDER BY `tabBOM`.`name` LIMIT 50' } diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js index 86787cac65f..a093d6f2640 100644 --- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js +++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js @@ -28,5 +28,4 @@ return{ ['Account', 'debit_or_credit', '=', 'Debit'] ] } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"'; } diff --git a/stock/doctype/packing_slip/packing_slip.js b/stock/doctype/packing_slip/packing_slip.js index b658220a1ca..e19ab493004 100644 --- a/stock/doctype/packing_slip/packing_slip.js +++ b/stock/doctype/packing_slip/packing_slip.js @@ -18,7 +18,6 @@ cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) { return{ filters:{ 'docstatus': 0} } - // return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=0 AND %(key)s LIKE "%s"'; } diff --git a/stock/doctype/serial_no/serial_no.js b/stock/doctype/serial_no/serial_no.js index df7058a9519..0253ffbe839 100644 --- a/stock/doctype/serial_no/serial_no.js +++ b/stock/doctype/serial_no/serial_no.js @@ -49,7 +49,6 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { return{ filters:{'is_group': "No"} } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } // Supplier diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js index 1f686026849..cd744ec121d 100644 --- a/support/doctype/customer_issue/customer_issue.js +++ b/support/doctype/customer_issue/customer_issue.js @@ -68,17 +68,12 @@ cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { return{ filters:{ 'customer': doc.customer} } - // return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer + - // '" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return{ filters:{ 'customer': doc.customer} } - // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation \ - // FROM tabContact WHERE customer = "' + doc.customer + - // '" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) { @@ -110,10 +105,6 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { return{ filters:{ 'serial_no': doc.serial_no} } - // return 'SELECT `tabSerial No`.item_code, `tabSerial No`.description \ - // FROM `tabSerial No` \ - // WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name = "' + doc.serial_no + - // '" AND `tabSerial No`.item_code LIKE "%s" ORDER BY `tabSerial No`.item_code ASC LIMIT 50'; } else{ return{ @@ -121,9 +112,6 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { ['Item', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabItem`.name, `tabItem`.item_name, `tabItem`.description \ - // FROM `tabItem` \ - // WHERE `tabItem`.docstatus != 2 AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.name ASC LIMIT 50'; } } @@ -134,10 +122,6 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { return{ filters:{ 'is_group': "No"} } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` \ - // FROM `tabTerritory` \ - // WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 \ - // AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { From f9404ba89f335f88fdea7038ac38d929d0806bd0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 12:07:45 +0530 Subject: [PATCH 06/27] [feature] Added Section Breaks to Grids for better visual hierarchy --- .../purchase_invoice_item.txt | 20 +++++++++- .../sales_invoice_item/sales_invoice_item.txt | 38 ++++++++++++++----- .../purchase_order_item.txt | 14 ++++++- .../supplier_quotation_item.txt | 14 ++++++- .../opportunity_item/opportunity_item.txt | 24 +++++++----- .../doctype/quotation_item/quotation_item.txt | 14 ++++++- .../sales_order_item/sales_order_item.txt | 14 ++++++- .../delivery_note_item/delivery_note_item.txt | 14 ++++++- .../material_request_item.txt | 8 +++- .../purchase_receipt_item.txt | 20 +++++++++- 10 files changed, 153 insertions(+), 27 deletions(-) diff --git a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt index 867cd7a1369..dce635b1d0e 100755 --- a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt +++ b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-22 12:43:10", "docstatus": 0, - "modified": "2013-07-09 12:21:47", + "modified": "2013-07-10 11:56:50", "modified_by": "Administrator", "owner": "Administrator" }, @@ -62,6 +62,12 @@ "read_only": 0, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" + }, { "doctype": "DocField", "fieldname": "qty", @@ -155,6 +161,12 @@ "read_only": 1, "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "accounting", + "fieldtype": "Section Break", + "label": "Accounting" + }, { "doctype": "DocField", "fieldname": "expense_head", @@ -183,6 +195,12 @@ "read_only": 0, "width": "120px" }, + { + "doctype": "DocField", + "fieldname": "reference", + "fieldtype": "Section Break", + "label": "Reference" + }, { "doctype": "DocField", "fieldname": "project_name", diff --git a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt index b0fd7c7e339..5fcddeeea85 100644 --- a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt +++ b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-04 11:02:19", "docstatus": 0, - "modified": "2013-07-09 12:46:12", + "modified": "2013-07-10 11:57:15", "modified_by": "Administrator", "owner": "Administrator" }, @@ -81,6 +81,12 @@ "reqd": 1, "width": "200px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" + }, { "doctype": "DocField", "fieldname": "qty", @@ -181,15 +187,9 @@ }, { "doctype": "DocField", - "fieldname": "warehouse", - "fieldtype": "Link", - "hidden": 0, - "label": "Warehouse", - "oldfieldname": "warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "print_hide": 1, - "read_only": 0 + "fieldname": "accounting", + "fieldtype": "Section Break", + "label": "Accounting" }, { "doctype": "DocField", @@ -234,6 +234,24 @@ "reqd": 0, "width": "120px" }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, + { + "doctype": "DocField", + "fieldname": "warehouse", + "fieldtype": "Link", + "hidden": 0, + "label": "Warehouse", + "oldfieldname": "warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "print_hide": 1, + "read_only": 0 + }, { "doctype": "DocField", "fieldname": "serial_no", diff --git a/buying/doctype/purchase_order_item/purchase_order_item.txt b/buying/doctype/purchase_order_item/purchase_order_item.txt index dac9a7be05d..92dde5dc9d2 100755 --- a/buying/doctype/purchase_order_item/purchase_order_item.txt +++ b/buying/doctype/purchase_order_item/purchase_order_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:06", "docstatus": 0, - "modified": "2013-07-09 11:45:00", + "modified": "2013-07-10 11:55:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -78,6 +78,12 @@ "reqd": 1, "search_index": 1 }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" + }, { "doctype": "DocField", "fieldname": "description", @@ -193,6 +199,12 @@ "read_only": 1, "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "warehouse", diff --git a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt index d4df4041be4..80c97c9e968 100644 --- a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt +++ b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-22 12:43:10", "docstatus": 0, - "modified": "2013-07-09 12:15:15", + "modified": "2013-07-10 11:54:21", "modified_by": "Administrator", "owner": "Administrator" }, @@ -75,6 +75,12 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", @@ -178,6 +184,12 @@ "read_only": 1, "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "warehouse", diff --git a/selling/doctype/opportunity_item/opportunity_item.txt b/selling/doctype/opportunity_item/opportunity_item.txt index ba7870e19d6..a5e93539f72 100644 --- a/selling/doctype/opportunity_item/opportunity_item.txt +++ b/selling/doctype/opportunity_item/opportunity_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:51", "docstatus": 0, - "modified": "2013-03-07 07:03:26", + "modified": "2013-07-10 11:52:34", "modified_by": "Administrator", "owner": "Administrator" }, @@ -80,14 +80,9 @@ }, { "doctype": "DocField", - "fieldname": "basic_rate", - "fieldtype": "Currency", - "hidden": 1, - "label": "Basic Rate", - "oldfieldname": "basic_rate", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "print_hide": 1 + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" }, { "doctype": "DocField", @@ -97,6 +92,17 @@ "oldfieldname": "qty", "oldfieldtype": "Currency" }, + { + "doctype": "DocField", + "fieldname": "basic_rate", + "fieldtype": "Currency", + "hidden": 1, + "label": "Basic Rate", + "oldfieldname": "basic_rate", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "print_hide": 1 + }, { "doctype": "DocField", "fieldname": "uom", diff --git a/selling/doctype/quotation_item/quotation_item.txt b/selling/doctype/quotation_item/quotation_item.txt index a15166af99e..145a4e6a52c 100644 --- a/selling/doctype/quotation_item/quotation_item.txt +++ b/selling/doctype/quotation_item/quotation_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:57", "docstatus": 0, - "modified": "2013-07-09 12:24:21", + "modified": "2013-07-10 11:52:06", "modified_by": "Administrator", "owner": "Administrator" }, @@ -79,6 +79,12 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", @@ -217,6 +223,12 @@ "search_index": 0, "width": "100px" }, + { + "doctype": "DocField", + "fieldname": "reference", + "fieldtype": "Section Break", + "label": "Reference" + }, { "doctype": "DocField", "fieldname": "item_group", diff --git a/selling/doctype/sales_order_item/sales_order_item.txt b/selling/doctype/sales_order_item/sales_order_item.txt index 0d1ca5ba2e4..49f43237853 100644 --- a/selling/doctype/sales_order_item/sales_order_item.txt +++ b/selling/doctype/sales_order_item/sales_order_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:58", "docstatus": 0, - "modified": "2013-07-09 12:28:31", + "modified": "2013-07-10 11:41:52", "modified_by": "Administrator", "owner": "Administrator" }, @@ -76,6 +76,12 @@ "search_index": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", @@ -203,6 +209,12 @@ "reqd": 0, "width": "100px" }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "reserved_warehouse", diff --git a/stock/doctype/delivery_note_item/delivery_note_item.txt b/stock/doctype/delivery_note_item/delivery_note_item.txt index ef5a98435d9..7d5e8e01d1e 100644 --- a/stock/doctype/delivery_note_item/delivery_note_item.txt +++ b/stock/doctype/delivery_note_item/delivery_note_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-22 13:15:44", "docstatus": 0, - "modified": "2013-07-09 12:42:09", + "modified": "2013-07-10 11:50:59", "modified_by": "Administrator", "owner": "Administrator" }, @@ -82,6 +82,12 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", @@ -207,6 +213,12 @@ "reqd": 0, "width": "100px" }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "warehouse", diff --git a/stock/doctype/material_request_item/material_request_item.txt b/stock/doctype/material_request_item/material_request_item.txt index 992b4cf239e..799be789658 100644 --- a/stock/doctype/material_request_item/material_request_item.txt +++ b/stock/doctype/material_request_item/material_request_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:02", "docstatus": 0, - "modified": "2013-07-09 11:37:12", + "modified": "2013-07-10 11:53:34", "modified_by": "Administrator", "owner": "Administrator" }, @@ -64,6 +64,12 @@ "reqd": 1, "width": "250px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_warehouse", + "fieldtype": "Section Break", + "label": "Quantity and Warehouse" + }, { "doctype": "DocField", "fieldname": "warehouse", diff --git a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt index 186ab3de825..59426c6cccf 100755 --- a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt +++ b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:10", "docstatus": 0, - "modified": "2013-07-09 12:20:50", + "modified": "2013-07-10 11:56:05", "modified_by": "Administrator", "owner": "Administrator" }, @@ -65,6 +65,12 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "received_and_accepted", + "fieldtype": "Section Break", + "label": "Received and Accepted" + }, { "default": "0.00", "doctype": "DocField", @@ -120,6 +126,12 @@ "reqd": 1, "width": "100px" }, + { + "doctype": "DocField", + "fieldname": "rate_and_amount", + "fieldtype": "Section Break", + "label": "Rate and Amount" + }, { "doctype": "DocField", "fieldname": "import_ref_rate", @@ -200,6 +212,12 @@ "reqd": 0, "width": "100px" }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "warehouse", From 6c17f012ba6ef4490b7eafc6aef3859f8fce4675 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Jul 2013 12:28:56 +0530 Subject: [PATCH 07/27] [minor][hr] validation added: salary slip can not be made if employee left before this month --- hr/doctype/salary_slip/salary_slip.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py index e3e43e471d0..7e8b6a1724d 100644 --- a/hr/doctype/salary_slip/salary_slip.py +++ b/hr/doctype/salary_slip/salary_slip.py @@ -92,7 +92,9 @@ class DocType(TransactionBase): if getdate(emp['relieving_date']) > m['month_start_date'] and getdate(emp['relieving_date']) < m['month_end_date']: payment_days = getdate(emp['relieving_date']).day elif getdate(emp['relieving_date']) < m['month_start_date']: - payment_days = 0 + webnotes.msgprint(_("Relieving Date of employee is ") + cstr(emp['relieving_date'] + + _(". Please set status of the employee as 'Left'")), raise_exception=1) + if emp['date_of_joining']: if getdate(emp['date_of_joining']) > m['month_start_date'] and getdate(emp['date_of_joining']) < m['month_end_date']: From 0c9a7a0a1398193d2e78443ffd763ba658d77652 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 10 Jul 2013 12:54:32 +0530 Subject: [PATCH 08/27] [Fix]Warehouse in Item grid of Purchase Order to call get_projected_qty --- buying/doctype/purchase_common/purchase_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 1974aa7f8ef..284c238db92 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -191,7 +191,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ var item = wn.model.get_doc(cdt, cdn); if(item.item_code && item.warehouse) { this.frm.call({ - method: "buying.utils.get_conversion_factor", + method: "buying.utils.get_projected_qty", child: item, args: { item_code: item.item_code, From 919b9fcccfb91b1d9b2280dab913b2cf3cecd1c3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 13:06:14 +0530 Subject: [PATCH 09/27] [cleanup] Maintenance Schedule, Maintenance Visit --- buying/doctype/supplier/supplier.py | 2 +- selling/doctype/customer/customer.py | 2 +- setup/doctype/sales_person/sales_person.py | 11 +- setup/doctype/sales_person/sales_person.txt | 18 +-- .../maintenance_schedule.js | 50 +++---- .../maintenance_schedule.py | 13 +- .../maintenance_schedule.txt | 77 +++-------- .../maintenance_schedule_item.txt | 16 ++- .../maintenance_visit/maintenance_visit.js | 117 +++++++---------- .../maintenance_visit/maintenance_visit.txt | 124 ++++-------------- .../maintenance_visit_purpose.txt | 68 +++++----- 11 files changed, 195 insertions(+), 303 deletions(-) diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py index d63d33607c5..d1552f9425a 100644 --- a/buying/doctype/supplier/supplier.py +++ b/buying/doctype/supplier/supplier.py @@ -196,7 +196,7 @@ class DocType(TransactionBase): @webnotes.whitelist() def get_dashboard_info(supplier): - if not webnotes.has_permission("Supplier", supplier): + if not webnotes.has_permission("Supplier", "read", supplier): webnotes.msgprint("No Permission", raise_exception=True) out = {} diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py index 83c10a5452f..2820fb380fa 100644 --- a/selling/doctype/customer/customer.py +++ b/selling/doctype/customer/customer.py @@ -177,7 +177,7 @@ class DocType(TransactionBase): @webnotes.whitelist() def get_dashboard_info(customer): - if not webnotes.has_permission("Customer", customer): + if not webnotes.has_permission("Customer", "read", customer): webnotes.msgprint("No Permission", raise_exception=True) out = {} diff --git a/setup/doctype/sales_person/sales_person.py b/setup/doctype/sales_person/sales_person.py index ea21cd06ce6..2fe08fa711e 100644 --- a/setup/doctype/sales_person/sales_person.py +++ b/setup/doctype/sales_person/sales_person.py @@ -32,4 +32,13 @@ class DocType(DocTypeNestedSet): for d in getlist(self.doclist, 'target_details'): if not flt(d.target_qty) and not flt(d.target_amount): webnotes.msgprint("Either target qty or target amount is mandatory.") - raise Exception \ No newline at end of file + raise Exception + + def get_email_id(self): + profile = webnotes.conn.get_value("Employee", self.doc.employee, "user_id") + if not profile: + webnotes.msgprint("User ID (Profile) no set for Employee %s" % self.doc.employee, + raise_exception=True) + else: + return webnotes.conn.get_value("Profile", profile, "email") or profile + \ No newline at end of file diff --git a/setup/doctype/sales_person/sales_person.txt b/setup/doctype/sales_person/sales_person.txt index 44a246dc3ea..56c6397454d 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-07-05 14:54:33", + "modified": "2013-07-10 12:51:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -44,12 +44,10 @@ }, { "doctype": "DocField", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "oldfieldtype": "Small Text", - "read_only": 1 + "fieldname": "name_and_employee_id", + "fieldtype": "Section Break", + "label": "Name and Employee ID", + "options": "icon-user" }, { "doctype": "DocField", @@ -93,7 +91,8 @@ "fieldname": "employee", "fieldtype": "Link", "label": "Employee", - "options": "Employee" + "options": "Employee", + "reqd": 1 }, { "doctype": "DocField", @@ -138,7 +137,8 @@ "fieldname": "target_details_section_break", "fieldtype": "Section Break", "label": "Sales Person Targets", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "options": "icon-bullseye" }, { "doctype": "DocField", diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.js b/support/doctype/maintenance_schedule/maintenance_schedule.js index ec75289290f..6e43cb1aaf1 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -17,6 +17,30 @@ wn.provide("erpnext.support"); // TODO commonify this code erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ + refresh: function() { + if (this.frm.doc.docstatus===0) { + cur_frm.add_custom_button(wn._('From Sales Order'), + function() { + wn.model.map_current_doc({ + method: "selling.doctype.sales_order.sales_order.make_maintenance_schedule", + source_doctype: "Sales Order", + get_query_filters: { + docstatus: 1, + order_type: cur_frm.doc.order_type, + customer: cur_frm.doc.customer || undefined, + company: cur_frm.doc.company + } + }) + }); + } else if (this.frm.doc.docstatus===1) { + cur_frm.add_custom_button(wn._("Make Maintenance Visit"), function() { + wn.model.open_mapped_doc({ + method: "support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit", + source_name: cur_frm.doc.name + }) + }) + } + }, customer: function() { var me = this; if(this.frm.doc.customer) { @@ -27,23 +51,8 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ if(!r.exc) me.frm.refresh_fields(); } }); - - // TODO shift this to depends_on - unhide_field(['customer_address', 'contact_person', 'customer_name', - 'address_display', 'contact_display', 'contact_mobile', 'contact_email', - 'territory', 'customer_group']); - - } + } }, - - get_items: function() { - wn.model.map_current_doc({ - method: "selling.doctype.sales_order.sales_order.make_maintenance_schedule", - source_name: cur_frm.doc.quotation_no, - }); - unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', - 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']); - } }); $.extend(cur_frm.cscript, new erpnext.support.MaintenanceSchedule({frm: cur_frm})); @@ -82,15 +91,6 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { } } -cur_frm.fields_dict['sales_order_no'].get_query = function(doc) { - doc = locals[this.doctype][this.docname]; - var cond = ''; - if(doc.customer) { - cond = '`tabSales Order`.customer = "'+doc.customer+'" AND'; - } - return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond}); -} - cur_frm.cscript.periodicity = function(doc, cdt, cdn){ var d = locals[cdt][cdn]; if(d.start_date && d.end_date){ diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.py b/support/doctype/maintenance_schedule/maintenance_schedule.py index ee7f45a852c..0e2d1f99202 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -77,8 +77,8 @@ class DocType(TransactionBase): self.update_amc_date(d.serial_no, d.end_date) if d.incharge_name not in email_map: - e = sql("select email_id, name from `tabSales Person` where name='%s' " %(d.incharge_name),as_dict=1)[0] - email_map[d.incharge_name] = (e['email_id']) + email_map[d.incharge_name] = webnotes.bean("Sales Person", + d.incharge_name).run_method("get_email_id") scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \ where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \ @@ -312,6 +312,9 @@ class DocType(TransactionBase): def make_maintenance_visit(source_name, target_doclist=None): from webnotes.model.mapper import get_mapped_doclist + def update_status(source, target, parent): + target.maintenance_type = "Scheduled" + doclist = get_mapped_doclist("Maintenance Schedule", source_name, { "Maintenance Schedule": { "doctype": "Maintenance Visit", @@ -320,13 +323,15 @@ def make_maintenance_visit(source_name, target_doclist=None): }, "validation": { "docstatus": ["=", 1] - } + }, + "postprocess": update_status }, "Maintenance Schedule Item": { "doctype": "Maintenance Visit Purpose", "field_map": { "parent": "prevdoc_docname", - "parenttype": "prevdoc_doctype" + "parenttype": "prevdoc_doctype", + "incharge_name": "service_person" } } }, target_doclist) diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.txt b/support/doctype/maintenance_schedule/maintenance_schedule.txt index fc95ec6dc2d..0491946bf03 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.txt +++ b/support/doctype/maintenance_schedule/maintenance_schedule.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:30", "docstatus": 0, - "modified": "2013-07-07 12:18:51", + "modified": "2013-07-10 12:18:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -24,13 +24,19 @@ "permlevel": 0 }, { + "amend": 1, + "cancel": 1, + "create": 1, "doctype": "DocPerm", "name": "__common__", "parent": "Maintenance Schedule", "parentfield": "permissions", "parenttype": "DocType", + "permlevel": 0, "read": 1, - "report": 1 + "report": 1, + "submit": 1, + "write": 1 }, { "doctype": "DocType", @@ -42,7 +48,7 @@ "fieldtype": "Section Break", "label": "Customer Details", "oldfieldtype": "Section Break", - "options": "Simple" + "options": "icon-user" }, { "doctype": "DocField", @@ -97,6 +103,7 @@ "doctype": "DocField", "fieldname": "address_display", "fieldtype": "Small Text", + "hidden": 1, "label": "Address", "read_only": 1 }, @@ -104,20 +111,23 @@ "doctype": "DocField", "fieldname": "contact_display", "fieldtype": "Small Text", + "hidden": 1, "label": "Contact", "read_only": 1 }, { "doctype": "DocField", "fieldname": "contact_mobile", - "fieldtype": "Text", + "fieldtype": "Data", + "hidden": 1, "label": "Mobile No", "read_only": 1 }, { "doctype": "DocField", "fieldname": "contact_email", - "fieldtype": "Text", + "fieldtype": "Data", + "hidden": 1, "label": "Contact Email", "print_hide": 1, "read_only": 1 @@ -202,26 +212,7 @@ "fieldtype": "Section Break", "label": "Items", "oldfieldtype": "Section Break", - "options": "Simple" - }, - { - "doctype": "DocField", - "fieldname": "sales_order_no", - "fieldtype": "Link", - "in_filter": 1, - "label": "Sales Order No", - "oldfieldname": "sales_order_no", - "oldfieldtype": "Link", - "options": "Sales Order", - "search_index": 1 - }, - { - "doctype": "DocField", - "fieldname": "get_items", - "fieldtype": "Button", - "label": "Get Items", - "oldfieldtype": "Button", - "report_hide": 1 + "options": "icon-shopping-cart" }, { "doctype": "DocField", @@ -238,7 +229,7 @@ "fieldtype": "Section Break", "label": "Schedule", "oldfieldtype": "Section Break", - "options": "Simple" + "options": "icon-time" }, { "doctype": "DocField", @@ -258,41 +249,11 @@ "read_only": 1 }, { - "amend": 1, - "cancel": 1, - "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "role": "System Manager", - "submit": 1, - "write": 1 + "role": "System Manager" }, { - "amend": 0, - "cancel": 0, - "create": 0, "doctype": "DocPerm", - "permlevel": 1, - "role": "System Manager", - "submit": 0 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "permlevel": 0, - "role": "Maintenance Manager", - "submit": 1, - "write": 1 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "role": "Maintenance Manager", - "submit": 0 + "role": "Maintenance Manager" } ] \ No newline at end of file diff --git a/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt b/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt index 3a95b2c0a3f..5c0fe3cddd3 100644 --- a/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt +++ b/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:05", "docstatus": 0, - "modified": "2013-03-07 07:03:24", + "modified": "2013-07-10 12:45:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -57,6 +57,12 @@ "read_only": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "schedule_details", + "fieldtype": "Section Break", + "label": "Schedule Details" + }, { "doctype": "DocField", "fieldname": "start_date", @@ -102,13 +108,19 @@ "fieldname": "incharge_name", "fieldtype": "Link", "in_filter": 1, - "label": "Incharge Name", + "label": "Sales Person Incharge", "oldfieldname": "incharge_name", "oldfieldtype": "Link", "options": "Sales Person", "reqd": 1, "search_index": 0 }, + { + "doctype": "DocField", + "fieldname": "reference", + "fieldtype": "Section Break", + "label": "Reference" + }, { "doctype": "DocField", "fieldname": "serial_no", diff --git a/support/doctype/maintenance_visit/maintenance_visit.js b/support/doctype/maintenance_visit/maintenance_visit.js index 6c282c01ad0..50cc797355c 100644 --- a/support/doctype/maintenance_visit/maintenance_visit.js +++ b/support/doctype/maintenance_visit/maintenance_visit.js @@ -17,6 +17,49 @@ wn.provide("erpnext.support"); // TODO commonify this code erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({ + refresh: function() { + if (this.frm.doc.docstatus===0) { + cur_frm.add_custom_button(wn._('From Maintenance Schedule'), + function() { + wn.model.map_current_doc({ + method: "support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit", + source_doctype: "Maintenance Schedule", + get_query_filters: { + docstatus: 1, + customer: cur_frm.doc.customer || undefined, + company: cur_frm.doc.company + } + }) + }); + cur_frm.add_custom_button(wn._('From Customer Issue'), + function() { + wn.model.map_current_doc({ + method: "support.doctype.customer_issue.customer_issue.make_maintenance_visit", + source_doctype: "Customer Issue", + get_query_filters: { + docstatus: 1, + status: ["in", "Open, Work in Progress"], + customer: cur_frm.doc.customer || undefined, + company: cur_frm.doc.company + } + }) + }); + cur_frm.add_custom_button(wn._('From Sales Order'), + function() { + wn.model.map_current_doc({ + method: "selling.doctype.sales_order.sales_order.make_maintenance_visit", + source_doctype: "Sales Order", + get_query_filters: { + docstatus: 1, + order_type: cur_frm.doc.order_type, + customer: cur_frm.doc.customer || undefined, + company: cur_frm.doc.company + } + }) + }); + } + cur_frm.cscript.hide_contact_info(); + }, customer: function() { var me = this; if(this.frm.doc.customer) { @@ -29,29 +72,9 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({ }); // TODO shift this to depends_on - hide_contact_info(this.frm.doc); + cur_frm.cscript.hide_contact_info(); } }, - - get_items: function() { - if(cur_frm.doc.sales_order_no) { - wn.model.map_current_doc({ - method: "selling.doctype.sales_order.sales_order.make_maintenance_visit", - source_name: cur_frm.doc.quotation_no, - }); - } else if (cur_frm.doc.customer_issue_no) { - wn.model.map_current_doc({ - method: "support.doctype.customer_issue.customer_issue.make_maintenance_visit", - source_name: cur_frm.doc.quotation_no, - }); - } else if (cur_frm.doc.maintenance_schedule) { - wn.model.map_current_doc({ - method: "support.doctype.maintenance_schedule.maintenance_schedule\ - .make_maintenance_visit", - source_name: cur_frm.doc.quotation_no, - }); - } - } }); $.extend(cur_frm.cscript, new erpnext.support.MaintenanceVisit({frm: cur_frm})); @@ -59,17 +82,11 @@ $.extend(cur_frm.cscript, new erpnext.support.MaintenanceVisit({frm: cur_frm})); cur_frm.cscript.onload = function(doc, dt, dn) { if(!doc.status) set_multiple(dt,dn,{status:'Draft'}); if(doc.__islocal) set_multiple(dt,dn,{mntc_date:get_today()}); - hide_contact_info(doc); + cur_frm.cscript.hide_contact_info(); } -var hide_contact_info = function(doc) { - if(doc.customer) $(cur_frm.fields_dict.contact_info_section.row.wrapper).toggle(true); - else $(cur_frm.fields_dict.contact_info_section.row.wrapper).toggle(false); - -} - -cur_frm.cscript.refresh = function(doc) { - hide_contact_info(doc); +cur_frm.cscript.hide_contact_info = function() { + cur_frm.toggle_display("contact_info_section", cur_frm.doc.customer ? true : false); } cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { @@ -84,14 +101,6 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } -cur_frm.cscript.get_items = function(doc, dt, dn) { - var callback = function(r,rt) { - hide_contact_info(doc); - cur_frm.refresh(); - } - get_server_fields('fetch_items','','',doc, dt, dn,1,callback); -} - cur_frm.fields_dict['maintenance_visit_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'; } @@ -104,36 +113,4 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { } } -cur_frm.fields_dict['sales_order_no'].get_query = function(doc) { - doc = locals[this.doctype][this.docname]; - var cond = ''; - if(doc.customer) { - cond = '`tabSales Order`.customer = "'+doc.customer+'" AND'; - } - return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond}); -} - -cur_frm.fields_dict['customer_issue_no'].get_query = function(doc) { - doc = locals[this.doctype][this.docname]; - var cond = ''; - if(doc.customer) { - cond = '`tabCustomer Issue`.customer = "'+doc.customer+'" AND'; - } - return repl('SELECT `tabCustomer Issue`.name FROM `tabCustomer Issue` WHERE `tabCustomer Issue`.company = "%(company)s" AND %(cond)s `tabCustomer Issue`.docstatus = 1 AND (`tabCustomer Issue`.status = "Open" OR `tabCustomer Issue`.status = "Work In Progress") AND `tabCustomer Issue`.name LIKE "%s" ORDER BY `tabCustomer Issue`.name DESC LIMIT 50', {company:doc.company, cond:cond}); -} - -cur_frm.fields_dict['maintenance_schedule'].get_query = function(doc) { - doc = locals[this.doctype][this.docname]; - var cond = ''; - if(doc.customer) { - cond = '`tabMaintenance Schedule`.customer = "'+doc.customer+'" AND'; - } - return repl('SELECT `tabMaintenance Schedule`.name FROM `tabMaintenance Schedule` WHERE `tabMaintenance Schedule`.company = "%(company)s" AND %(cond)s `tabMaintenance Schedule`.docstatus = 1 AND `tabMaintenance Schedule`.name LIKE "%s" ORDER BY `tabMaintenance Schedule`.name DESC LIMIT 50', {company:doc.company, cond:cond}); -} - -//get query select Territory -cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { - return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; -} - cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; \ No newline at end of file diff --git a/support/doctype/maintenance_visit/maintenance_visit.txt b/support/doctype/maintenance_visit/maintenance_visit.txt index c57787e4d41..478d9ac71af 100644 --- a/support/doctype/maintenance_visit/maintenance_visit.txt +++ b/support/doctype/maintenance_visit/maintenance_visit.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:31", "docstatus": 0, - "modified": "2013-07-07 12:08:12", + "modified": "2013-07-10 12:26:15", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -24,13 +24,19 @@ "permlevel": 0 }, { + "amend": 1, + "cancel": 1, + "create": 1, "doctype": "DocPerm", "name": "__common__", "parent": "Maintenance Visit", "parentfield": "permissions", "parenttype": "DocType", + "permlevel": 0, "read": 1, - "report": 1 + "report": 1, + "submit": 1, + "write": 1 }, { "doctype": "DocType", @@ -42,7 +48,7 @@ "fieldtype": "Section Break", "label": "Customer Details", "oldfieldtype": "Section Break", - "options": "Simple" + "options": "icon-user" }, { "doctype": "DocField", @@ -137,7 +143,7 @@ "fieldtype": "Section Break", "label": "Maintenance Details", "oldfieldtype": "Section Break", - "options": "Simple" + "options": "icon-wrench" }, { "doctype": "DocField", @@ -150,6 +156,11 @@ "options": "\nPartially Completed\nFully Completed", "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "column_break_14", + "fieldtype": "Column Break" + }, { "default": "Unscheduled", "doctype": "DocField", @@ -164,58 +175,12 @@ "reqd": 1, "search_index": 0 }, - { - "doctype": "DocField", - "fieldname": "column_break2", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "width": "50%" - }, - { - "doctype": "DocField", - "fieldname": "sales_order_no", - "fieldtype": "Link", - "in_filter": 1, - "label": "Sales Order No", - "oldfieldname": "sales_order_no", - "oldfieldtype": "Link", - "options": "Sales Order", - "search_index": 1 - }, - { - "doctype": "DocField", - "fieldname": "customer_issue_no", - "fieldtype": "Link", - "in_filter": 1, - "label": "Customer Issue No", - "oldfieldname": "customer_issue_no", - "oldfieldtype": "Link", - "options": "Customer Issue", - "search_index": 1 - }, - { - "doctype": "DocField", - "fieldname": "maintenance_schedule", - "fieldtype": "Link", - "in_filter": 1, - "label": "Maintenance Schedule", - "options": "Maintenance Schedule" - }, - { - "doctype": "DocField", - "fieldname": "get_items", - "fieldtype": "Button", - "label": "Get Items", - "oldfieldtype": "Button", - "print_hide": 1, - "report_hide": 1 - }, { "doctype": "DocField", "fieldname": "section_break0", "fieldtype": "Section Break", "oldfieldtype": "Section Break", - "options": "Simple" + "options": "icon-wrench" }, { "doctype": "DocField", @@ -231,7 +196,8 @@ "fieldname": "more_info", "fieldtype": "Section Break", "label": "More Info", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "options": "icon-file-text" }, { "doctype": "DocField", @@ -301,7 +267,8 @@ "doctype": "DocField", "fieldname": "contact_info_section", "fieldtype": "Section Break", - "label": "Contact Info" + "label": "Contact Info", + "options": "icon-bullhorn" }, { "doctype": "DocField", @@ -341,60 +308,15 @@ "print_hide": 1 }, { - "amend": 1, - "cancel": 1, - "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "role": "System Manager", - "submit": 1, - "write": 1 + "role": "System Manager" }, { - "amend": 0, - "cancel": 0, - "create": 0, "doctype": "DocPerm", - "permlevel": 1, - "role": "System Manager", - "submit": 0 + "role": "Maintenance Manager" }, { - "amend": 1, - "cancel": 1, - "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "role": "Maintenance Manager", - "submit": 1, - "write": 1 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "role": "Maintenance Manager", - "submit": 0 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "permlevel": 0, - "role": "Maintenance User", - "submit": 1, - "write": 1 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "role": "Maintenance User", - "submit": 0 + "role": "Maintenance User" } ] \ No newline at end of file diff --git a/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt b/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt index 694f87105d8..4f4af9ac546 100644 --- a/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt +++ b/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:06", "docstatus": 0, - "modified": "2013-03-07 07:03:24", + "modified": "2013-07-10 12:58:21", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -25,36 +25,6 @@ "doctype": "DocType", "name": "Maintenance Visit Purpose" }, - { - "doctype": "DocField", - "fieldname": "description", - "fieldtype": "Small Text", - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Small Text", - "print_width": "300px", - "reqd": 1, - "width": "300px" - }, - { - "doctype": "DocField", - "fieldname": "service_person", - "fieldtype": "Link", - "label": "Service Person", - "oldfieldname": "service_person", - "oldfieldtype": "Link", - "options": "Sales Person", - "reqd": 1 - }, - { - "doctype": "DocField", - "fieldname": "work_done", - "fieldtype": "Small Text", - "label": "Work Done", - "oldfieldname": "work_done", - "oldfieldtype": "Small Text", - "reqd": 1 - }, { "doctype": "DocField", "fieldname": "item_code", @@ -81,6 +51,42 @@ "oldfieldname": "serial_no", "oldfieldtype": "Small Text" }, + { + "doctype": "DocField", + "fieldname": "description", + "fieldtype": "Small Text", + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "print_width": "300px", + "reqd": 1, + "width": "300px" + }, + { + "doctype": "DocField", + "fieldname": "work_details", + "fieldtype": "Section Break", + "label": "Work Details" + }, + { + "doctype": "DocField", + "fieldname": "service_person", + "fieldtype": "Link", + "label": "Sales Person", + "oldfieldname": "service_person", + "oldfieldtype": "Link", + "options": "Sales Person", + "reqd": 1 + }, + { + "doctype": "DocField", + "fieldname": "work_done", + "fieldtype": "Small Text", + "label": "Work Done", + "oldfieldname": "work_done", + "oldfieldtype": "Small Text", + "reqd": 1 + }, { "doctype": "DocField", "fieldname": "prevdoc_docname", From f52dc07a5875e0cea89744610a132e9b93007aa9 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 10 Jul 2013 13:07:49 +0530 Subject: [PATCH 10/27] queries to server side --- .../mode_of_payment/mode_of_payment.js | 11 ++-- .../doctype/sales_invoice/sales_invoice.js | 8 ++- .../doctype/sales_invoice/sales_invoice.py | 11 ++++ .../purchase_common/purchase_common.js | 28 ++++++--- controllers/queries.py | 17 ++++-- .../bom_replace_tool/bom_replace_tool.js | 10 ++- .../production_order/production_order.js | 5 +- projects/doctype/time_log/time_log.js | 6 +- selling/doctype/sales_common/sales_common.js | 61 +++++++++++-------- selling/doctype/sales_common/sales_common.py | 22 +++++++ 10 files changed, 125 insertions(+), 54 deletions(-) diff --git a/accounts/doctype/mode_of_payment/mode_of_payment.js b/accounts/doctype/mode_of_payment/mode_of_payment.js index 85b2ab1696f..e3625e61000 100644 --- a/accounts/doctype/mode_of_payment/mode_of_payment.js +++ b/accounts/doctype/mode_of_payment/mode_of_payment.js @@ -15,8 +15,11 @@ // along with this program. If not, see . cur_frm.set_query("default_account", function(doc) { - return erpnext.queries.account({ - account_type: "Bank or Cash", - company: doc.company - }); + return{ + query: "controllers.queries.account_query", + filters: { + 'account_type': "Bank or Cash", + 'company': doc.company + } + } }); \ No newline at end of file diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 1487ec98728..421630b450f 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -313,14 +313,16 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { // Income Account in Details Table // -------------------------------- cur_frm.set_query("income_account", "entries", function(doc) { - return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Credit" OR tabAccount.account_type = "Income Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'; -}) + return{ + query: "accounts.doctype.sales_invoice.sales_invoice.get_income_account", + filters: {'company': doc.company} + } +}); // expense account if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", filters: { 'is_pl_account': 'Yes', 'debit_or_credit': 'Debit', diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index e0147b12d38..d7ab91a5ca7 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -984,3 +984,14 @@ def get_bank_cash_account(mode_of_payment): return { "cash_bank_account": val } + +def get_income_account(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + + return webnotes.conn.sql("""select tabAccount.name from `tabAccount` + where (tabAccount.debit_or_credit="Credit" + or tabAccount.account_type = "Income Account") + and tabAccount.group_or_ledger="Ledger" and tabAccount.docstatus!=2 + and tabAccount.company = '%(company)s' and tabAccount.%(key)s LIKE '%(txt)s' + %(mcond)s""" % {'company': filters['company'], 'key': searchfield, + 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)}) \ No newline at end of file diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 1b7dcf0e473..7d3d600c0af 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -28,27 +28,37 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ if(this.frm.fields_dict.price_list_name) { this.frm.set_query("price_list_name", function() { - return repl("select name, currency from `tabPrice List` \ - where buying_or_selling = 'Buying' and name like \"%s%%\""); + return{ + filters: { 'buying_or_selling': "Buying" } + } }); this.frm.set_query("price_list_currency", function() { - return repl("select distinct ref_currency from `tabItem Price` \ - where price_list_name=\"%(price_list_name)s\" and buying_or_selling = 'Buying' \ - and ref_currency like \"%s%%\"", - {price_list_name: me.frm.doc.price_list_name}); + return{ + filters: { + 'price_list_name': me.frm.doc.price_list_name, + 'buying_or_selling': "Buying" + } + } }); } if(this.frm.fields_dict.supplier) { - this.frm.set_query("supplier", erpnext.utils.supplier_query); + this.frm.set_query("supplier", function() { + return{ query:"controllers.queries.supplier_query" }}); } this.frm.set_query("item_code", this.frm.cscript.fname, function() { if(me.frm.doc.is_subcontracted == "Yes") { - return erpnext.queries.item({'ifnull(tabItem.is_sub_contracted_item, "No")': "Yes"}); + return{ + query:"controllers.queries.item_query", + filters:{ 'is_sub_contracted_item': 'Yes' } + } } else { - return erpnext.queries.item({'ifnull(tabItem.is_purchase_item, "No")': "Yes"}); + return{ + query:"controllers.queries.item_query", + filters:{ 'is_purchase_item': 'Yes' } + } } }); }, diff --git a/controllers/queries.py b/controllers/queries.py index ac8ab251221..67d53184d5a 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -20,7 +20,13 @@ import webnotes def get_filters_cond(doctype, filters, conditions): if filters: if isinstance(filters, dict): - filters = map(lambda f: [doctype, f[0], "=", f[1]], filters.items()) + filters = filters.items() + flt = [] + for f in filters: + if f[1][0] == '!': + flt.append([doctype, f[0], '!=', f[1][1:]]) + else: + flt.append([doctype, f[0], '=', f[1]]) from webnotes.widgets.reportview import build_filter_conditions build_filter_conditions(filters, conditions) @@ -36,6 +42,7 @@ def get_match_cond(doctype, searchfield = 'name'): from webnotes.widgets.reportview import build_match_conditions cond = build_match_conditions(doctype, fields) + if cond: cond = ' and ' + cond else: @@ -81,10 +88,12 @@ def lead_query(doctype, txt, searchfield, start, page_len, filters): # searches for customer def customer_query(doctype, txt, searchfield, start, page_len, filters): cust_master_name = webnotes.defaults.get_user_default("cust_master_name") + if cust_master_name == "Customer Name": fields = ["name", "customer_group", "territory"] else: fields = ["name", "customer_name", "customer_group", "territory"] + fields = ", ".join(fields) return webnotes.conn.sql("""select %(field)s from `tabCustomer` where docstatus < 2 and @@ -142,6 +151,7 @@ def account_query(doctype, txt, searchfield, start, page_len, filters): def item_query(doctype, txt, searchfield, start, page_len, filters): conditions = [] + return webnotes.conn.sql("""select tabItem.name, if(length(tabItem.item_name) > 40, concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name, @@ -158,6 +168,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters): def bom(doctype, txt, searchfield, start, page_len, filters): conditions = [] + return webnotes.conn.sql("""select tabBOM.name, tabBOM.item from tabBOM where tabBOM.docstatus=1 and tabBOM.is_active=1 @@ -166,10 +177,6 @@ def bom(doctype, txt, searchfield, start, page_len, filters): 'fcond': get_filters_cond(doctype, filters, conditions), 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) -# erpnext.queries.task = function() { -# return { query: "projects.utils.query_task" }; -# }; - def get_project_name(doctype, txt, searchfield, start, page_len, filters): cond = '' if filters['customer']: diff --git a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.js b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.js index c98603cfb97..bad03ac2ae9 100644 --- a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.js +++ b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.js @@ -20,10 +20,16 @@ cur_frm.cscript.refresh = function(doc) { } cur_frm.set_query("current_bom", function(doc) { - return erpnext.queries.bom({name: "!" + doc.new_bom}); + return{ + query:"controllers.queries.bom", + filters: {name: "!" + doc.new_bom} + } }); cur_frm.set_query("new_bom", function(doc) { - return erpnext.queries.bom({name: "!" + doc.current_bom}); + return{ + query:"controllers.queries.bom", + filters: {name: "!" + doc.current_bom} + } }); \ No newline at end of file diff --git a/manufacturing/doctype/production_order/production_order.js b/manufacturing/doctype/production_order/production_order.js index 7dc905a5369..c3a45e2f4a8 100644 --- a/manufacturing/doctype/production_order/production_order.js +++ b/manufacturing/doctype/production_order/production_order.js @@ -117,6 +117,9 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) { cur_frm.set_query("bom_no", function(doc) { if (doc.production_item) { - return erpnext.queries.bom({item: cstr(doc.production_item)}); + return{ + query:"controllers.queries.bom", + filters: {item: cstr(doc.production_item)} + } } else msgprint(" Please enter Production Item first"); }); \ No newline at end of file diff --git a/projects/doctype/time_log/time_log.js b/projects/doctype/time_log/time_log.js index 22f9610b8ff..69ec3043c93 100644 --- a/projects/doctype/time_log/time_log.js +++ b/projects/doctype/time_log/time_log.js @@ -2,8 +2,8 @@ wn.provide("erpnext.projects"); erpnext.projects.TimeLog = wn.ui.form.Controller.extend({ setup: function() { - this.frm.set_query("task", erpnext.queries.task); - } -}); + this.frm.set_query("task", function() { + return { query: "projects.utils.query_task" } + }); cur_frm.cscript = new erpnext.projects.TimeLog({frm: cur_frm}); \ No newline at end of file diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index 02db55a29dc..8d869501f2c 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -36,33 +36,34 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } this.frm.set_query("customer_address", function() { - return 'SELECT name, address_line1, city FROM tabAddress \ - WHERE customer = "'+ me.frm.doc.customer +'" AND docstatus != 2 AND \ - %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; + return { + filters: {'customer': me.frm.doc.customer } + } }); this.frm.set_query("contact_person", function() { - return 'SELECT name, CONCAT(first_name," ",ifnull(last_name,"")) As FullName, \ - department, designation FROM tabContact WHERE customer = "'+ me.frm.doc.customer + - '" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; + return { + filters: {'customer': me.frm.doc.customer } + } }); if(this.frm.fields_dict.charge) { this.frm.set_query("charge", function() { - return 'SELECT DISTINCT `tabSales Taxes and Charges Master`.name FROM \ - `tabSales Taxes and Charges Master` \ - WHERE `tabSales Taxes and Charges Master`.company = "' + me.frm.doc.company + - '" AND `tabSales Taxes and Charges Master`.company is not NULL \ - AND `tabSales Taxes and Charges Master`.docstatus != 2 \ - AND `tabSales Taxes and Charges Master`.%(key)s LIKE "%s" \ - ORDER BY `tabSales Taxes and Charges Master`.name LIMIT 50'; + return { + filters: [ + ['Sales Taxes and Charges Master', 'company', '=', me.frm.doc.company], + ['Sales Taxes and Charges Master', 'company', 'is not', 'NULL'], + ['Sales Taxes and Charges Master', 'docstatus', '!=', 2] + ] + } }); } this.frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { return{ query:"controllers.queries.customer_query" } } - this.frm.fields_dict.lead && this.frm.set_query("lead", erpnext.utils.lead_query); + this.frm.fields_dict.lead && this.frm.set_query("lead", function(doc,cdt,cdn) { + return{ query:"controllers.queries.lead_query" } }); if(!this.fname) { return; @@ -71,8 +72,10 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ if(this.frm.fields_dict[this.fname].grid.get_field('item_code')) { this.frm.set_query("item_code", this.fname, function() { return me.frm.doc.order_type === "Maintenance" ? - erpnext.queries.item({'ifnull(tabItem.is_service_item, "No")': "Yes"}) : - erpnext.queries.item({'ifnull(tabItem.is_sales_item, "No")': "Yes"}); + { query:"controllers.queries.item_query", + filters:{'is_service_item': 'Yes'}} : + { query:"controllers.queries.item_query", + filters:{'is_sales_item': 'Yes' }} ; }); } @@ -83,18 +86,22 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ wn.throw("Please enter Item Code to get batch no"); } else { if(item.warehouse) { - return "select batch_no from `tabStock Ledger Entry` sle \ - where item_code = '" + item.item_code + - "' and warehouse = '" + item.warehouse + - "' and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%s' \ - and exists(select * from `tabBatch` where \ - name = sle.batch_no and expiry_date >= '" + me.frm.doc.posting_date + - "' and docstatus != 2) group by batch_no having sum(actual_qty) > 0 \ - order by batch_no desc limit 50"; + return { + query : "selling.doctype.sales_common.sales_common.get_batch_no", + filters: { + 'item_code': item.item_code, + 'warehouse': item.warehouse, + 'posting_date': me.frm.doc.posting_date + } + } } else { - return "SELECT name FROM tabBatch WHERE docstatus != 2 AND item = '" + - item.item_code + "' and expiry_date >= '" + me.frm.doc.posting_date + - "' AND name like '%s' ORDER BY name DESC LIMIT 50"; + return{ + query : "selling.doctype.sales_common.sales_common.get_batch_no", + filters: { + 'item': item.item_code, + 'posting_date': me.frm.doc.posting_date + } + } } } }); diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py index f34ebf917d8..dfbfb489584 100644 --- a/selling/doctype/sales_common/sales_common.py +++ b/selling/doctype/sales_common/sales_common.py @@ -365,3 +365,25 @@ class DocType(TransactionBase): dt = webnotes.conn.sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname)) d.prevdoc_date = (dt and dt[0][0]) and dt[0][0].strftime('%Y-%m-%d') or '' +def get_batch_no(doctype, txt, searchfield, start, page_len, filters): + from controllers.queries import get_match_cond + + if filters.has_key('warehouse'): + return webnotes.conn.sql("""select batch_no from `tabStock Ledger Entry` sle + where item_code = '%(item_code)s' and warehouse = '%(warehouse)s' + and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%(txt)s' + and exists(select * from `tabBatch` where + name = sle.batch_no and expiry_date >= '%(posting_date)s' + and docstatus != 2) %(mcond)s + group by batch_no having sum(actual_qty) > 0 + order by batch_no desc limit %(start)s, %(page_len)s + """ % {'item_code': filters['item_code'], 'warehouse': filters['warehouse'], + 'posting_date': filters['posting_date'], 'txt': 'txt': "%%%s%%" % txt, + 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) + else: + return webnotes.conn.sql("""select name from tabBatch where docstatus != 2 + and item = '%(item_code)s' and expiry_date >= '%(posting_date)s' + and name like '%(txt)s' %(mcond)s ORDER BY name DESC LIMIT 50""" % + {'item_code': filters['item_code'], 'posting_date': filters['posting_date'], + 'txt': 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) \ No newline at end of file From 790a91271ef24c885136018573729c6896dd68a6 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 13:18:02 +0530 Subject: [PATCH 11/27] [fix] Customer Issue no longer submittable, does not make sense --- .../doctype/customer_issue/customer_issue.js | 7 ++-- .../doctype/customer_issue/customer_issue.txt | 32 ++++--------------- .../maintenance_visit/maintenance_visit.js | 1 - 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js index 558ef321b48..9957c8e5b9a 100644 --- a/support/doctype/customer_issue/customer_issue.js +++ b/support/doctype/customer_issue/customer_issue.js @@ -18,10 +18,9 @@ wn.provide("erpnext.support"); // TODO commonify this code erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({ refresh: function() { - if(cur_frm.doc.docstatus==1 && (cur_frm.doc.status=='Open' || - cur_frm.doc.status == 'Work In Progress')) { - cur_frm.add_custom_button('Make Maintenance Visit', this.make_maintenance_visit) - } + if((cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) { + cur_frm.add_custom_button('Make Maintenance Visit', this.make_maintenance_visit) + } }, customer: function() { diff --git a/support/doctype/customer_issue/customer_issue.txt b/support/doctype/customer_issue/customer_issue.txt index 1850f571899..5f89ade9abb 100644 --- a/support/doctype/customer_issue/customer_issue.txt +++ b/support/doctype/customer_issue/customer_issue.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:30", "docstatus": 0, - "modified": "2013-07-05 14:34:37", + "modified": "2013-07-10 13:13:27", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, @@ -10,7 +10,7 @@ "autoname": "naming_series:", "doctype": "DocType", "icon": "icon-bug", - "is_submittable": 1, + "is_submittable": 0, "module": "Support", "name": "__common__", "search_fields": "status,customer,customer_name,allocated_to,allocated_on, territory" @@ -24,6 +24,8 @@ "permlevel": 0 }, { + "amend": 0, + "cancel": 1, "create": 1, "doctype": "DocPerm", "name": "__common__", @@ -33,6 +35,8 @@ "permlevel": 0, "read": 1, "report": 1, + "role": "Maintenance User", + "submit": 0, "write": 1 }, { @@ -412,28 +416,6 @@ "width": "150px" }, { - "amend": 1, - "cancel": 1, - "doctype": "DocPerm", - "role": "System Manager", - "submit": 1 - }, - { - "amend": 1, - "cancel": 1, - "doctype": "DocPerm", - "role": "Maintenance Manager", - "submit": 1 - }, - { - "amend": 1, - "cancel": 1, - "doctype": "DocPerm", - "role": "Maintenance User", - "submit": 1 - }, - { - "doctype": "DocPerm", - "role": "Guest" + "doctype": "DocPerm" } ] \ No newline at end of file diff --git a/support/doctype/maintenance_visit/maintenance_visit.js b/support/doctype/maintenance_visit/maintenance_visit.js index 50cc797355c..8de80afca3a 100644 --- a/support/doctype/maintenance_visit/maintenance_visit.js +++ b/support/doctype/maintenance_visit/maintenance_visit.js @@ -37,7 +37,6 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({ method: "support.doctype.customer_issue.customer_issue.make_maintenance_visit", source_doctype: "Customer Issue", get_query_filters: { - docstatus: 1, status: ["in", "Open, Work in Progress"], customer: cur_frm.doc.customer || undefined, company: cur_frm.doc.company From 749b37f4f56e98d9b67f64076002ff63abdb868d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Jul 2013 14:16:59 +0530 Subject: [PATCH 12/27] [fix][hr] pull salary structure in salary slip --- hr/doctype/employee/employee.js | 15 ++++---- hr/doctype/employee/employee.txt | 51 ++++++--------------------- hr/doctype/salary_slip/salary_slip.py | 8 +---- 3 files changed, 17 insertions(+), 57 deletions(-) diff --git a/hr/doctype/employee/employee.js b/hr/doctype/employee/employee.js index 5a2dbab87f7..4ef66a0b84f 100644 --- a/hr/doctype/employee/employee.js +++ b/hr/doctype/employee/employee.js @@ -30,13 +30,9 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({ refresh: function() { var me = this; erpnext.hide_naming_series(); - if(!this.frm.doc.__islocal) { - cur_frm.add_custom_button('View Active Salary Structure', function() { - me.view_active_salary_structure(this); }); - + if(!this.frm.doc.__islocal) { cur_frm.add_custom_button('Make Salary Structure', function() { me.make_salary_structure(this); }); - } }, @@ -45,7 +41,8 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({ this.frm.call({ method:"hr.utils.get_leave_approver_list", callback: function(r) { - me.frm.fields_dict.employee_leave_approvers.grid.get_field("leave_approver").df.options = + me.frm.fields_dict.employee_leave_approvers.grid + .get_field("leave_approver").df.options = $.map(r.message, function(profile) { return {value: profile, label: wn.user_info(profile).fullname}; }); @@ -75,9 +72,9 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({ if(r.message) { msgprint(wn._("Employee") + ' "' + me.frm.doc.name + '": ' + wn._("An active Salary Structure already exists. \ - If you want to create new one, please ensure that no active Salary Structure \ - exists for this Employee. Go to the active Salary Structure and set \ - \"Is Active\" = \"No\"")); + If you want to create new one, please ensure that no active \ + Salary Structure exists for this Employee. \ + Go to the active Salary Structure and set \"Is Active\" = \"No\"")); } else if(!r.exc) { wn.model.map({ source: wn.model.get_doclist(me.frm.doc.doctype, me.frm.doc.name), diff --git a/hr/doctype/employee/employee.txt b/hr/doctype/employee/employee.txt index 9d6dfae8fde..44e1bb21ffe 100644 --- a/hr/doctype/employee/employee.txt +++ b/hr/doctype/employee/employee.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 09:04:18", "docstatus": 0, - "modified": "2013-07-05 14:36:19", + "modified": "2013-07-10 12:52:17", "modified_by": "Administrator", "owner": "Administrator" }, @@ -31,7 +31,9 @@ "parent": "Employee", "parentfield": "permissions", "parenttype": "DocType", + "permlevel": 0, "read": 1, + "report": 1, "submit": 0 }, { @@ -55,7 +57,7 @@ "doctype": "DocField", "fieldname": "image_view", "fieldtype": "Image", - "in_list_view": 1, + "in_list_view": 0, "label": "Image View", "options": "image" }, @@ -562,6 +564,12 @@ "fieldtype": "Data", "label": "Place of Issue" }, + { + "doctype": "DocField", + "fieldname": "column_break6", + "fieldtype": "Column Break", + "width": "50%" + }, { "doctype": "DocField", "fieldname": "marital_status", @@ -576,12 +584,6 @@ "label": "Blood Group", "options": "\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-" }, - { - "doctype": "DocField", - "fieldname": "column_break6", - "fieldtype": "Column Break", - "width": "50%" - }, { "description": "Here you can maintain family details like name and occupation of parent, spouse and children", "doctype": "DocField", @@ -748,17 +750,6 @@ "create": 0, "doctype": "DocPerm", "match": "employee", - "permlevel": 0, - "report": 1, - "role": "Employee", - "write": 0 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "report": 0, "role": "Employee", "write": 0 }, @@ -767,8 +758,6 @@ "create": 1, "doctype": "DocPerm", "match": "company", - "permlevel": 0, - "report": 1, "role": "HR User", "write": 1 }, @@ -776,27 +765,7 @@ "cancel": 1, "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "report": 1, "role": "HR Manager", "write": 1 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "HR User", - "write": 0 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "HR Manager", - "write": 0 } ] \ No newline at end of file diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py index 7e8b6a1724d..1af71d5b24b 100644 --- a/hr/doctype/salary_slip/salary_slip.py +++ b/hr/doctype/salary_slip/salary_slip.py @@ -21,7 +21,7 @@ from webnotes.utils import add_days, cint, cstr, flt, getdate from webnotes.model.doc import make_autoname from webnotes.model.bean import getlist from webnotes.model.code import get_obj -from webnotes import msgprint +from webnotes import msgprint, _ from setup.utils import get_company_currency sql = webnotes.conn.sql @@ -65,12 +65,6 @@ class DocType(TransactionBase): from hr.doctype.salary_structure.salary_structure import make_salary_slip make_salary_slip(struct, self.doclist) - basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % self.doc.employee) - self.doc.bank_name = basic_info[0][0] - self.doc.bank_account_no = basic_info[0][1] - self.doc.esic_no = basic_info[0][2] - self.doc.pf_no = basic_info[0][3] - def get_leave_details(self, lwp=None): m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month) From 2deca5f3f676c944c354ed039e68756d28d9d27c Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 10 Jul 2013 14:31:29 +0530 Subject: [PATCH 13/27] queries to server side --- buying/doctype/purchase_common/purchase_common.js | 4 ++-- controllers/queries.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 7d3d600c0af..9b05bc5e343 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -56,8 +56,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } } else { return{ - query:"controllers.queries.item_query", - filters:{ 'is_purchase_item': 'Yes' } + query: "controllers.queries.item_query", + filters: { 'is_purchase_item': 'Yes' } } } }); diff --git a/controllers/queries.py b/controllers/queries.py index 67d53184d5a..b3556e52290 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -29,7 +29,7 @@ def get_filters_cond(doctype, filters, conditions): flt.append([doctype, f[0], '=', f[1]]) from webnotes.widgets.reportview import build_filter_conditions - build_filter_conditions(filters, conditions) + build_filter_conditions(flt, conditions) cond = ' and ' + ' and '.join(conditions) else: cond = '' From 3429b609a79d892f138162e5830245a6766ad194 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 15:03:37 +0530 Subject: [PATCH 14/27] [feature] [grid] Allow Grid viewable columns to be selected via 'In List View' --- .../bank_reconciliation_detail.txt | 8 +- .../doctype/budget_control/budget_control.txt | 7 +- .../doctype/budget_detail/budget_detail.txt | 3 +- .../budget_distribution_detail.txt | 3 +- .../c_form_invoice_detail.txt | 3 +- .../journal_voucher_detail.txt | 45 ++-- accounts/doctype/mis_control/mis_control.txt | 7 +- ...ayment_to_invoice_matching_tool_detail.txt | 8 +- .../purchase_invoice_advance.txt | 7 +- .../purchase_invoice_item.txt | 32 ++- .../purchase_taxes_and_charges.txt | 8 +- .../sales_invoice_advance.txt | 7 +- .../sales_invoice_item/sales_invoice_item.txt | 24 ++- .../sales_taxes_and_charges.txt | 8 +- .../shipping_rule_condition.txt | 3 +- .../purchase_common/purchase_common.txt | 7 +- .../purchase_order_item.txt | 35 ++- .../purchase_order_item_supplied.txt | 8 +- .../purchase_receipt_item_supplied.txt | 8 +- .../quality_inspection_reading.txt | 8 +- .../supplier_quotation_item.txt | 27 ++- hr/doctype/appraisal_goal/appraisal_goal.txt | 3 +- .../appraisal_template_goal.txt | 3 +- .../employee_education/employee_education.txt | 3 +- .../employee_external_work_history.txt | 3 +- .../employee_internal_work_history.txt | 3 +- .../employee_leave_approver.txt | 3 +- .../expense_claim_detail.txt | 3 +- hr/doctype/holiday/holiday.txt | 3 +- .../leave_block_list_allow.txt | 3 +- .../leave_block_list_date.txt | 3 +- .../salary_slip_deduction.txt | 3 +- .../salary_slip_earning.txt | 3 +- .../salary_structure_deduction.txt | 3 +- .../salary_structure_earning.txt | 3 +- .../bom_explosion_item/bom_explosion_item.txt | 9 +- manufacturing/doctype/bom_item/bom_item.txt | 9 +- .../doctype/bom_operation/bom_operation.txt | 3 +- .../production_plan_item.txt | 9 +- .../production_plan_sales_order.txt | 3 +- .../project_milestone/project_milestone.txt | 3 +- .../time_log_batch_detail.txt | 3 +- .../installation_note_item.txt | 10 +- .../opportunity_item/opportunity_item.txt | 11 +- .../doctype/quotation_item/quotation_item.txt | 23 +- .../doctype/sales_bom_item/sales_bom_item.txt | 7 +- selling/doctype/sales_common/sales_common.txt | 7 +- .../sales_order_item/sales_order_item.txt | 30 ++- selling/doctype/sales_team/sales_team.txt | 9 +- .../authorization_control.txt | 6 +- .../contact_control/contact_control.txt | 14 +- setup/doctype/for_territory/for_territory.txt | 3 +- .../notification_control.txt | 199 +++++++++--------- setup/doctype/sms_parameter/sms_parameter.txt | 3 +- setup/doctype/target_detail/target_detail.txt | 3 +- stock/doctype/bin/bin.txt | 8 +- .../delivery_note_item/delivery_note_item.txt | 20 +- .../delivery_note_packing_item.txt | 9 +- .../item_customer_detail.txt | 3 +- stock/doctype/item_price/item_price.txt | 3 +- .../item_quality_inspection_parameter.txt | 3 +- stock/doctype/item_reorder/item_reorder.txt | 3 +- stock/doctype/item_supplier/item_supplier.txt | 3 +- stock/doctype/item_tax/item_tax.txt | 3 +- .../item_website_specification.txt | 3 +- .../landed_cost_item/landed_cost_item.txt | 3 +- .../landed_cost_purchase_receipt.txt | 3 +- .../material_request_item.txt | 11 +- .../packing_slip_item/packing_slip_item.txt | 10 +- .../purchase_receipt_item.txt | 23 +- .../stock_entry_detail/stock_entry_detail.txt | 9 +- stock/doctype/stock_ledger/stock_ledger.txt | 2 +- .../uom_conversion_detail.txt | 4 +- .../doctype/warehouse_user/warehouse_user.txt | 3 +- .../maintenance_schedule_detail.txt | 8 +- .../maintenance_schedule_item.txt | 9 +- .../maintenance_visit_purpose.txt | 9 +- utilities/doctype/note_user/note_user.txt | 3 +- .../about_us_team_member.txt | 3 +- .../company_history/company_history.txt | 3 +- .../shopping_cart_price_list.txt | 3 +- .../shopping_cart_shipping_rule.txt | 3 +- ...shopping_cart_taxes_and_charges_master.txt | 3 +- website/doctype/top_bar_item/top_bar_item.txt | 3 +- .../website_item_group/website_item_group.txt | 3 +- .../website_slideshow_item.txt | 3 +- 86 files changed, 627 insertions(+), 224 deletions(-) diff --git a/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt b/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt index 11481d7dc86..5e98cb01fbf 100644 --- a/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt +++ b/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:37", "docstatus": 0, - "modified": "2013-07-05 11:05:59", + "modified": "2013-07-10 14:54:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "doctype": "DocField", "fieldname": "voucher_id", "fieldtype": "Link", + "in_list_view": 1, "label": "Voucher ID", "oldfieldname": "voucher_id", "oldfieldtype": "Link", @@ -39,6 +40,7 @@ "doctype": "DocField", "fieldname": "against_account", "fieldtype": "Data", + "in_list_view": 1, "label": "Against Account", "oldfieldname": "against_account", "oldfieldtype": "Data", @@ -49,6 +51,7 @@ "doctype": "DocField", "fieldname": "posting_date", "fieldtype": "Date", + "in_list_view": 1, "label": "Posting Date", "oldfieldname": "posting_date", "oldfieldtype": "Date", @@ -58,6 +61,7 @@ "doctype": "DocField", "fieldname": "clearance_date", "fieldtype": "Date", + "in_list_view": 1, "label": "Clearance Date", "oldfieldname": "clearance_date", "oldfieldtype": "Date" @@ -66,6 +70,7 @@ "doctype": "DocField", "fieldname": "cheque_number", "fieldtype": "Data", + "in_list_view": 1, "label": "Cheque Number", "oldfieldname": "cheque_number", "oldfieldtype": "Data", @@ -75,6 +80,7 @@ "doctype": "DocField", "fieldname": "cheque_date", "fieldtype": "Date", + "in_list_view": 1, "label": "Cheque Date", "oldfieldname": "cheque_date", "oldfieldtype": "Date", diff --git a/accounts/doctype/budget_control/budget_control.txt b/accounts/doctype/budget_control/budget_control.txt index e86fef8b5b5..13adf4b4065 100644 --- a/accounts/doctype/budget_control/budget_control.txt +++ b/accounts/doctype/budget_control/budget_control.txt @@ -2,7 +2,7 @@ { "creation": "2012-03-27 14:35:41", "docstatus": 0, - "modified": "2012-03-27 14:35:41", + "modified": "2013-07-10 14:54:06", "modified_by": "Administrator", "owner": "nabin@webnotestech.com" }, @@ -10,10 +10,7 @@ "doctype": "DocType", "issingle": 1, "module": "Accounts", - "name": "__common__", - "section_style": "Simple", - "show_in_menu": 0, - "version": 23 + "name": "__common__" }, { "doctype": "DocType", diff --git a/accounts/doctype/budget_detail/budget_detail.txt b/accounts/doctype/budget_detail/budget_detail.txt index 10d3a195f3d..f16190d0bdd 100644 --- a/accounts/doctype/budget_detail/budget_detail.txt +++ b/accounts/doctype/budget_detail/budget_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:55:04", "docstatus": 0, - "modified": "2013-07-09 14:44:37", + "modified": "2013-07-10 14:54:06", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Budget Detail", "parentfield": "fields", diff --git a/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt b/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt index ff5d8fd0737..c8207bda586 100644 --- a/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt +++ b/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:38", "docstatus": 0, - "modified": "2013-03-07 07:03:19", + "modified": "2013-07-10 14:54:06", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Budget Distribution Detail", "parentfield": "fields", diff --git a/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt b/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt index ba247d34827..487c982be66 100644 --- a/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt +++ b/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:38", "docstatus": 0, - "modified": "2013-03-07 07:03:19", + "modified": "2013-07-10 14:54:06", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "C-Form Invoice Detail", "parentfield": "fields", diff --git a/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt index 9946bfb37f8..750449b5242 100644 --- a/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt +++ b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:39", "docstatus": 0, - "modified": "2013-07-01 13:53:33", + "modified": "2013-07-10 14:56:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "account", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Account", "oldfieldname": "account", "oldfieldtype": "Link", @@ -39,30 +40,14 @@ "search_index": 1, "width": "250px" }, - { - "doctype": "DocField", - "fieldname": "debit", - "fieldtype": "Currency", - "label": "Debit", - "oldfieldname": "debit", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency" - }, - { - "doctype": "DocField", - "fieldname": "credit", - "fieldtype": "Currency", - "label": "Credit", - "oldfieldname": "credit", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency" - }, { "default": ":Company", + "description": "If Income or Expense", "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Cost Center", "oldfieldname": "cost_center", "oldfieldtype": "Link", @@ -71,10 +56,31 @@ "search_index": 0, "width": "180px" }, + { + "doctype": "DocField", + "fieldname": "debit", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Debit", + "oldfieldname": "debit", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency" + }, + { + "doctype": "DocField", + "fieldname": "credit", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Credit", + "oldfieldname": "credit", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency" + }, { "doctype": "DocField", "fieldname": "balance", "fieldtype": "Currency", + "in_list_view": 1, "label": "Account Balance", "no_copy": 1, "oldfieldname": "balance", @@ -87,6 +93,7 @@ "fieldname": "against_voucher", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Against Purchase Invoice", "no_copy": 1, "oldfieldname": "against_voucher", diff --git a/accounts/doctype/mis_control/mis_control.txt b/accounts/doctype/mis_control/mis_control.txt index 5d42bdef83b..ed0bedb12a4 100644 --- a/accounts/doctype/mis_control/mis_control.txt +++ b/accounts/doctype/mis_control/mis_control.txt @@ -2,7 +2,7 @@ { "creation": "2012-03-27 14:35:49", "docstatus": 0, - "modified": "2012-03-27 14:35:49", + "modified": "2013-07-10 14:54:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -10,10 +10,7 @@ "doctype": "DocType", "issingle": 1, "module": "Accounts", - "name": "__common__", - "section_style": "Simple", - "show_in_menu": 0, - "version": 120 + "name": "__common__" }, { "doctype": "DocType", diff --git a/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.txt b/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.txt index 1908101b7b9..5259f746675 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.txt +++ b/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:39", "docstatus": 0, - "modified": "2013-03-07 07:03:26", + "modified": "2013-07-10 14:54:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ "doctype": "DocField", "fieldname": "voucher_no", "fieldtype": "Link", + "in_list_view": 1, "label": "Voucher No", "options": "Journal Voucher", "print_width": "140px", @@ -39,6 +40,7 @@ "doctype": "DocField", "fieldname": "amt_due", "fieldtype": "Currency", + "in_list_view": 1, "label": "Unmatched Amount", "options": "Company:company:default_currency", "read_only": 1 @@ -47,6 +49,7 @@ "doctype": "DocField", "fieldname": "amt_to_be_reconciled", "fieldtype": "Currency", + "in_list_view": 1, "label": "Allocated Amount", "options": "Company:company:default_currency", "reqd": 1 @@ -55,6 +58,7 @@ "doctype": "DocField", "fieldname": "posting_date", "fieldtype": "Date", + "in_list_view": 1, "label": "Posting Date", "read_only": 1 }, @@ -62,6 +66,7 @@ "doctype": "DocField", "fieldname": "total_amt", "fieldtype": "Currency", + "in_list_view": 1, "label": "Total Amount", "options": "Company:company:default_currency", "read_only": 1 @@ -70,6 +75,7 @@ "doctype": "DocField", "fieldname": "against_account", "fieldtype": "Data", + "in_list_view": 1, "label": "Against Account", "read_only": 1 }, diff --git a/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt b/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt index 6b316840291..49aa68887b5 100644 --- a/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt +++ b/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-08 15:36:46", "docstatus": 0, - "modified": "2013-03-20 16:52:12", + "modified": "2013-07-10 14:54:12", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "journal_voucher", "fieldtype": "Link", + "in_list_view": 1, "label": "Journal Voucher", "oldfieldname": "journal_voucher", "oldfieldtype": "Link", @@ -42,6 +43,7 @@ "fieldname": "jv_detail_no", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Journal Voucher Detail No", "oldfieldname": "jv_detail_no", "oldfieldtype": "Date", @@ -54,6 +56,7 @@ "doctype": "DocField", "fieldname": "advance_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Advance Amount", "oldfieldname": "advance_amount", "oldfieldtype": "Currency", @@ -66,6 +69,7 @@ "doctype": "DocField", "fieldname": "allocated_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Allocated Amount", "oldfieldname": "allocated_amount", "oldfieldtype": "Currency", @@ -77,6 +81,7 @@ "doctype": "DocField", "fieldname": "remarks", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Remarks", "oldfieldname": "remarks", "oldfieldtype": "Small Text", diff --git a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt index dce635b1d0e..d7fb8e552b2 100755 --- a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt +++ b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-22 12:43:10", "docstatus": 0, - "modified": "2013-07-10 11:56:50", + "modified": "2013-07-10 14:54:12", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Item", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -44,6 +45,7 @@ "fieldname": "item_name", "fieldtype": "Data", "in_filter": 0, + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -55,6 +57,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -66,12 +69,14 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Qty", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -83,6 +88,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "options": "UOM", "print_hide": 1, @@ -92,6 +98,7 @@ "doctype": "DocField", "fieldname": "import_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "options": "currency", "print_hide": 1, @@ -101,6 +108,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 0, "read_only": 0 @@ -109,6 +117,7 @@ "doctype": "DocField", "fieldname": "import_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate ", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -121,6 +130,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -132,6 +142,7 @@ "doctype": "DocField", "fieldname": "purchase_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "options": "Company:company:default_currency", "print_hide": 1, @@ -141,6 +152,7 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "rate", "oldfieldtype": "Currency", @@ -153,6 +165,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -165,12 +178,14 @@ "doctype": "DocField", "fieldname": "accounting", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Accounting" }, { "doctype": "DocField", "fieldname": "expense_head", "fieldtype": "Link", + "in_list_view": 0, "label": "Expense Head", "oldfieldname": "expense_head", "oldfieldtype": "Link", @@ -186,6 +201,7 @@ "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", + "in_list_view": 0, "label": "Cost Center", "oldfieldname": "cost_center", "oldfieldtype": "Link", @@ -199,6 +215,7 @@ "doctype": "DocField", "fieldname": "reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Reference" }, { @@ -206,6 +223,7 @@ "fieldname": "project_name", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Project Name", "options": "Project", "print_hide": 1, @@ -216,6 +234,7 @@ "fieldname": "brand", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Data", @@ -228,6 +247,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -241,6 +261,7 @@ "fieldname": "purchase_order", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Purchase Order", "no_copy": 1, "oldfieldname": "purchase_order", @@ -256,6 +277,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Purchase Order Item", "no_copy": 1, "oldfieldname": "po_detail", @@ -269,6 +291,7 @@ "fieldname": "purchase_receipt", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Purchase Receipt", "no_copy": 1, "oldfieldname": "purchase_receipt", @@ -284,6 +307,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "PR Detail", "no_copy": 1, "oldfieldname": "pr_detail", @@ -298,6 +322,7 @@ "fieldname": "item_tax_rate", "fieldtype": "Small Text", "hidden": 1, + "in_list_view": 0, "label": "Item Tax Rate", "oldfieldname": "item_tax_rate", "oldfieldtype": "Small Text", @@ -310,6 +335,7 @@ "fieldname": "item_tax_amount", "fieldtype": "Currency", "hidden": 1, + "in_list_view": 0, "label": "Item Tax Amount", "no_copy": 1, "options": "Company:company:default_currency", @@ -324,6 +350,7 @@ "fieldname": "valuation_rate", "fieldtype": "Currency", "hidden": 1, + "in_list_view": 0, "label": "Valuation Rate", "no_copy": 1, "options": "Company:company:default_currency", @@ -334,6 +361,7 @@ "doctype": "DocField", "fieldname": "conversion_factor", "fieldtype": "Float", + "in_list_view": 0, "label": "Conversion Factor", "print_hide": 1, "read_only": 0 @@ -343,6 +371,7 @@ "fieldname": "rm_supp_cost", "fieldtype": "Currency", "hidden": 1, + "in_list_view": 0, "label": "Raw Materials Supplied Cost", "no_copy": 1, "options": "Company:company:default_currency", @@ -354,6 +383,7 @@ "doctype": "DocField", "fieldname": "page_break", "fieldtype": "Check", + "in_list_view": 0, "label": "Page Break", "no_copy": 1, "print_hide": 1, diff --git a/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt b/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt index d6d2a92b7ae..5ea7fc09ff2 100644 --- a/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt +++ b/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:04", "docstatus": 0, - "modified": "2013-05-28 12:02:02", + "modified": "2013-07-10 14:54:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -31,6 +31,7 @@ "doctype": "DocField", "fieldname": "category", "fieldtype": "Select", + "in_list_view": 1, "label": "Consider Tax or Charge for", "oldfieldname": "category", "oldfieldtype": "Select", @@ -42,6 +43,7 @@ "doctype": "DocField", "fieldname": "charge_type", "fieldtype": "Select", + "in_list_view": 1, "label": "Type", "oldfieldname": "charge_type", "oldfieldtype": "Select", @@ -53,6 +55,7 @@ "doctype": "DocField", "fieldname": "account_head", "fieldtype": "Link", + "in_list_view": 1, "label": "Account Head", "oldfieldname": "account_head", "oldfieldtype": "Link", @@ -65,6 +68,7 @@ "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", + "in_list_view": 1, "label": "Cost Center", "oldfieldname": "cost_center", "oldfieldtype": "Link", @@ -75,6 +79,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -87,6 +92,7 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Float", + "in_list_view": 1, "label": "Rate", "oldfieldname": "rate", "oldfieldtype": "Currency", diff --git a/accounts/doctype/sales_invoice_advance/sales_invoice_advance.txt b/accounts/doctype/sales_invoice_advance/sales_invoice_advance.txt index 32ef4c55b96..b82f4acabd3 100644 --- a/accounts/doctype/sales_invoice_advance/sales_invoice_advance.txt +++ b/accounts/doctype/sales_invoice_advance/sales_invoice_advance.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:41", "docstatus": 0, - "modified": "2013-03-07 07:03:30", + "modified": "2013-07-10 14:54:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "journal_voucher", "fieldtype": "Link", + "in_list_view": 1, "label": "Journal Voucher", "oldfieldname": "journal_voucher", "oldfieldtype": "Link", @@ -42,6 +43,7 @@ "fieldname": "jv_detail_no", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Journal Voucher Detail No", "oldfieldname": "jv_detail_no", "oldfieldtype": "Data", @@ -54,6 +56,7 @@ "doctype": "DocField", "fieldname": "advance_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Advance amount", "oldfieldname": "advance_amount", "oldfieldtype": "Currency", @@ -66,6 +69,7 @@ "doctype": "DocField", "fieldname": "allocated_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Allocated amount", "oldfieldname": "allocated_amount", "oldfieldtype": "Currency", @@ -77,6 +81,7 @@ "doctype": "DocField", "fieldname": "remarks", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Remarks", "oldfieldname": "remarks", "oldfieldtype": "Small Text", diff --git a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt index 5fcddeeea85..03b9f8b9afa 100644 --- a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt +++ b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-04 11:02:19", "docstatus": 0, - "modified": "2013-07-10 11:57:15", + "modified": "2013-07-10 14:54:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "barcode", "fieldtype": "Data", + "in_list_view": 0, "label": "Barcode", "print_hide": 1, "read_only": 0 @@ -38,6 +39,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -52,6 +54,7 @@ "fieldname": "customer_item_code", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Customer's Item Code", "print_hide": 1, "read_only": 1 @@ -61,6 +64,7 @@ "fieldname": "item_name", "fieldtype": "Data", "in_filter": 0, + "in_list_view": 0, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -73,6 +77,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -85,12 +90,14 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -101,6 +108,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "read_only": 1 }, @@ -108,6 +116,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "oldfieldname": "ref_rate", "oldfieldtype": "Currency", @@ -120,6 +129,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount (%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -130,6 +140,7 @@ "doctype": "DocField", "fieldname": "export_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Basic Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -141,6 +152,7 @@ "doctype": "DocField", "fieldname": "export_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "export_amount", "oldfieldtype": "Currency", @@ -152,6 +164,7 @@ "doctype": "DocField", "fieldname": "base_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "oldfieldname": "base_ref_rate", "oldfieldtype": "Currency", @@ -164,6 +177,7 @@ "fieldname": "basic_rate", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 0, "label": "Basic Rate (Company Currency)", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", @@ -177,6 +191,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -189,6 +204,7 @@ "doctype": "DocField", "fieldname": "accounting", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Accounting" }, { @@ -196,6 +212,7 @@ "fieldname": "income_account", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Income Account", "oldfieldname": "income_account", "oldfieldtype": "Link", @@ -212,6 +229,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Expense Account", "options": "Account", "print_hide": 1, @@ -224,6 +242,7 @@ "fieldname": "cost_center", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Cost Center", "oldfieldname": "cost_center", "oldfieldtype": "Link", @@ -238,6 +257,7 @@ "doctype": "DocField", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Warehouse and Reference" }, { @@ -245,6 +265,7 @@ "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, + "in_list_view": 0, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -257,6 +278,7 @@ "fieldname": "serial_no", "fieldtype": "Small Text", "in_filter": 1, + "in_list_view": 1, "label": "Serial No", "oldfieldname": "serial_no", "oldfieldtype": "Small Text", diff --git a/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt index ba9f90724a9..fbba6437f26 100644 --- a/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt +++ b/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-24 11:39:32", "docstatus": 0, - "modified": "2013-05-28 11:59:02", + "modified": "2013-07-10 14:54:21", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "doctype": "DocField", "fieldname": "charge_type", "fieldtype": "Select", + "in_list_view": 1, "label": "Type", "oldfieldname": "charge_type", "oldfieldtype": "Select", @@ -40,6 +41,7 @@ "doctype": "DocField", "fieldname": "account_head", "fieldtype": "Link", + "in_list_view": 1, "label": "Account Head", "oldfieldname": "account_head", "oldfieldtype": "Link", @@ -52,6 +54,7 @@ "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", + "in_list_view": 1, "label": "Cost Center", "oldfieldname": "cost_center_other_charges", "oldfieldtype": "Link", @@ -61,6 +64,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -72,6 +76,7 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Float", + "in_list_view": 1, "label": "Rate", "oldfieldname": "rate", "oldfieldtype": "Currency", @@ -81,6 +86,7 @@ "doctype": "DocField", "fieldname": "tax_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "tax_amount", "oldfieldtype": "Currency", diff --git a/accounts/doctype/shipping_rule_condition/shipping_rule_condition.txt b/accounts/doctype/shipping_rule_condition/shipping_rule_condition.txt index 2fe43db24d8..3784ecbfb24 100644 --- a/accounts/doctype/shipping_rule_condition/shipping_rule_condition.txt +++ b/accounts/doctype/shipping_rule_condition/shipping_rule_condition.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-25 11:54:50", "docstatus": 0, - "modified": "2013-06-25 11:58:04", + "modified": "2013-07-10 14:54:22", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Shipping Rule Condition", "parentfield": "fields", diff --git a/buying/doctype/purchase_common/purchase_common.txt b/buying/doctype/purchase_common/purchase_common.txt index 15ef5743f3d..40f5756f25f 100644 --- a/buying/doctype/purchase_common/purchase_common.txt +++ b/buying/doctype/purchase_common/purchase_common.txt @@ -2,7 +2,7 @@ { "creation": "2012-03-27 14:35:51", "docstatus": 0, - "modified": "2012-03-27 14:35:51", + "modified": "2013-07-10 14:54:12", "modified_by": "Administrator", "owner": "Administrator" }, @@ -10,10 +10,7 @@ "doctype": "DocType", "issingle": 1, "module": "Buying", - "name": "__common__", - "section_style": "Simple", - "show_in_menu": 0, - "version": 187 + "name": "__common__" }, { "doctype": "DocType", diff --git a/buying/doctype/purchase_order_item/purchase_order_item.txt b/buying/doctype/purchase_order_item/purchase_order_item.txt index 92dde5dc9d2..c7233d0ecdf 100755 --- a/buying/doctype/purchase_order_item/purchase_order_item.txt +++ b/buying/doctype/purchase_order_item/purchase_order_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:06", "docstatus": 0, - "modified": "2013-07-10 11:55:03", + "modified": "2013-07-10 14:54:14", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -45,6 +46,7 @@ "fieldtype": "Date", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Reqd By Date", "no_copy": 0, "oldfieldname": "schedule_date", @@ -60,6 +62,7 @@ "fieldname": "supplier_part_no", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Supplier Part Number", "print_hide": 1, "read_only": 1 @@ -70,6 +73,7 @@ "fieldtype": "Data", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -82,12 +86,14 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { "doctype": "DocField", "fieldname": "description", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -101,6 +107,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -113,6 +120,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -127,6 +135,7 @@ "doctype": "DocField", "fieldname": "import_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "options": "currency", "print_hide": 1, @@ -136,6 +145,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 0, "read_only": 0 @@ -145,6 +155,7 @@ "fieldname": "import_rate", "fieldtype": "Currency", "hidden": 0, + "in_list_view": 1, "label": "Rate ", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -156,6 +167,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -166,6 +178,7 @@ "doctype": "DocField", "fieldname": "purchase_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "options": "Company:company:default_currency", "print_hide": 1, @@ -176,6 +189,7 @@ "doctype": "DocField", "fieldname": "purchase_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "purchase_rate", "oldfieldtype": "Currency", @@ -191,6 +205,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -203,6 +218,7 @@ "doctype": "DocField", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Warehouse and Reference" }, { @@ -210,6 +226,7 @@ "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, + "in_list_view": 0, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -223,6 +240,7 @@ "fieldname": "project_name", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Project Name", "options": "Project", "print_hide": 1, @@ -234,6 +252,7 @@ "fieldname": "conversion_factor", "fieldtype": "Float", "hidden": 0, + "in_list_view": 0, "label": "UOM Conversion Factor", "oldfieldname": "conversion_factor", "oldfieldtype": "Currency", @@ -248,6 +267,7 @@ "fieldname": "stock_uom", "fieldtype": "Data", "hidden": 0, + "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -262,6 +282,7 @@ "fieldname": "prevdoc_doctype", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Prevdoc DocType", "no_copy": 1, "oldfieldname": "prevdoc_doctype", @@ -275,6 +296,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Material Request No", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -292,6 +314,7 @@ "fieldtype": "Date", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Material Request Date", "no_copy": 1, "oldfieldname": "prevdoc_date", @@ -306,6 +329,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Material Request Detail No", "no_copy": 1, "oldfieldname": "prevdoc_detail_docname", @@ -320,6 +344,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 0, + "in_list_view": 1, "label": "Supplier Quotation", "no_copy": 1, "options": "Supplier Quotation", @@ -331,6 +356,7 @@ "fieldname": "supplier_quotation_item", "fieldtype": "Link", "hidden": 1, + "in_list_view": 1, "label": "Supplier Quotation Item", "no_copy": 1, "options": "Supplier Quotation Item", @@ -341,6 +367,7 @@ "fieldname": "brand", "fieldtype": "Link", "hidden": 1, + "in_list_view": 1, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -354,6 +381,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 1, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -367,6 +395,7 @@ "fieldname": "stock_qty", "fieldtype": "Float", "hidden": 0, + "in_list_view": 1, "label": "Stock Qty", "no_copy": 1, "oldfieldname": "stock_qty", @@ -381,6 +410,7 @@ "fieldname": "received_qty", "fieldtype": "Float", "hidden": 0, + "in_list_view": 1, "label": "Received Qty", "no_copy": 1, "oldfieldname": "received_qty", @@ -392,6 +422,7 @@ "doctype": "DocField", "fieldname": "billed_amt", "fieldtype": "Currency", + "in_list_view": 1, "label": "Billed Amt", "no_copy": 1, "options": "currency", @@ -404,6 +435,7 @@ "fieldname": "item_tax_rate", "fieldtype": "Small Text", "hidden": 1, + "in_list_view": 1, "label": "Item Tax Rate", "oldfieldname": "item_tax_rate", "oldfieldtype": "Small Text", @@ -417,6 +449,7 @@ "fieldname": "page_break", "fieldtype": "Check", "hidden": 0, + "in_list_view": 1, "label": "Page Break", "no_copy": 1, "oldfieldname": "page_break", diff --git a/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt b/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt index d08963b24b3..1d91aa323d1 100644 --- a/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt +++ b/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:42", "docstatus": 0, - "modified": "2013-03-07 07:03:28", + "modified": "2013-07-10 14:54:15", "modified_by": "Administrator", "owner": "dhanalekshmi@webnotestech.com" }, @@ -31,6 +31,7 @@ "fieldtype": "Data", "hidden": 0, "in_filter": 0, + "in_list_view": 1, "label": "Reference Name", "oldfieldname": "reference_name", "oldfieldtype": "Data", @@ -41,6 +42,7 @@ "doctype": "DocField", "fieldname": "bom_detail_no", "fieldtype": "Data", + "in_list_view": 1, "label": "BOM Detail No", "oldfieldname": "bom_detail_no", "oldfieldtype": "Data", @@ -50,6 +52,7 @@ "doctype": "DocField", "fieldname": "main_item_code", "fieldtype": "Data", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "main_item_code", "oldfieldtype": "Data", @@ -59,6 +62,7 @@ "doctype": "DocField", "fieldname": "rm_item_code", "fieldtype": "Data", + "in_list_view": 1, "label": "Raw Material Item Code", "oldfieldname": "rm_item_code", "oldfieldtype": "Data", @@ -68,6 +72,7 @@ "doctype": "DocField", "fieldname": "required_qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Required Qty", "oldfieldname": "required_qty", "oldfieldtype": "Currency", @@ -77,6 +82,7 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate", "oldfieldname": "rate", "oldfieldtype": "Currency", diff --git a/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt b/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt index 4c0ce0d5b25..0ee20a57769 100644 --- a/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt +++ b/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:42", "docstatus": 0, - "modified": "2013-03-07 07:03:28", + "modified": "2013-07-10 14:54:17", "modified_by": "Administrator", "owner": "wasim@webnotestech.com" }, @@ -31,6 +31,7 @@ "fieldtype": "Data", "hidden": 0, "in_filter": 0, + "in_list_view": 1, "label": "Reference Name", "oldfieldname": "reference_name", "oldfieldtype": "Data", @@ -41,6 +42,7 @@ "doctype": "DocField", "fieldname": "bom_detail_no", "fieldtype": "Data", + "in_list_view": 1, "label": "BOM Detail No", "oldfieldname": "bom_detail_no", "oldfieldtype": "Data", @@ -50,6 +52,7 @@ "doctype": "DocField", "fieldname": "main_item_code", "fieldtype": "Data", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "main_item_code", "oldfieldtype": "Data", @@ -59,6 +62,7 @@ "doctype": "DocField", "fieldname": "rm_item_code", "fieldtype": "Data", + "in_list_view": 1, "label": "Raw Material Item Code", "oldfieldname": "rm_item_code", "oldfieldtype": "Data" @@ -67,6 +71,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Data", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Data", @@ -78,6 +83,7 @@ "doctype": "DocField", "fieldname": "required_qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Required Qty", "oldfieldname": "required_qty", "oldfieldtype": "Currency", diff --git a/buying/doctype/quality_inspection_reading/quality_inspection_reading.txt b/buying/doctype/quality_inspection_reading/quality_inspection_reading.txt index 066185ecf76..0c68cc74c73 100644 --- a/buying/doctype/quality_inspection_reading/quality_inspection_reading.txt +++ b/buying/doctype/quality_inspection_reading/quality_inspection_reading.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:43", "docstatus": 0, - "modified": "2013-03-07 07:03:29", + "modified": "2013-07-10 14:54:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "specification", "fieldtype": "Data", + "in_list_view": 1, "label": "Parameter", "oldfieldname": "specification", "oldfieldtype": "Data", @@ -38,6 +39,7 @@ "doctype": "DocField", "fieldname": "value", "fieldtype": "Data", + "in_list_view": 1, "label": "Acceptance Criteria", "oldfieldname": "value", "oldfieldtype": "Data" @@ -46,6 +48,7 @@ "doctype": "DocField", "fieldname": "reading_1", "fieldtype": "Data", + "in_list_view": 1, "label": "Reading 1", "oldfieldname": "reading_1", "oldfieldtype": "Data" @@ -54,6 +57,7 @@ "doctype": "DocField", "fieldname": "reading_2", "fieldtype": "Data", + "in_list_view": 1, "label": "Reading 2", "oldfieldname": "reading_2", "oldfieldtype": "Data" @@ -62,6 +66,7 @@ "doctype": "DocField", "fieldname": "reading_3", "fieldtype": "Data", + "in_list_view": 1, "label": "Reading 3", "oldfieldname": "reading_3", "oldfieldtype": "Data" @@ -70,6 +75,7 @@ "doctype": "DocField", "fieldname": "reading_4", "fieldtype": "Data", + "in_list_view": 1, "label": "Reading 4", "oldfieldname": "reading_4", "oldfieldtype": "Data" diff --git a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt index 80c97c9e968..3ac62002a4c 100644 --- a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt +++ b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-22 12:43:10", "docstatus": 0, - "modified": "2013-07-10 11:54:21", + "modified": "2013-07-10 14:54:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -45,6 +46,7 @@ "fieldname": "supplier_part_no", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Supplier Part Number", "print_hide": 1, "read_only": 1 @@ -55,6 +57,7 @@ "fieldtype": "Data", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -67,6 +70,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -79,6 +83,7 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { @@ -86,6 +91,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -98,6 +104,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -112,6 +119,7 @@ "doctype": "DocField", "fieldname": "import_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "options": "currency", "print_hide": 1, @@ -121,6 +129,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 0, "read_only": 0 @@ -130,6 +139,7 @@ "fieldname": "import_rate", "fieldtype": "Currency", "hidden": 0, + "in_list_view": 1, "label": "Rate ", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -141,6 +151,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -151,6 +162,7 @@ "doctype": "DocField", "fieldname": "purchase_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "options": "Company:company:default_currency", "print_hide": 1, @@ -161,6 +173,7 @@ "doctype": "DocField", "fieldname": "purchase_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "purchase_rate", "oldfieldtype": "Currency", @@ -176,6 +189,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -188,6 +202,7 @@ "doctype": "DocField", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Warehouse and Reference" }, { @@ -195,6 +210,7 @@ "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, + "in_list_view": 0, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -208,6 +224,7 @@ "fieldname": "project_name", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Project Name", "options": "Project", "print_hide": 1, @@ -219,6 +236,7 @@ "fieldname": "prevdoc_doctype", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Prevdoc DocType", "no_copy": 1, "oldfieldname": "prevdoc_doctype", @@ -232,6 +250,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Material Request No", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -249,6 +268,7 @@ "fieldtype": "Date", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Material Request Date", "no_copy": 1, "oldfieldname": "prevdoc_date", @@ -263,6 +283,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Material Request Detail No", "no_copy": 1, "oldfieldname": "prevdoc_detail_docname", @@ -276,6 +297,7 @@ "fieldname": "brand", "fieldtype": "Link", "hidden": 1, + "in_list_view": 0, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -289,6 +311,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -303,6 +326,7 @@ "fieldname": "item_tax_rate", "fieldtype": "Small Text", "hidden": 1, + "in_list_view": 0, "label": "Item Tax Rate", "oldfieldname": "item_tax_rate", "oldfieldtype": "Small Text", @@ -316,6 +340,7 @@ "fieldname": "page_break", "fieldtype": "Check", "hidden": 0, + "in_list_view": 0, "label": "Page Break", "no_copy": 1, "oldfieldname": "page_break", diff --git a/hr/doctype/appraisal_goal/appraisal_goal.txt b/hr/doctype/appraisal_goal/appraisal_goal.txt index ed71e69fba8..794a8797343 100644 --- a/hr/doctype/appraisal_goal/appraisal_goal.txt +++ b/hr/doctype/appraisal_goal/appraisal_goal.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:44", "docstatus": 0, - "modified": "2013-03-07 07:03:18", + "modified": "2013-07-10 14:54:03", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Appraisal Goal", "parentfield": "fields", diff --git a/hr/doctype/appraisal_template_goal/appraisal_template_goal.txt b/hr/doctype/appraisal_template_goal/appraisal_template_goal.txt index da9fde011af..074c247cca2 100644 --- a/hr/doctype/appraisal_template_goal/appraisal_template_goal.txt +++ b/hr/doctype/appraisal_template_goal/appraisal_template_goal.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:44", "docstatus": 0, - "modified": "2013-03-07 07:03:18", + "modified": "2013-07-10 14:54:03", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Appraisal Template Goal", "parentfield": "fields", diff --git a/hr/doctype/employee_education/employee_education.txt b/hr/doctype/employee_education/employee_education.txt index 46b6f00d408..69bbbdeace8 100644 --- a/hr/doctype/employee_education/employee_education.txt +++ b/hr/doctype/employee_education/employee_education.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:45", "docstatus": 0, - "modified": "2013-03-07 07:03:21", + "modified": "2013-07-10 14:54:08", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Employee Education", "parentfield": "fields", diff --git a/hr/doctype/employee_external_work_history/employee_external_work_history.txt b/hr/doctype/employee_external_work_history/employee_external_work_history.txt index 05fc5c0a4ee..2d5472927af 100644 --- a/hr/doctype/employee_external_work_history/employee_external_work_history.txt +++ b/hr/doctype/employee_external_work_history/employee_external_work_history.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:45", "docstatus": 0, - "modified": "2013-03-07 07:03:21", + "modified": "2013-07-10 14:54:08", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Employee External Work History", "parentfield": "fields", diff --git a/hr/doctype/employee_internal_work_history/employee_internal_work_history.txt b/hr/doctype/employee_internal_work_history/employee_internal_work_history.txt index d813e7cdadf..9cd03ceea2d 100644 --- a/hr/doctype/employee_internal_work_history/employee_internal_work_history.txt +++ b/hr/doctype/employee_internal_work_history/employee_internal_work_history.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:45", "docstatus": 0, - "modified": "2013-03-07 07:03:21", + "modified": "2013-07-10 14:54:08", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Employee Internal Work History", "parentfield": "fields", diff --git a/hr/doctype/employee_leave_approver/employee_leave_approver.txt b/hr/doctype/employee_leave_approver/employee_leave_approver.txt index 31e3e09efa0..f175bbdc29e 100644 --- a/hr/doctype/employee_leave_approver/employee_leave_approver.txt +++ b/hr/doctype/employee_leave_approver/employee_leave_approver.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-12 06:56:15", "docstatus": 0, - "modified": "2013-04-12 07:53:33", + "modified": "2013-07-10 14:54:08", "modified_by": "Administrator", "owner": "Administrator" }, @@ -19,6 +19,7 @@ "doctype": "DocField", "fieldname": "leave_approver", "fieldtype": "Select", + "in_list_view": 0, "label": "Leave Approver", "name": "__common__", "parent": "Employee Leave Approver", diff --git a/hr/doctype/expense_claim_detail/expense_claim_detail.txt b/hr/doctype/expense_claim_detail/expense_claim_detail.txt index d2b5cf3c7dd..e9c5a996937 100644 --- a/hr/doctype/expense_claim_detail/expense_claim_detail.txt +++ b/hr/doctype/expense_claim_detail/expense_claim_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:46", "docstatus": 0, - "modified": "2013-03-07 07:03:21", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Expense Claim Detail", "parentfield": "fields", diff --git a/hr/doctype/holiday/holiday.txt b/hr/doctype/holiday/holiday.txt index 94f7936a4a3..3b87bb08c7a 100644 --- a/hr/doctype/holiday/holiday.txt +++ b/hr/doctype/holiday/holiday.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:46", "docstatus": 0, - "modified": "2013-03-07 07:03:21", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Holiday", "parentfield": "fields", diff --git a/hr/doctype/leave_block_list_allow/leave_block_list_allow.txt b/hr/doctype/leave_block_list_allow/leave_block_list_allow.txt index 8e362f3542a..1e8c86b8c11 100644 --- a/hr/doctype/leave_block_list_allow/leave_block_list_allow.txt +++ b/hr/doctype/leave_block_list_allow/leave_block_list_allow.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:47", "docstatus": 0, - "modified": "2013-03-07 07:03:23", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ "doctype": "DocField", "fieldname": "allow_user", "fieldtype": "Link", + "in_list_view": 1, "label": "Allow User", "name": "__common__", "options": "Profile", diff --git a/hr/doctype/leave_block_list_date/leave_block_list_date.txt b/hr/doctype/leave_block_list_date/leave_block_list_date.txt index d0b9fbf1b10..c13e2d57c2a 100644 --- a/hr/doctype/leave_block_list_date/leave_block_list_date.txt +++ b/hr/doctype/leave_block_list_date/leave_block_list_date.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:47", "docstatus": 0, - "modified": "2013-03-07 07:03:23", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Leave Block List Date", "parentfield": "fields", diff --git a/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt b/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt index 86acef0c4fd..7fa4051bedc 100644 --- a/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt +++ b/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:48", "docstatus": 0, - "modified": "2013-03-07 07:03:30", + "modified": "2013-07-10 14:54:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Salary Slip Deduction", "parentfield": "fields", diff --git a/hr/doctype/salary_slip_earning/salary_slip_earning.txt b/hr/doctype/salary_slip_earning/salary_slip_earning.txt index 64f4dc6cefa..4ac3f39a1eb 100644 --- a/hr/doctype/salary_slip_earning/salary_slip_earning.txt +++ b/hr/doctype/salary_slip_earning/salary_slip_earning.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:48", "docstatus": 0, - "modified": "2013-03-07 07:03:30", + "modified": "2013-07-10 14:54:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Salary Slip Earning", "parentfield": "fields", diff --git a/hr/doctype/salary_structure_deduction/salary_structure_deduction.txt b/hr/doctype/salary_structure_deduction/salary_structure_deduction.txt index 53dbf6978c5..81e9a469eba 100644 --- a/hr/doctype/salary_structure_deduction/salary_structure_deduction.txt +++ b/hr/doctype/salary_structure_deduction/salary_structure_deduction.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:48", "docstatus": 0, - "modified": "2013-03-07 07:03:30", + "modified": "2013-07-10 14:54:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Salary Structure Deduction", "parentfield": "fields", diff --git a/hr/doctype/salary_structure_earning/salary_structure_earning.txt b/hr/doctype/salary_structure_earning/salary_structure_earning.txt index 29c3f52c8cb..b2a8e30dc27 100644 --- a/hr/doctype/salary_structure_earning/salary_structure_earning.txt +++ b/hr/doctype/salary_structure_earning/salary_structure_earning.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:48", "docstatus": 0, - "modified": "2013-03-07 07:03:30", + "modified": "2013-07-10 14:54:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Salary Structure Earning", "parentfield": "fields", diff --git a/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt b/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt index 3808cdfb00f..abc74cd35b4 100644 --- a/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt +++ b/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:57", "docstatus": 0, - "modified": "2013-06-04 13:13:28", + "modified": "2013-07-10 14:54:04", "modified_by": "Administrator", "owner": "Administrator" }, @@ -32,6 +32,7 @@ "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -41,6 +42,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -51,6 +53,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Qty", "oldfieldname": "qty", "oldfieldtype": "Currency" @@ -59,6 +62,7 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Float", + "in_list_view": 1, "label": "Rate", "oldfieldname": "standard_rate", "oldfieldtype": "Currency" @@ -67,6 +71,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Float", + "in_list_view": 1, "label": "Amount", "oldfieldname": "amount_as_per_sr", "oldfieldtype": "Currency" @@ -75,6 +80,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Link", + "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Link", @@ -85,6 +91,7 @@ "fieldname": "qty_consumed_per_unit", "fieldtype": "Float", "hidden": 0, + "in_list_view": 1, "label": "Qty Consumed Per Unit", "no_copy": 0 } diff --git a/manufacturing/doctype/bom_item/bom_item.txt b/manufacturing/doctype/bom_item/bom_item.txt index 2554adf21f6..85fbcf69732 100644 --- a/manufacturing/doctype/bom_item/bom_item.txt +++ b/manufacturing/doctype/bom_item/bom_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:49", "docstatus": 0, - "modified": "2013-06-27 11:30:07", + "modified": "2013-07-10 14:54:05", "modified_by": "Administrator", "owner": "Administrator" }, @@ -41,6 +41,7 @@ "doctype": "DocField", "fieldname": "operation_no", "fieldtype": "Select", + "in_list_view": 1, "label": "Operation No", "oldfieldname": "operation_no", "oldfieldtype": "Data", @@ -51,6 +52,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -63,6 +65,7 @@ "fieldname": "bom_no", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "BOM No", "oldfieldname": "bom_no", "oldfieldtype": "Link", @@ -76,6 +79,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Qty", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -85,6 +89,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -96,12 +101,14 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Float", + "in_list_view": 1, "label": "Rate" }, { "doctype": "DocField", "fieldname": "amount", "fieldtype": "Float", + "in_list_view": 1, "label": "Amount", "oldfieldname": "amount_as_per_mar", "oldfieldtype": "Currency", diff --git a/manufacturing/doctype/bom_operation/bom_operation.txt b/manufacturing/doctype/bom_operation/bom_operation.txt index 56805b5a607..86dffe9820c 100644 --- a/manufacturing/doctype/bom_operation/bom_operation.txt +++ b/manufacturing/doctype/bom_operation/bom_operation.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:49", "docstatus": 0, - "modified": "2013-03-07 07:03:19", + "modified": "2013-07-10 14:54:05", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "BOM Operation", "parentfield": "fields", diff --git a/manufacturing/doctype/production_plan_item/production_plan_item.txt b/manufacturing/doctype/production_plan_item/production_plan_item.txt index 3af1bea3136..37f56c90a57 100644 --- a/manufacturing/doctype/production_plan_item/production_plan_item.txt +++ b/manufacturing/doctype/production_plan_item/production_plan_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:49", "docstatus": 0, - "modified": "2013-03-07 07:03:26", + "modified": "2013-07-10 14:54:12", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -41,6 +42,7 @@ "doctype": "DocField", "fieldname": "bom_no", "fieldtype": "Link", + "in_list_view": 1, "label": "BOM No", "oldfieldname": "bom_no", "oldfieldtype": "Link", @@ -54,6 +56,7 @@ "doctype": "DocField", "fieldname": "planned_qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Planned Qty", "oldfieldname": "planned_qty", "oldfieldtype": "Currency", @@ -65,6 +68,7 @@ "doctype": "DocField", "fieldname": "sales_order", "fieldtype": "Link", + "in_list_view": 1, "label": "Sales Order", "oldfieldname": "source_docname", "oldfieldtype": "Data", @@ -76,6 +80,7 @@ "doctype": "DocField", "fieldname": "so_pending_qty", "fieldtype": "Float", + "in_list_view": 1, "label": "SO Pending Qty", "oldfieldname": "prevdoc_reqd_qty", "oldfieldtype": "Currency", @@ -88,6 +93,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -100,6 +106,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", diff --git a/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt b/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt index dc5b88de97a..e74f3bb576d 100644 --- a/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt +++ b/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:49", "docstatus": 0, - "modified": "2013-03-07 07:03:26", + "modified": "2013-07-10 14:54:12", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Production Plan Sales Order", "parentfield": "fields", diff --git a/projects/doctype/project_milestone/project_milestone.txt b/projects/doctype/project_milestone/project_milestone.txt index 11c5d20cc08..31722d6359b 100644 --- a/projects/doctype/project_milestone/project_milestone.txt +++ b/projects/doctype/project_milestone/project_milestone.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:50", "docstatus": 0, - "modified": "2013-03-07 07:03:26", + "modified": "2013-07-10 14:54:12", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Project Milestone", "parentfield": "fields", diff --git a/projects/doctype/time_log_batch_detail/time_log_batch_detail.txt b/projects/doctype/time_log_batch_detail/time_log_batch_detail.txt index 8bd554fb199..98eca10092a 100644 --- a/projects/doctype/time_log_batch_detail/time_log_batch_detail.txt +++ b/projects/doctype/time_log_batch_detail/time_log_batch_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-05 09:11:06", "docstatus": 0, - "modified": "2013-03-07 07:03:34", + "modified": "2013-07-10 14:54:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Time Log Batch Detail", "parentfield": "fields", diff --git a/selling/doctype/installation_note_item/installation_note_item.txt b/selling/doctype/installation_note_item/installation_note_item.txt index a2ccdc4ec7f..02871ad7343 100644 --- a/selling/doctype/installation_note_item/installation_note_item.txt +++ b/selling/doctype/installation_note_item/installation_note_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:51", "docstatus": 0, - "modified": "2013-03-07 07:03:21", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -39,6 +40,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Data", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Data", @@ -51,6 +53,7 @@ "fieldname": "prevdoc_date", "fieldtype": "Date", "hidden": 0, + "in_list_view": 1, "label": "Delivery Date", "oldfieldname": "prevdoc_date", "oldfieldtype": "Date", @@ -61,6 +64,7 @@ "doctype": "DocField", "fieldname": "serial_no", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Serial No", "oldfieldname": "serial_no", "oldfieldtype": "Small Text", @@ -72,6 +76,7 @@ "fieldname": "prevdoc_detail_docname", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Against Document Detail No", "no_copy": 1, "oldfieldname": "prevdoc_detail_docname", @@ -87,6 +92,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Against Document No", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -103,6 +109,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Document Type", "no_copy": 1, "oldfieldname": "prevdoc_doctype", @@ -117,6 +124,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Installed Qty", "oldfieldname": "qty", "oldfieldtype": "Currency", diff --git a/selling/doctype/opportunity_item/opportunity_item.txt b/selling/doctype/opportunity_item/opportunity_item.txt index a5e93539f72..fb1501c0c3f 100644 --- a/selling/doctype/opportunity_item/opportunity_item.txt +++ b/selling/doctype/opportunity_item/opportunity_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:51", "docstatus": 0, - "modified": "2013-07-10 11:52:34", + "modified": "2013-07-10 14:54:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -38,6 +39,7 @@ "doctype": "DocField", "fieldname": "item_name", "fieldtype": "Data", + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -47,6 +49,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -59,6 +62,7 @@ "fieldname": "item_group", "fieldtype": "Link", "hidden": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -71,6 +75,7 @@ "fieldname": "brand", "fieldtype": "Link", "hidden": 1, + "in_list_view": 0, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -82,12 +87,14 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Qty", "oldfieldname": "qty", "oldfieldtype": "Currency" @@ -97,6 +104,7 @@ "fieldname": "basic_rate", "fieldtype": "Currency", "hidden": 1, + "in_list_view": 0, "label": "Basic Rate", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", @@ -107,6 +115,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", diff --git a/selling/doctype/quotation_item/quotation_item.txt b/selling/doctype/quotation_item/quotation_item.txt index 145a4e6a52c..32b8421806f 100644 --- a/selling/doctype/quotation_item/quotation_item.txt +++ b/selling/doctype/quotation_item/quotation_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:57", "docstatus": 0, - "modified": "2013-07-10 11:52:06", + "modified": "2013-07-10 14:54:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -31,6 +31,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -47,6 +48,7 @@ "fieldname": "customer_item_code", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Customer's Item Code", "print_hide": 1, "read_only": 1 @@ -56,6 +58,7 @@ "fieldname": "item_name", "fieldtype": "Data", "in_filter": 1, + "in_list_view": 0, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -70,6 +73,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -83,6 +87,7 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { @@ -91,6 +96,7 @@ "fieldname": "qty", "fieldtype": "Float", "in_filter": 0, + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -105,6 +111,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -119,6 +126,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "oldfieldname": "ref_rate", "oldfieldtype": "Currency", @@ -134,6 +142,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount (%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -148,6 +157,7 @@ "fieldname": "export_rate", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 1, "label": "Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -165,6 +175,7 @@ "fieldname": "export_amount", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 1, "label": "Amount", "oldfieldname": "export_amount", "oldfieldtype": "Currency", @@ -180,6 +191,7 @@ "doctype": "DocField", "fieldname": "base_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "oldfieldname": "base_ref_rate", "oldfieldtype": "Currency", @@ -195,6 +207,7 @@ "fieldname": "basic_rate", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 0, "label": "Basic Rate (Company Currency)", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", @@ -212,6 +225,7 @@ "fieldname": "amount", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -227,6 +241,7 @@ "doctype": "DocField", "fieldname": "reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Reference" }, { @@ -235,6 +250,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -249,6 +265,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -264,6 +281,7 @@ "fieldname": "item_tax_rate", "fieldtype": "Small Text", "hidden": 1, + "in_list_view": 0, "label": "Item Tax Rate", "oldfieldname": "item_tax_rate", "oldfieldtype": "Small Text", @@ -275,6 +293,7 @@ "doctype": "DocField", "fieldname": "prevdoc_docname", "fieldtype": "Data", + "in_list_view": 0, "label": "Against Docname", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -290,6 +309,7 @@ "fieldname": "prevdoc_doctype", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Against Doctype", "no_copy": 1, "oldfieldname": "prevdoc_doctype", @@ -306,6 +326,7 @@ "fieldname": "page_break", "fieldtype": "Check", "hidden": 0, + "in_list_view": 0, "label": "Page Break", "no_copy": 1, "oldfieldname": "page_break", diff --git a/selling/doctype/sales_bom_item/sales_bom_item.txt b/selling/doctype/sales_bom_item/sales_bom_item.txt index f7906b72d8b..1bd456b9e7d 100644 --- a/selling/doctype/sales_bom_item/sales_bom_item.txt +++ b/selling/doctype/sales_bom_item/sales_bom_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-23 16:55:51", "docstatus": 0, - "modified": "2013-06-26 13:45:41", + "modified": "2013-07-10 14:54:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", + "in_list_view": 1, "label": "Item", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -38,6 +39,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Qty", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -47,6 +49,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -57,6 +60,7 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Float", + "in_list_view": 1, "label": "Rate", "oldfieldname": "rate", "oldfieldtype": "Currency" @@ -65,6 +69,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", diff --git a/selling/doctype/sales_common/sales_common.txt b/selling/doctype/sales_common/sales_common.txt index 4d00b5146a1..a407493c6f8 100644 --- a/selling/doctype/sales_common/sales_common.txt +++ b/selling/doctype/sales_common/sales_common.txt @@ -2,7 +2,7 @@ { "creation": "2012-03-27 14:36:14", "docstatus": 0, - "modified": "2012-03-27 14:36:14", + "modified": "2013-07-10 14:54:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -10,10 +10,7 @@ "doctype": "DocType", "issingle": 1, "module": "Selling", - "name": "__common__", - "section_style": "Simple", - "show_in_menu": 0, - "version": 290 + "name": "__common__" }, { "doctype": "DocType", diff --git a/selling/doctype/sales_order_item/sales_order_item.txt b/selling/doctype/sales_order_item/sales_order_item.txt index 49f43237853..84e44b0e2b1 100644 --- a/selling/doctype/sales_order_item/sales_order_item.txt +++ b/selling/doctype/sales_order_item/sales_order_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:58", "docstatus": 0, - "modified": "2013-07-10 11:41:52", + "modified": "2013-07-10 14:54:21", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -45,6 +46,7 @@ "fieldname": "customer_item_code", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Customer's Item Code", "print_hide": 1, "read_only": 1 @@ -53,6 +55,7 @@ "doctype": "DocField", "fieldname": "item_name", "fieldtype": "Data", + "in_list_view": 0, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -67,6 +70,7 @@ "fieldname": "description", "fieldtype": "Small Text", "in_filter": 1, + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -80,6 +84,7 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { @@ -87,6 +92,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -100,6 +106,7 @@ "fieldname": "stock_uom", "fieldtype": "Data", "hidden": 0, + "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -113,6 +120,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "oldfieldname": "ref_rate", "oldfieldtype": "Currency", @@ -128,6 +136,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount(%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -141,6 +150,7 @@ "doctype": "DocField", "fieldname": "export_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -155,6 +165,7 @@ "doctype": "DocField", "fieldname": "export_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "no_copy": 0, "oldfieldname": "export_amount", @@ -169,6 +180,7 @@ "doctype": "DocField", "fieldname": "base_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "oldfieldname": "base_ref_rate", "oldfieldtype": "Currency", @@ -183,6 +195,7 @@ "doctype": "DocField", "fieldname": "basic_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Basic Rate (Company Currency)", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", @@ -198,6 +211,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "no_copy": 0, "oldfieldname": "amount", @@ -213,12 +227,14 @@ "doctype": "DocField", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Warehouse and Reference" }, { "doctype": "DocField", "fieldname": "reserved_warehouse", "fieldtype": "Link", + "in_list_view": 0, "label": "Reserved Warehouse", "no_copy": 1, "oldfieldname": "reserved_warehouse", @@ -236,6 +252,7 @@ "fieldname": "projected_qty", "fieldtype": "Float", "hidden": 1, + "in_list_view": 0, "label": "Projected Qty", "no_copy": 1, "oldfieldname": "projected_qty", @@ -250,6 +267,7 @@ "doctype": "DocField", "fieldname": "actual_qty", "fieldtype": "Float", + "in_list_view": 0, "label": "Actual Qty", "no_copy": 1, "print_hide": 1, @@ -264,6 +282,7 @@ "fieldtype": "Float", "hidden": 0, "in_filter": 0, + "in_list_view": 0, "label": "Delivered Qty", "no_copy": 1, "oldfieldname": "delivered_qty", @@ -278,6 +297,7 @@ "doctype": "DocField", "fieldname": "billed_amt", "fieldtype": "Currency", + "in_list_view": 0, "label": "Billed Amt", "no_copy": 1, "options": "currency", @@ -290,6 +310,7 @@ "fieldname": "planned_qty", "fieldtype": "Float", "hidden": 1, + "in_list_view": 0, "label": "Planned Quantity", "no_copy": 1, "oldfieldname": "planned_qty", @@ -306,6 +327,7 @@ "fieldname": "produced_qty", "fieldtype": "Float", "hidden": 1, + "in_list_view": 0, "label": "Produced Quantity", "oldfieldname": "produced_qty", "oldfieldtype": "Currency", @@ -321,6 +343,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Brand Name", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -335,6 +358,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -349,6 +373,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Quotation", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -363,6 +388,7 @@ "doctype": "DocField", "fieldname": "page_break", "fieldtype": "Check", + "in_list_view": 0, "label": "Page Break", "oldfieldname": "page_break", "oldfieldtype": "Check", @@ -375,6 +401,7 @@ "fieldname": "item_tax_rate", "fieldtype": "Small Text", "hidden": 1, + "in_list_view": 0, "label": "Item Tax Rate", "oldfieldname": "item_tax_rate", "oldfieldtype": "Small Text", @@ -389,6 +416,7 @@ "fieldtype": "Date", "hidden": 1, "in_filter": 0, + "in_list_view": 0, "label": "Sales Order Date", "oldfieldname": "transaction_date", "oldfieldtype": "Date", diff --git a/selling/doctype/sales_team/sales_team.txt b/selling/doctype/sales_team/sales_team.txt index 29a951eef70..ae50814b118 100644 --- a/selling/doctype/sales_team/sales_team.txt +++ b/selling/doctype/sales_team/sales_team.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-19 13:30:51", "docstatus": 0, - "modified": "2013-05-21 17:04:45", + "modified": "2013-07-10 14:54:22", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "fieldname": "sales_person", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Sales Person", "oldfieldname": "sales_person", "oldfieldtype": "Link", @@ -43,6 +44,7 @@ "fieldname": "sales_designation", "fieldtype": "Data", "hidden": 0, + "in_list_view": 1, "label": "Designation", "oldfieldname": "sales_designation", "oldfieldtype": "Data", @@ -54,6 +56,7 @@ "fieldname": "contact_no", "fieldtype": "Data", "hidden": 1, + "in_list_view": 1, "label": "Contact No.", "oldfieldname": "contact_no", "oldfieldtype": "Data", @@ -64,6 +67,7 @@ "doctype": "DocField", "fieldname": "allocated_percentage", "fieldtype": "Float", + "in_list_view": 1, "label": "Contribution (%)", "oldfieldname": "allocated_percentage", "oldfieldtype": "Currency", @@ -75,6 +79,7 @@ "doctype": "DocField", "fieldname": "allocated_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Contribution to Net Total", "oldfieldname": "allocated_amount", "oldfieldtype": "Currency", @@ -90,6 +95,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Parenttype", "oldfieldname": "parenttype", "oldfieldtype": "Data", @@ -100,6 +106,7 @@ "doctype": "DocField", "fieldname": "incentives", "fieldtype": "Currency", + "in_list_view": 1, "label": "Incentives", "oldfieldname": "incentives", "oldfieldtype": "Currency", diff --git a/setup/doctype/authorization_control/authorization_control.txt b/setup/doctype/authorization_control/authorization_control.txt index 601381ec317..897994b7324 100644 --- a/setup/doctype/authorization_control/authorization_control.txt +++ b/setup/doctype/authorization_control/authorization_control.txt @@ -2,7 +2,7 @@ { "creation": "2012-03-27 14:36:18", "docstatus": 0, - "modified": "2012-03-27 14:36:18", + "modified": "2013-07-10 14:54:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -10,9 +10,7 @@ "doctype": "DocType", "issingle": 1, "module": "Setup", - "name": "__common__", - "section_style": "Tabbed", - "version": 216 + "name": "__common__" }, { "doctype": "DocType", diff --git a/setup/doctype/contact_control/contact_control.txt b/setup/doctype/contact_control/contact_control.txt index 9fab3675911..80caeae1e27 100644 --- a/setup/doctype/contact_control/contact_control.txt +++ b/setup/doctype/contact_control/contact_control.txt @@ -2,7 +2,7 @@ { "creation": "2012-03-27 14:36:19", "docstatus": 0, - "modified": "2012-03-27 14:36:19", + "modified": "2013-07-10 14:54:06", "modified_by": "Administrator", "owner": "Administrator" }, @@ -12,14 +12,12 @@ "issingle": 1, "module": "Setup", "name": "__common__", - "read_only": 1, - "section_style": "Simple", - "show_in_menu": 0, - "version": 25 + "read_only": 1 }, { "doctype": "DocField", "fieldtype": "Text", + "in_list_view": 1, "name": "__common__", "parent": "Contact Control", "parentfield": "fields", @@ -42,9 +40,6 @@ "doctype": "DocType", "name": "Contact Control" }, - { - "doctype": "DocPerm" - }, { "doctype": "DocField", "fieldname": "header", @@ -59,5 +54,8 @@ "doctype": "DocField", "fieldname": "supplier_intro", "label": "Supplier Intro" + }, + { + "doctype": "DocPerm" } ] \ No newline at end of file diff --git a/setup/doctype/for_territory/for_territory.txt b/setup/doctype/for_territory/for_territory.txt index 658a11c7acc..be454ec0183 100644 --- a/setup/doctype/for_territory/for_territory.txt +++ b/setup/doctype/for_territory/for_territory.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-20 12:48:38", "docstatus": 0, - "modified": "2013-06-20 12:48:38", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ "doctype": "DocField", "fieldname": "territory", "fieldtype": "Link", + "in_list_view": 1, "label": "Territory", "name": "__common__", "options": "Territory", diff --git a/setup/doctype/notification_control/notification_control.txt b/setup/doctype/notification_control/notification_control.txt index be86a962ca6..c1f559b99b5 100644 --- a/setup/doctype/notification_control/notification_control.txt +++ b/setup/doctype/notification_control/notification_control.txt @@ -1,208 +1,217 @@ [ { - "owner": "Administrator", - "docstatus": 0, "creation": "2012-07-12 23:29:45", + "docstatus": 0, + "modified": "2013-07-10 14:54:11", "modified_by": "Administrator", - "modified": "2013-01-10 12:22:45" + "owner": "Administrator" }, { + "allow_copy": 1, "allow_email": 1, - "issingle": 1, - "description": "Send automatic emails to Contacts on Submitting transactions.", - "name": "__common__", "allow_print": 1, + "description": "Send automatic emails to Contacts on Submitting transactions.", "doctype": "DocType", + "issingle": 1, "module": "Setup", - "allow_copy": 1 + "name": "__common__" }, { - "name": "__common__", - "parent": "Notification Control", "doctype": "DocField", - "parenttype": "DocType", - "permlevel": 0, - "parentfield": "fields" - }, - { "name": "__common__", "parent": "Notification Control", - "read": 1, - "doctype": "DocPerm", + "parentfield": "fields", "parenttype": "DocType", - "permlevel": 0, - "parentfield": "permissions" + "permlevel": 0 }, { - "name": "Notification Control", - "doctype": "DocType" + "doctype": "DocPerm", + "name": "__common__", + "parent": "Notification Control", + "parentfield": "permissions", + "parenttype": "DocType", + "permlevel": 0, + "read": 1 + }, + { + "doctype": "DocType", + "name": "Notification Control" }, { "description": "When any of the checked transactions are \"Submitted\", an email pop-up automatically opened to send an email to the associated \"Contact\" in that transaction, with the transaction as an attachment. The user may or may not send the email.", "doctype": "DocField", - "label": "Prompt for Email on Submission of", "fieldname": "send_autonotification_for", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Prompt for Email on Submission of" }, { - "print_width": "50%", "doctype": "DocField", - "label": "Sales", - "width": "50%", "fieldname": "sales", - "fieldtype": "Column Break" - }, - { - "doctype": "DocField", - "label": "Quotation", - "fieldname": "quotation", - "fieldtype": "Check" - }, - { - "doctype": "DocField", - "label": "Sales Order", - "fieldname": "sales_order", - "fieldtype": "Check" - }, - { - "doctype": "DocField", - "label": "Delivery Note", - "fieldname": "delivery_note", - "fieldtype": "Check" - }, - { - "doctype": "DocField", - "label": "Sales Invoice", - "fieldname": "sales_invoice", - "fieldtype": "Check" - }, - { + "fieldtype": "Column Break", + "in_list_view": 0, + "label": "Sales", "print_width": "50%", + "width": "50%" + }, + { + "doctype": "DocField", + "fieldname": "quotation", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Quotation" + }, + { + "doctype": "DocField", + "fieldname": "sales_order", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Sales Order" + }, + { + "doctype": "DocField", + "fieldname": "delivery_note", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Delivery Note" + }, + { + "doctype": "DocField", + "fieldname": "sales_invoice", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Sales Invoice" + }, + { "doctype": "DocField", - "label": "Purchase", - "width": "50%", "fieldname": "purchase", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "in_list_view": 0, + "label": "Purchase", + "print_width": "50%", + "width": "50%" }, { "doctype": "DocField", - "label": "Purchase Order", "fieldname": "purchase_order", - "fieldtype": "Check" + "fieldtype": "Check", + "in_list_view": 1, + "label": "Purchase Order" }, { "doctype": "DocField", - "label": "Purchase Receipt", "fieldname": "purchase_receipt", - "fieldtype": "Check" + "fieldtype": "Check", + "in_list_view": 1, + "label": "Purchase Receipt" }, { "doctype": "DocField", - "label": "Expense Claim", "fieldname": "expense_claim", - "fieldtype": "Check" + "fieldtype": "Check", + "label": "Expense Claim" }, { "description": "Customize the introductory text that goes as a part of that email. Each transaction has a separate introductory text.", "doctype": "DocField", - "label": "Customize the Notification", "fieldname": "customize_the_notification", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "label": "Customize the Notification" }, { "doctype": "DocField", - "label": "Select Transaction", "fieldname": "select_transaction", "fieldtype": "Select", + "label": "Select Transaction", "options": "\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPurchase Order\nPurchase Receipt\nExpense Claim\nExpense Claim Approved\nExpense Claim Rejected" }, { "doctype": "DocField", - "label": "Custom Message", "fieldname": "custom_message", - "fieldtype": "Text Editor" + "fieldtype": "Text Editor", + "label": "Custom Message" }, { "doctype": "DocField", - "label": "Update", "fieldname": "update", "fieldtype": "Button", + "label": "Update", "options": "set_message" }, { - "print_hide": 1, "doctype": "DocField", - "label": "Quotation Message", "fieldname": "quotation_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Quotation Message", + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Sales Order Message", "fieldname": "sales_order_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Sales Order Message", + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Delivery Note Message", "fieldname": "delivery_note_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Delivery Note Message", + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Sales Invoice Message", "fieldname": "sales_invoice_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Sales Invoice Message", + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Purchase Order Message", "fieldname": "purchase_order_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Purchase Order Message", + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Purchase Receipt Message", "fieldname": "purchase_receipt_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Purchase Receipt Message", + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Expense Claim Approved Message", "fieldname": "expense_claim_approved_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Expense Claim Approved Message", + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Expense Claim Rejected Message", "fieldname": "expense_claim_rejected_message", "fieldtype": "Text", - "hidden": 1 + "hidden": 1, + "label": "Expense Claim Rejected Message", + "print_hide": 1 }, { "create": 0, "doctype": "DocPerm", - "write": 0, - "role": "Guest" + "role": "Guest", + "write": 0 }, { "create": 1, "doctype": "DocPerm", - "write": 1, - "role": "System Manager" + "role": "System Manager", + "write": 1 } ] \ No newline at end of file diff --git a/setup/doctype/sms_parameter/sms_parameter.txt b/setup/doctype/sms_parameter/sms_parameter.txt index cc7a002b1e8..38cca31d772 100755 --- a/setup/doctype/sms_parameter/sms_parameter.txt +++ b/setup/doctype/sms_parameter/sms_parameter.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:58", "docstatus": 0, - "modified": "2013-03-07 07:03:32", + "modified": "2013-07-10 14:54:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,6 +15,7 @@ { "doctype": "DocField", "fieldtype": "Data", + "in_list_view": 1, "name": "__common__", "parent": "SMS Parameter", "parentfield": "fields", diff --git a/setup/doctype/target_detail/target_detail.txt b/setup/doctype/target_detail/target_detail.txt index b3e28861218..5d22d8896db 100644 --- a/setup/doctype/target_detail/target_detail.txt +++ b/setup/doctype/target_detail/target_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:58", "docstatus": 0, - "modified": "2013-03-07 07:03:33", + "modified": "2013-07-10 14:54:24", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Target Detail", "parentfield": "fields", diff --git a/stock/doctype/bin/bin.txt b/stock/doctype/bin/bin.txt index cf3fbb17dcb..34681a87f23 100644 --- a/stock/doctype/bin/bin.txt +++ b/stock/doctype/bin/bin.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:25", "docstatus": 0, - "modified": "2013-01-23 16:53:15", + "modified": "2013-07-10 14:54:04", "modified_by": "Administrator", "owner": "Administrator" }, @@ -45,6 +45,7 @@ "fieldname": "warehouse", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -55,6 +56,7 @@ "doctype": "DocField", "fieldname": "warehouse_type", "fieldtype": "Data", + "in_list_view": 1, "label": "Warehouse Type", "oldfieldname": "warehouse_type", "oldfieldtype": "Data" @@ -64,6 +66,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -76,6 +79,7 @@ "fieldname": "reserved_qty", "fieldtype": "Float", "in_filter": 0, + "in_list_view": 1, "label": "Reserved Quantity", "oldfieldname": "reserved_qty", "oldfieldtype": "Currency", @@ -87,6 +91,7 @@ "fieldname": "actual_qty", "fieldtype": "Float", "in_filter": 1, + "in_list_view": 1, "label": "Actual Quantity", "oldfieldname": "actual_qty", "oldfieldtype": "Currency", @@ -98,6 +103,7 @@ "fieldname": "ordered_qty", "fieldtype": "Float", "in_filter": 0, + "in_list_view": 1, "label": "Ordered Quantity", "oldfieldname": "ordered_qty", "oldfieldtype": "Currency", diff --git a/stock/doctype/delivery_note_item/delivery_note_item.txt b/stock/doctype/delivery_note_item/delivery_note_item.txt index 7d5e8e01d1e..346673f46e6 100644 --- a/stock/doctype/delivery_note_item/delivery_note_item.txt +++ b/stock/doctype/delivery_note_item/delivery_note_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-22 13:15:44", "docstatus": 0, - "modified": "2013-07-10 11:50:59", + "modified": "2013-07-10 14:54:07", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "barcode", "fieldtype": "Data", + "in_list_view": 0, "label": "Barcode", "print_hide": 1, "read_only": 0 @@ -38,6 +39,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -53,6 +55,7 @@ "fieldname": "customer_item_code", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Customer's Item Code", "print_hide": 1, "read_only": 1 @@ -61,6 +64,7 @@ "doctype": "DocField", "fieldname": "item_name", "fieldtype": "Data", + "in_list_view": 0, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -74,6 +78,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -86,6 +91,7 @@ "doctype": "DocField", "fieldname": "quantity_and_rate", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Rate" }, { @@ -93,6 +99,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -105,6 +112,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -119,6 +127,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "no_copy": 0, "oldfieldname": "ref_rate", @@ -135,6 +144,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount (%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -147,6 +157,7 @@ "doctype": "DocField", "fieldname": "export_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -161,6 +172,7 @@ "doctype": "DocField", "fieldname": "export_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "export_amount", "oldfieldtype": "Currency", @@ -175,6 +187,7 @@ "doctype": "DocField", "fieldname": "base_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "oldfieldname": "base_ref_rate", "oldfieldtype": "Currency", @@ -189,6 +202,7 @@ "doctype": "DocField", "fieldname": "basic_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", @@ -203,6 +217,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -217,12 +232,14 @@ "doctype": "DocField", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Warehouse and Reference" }, { "doctype": "DocField", "fieldname": "warehouse", "fieldtype": "Link", + "in_list_view": 0, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -237,6 +254,7 @@ "fieldname": "serial_no", "fieldtype": "Text", "in_filter": 1, + "in_list_view": 1, "label": "Serial No", "no_copy": 1, "oldfieldname": "serial_no", diff --git a/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt b/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt index defd39d6855..441b13a1a9f 100644 --- a/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt +++ b/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:00", "docstatus": 0, - "modified": "2013-03-07 07:03:20", + "modified": "2013-07-10 14:54:08", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ "doctype": "DocField", "fieldname": "parent_item", "fieldtype": "Link", + "in_list_view": 1, "label": "Parent Item", "oldfieldname": "parent_item", "oldfieldtype": "Link", @@ -39,6 +40,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -50,6 +52,7 @@ "fieldname": "item_name", "fieldtype": "Data", "in_filter": 1, + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -60,6 +63,7 @@ "fieldname": "parent_detail_docname", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Parent Detail docname", "no_copy": 1, "oldfieldname": "parent_detail_docname", @@ -71,6 +75,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -82,6 +87,7 @@ "doctype": "DocField", "fieldname": "warehouse", "fieldtype": "Link", + "in_list_view": 1, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -91,6 +97,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Qty", "oldfieldname": "qty", "oldfieldtype": "Currency", diff --git a/stock/doctype/item_customer_detail/item_customer_detail.txt b/stock/doctype/item_customer_detail/item_customer_detail.txt index 3b916a22d46..def1dff2301 100644 --- a/stock/doctype/item_customer_detail/item_customer_detail.txt +++ b/stock/doctype/item_customer_detail/item_customer_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-08 15:37:16", "docstatus": 0, - "modified": "2013-03-21 17:29:45", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -19,6 +19,7 @@ { "doctype": "DocField", "in_filter": 1, + "in_list_view": 1, "name": "__common__", "parent": "Item Customer Detail", "parentfield": "fields", diff --git a/stock/doctype/item_price/item_price.txt b/stock/doctype/item_price/item_price.txt index e4926cbebb6..8062b5722a1 100644 --- a/stock/doctype/item_price/item_price.txt +++ b/stock/doctype/item_price/item_price.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-02 16:29:48", "docstatus": 0, - "modified": "2013-06-11 18:27:55", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -17,6 +17,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Item Price", "parentfield": "fields", diff --git a/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.txt b/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.txt index 8233ede8855..df8c817de1c 100644 --- a/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.txt +++ b/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:01", "docstatus": 0, - "modified": "2013-03-07 07:03:22", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ { "doctype": "DocField", "fieldtype": "Data", + "in_list_view": 1, "name": "__common__", "oldfieldtype": "Data", "parent": "Item Quality Inspection Parameter", diff --git a/stock/doctype/item_reorder/item_reorder.txt b/stock/doctype/item_reorder/item_reorder.txt index b6933c7458e..ae9de1e7249 100644 --- a/stock/doctype/item_reorder/item_reorder.txt +++ b/stock/doctype/item_reorder/item_reorder.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:42:59", "docstatus": 0, - "modified": "2013-03-19 12:22:44", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Item Reorder", "parentfield": "fields", diff --git a/stock/doctype/item_supplier/item_supplier.txt b/stock/doctype/item_supplier/item_supplier.txt index 312950466e7..e0e0e6d0a4c 100644 --- a/stock/doctype/item_supplier/item_supplier.txt +++ b/stock/doctype/item_supplier/item_supplier.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:01", "docstatus": 0, - "modified": "2013-03-07 07:03:22", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Item Supplier", "parentfield": "fields", diff --git a/stock/doctype/item_tax/item_tax.txt b/stock/doctype/item_tax/item_tax.txt index 343f965e89f..cbc112e1f0c 100644 --- a/stock/doctype/item_tax/item_tax.txt +++ b/stock/doctype/item_tax/item_tax.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:01", "docstatus": 0, - "modified": "2013-03-07 07:03:22", + "modified": "2013-07-10 14:54:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Item Tax", "parentfield": "fields", diff --git a/stock/doctype/item_website_specification/item_website_specification.txt b/stock/doctype/item_website_specification/item_website_specification.txt index 1b371c7f600..c3c1d34751c 100644 --- a/stock/doctype/item_website_specification/item_website_specification.txt +++ b/stock/doctype/item_website_specification/item_website_specification.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:01", "docstatus": 0, - "modified": "2013-03-07 07:03:22", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Item Website Specification", "parentfield": "fields", diff --git a/stock/doctype/landed_cost_item/landed_cost_item.txt b/stock/doctype/landed_cost_item/landed_cost_item.txt index 1563face4fb..3e14ce834d1 100644 --- a/stock/doctype/landed_cost_item/landed_cost_item.txt +++ b/stock/doctype/landed_cost_item/landed_cost_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:02", "docstatus": 0, - "modified": "2013-03-07 07:03:23", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "wasim@webnotestech.com" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Landed Cost Item", "parentfield": "fields", diff --git a/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.txt b/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.txt index 8b80559064a..e47dd27a5c7 100644 --- a/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.txt +++ b/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:02", "docstatus": 0, - "modified": "2013-03-07 07:03:23", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "wasim@webnotestech.com" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Landed Cost Purchase Receipt", "parentfield": "fields", diff --git a/stock/doctype/material_request_item/material_request_item.txt b/stock/doctype/material_request_item/material_request_item.txt index 799be789658..86cc168613f 100644 --- a/stock/doctype/material_request_item/material_request_item.txt +++ b/stock/doctype/material_request_item/material_request_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:02", "docstatus": 0, - "modified": "2013-07-10 11:53:34", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -44,6 +45,7 @@ "doctype": "DocField", "fieldname": "schedule_date", "fieldtype": "Date", + "in_list_view": 1, "label": "Required Date", "no_copy": 1, "oldfieldname": "schedule_date", @@ -57,6 +59,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -68,12 +71,14 @@ "doctype": "DocField", "fieldname": "quantity_and_warehouse", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Quantity and Warehouse" }, { "doctype": "DocField", "fieldname": "warehouse", "fieldtype": "Link", + "in_list_view": 1, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -88,6 +93,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "no_copy": 0, "oldfieldname": "qty", @@ -100,6 +106,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "Stock UOM", "no_copy": 0, "oldfieldname": "uom", @@ -114,6 +121,7 @@ "doctype": "DocField", "fieldname": "lead_time_date", "fieldtype": "Date", + "in_list_view": 0, "label": "Lead Time Date", "no_copy": 1, "oldfieldname": "lead_time_date", @@ -126,6 +134,7 @@ "fieldname": "item_name", "fieldtype": "Data", "in_filter": 1, + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", diff --git a/stock/doctype/packing_slip_item/packing_slip_item.txt b/stock/doctype/packing_slip_item/packing_slip_item.txt index b186f40c5fb..8dea8779ace 100644 --- a/stock/doctype/packing_slip_item/packing_slip_item.txt +++ b/stock/doctype/packing_slip_item/packing_slip_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-08 13:10:16", "docstatus": 0, - "modified": "2013-04-11 15:06:05", + "modified": "2013-07-10 14:54:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Code", "options": "Item", "print_width": "100px", @@ -40,6 +41,7 @@ "doctype": "DocField", "fieldname": "item_name", "fieldtype": "Data", + "in_list_view": 1, "label": "Item Name", "print_width": "200px", "read_only": 1, @@ -49,6 +51,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "print_width": "100px", "read_only": 0, @@ -59,6 +62,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "print_width": "100px", "read_only": 1, @@ -68,6 +72,7 @@ "doctype": "DocField", "fieldname": "net_weight", "fieldtype": "Float", + "in_list_view": 1, "label": "Net Weight", "print_width": "100px", "read_only": 0, @@ -77,6 +82,7 @@ "doctype": "DocField", "fieldname": "weight_uom", "fieldtype": "Link", + "in_list_view": 0, "label": "Weight UOM", "options": "UOM", "print_width": "100px", @@ -87,6 +93,7 @@ "doctype": "DocField", "fieldname": "page_break", "fieldtype": "Check", + "in_list_view": 1, "label": "Page Break", "read_only": 0 }, @@ -95,6 +102,7 @@ "fieldname": "dn_detail", "fieldtype": "Data", "hidden": 1, + "in_list_view": 1, "label": "DN Detail", "read_only": 0 } diff --git a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt index 59426c6cccf..60b1b567ac4 100755 --- a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt +++ b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:10", "docstatus": 0, - "modified": "2013-07-10 11:56:05", + "modified": "2013-07-10 14:54:16", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -45,6 +46,7 @@ "fieldname": "item_name", "fieldtype": "Data", "in_filter": 0, + "in_list_view": 0, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -57,6 +59,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -69,6 +72,7 @@ "doctype": "DocField", "fieldname": "received_and_accepted", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Received and Accepted" }, { @@ -76,6 +80,7 @@ "doctype": "DocField", "fieldname": "received_qty", "fieldtype": "Float", + "in_list_view": 0, "label": "Recd Quantity", "oldfieldname": "received_qty", "oldfieldtype": "Currency", @@ -90,6 +95,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Accepted Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -103,6 +109,7 @@ "fieldname": "rejected_qty", "fieldtype": "Float", "in_filter": 0, + "in_list_view": 0, "label": "Rejected Quantity", "oldfieldname": "rejected_qty", "oldfieldtype": "Currency", @@ -116,6 +123,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -130,12 +138,14 @@ "doctype": "DocField", "fieldname": "rate_and_amount", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Rate and Amount" }, { "doctype": "DocField", "fieldname": "import_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "options": "currency", "print_hide": 1, @@ -145,6 +155,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 1, "read_only": 0 @@ -154,6 +165,7 @@ "doctype": "DocField", "fieldname": "import_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -167,6 +179,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -177,6 +190,7 @@ "doctype": "DocField", "fieldname": "purchase_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate (Company Currency)", "options": "Company:company:default_currency", "print_hide": 1, @@ -187,6 +201,7 @@ "doctype": "DocField", "fieldname": "purchase_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "purchase_rate", "oldfieldtype": "Currency", @@ -202,6 +217,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -216,6 +232,7 @@ "doctype": "DocField", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Warehouse and Reference" }, { @@ -223,6 +240,7 @@ "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, + "in_list_view": 0, "label": "Accepted Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -236,6 +254,7 @@ "doctype": "DocField", "fieldname": "conversion_factor", "fieldtype": "Float", + "in_list_view": 0, "label": "Conversion Factor", "oldfieldname": "conversion_factor", "oldfieldtype": "Currency", @@ -249,6 +268,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -263,6 +283,7 @@ "fieldname": "serial_no", "fieldtype": "Text", "in_filter": 1, + "in_list_view": 1, "label": "Serial No", "no_copy": 1, "oldfieldname": "serial_no", diff --git a/stock/doctype/stock_entry_detail/stock_entry_detail.txt b/stock/doctype/stock_entry_detail/stock_entry_detail.txt index 8426ddca274..f47e192c696 100644 --- a/stock/doctype/stock_entry_detail/stock_entry_detail.txt +++ b/stock/doctype/stock_entry_detail/stock_entry_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-29 18:22:12", "docstatus": 0, - "modified": "2013-03-29 19:43:04", + "modified": "2013-07-10 14:54:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "s_warehouse", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Source Warehouse", "no_copy": 1, "oldfieldname": "s_warehouse", @@ -42,6 +43,7 @@ "fieldname": "t_warehouse", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Target Warehouse", "no_copy": 1, "oldfieldname": "t_warehouse", @@ -54,6 +56,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -66,6 +69,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Text", @@ -77,6 +81,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Qty", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -87,6 +92,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -98,6 +104,7 @@ "doctype": "DocField", "fieldname": "incoming_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Valuation Rate", "oldfieldname": "incoming_rate", "oldfieldtype": "Currency", diff --git a/stock/doctype/stock_ledger/stock_ledger.txt b/stock/doctype/stock_ledger/stock_ledger.txt index 1da37c67013..afdaa4d9b48 100644 --- a/stock/doctype/stock_ledger/stock_ledger.txt +++ b/stock/doctype/stock_ledger/stock_ledger.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:30", "docstatus": 0, - "modified": "2013-01-22 14:57:24", + "modified": "2013-07-10 14:54:23", "modified_by": "Administrator", "owner": "Administrator" }, diff --git a/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt b/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt index 381c7f7407b..8b35f64cfb7 100644 --- a/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt +++ b/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:04", "docstatus": 0, - "modified": "2013-03-07 07:03:34", + "modified": "2013-07-10 14:54:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -38,6 +39,7 @@ "doctype": "DocField", "fieldname": "conversion_factor", "fieldtype": "Float", + "in_list_view": 1, "label": "Conversion Factor", "oldfieldname": "conversion_factor", "oldfieldtype": "Float" diff --git a/stock/doctype/warehouse_user/warehouse_user.txt b/stock/doctype/warehouse_user/warehouse_user.txt index 6912e30d3f9..fee6221727d 100644 --- a/stock/doctype/warehouse_user/warehouse_user.txt +++ b/stock/doctype/warehouse_user/warehouse_user.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:05", "docstatus": 0, - "modified": "2013-03-07 07:03:34", + "modified": "2013-07-10 14:54:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -17,6 +17,7 @@ "doctype": "DocField", "fieldname": "user", "fieldtype": "Link", + "in_list_view": 1, "label": "User", "name": "__common__", "options": "Profile", diff --git a/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt b/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt index 0aa4d0d3a8a..e55a69c8d5a 100644 --- a/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt +++ b/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:05", "docstatus": 0, - "modified": "2013-03-07 07:03:23", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -43,6 +44,7 @@ "fieldname": "item_name", "fieldtype": "Data", "in_filter": 0, + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -54,6 +56,7 @@ "fieldname": "scheduled_date", "fieldtype": "Date", "in_filter": 1, + "in_list_view": 1, "label": "Scheduled Date", "oldfieldname": "scheduled_date", "oldfieldtype": "Date", @@ -65,6 +68,7 @@ "fieldname": "actual_date", "fieldtype": "Date", "hidden": 1, + "in_list_view": 0, "label": "Actual Date", "no_copy": 1, "oldfieldname": "actual_date", @@ -78,6 +82,7 @@ "fieldname": "incharge_name", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Incharge Name", "oldfieldname": "incharge_name", "oldfieldtype": "Link", @@ -90,6 +95,7 @@ "fieldname": "serial_no", "fieldtype": "Small Text", "in_filter": 1, + "in_list_view": 1, "label": "Serial No", "no_copy": 0, "oldfieldname": "serial_no", diff --git a/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt b/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt index 5c0fe3cddd3..648a3289131 100644 --- a/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt +++ b/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:05", "docstatus": 0, - "modified": "2013-07-10 12:45:10", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -41,6 +42,7 @@ "doctype": "DocField", "fieldname": "item_name", "fieldtype": "Data", + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -50,6 +52,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Data", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Data", @@ -61,6 +64,7 @@ "doctype": "DocField", "fieldname": "schedule_details", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Schedule Details" }, { @@ -68,6 +72,7 @@ "fieldname": "start_date", "fieldtype": "Date", "in_filter": 1, + "in_list_view": 1, "label": "Start Date", "oldfieldname": "start_date", "oldfieldtype": "Date", @@ -79,6 +84,7 @@ "fieldname": "end_date", "fieldtype": "Date", "in_filter": 1, + "in_list_view": 1, "label": "End Date", "oldfieldname": "end_date", "oldfieldtype": "Date", @@ -89,6 +95,7 @@ "doctype": "DocField", "fieldname": "periodicity", "fieldtype": "Select", + "in_list_view": 1, "label": "Periodicity", "oldfieldname": "periodicity", "oldfieldtype": "Select", diff --git a/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt b/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt index 4f4af9ac546..53fa0a2e199 100644 --- a/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt +++ b/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:06", "docstatus": 0, - "modified": "2013-07-10 12:58:21", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -29,6 +29,7 @@ "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -38,6 +39,7 @@ "doctype": "DocField", "fieldname": "item_name", "fieldtype": "Data", + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -47,6 +49,7 @@ "doctype": "DocField", "fieldname": "serial_no", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Serial No", "oldfieldname": "serial_no", "oldfieldtype": "Small Text" @@ -55,6 +58,7 @@ "doctype": "DocField", "fieldname": "description", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Description", "oldfieldname": "description", "oldfieldtype": "Small Text", @@ -66,12 +70,14 @@ "doctype": "DocField", "fieldname": "work_details", "fieldtype": "Section Break", + "in_list_view": 0, "label": "Work Details" }, { "doctype": "DocField", "fieldname": "service_person", "fieldtype": "Link", + "in_list_view": 1, "label": "Sales Person", "oldfieldname": "service_person", "oldfieldtype": "Link", @@ -82,6 +88,7 @@ "doctype": "DocField", "fieldname": "work_done", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Work Done", "oldfieldname": "work_done", "oldfieldtype": "Small Text", diff --git a/utilities/doctype/note_user/note_user.txt b/utilities/doctype/note_user/note_user.txt index 2d82bb03845..fcc1d1168f5 100644 --- a/utilities/doctype/note_user/note_user.txt +++ b/utilities/doctype/note_user/note_user.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 14:24:48", "docstatus": 0, - "modified": "2013-05-24 14:24:48", + "modified": "2013-07-10 14:54:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Note User", "parentfield": "fields", diff --git a/website/doctype/about_us_team_member/about_us_team_member.txt b/website/doctype/about_us_team_member/about_us_team_member.txt index b1bf6b306a3..c5e6d164e96 100644 --- a/website/doctype/about_us_team_member/about_us_team_member.txt +++ b/website/doctype/about_us_team_member/about_us_team_member.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:55:11", "docstatus": 0, - "modified": "2013-03-12 13:51:02", + "modified": "2013-07-10 14:54:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "About Us Team Member", "parentfield": "fields", diff --git a/website/doctype/company_history/company_history.txt b/website/doctype/company_history/company_history.txt index 544845d256e..c0f230c3470 100644 --- a/website/doctype/company_history/company_history.txt +++ b/website/doctype/company_history/company_history.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:08", "docstatus": 0, - "modified": "2013-03-07 07:03:19", + "modified": "2013-07-10 14:54:06", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Company History", "parentfield": "fields", diff --git a/website/doctype/shopping_cart_price_list/shopping_cart_price_list.txt b/website/doctype/shopping_cart_price_list/shopping_cart_price_list.txt index 57ddc21cc39..cdda874e1df 100644 --- a/website/doctype/shopping_cart_price_list/shopping_cart_price_list.txt +++ b/website/doctype/shopping_cart_price_list/shopping_cart_price_list.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-20 16:00:18", "docstatus": 0, - "modified": "2013-06-20 16:01:34", + "modified": "2013-07-10 14:54:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ "doctype": "DocField", "fieldname": "price_list", "fieldtype": "Link", + "in_list_view": 1, "label": "Price List", "name": "__common__", "options": "Price List", diff --git a/website/doctype/shopping_cart_shipping_rule/shopping_cart_shipping_rule.txt b/website/doctype/shopping_cart_shipping_rule/shopping_cart_shipping_rule.txt index caeba3d96a4..302b0aef8e5 100644 --- a/website/doctype/shopping_cart_shipping_rule/shopping_cart_shipping_rule.txt +++ b/website/doctype/shopping_cart_shipping_rule/shopping_cart_shipping_rule.txt @@ -2,7 +2,7 @@ { "creation": "2013-07-03 13:15:34", "docstatus": 0, - "modified": "2013-07-03 13:19:02", + "modified": "2013-07-10 14:54:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ "doctype": "DocField", "fieldname": "shipping_rule", "fieldtype": "Link", + "in_list_view": 1, "label": "Shipping Rule", "name": "__common__", "options": "Shipping Rule", diff --git a/website/doctype/shopping_cart_taxes_and_charges_master/shopping_cart_taxes_and_charges_master.txt b/website/doctype/shopping_cart_taxes_and_charges_master/shopping_cart_taxes_and_charges_master.txt index 6cd9f382d84..f00a23d2e66 100644 --- a/website/doctype/shopping_cart_taxes_and_charges_master/shopping_cart_taxes_and_charges_master.txt +++ b/website/doctype/shopping_cart_taxes_and_charges_master/shopping_cart_taxes_and_charges_master.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-20 16:57:03", "docstatus": 0, - "modified": "2013-06-20 16:57:03", + "modified": "2013-07-10 14:54:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ "doctype": "DocField", "fieldname": "sales_taxes_and_charges_master", "fieldtype": "Link", + "in_list_view": 1, "label": "Tax Master", "name": "__common__", "options": "Sales Taxes and Charges Master", diff --git a/website/doctype/top_bar_item/top_bar_item.txt b/website/doctype/top_bar_item/top_bar_item.txt index 0076f7f50f8..58d101e12a3 100644 --- a/website/doctype/top_bar_item/top_bar_item.txt +++ b/website/doctype/top_bar_item/top_bar_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:08", "docstatus": 0, - "modified": "2013-03-07 07:03:34", + "modified": "2013-07-10 14:54:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,6 +14,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Top Bar Item", "parentfield": "fields", diff --git a/website/doctype/website_item_group/website_item_group.txt b/website/doctype/website_item_group/website_item_group.txt index 0b643065f11..3d26e85315e 100644 --- a/website/doctype/website_item_group/website_item_group.txt +++ b/website/doctype/website_item_group/website_item_group.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:09", "docstatus": 0, - "modified": "2013-03-07 07:03:34", + "modified": "2013-07-10 14:54:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -18,6 +18,7 @@ "doctype": "DocField", "fieldname": "item_group", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Group", "name": "__common__", "options": "Item Group", diff --git a/website/doctype/website_slideshow_item/website_slideshow_item.txt b/website/doctype/website_slideshow_item/website_slideshow_item.txt index 53aa628bde6..c6fd78caf08 100644 --- a/website/doctype/website_slideshow_item/website_slideshow_item.txt +++ b/website/doctype/website_slideshow_item/website_slideshow_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 12:26:33", "docstatus": 0, - "modified": "2013-03-07 07:03:34", + "modified": "2013-07-10 14:54:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,6 +16,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "Website Slideshow Item", "parentfield": "fields", From 6e68e0e5d8f5eaf27f090bb1ae36244ba5b0f331 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Jul 2013 15:33:29 +0530 Subject: [PATCH 15/27] [fix] validate with prev doc --- .../doctype/sales_person/test_sales_person.py | 10 +++++-- utilities/transaction_base.py | 29 +++++++++++-------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/setup/doctype/sales_person/test_sales_person.py b/setup/doctype/sales_person/test_sales_person.py index 2dea3e5deec..f4283de38ca 100644 --- a/setup/doctype/sales_person/test_sales_person.py +++ b/setup/doctype/sales_person/test_sales_person.py @@ -1,21 +1,25 @@ +test_dependencies = ["Employee"] test_records = [ [{ "doctype": "Sales Person", "sales_person_name": "_Test Sales Person", "parent_sales_person": "All Sales Persons", - "is_group": "No" + "is_group": "No", + "employee": "_T-Employee-0001", }], [{ "doctype": "Sales Person", "sales_person_name": "_Test Sales Person 1", "parent_sales_person": "All Sales Persons", - "is_group": "No" + "is_group": "No", + "employee": "_T-Employee-0002", }], [{ "doctype": "Sales Person", "sales_person_name": "_Test Sales Person 2", "parent_sales_person": "All Sales Persons", - "is_group": "No" + "is_group": "No", + "employee": "_T-Employee-0003", }] diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 30a40da7ba5..74a75e66a91 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -301,23 +301,28 @@ class TransactionBase(StatusUpdater): def validate_with_previous_doc(self, source_dt, ref): for key, val in ref.items(): + is_child = val.get("is_child_table") ref_doc = {} for d in self.doclist.get({"doctype": source_dt}): - if d.fields.get(val["ref_dn_field"]): - ref_doc.setdefault(key, d.fields[val["ref_dn_field"]]) - - if val.get("is_child_table"): - self.compare_values(ref_doc, val["compare_fields"], d) - else: + ref_dn = d.fields.get(val["ref_dn_field"]) + if ref_dn: + if is_child: + self.compare_values({key: [ref_dn]}, val["compare_fields"], d) + elif ref_dn: + ref_doc.setdefault(key, []) + if ref_dn not in ref_doc[key]: + ref_doc[key].append(ref_dn) + if ref_doc: self.compare_values(ref_doc, val["compare_fields"]) def compare_values(self, ref_doc, fields, doc=None): - for ref_doctype, ref_docname in ref_doc.items(): - prevdoc_values = webnotes.conn.get_value(ref_doctype, ref_docname, - [d[0] for d in fields], as_dict=1) - - for field, condition in fields: - self.validate_value(field, condition, prevdoc_values[field], doc) + for ref_doctype, ref_dn_list in ref_doc.items(): + for ref_docname in ref_dn_list: + prevdoc_values = webnotes.conn.get_value(ref_doctype, ref_docname, + [d[0] for d in fields], as_dict=1) + + for field, condition in fields: + self.validate_value(field, condition, prevdoc_values[field], doc) def get_default_address_and_contact(party_field, party_name, fetch_shipping_address=False): out = {} From a29b69245ea1cbbc998704d71edbf2b3204d8465 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 10 Jul 2013 16:06:31 +0530 Subject: [PATCH 16/27] get_query to servet side --- .../payment_to_invoice_matching_tool.py | 38 ++++--- controllers/queries.py | 104 ++++++++++++------ 2 files changed, 93 insertions(+), 49 deletions(-) diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index 633bdd1590c..b1bec06bad9 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -141,17 +141,27 @@ class DocType: msgprint("No amount allocated.", raise_exception=1) def gl_entry_details(doctype, txt, searchfield, start, page_len, filters): - ("""select gle.voucher_no, gle.posting_date, gle.%(account_type)s - from `tabGL Entry` gle - where gle.account = '%(acc)s' and gle.voucher_type = '%(dt)s' - and gle.voucher_no like '%s' and ifnull(gle.is_cancelled, 'No') = 'No' - and (ifnull(gle.against_voucher, '') = '' or ifnull(gle.against_voucher, '') = gle.voucher_no ) - and ifnull(gle.%(account_type)s, 0) > 0 - and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0) - from `tabGL Entry` - where against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no - and voucher_no != gle.voucher_no - and ifnull(is_cancelled, 'No') = 'No') != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) - ORDER BY gle.posting_date DESC, gle.voucher_no DESC limit %(start)s, %(page_len)s"""% - {dt:filters["dt"], acc:filters["acc"], account_type: filters['account_type'], "start": start, - "page_len": page_len}) \ No newline at end of file + from controllers.queries import get_match_cond + + return webnotes.conn.sql("""select gle.voucher_no, gle.posting_date, + gle.%(account_type)s from `tabGL Entry` gle + where gle.account = '%(acc)s' + and gle.voucher_type = '%(dt)s' + and gle.voucher_no like '%(txt)s' + and ifnull(gle.is_cancelled, 'No') = 'No' + and (ifnull(gle.against_voucher, '') = '' + or ifnull(gle.against_voucher, '') = gle.voucher_no ) + and ifnull(gle.%(account_type)s, 0) > 0 + and (select ifnull(abs(sum(ifnull(debit, 0)) + - sum(ifnull(credit, 0))), 0) + from `tabGL Entry` + where against_voucher_type = '%(dt)s' + and against_voucher = gle.voucher_no + and voucher_no != gle.voucher_no + and ifnull(is_cancelled, 'No') = 'No') + != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) + %(mcond)s + ORDER BY gle.posting_date desc, gle.voucher_no desc + limit %(start)s, %(page_len)s""" % {dt:filters["dt"], acc:filters["acc"], + account_type: filters['account_type'], 'mcond':get_match_cond(doctype, searchfield) + 'txt': "%%%s%%" % txt,"start": start, "page_len": page_len}) \ No newline at end of file diff --git a/controllers/queries.py b/controllers/queries.py index b3556e52290..e397420e3ed 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -16,6 +16,7 @@ from __future__ import unicode_literals import webnotes +from webnotes.utils import cstr def get_filters_cond(doctype, filters, conditions): if filters: @@ -52,37 +53,51 @@ def get_match_cond(doctype, searchfield = 'name'): # 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 + 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, + 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` - where status = 'Active' and docstatus < 2 and - (%(key)s like "%(txt)s" or employee_name like "%(txt)s") %(mcond)s + where status = 'Active' + and docstatus < 2 + and (%(key)s like "%(txt)s" + or employee_name like "%(txt)s") + %(mcond)s order by case when name like "%(txt)s" then 0 else 1 end, case when employee_name like "%(txt)s" then 0 else 1 end, - name limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt, + name + 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 leads which are not converted def lead_query(doctype, txt, searchfield, start, page_len, filters): return webnotes.conn.sql("""select name, lead_name, company_name from `tabLead` - where docstatus < 2 and ifnull(status, '') != 'Converted' and - (%(key)s like "%(txt)s" or lead_name like "%(txt)s" or company_name like "%(txt)s") %(mcond)s + where docstatus < 2 + and ifnull(status, '') != 'Converted' + and (%(key)s like "%(txt)s" + or lead_name like "%(txt)s" + or company_name like "%(txt)s") + %(mcond)s order by case when name like "%(txt)s" then 0 else 1 end, case when lead_name like "%(txt)s" then 0 else 1 end, case when company_name like "%(txt)s" then 0 else 1 end, - lead_name asc limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt, + lead_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 customer @@ -96,12 +111,16 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters): fields = ", ".join(fields) - return webnotes.conn.sql("""select %(field)s from `tabCustomer` where docstatus < 2 and - (%(key)s like "%(txt)s" or customer_name like "%(txt)s") %(mcond)s + return webnotes.conn.sql("""select %(field)s from `tabCustomer` + where docstatus < 2 + and (%(key)s like "%(txt)s" + or customer_name like "%(txt)s") + %(mcond)s order by case when name like "%(txt)s" then 0 else 1 end, case when customer_name like "%(txt)s" then 0 else 1 end, - name, customer_name limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield, + name, customer_name + limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield, 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) @@ -114,12 +133,16 @@ def supplier_query(doctype, txt, searchfield, start, page_len, filters): fields = ["name", "supplier_name", "supplier_type"] fields = ", ".join(fields) - return webnotes.conn.sql("""select %(field)s from `tabSupplier` where docstatus < 2 and \ - (%(key)s like "%(txt)s" or supplier_name like "%(txt)s") %(mcond)s + return webnotes.conn.sql("""select %(field)s from `tabSupplier` + where docstatus < 2 + and (%(key)s like "%(txt)s" + or supplier_name like "%(txt)s") + %(mcond)s order by case when name like "%(txt)s" then 0 else 1 end, case when supplier_name like "%(txt)s" then 0 else 1 end, - name, supplier_name limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield, + name, supplier_name + limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield, 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) @@ -131,9 +154,11 @@ def item_std(doctype, txt, searchfield, start, page_len, filters): concat(substr(tabItem.description, 1, 40), "..."), description) as decription FROM tabItem WHERE tabItem.docstatus!=2 - AND tabItem.%(key)s LIKE "%(txt)s" %(mcond)s limit %(start)s, %(page_len)s """ % - {'key': searchfield, 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), - 'start': start, 'page_len': page_len}) + and tabItem.%(key)s LIKE "%(txt)s" + %(mcond)s + limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, + 'mcond':get_match_cond(doctype, searchfield), 'start': start, + 'page_len': page_len}) def account_query(doctype, txt, searchfield, start, page_len, filters): conditions = [] @@ -144,8 +169,10 @@ def account_query(doctype, txt, searchfield, start, page_len, filters): return webnotes.conn.sql("""select tabAccount.name, tabAccount.parent_account, tabAccount.debit_or_credit from tabAccount - where tabAccount.docstatus!=2 and tabAccount.%(key)s LIKE "%(txt)s" - %(fcond)s %(mcond)s limit %(start)s, %(page_len)s""" % {'key': searchfield, + where tabAccount.docstatus!=2 + and tabAccount.%(key)s LIKE "%(txt)s" + %(fcond)s %(mcond)s + limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt, 'fcond': get_filters_cond(doctype, filters, conditions), 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) @@ -157,12 +184,14 @@ def item_query(doctype, txt, searchfield, start, page_len, filters): concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name, if(length(tabItem.description) > 40, \ concat(substr(tabItem.description, 1, 40), "..."), description) as decription - FROM tabItem - WHERE tabItem.docstatus!=2 - AND (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00") - OR `tabItem`.`end_of_life` > NOW()) - AND (tabItem.%(key)s LIKE "%(txt)s" OR tabItem.item_name LIKE "%(txt)s") %(fcond)s - %(mcond)s limit %(start)s,%(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, + from tabItem + where tabItem.docstatus!=2 + and (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00") + or `tabItem`.`end_of_life` > NOW()) + and (tabItem.%(key)s LIKE "%(txt)s" + or tabItem.item_name LIKE "%(txt)s") + %(fcond)s %(mcond)s + limit %(start)s,%(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, 'fcond': get_filters_cond(doctype, filters, conditions), 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) @@ -171,17 +200,22 @@ def bom(doctype, txt, searchfield, start, page_len, filters): return webnotes.conn.sql("""select tabBOM.name, tabBOM.item from tabBOM - where tabBOM.docstatus=1 and tabBOM.is_active=1 - and tabBOM.%(key)s like "%s" %(fcond)s %(mcond)s limit %(start)s, - %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, - 'fcond': get_filters_cond(doctype, filters, conditions), 'mcond':get_match_cond(doctype, searchfield), - 'start': start, 'page_len': page_len}) + where tabBOM.docstatus=1 + and tabBOM.is_active=1 + and tabBOM.%(key)s like "%s" + %(fcond)s %(mcond)s + limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, + 'fcond': get_filters_cond(doctype, filters, conditions), + 'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) def get_project_name(doctype, txt, searchfield, start, page_len, filters): cond = '' if filters['customer']: cond = '(`tabProject`.customer = "' + filters['customer'] + '" or ifnull(`tabProject`.customer,"")="") and' + return webnotes.conn.sql("""select `tabProject`.name from `tabProject` - where `tabProject`.status not in ("Completed", "Cancelled") and %(cond)s - `tabProject`.name like "%(txt)s" %(mcond)s order by `tabProject`.name asc limit %(start)s, %(page_len)s """ % - {'cond': cond,'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) \ No newline at end of file + where `tabProject`.status not in ("Completed", "Cancelled") + and %(cond)s `tabProject`.name like "%(txt)s" %(mcond)s + order by `tabProject`.name asc + limit %(start)s, %(page_len)s """ % {'cond': cond,'txt': "%%%s%%" % txt, + 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) \ No newline at end of file From 10b112807cef7e0f24b991cd593e689467b5d34e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Jul 2013 16:48:29 +0530 Subject: [PATCH 17/27] [fix] related to mapping --- .../supplier_quotation/supplier_quotation.py | 17 ++++++----- hr/doctype/salary_slip/salary_slip.js | 19 +++++------- hr/doctype/salary_slip/salary_slip.py | 26 ++++++++++------ .../salary_structure/salary_structure.py | 30 +++++++++---------- .../material_request/material_request.py | 13 ++++---- 5 files changed, 55 insertions(+), 50 deletions(-) diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py index f49782fd9a5..3e177a1d314 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/buying/doctype/supplier_quotation/supplier_quotation.py @@ -94,14 +94,15 @@ def make_purchase_order(source_name, target_doclist=None): }, "Supplier Quotation Item": { "doctype": "Purchase Order Item", - "field_map": { - "name": "supplier_quotation_item", - "parent": "supplier_quotation", - "uom": "stock_uom", - "prevdoc_detail_docname": "prevdoc_detail_docname", - "prevdoc_doctype": "prevdoc_doctype", - "prevdoc_docname": "prevdoc_docname", - }, + "field_map": [ + ["name", "supplier_quotation_item"], + ["parent", "supplier_quotation"], + ["uom", "stock_uom"], + ["uom", "uom"], + ["prevdoc_detail_docname", "prevdoc_detail_docname"], + ["prevdoc_doctype", "prevdoc_doctype"], + ["prevdoc_docname", "prevdoc_docname"] + ], "postprocess": update_item }, "Purchase Taxes and Charges": { diff --git a/hr/doctype/salary_slip/salary_slip.js b/hr/doctype/salary_slip/salary_slip.js index fc582713364..cfffc5fcad1 100644 --- a/hr/doctype/salary_slip/salary_slip.js +++ b/hr/doctype/salary_slip/salary_slip.js @@ -20,13 +20,14 @@ cur_frm.add_fetch('employee', 'company', 'company'); // ------------------------------------------------------------------- cur_frm.cscript.onload = function(doc,dt,dn){ if((cint(doc.__islocal) == 1) && !doc.amended_from){ - var today=new Date(); - month = (today.getMonth()+01).toString(); - if(month.length>1) doc.month = month; - else doc.month = '0'+month; - doc.fiscal_year = sys_defaults['fiscal_year']; + if(!doc.month) { + var today=new Date(); + month = (today.getMonth()+01).toString(); + if(month.length>1) doc.month = month; + else doc.month = '0'+month; + } + if(!doc.fiscal_year) doc.fiscal_year = sys_defaults['fiscal_year']; refresh_many(['month', 'fiscal_year']); - cur_frm.cscript.fiscal_year(doc, dt, dn); } } @@ -42,8 +43,6 @@ cur_frm.cscript.fiscal_year = function(doc,dt,dn){ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year; -// Calculate total if lwp exists -// ------------------------------------------------------------------------ cur_frm.cscript.leave_without_pay = function(doc,dt,dn){ if (doc.employee && doc.fiscal_year && doc.month) { $c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) { @@ -54,16 +53,12 @@ cur_frm.cscript.leave_without_pay = function(doc,dt,dn){ } } -// Calculate all -// ------------------------------------------------------------------------ var calculate_all = function(doc, dt, dn) { calculate_earning_total(doc, dt, dn); calculate_ded_total(doc, dt, dn); calculate_net_pay(doc, dt, dn); } -// Trigger on earning modified amount and depends on lwp -// ------------------------------------------------------------------------ cur_frm.cscript.e_modified_amount = function(doc,dt,dn){ calculate_earning_total(doc, dt, dn); calculate_net_pay(doc, dt, dn); diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py index 1af71d5b24b..2b1d80c1932 100644 --- a/hr/doctype/salary_slip/salary_slip.py +++ b/hr/doctype/salary_slip/salary_slip.py @@ -17,7 +17,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import add_days, cint, cstr, flt, getdate +from webnotes.utils import add_days, cint, cstr, flt, getdate, nowdate from webnotes.model.doc import make_autoname from webnotes.model.bean import getlist from webnotes.model.code import get_obj @@ -40,9 +40,7 @@ class DocType(TransactionBase): def get_emp_and_leave_details(self): if self.doc.employee: - # Get payment days - if self.doc.fiscal_year and self.doc.month: - self.get_leave_details() + self.get_leave_details() # check sal structure struct = self.check_sal_struct() @@ -59,14 +57,24 @@ class DocType(TransactionBase): def pull_sal_struct(self, struct): - self.doclist = self.doc.clear_table(self.doclist, 'earning_details') - self.doclist = self.doc.clear_table(self.doclist, 'deduction_details') - from hr.doctype.salary_structure.salary_structure import make_salary_slip - make_salary_slip(struct, self.doclist) - + self.doclist = make_salary_slip(struct, self.doclist) + + def pull_emp_details(self): + emp = webnotes.conn.get_value("Employee", self.doc.employee, + ["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1) + if emp: + self.doc.bank_name = emp.bank_name + self.doc.bank_ac_no = emp.bank_ac_no + self.doc.esic_no = emp.esic_card_no + self.doc.pf_no = emp.pf_number def get_leave_details(self, lwp=None): + if not self.doc.fiscal_year: + self.doc.fiscal_year = webnotes.get_default("fiscal_year") + if not self.doc.month: + self.doc.month = "%02d" % getdate(nowdate()).month + m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month) if not lwp: diff --git a/hr/doctype/salary_structure/salary_structure.py b/hr/doctype/salary_structure/salary_structure.py index f890024f70c..37b0b4720c1 100644 --- a/hr/doctype/salary_structure/salary_structure.py +++ b/hr/doctype/salary_structure/salary_structure.py @@ -99,14 +99,11 @@ def make_salary_slip(source_name, target_doclist=None): from webnotes.model.mapper import get_mapped_doclist def postprocess(source, target): - emp = webnotes.conn.get_value("Employee", source.doc.employee, - ["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1) - if emp: - target[0].bank_name = emp.bank_name - target[0].bank_ac_no = emp.bank_ac_no - target[0].esic_no = emp.esic_card_no - target[0].pf_no = emp.pf_number - + sal_slip = webnotes.bean(target) + sal_slip.run_method("pull_emp_details") + sal_slip.run_method("get_leave_details") + sal_slip.run_method("calculate_net_pay") + doclist = get_mapped_doclist("Salary Structure", source_name, { "Salary Structure": { "doctype": "Salary Slip", @@ -116,16 +113,19 @@ def make_salary_slip(source_name, target_doclist=None): }, "Salary Structure Deduction": { "doctype": "Salary Slip Deduction", - "field_map": { - "depend_on_lwp": "d_depends_on_lwp" - } + "field_map": [ + ["depend_on_lwp", "d_depends_on_lwp"], + ["d_modified_amt", "d_amount"], + ["d_modified_amt", "d_modified_amount"] + ] }, "Salary Structure Earning": { "doctype": "Salary Slip Earning", - "field_map": { - "depend_on_lwp": "e_depends_on_lwp", - "modified_value": "e_modified_amount" - } + "field_map": [ + ["depend_on_lwp", "e_depends_on_lwp"], + ["modified_value", "e_modified_amount"], + ["modified_value", "e_amount"] + ] } }, target_doclist, postprocess) diff --git a/stock/doctype/material_request/material_request.py b/stock/doctype/material_request/material_request.py index 861162acd4c..71a9e133864 100644 --- a/stock/doctype/material_request/material_request.py +++ b/stock/doctype/material_request/material_request.py @@ -254,12 +254,13 @@ def make_purchase_order(source_name, target_doclist=None): }, "Material Request Item": { "doctype": "Purchase Order Item", - "field_map": { - "name": "prevdoc_detail_docname", - "parent": "prevdoc_docname", - "parenttype": "prevdoc_doctype", - "uom": "stock_uom" - }, + "field_map": [ + ["name", "prevdoc_detail_docname"], + ["parent", "prevdoc_docname"], + ["parenttype", "prevdoc_doctype"], + ["uom", "stock_uom"], + ["uom", "uom"] + ], "postprocess": update_item } }, target_doclist, set_missing_values) From ee85cfd476e1c1423552f77b5645fe51f0a5c41d Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 10 Jul 2013 17:35:14 +0530 Subject: [PATCH 18/27] get_query to server side --- .../payment_to_invoice_matching_tool.py | 5 ++- accounts/doctype/pos_setting/pos_setting.js | 2 +- .../doctype/sales_invoice/sales_invoice.py | 10 +++-- .../quality_inspection/quality_inspection.js | 23 +++++------ .../supplier_quotation/supplier_quotation.js | 2 +- projects/doctype/task/task.py | 11 ++--- selling/doctype/opportunity/opportunity.py | 11 ++--- selling/doctype/quotation/quotation.js | 2 +- selling/doctype/quotation/quotation.py | 35 ++++++++++------ selling/doctype/sales_common/sales_common.py | 40 ++++++++++++------- stock/doctype/packing_slip/packing_slip.py | 6 ++- stock/doctype/stock_entry/stock_entry.py | 30 +++++++++----- .../maintenance_schedule.py | 22 +++++----- 13 files changed, 116 insertions(+), 83 deletions(-) diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index b1bec06bad9..07a97d8823a 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -153,13 +153,14 @@ def gl_entry_details(doctype, txt, searchfield, start, page_len, filters): or ifnull(gle.against_voucher, '') = gle.voucher_no ) and ifnull(gle.%(account_type)s, 0) > 0 and (select ifnull(abs(sum(ifnull(debit, 0)) - - sum(ifnull(credit, 0))), 0) + - sum(ifnull(credit, 0))), 0) from `tabGL Entry` where against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no and voucher_no != gle.voucher_no and ifnull(is_cancelled, 'No') = 'No') - != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) + != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0) + ) %(mcond)s ORDER BY gle.posting_date desc, gle.voucher_no desc limit %(start)s, %(page_len)s""" % {dt:filters["dt"], acc:filters["acc"], diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index aa9cf11539c..991c8daadf1 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -55,7 +55,7 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) { return{ filters:{ 'company_name': doc.company, - 'group_or_ledger': "Ledger", + 'group_or_ledger': "Ledger" } } } diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index d7ab91a5ca7..e42cb733400 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -990,8 +990,10 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters): return webnotes.conn.sql("""select tabAccount.name from `tabAccount` where (tabAccount.debit_or_credit="Credit" - or tabAccount.account_type = "Income Account") - and tabAccount.group_or_ledger="Ledger" and tabAccount.docstatus!=2 - and tabAccount.company = '%(company)s' and tabAccount.%(key)s LIKE '%(txt)s' - %(mcond)s""" % {'company': filters['company'], 'key': searchfield, + or tabAccount.account_type = "Income Account") + and tabAccount.group_or_ledger="Ledger" + and tabAccount.docstatus!=2 + and tabAccount.company = '%(company)s' + and tabAccount.%(key)s LIKE '%(txt)s' + %(mcond)s""" % {'company': filters['company'], 'key': searchfield, 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)}) \ No newline at end of file diff --git a/buying/doctype/quality_inspection/quality_inspection.js b/buying/doctype/quality_inspection/quality_inspection.js index 72eaecb5a12..d40d81a4fa0 100644 --- a/buying/doctype/quality_inspection/quality_inspection.js +++ b/buying/doctype/quality_inspection/quality_inspection.js @@ -43,15 +43,11 @@ cur_frm.cscript.refresh = cur_frm.cscript.inspection_type; // item code based on GRN/DN cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { - filter = {}; - if (doc.purchase_receipt_no) - filter:{ - 'parent': doc.purchase_receipt_no - } - else if (doc.delivery_note_no) - filter:{ - 'parent': doc.delivery_note_no - } + var filter = {}; + if (doc.purchase_receipt_no) filter['parent'] = doc.purchase_receipt_no; + + else if (doc.delivery_note_no) filter['parent'] = doc.delivery_note_no; + return{ filters: filter } @@ -59,15 +55,14 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { // Serial No based on item_code cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) { - filter = {}; + var filter = {}; if (doc.item_code) filter:{ 'item_code': doc.item_code, 'status': "In Store" } - // return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; else - filter:{ 'status': "In Store" } - // return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50'; - return{ filters: filter } + filter: { 'status': "In Store" } + + return { filters: filter } } \ No newline at end of file diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js index 54ef722885f..722ac002a04 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/buying/doctype/supplier_quotation/supplier_quotation.js @@ -67,7 +67,7 @@ cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query function(doc, cdt, cdn) { return{ filters:[ - ['Project', 'status', 'not in', 'Completed, Cancelled'], + ['Project', 'status', 'not in', 'Completed, Cancelled'] ] } } diff --git a/projects/doctype/task/task.py b/projects/doctype/task/task.py index 0072b1f70de..0ea9eea1eb2 100644 --- a/projects/doctype/task/task.py +++ b/projects/doctype/task/task.py @@ -96,8 +96,9 @@ def get_events(start, end, filters=None): def get_project(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond return webnotes.conn.sql(""" select name from `tabProject` - where %(key)s like "%(txt)s" %(mcond)s - order by name limit %(start)s, %(page_len)s - """ % {'key': searchfield, 'txt': "%%%s%%" % txt, - 'mcond':get_match_cond(doctype, searchfield), - 'start': start, 'page_len': page_len}) \ No newline at end of file + where %(key)s like "%(txt)s" + %(mcond)s + order by name + limit %(start)s, %(page_len)s """ % {'key': searchfield, + 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) \ No newline at end of file diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py index 6217821499a..92d391b2de3 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -207,8 +207,9 @@ def make_quotation(source_name, target_doclist=None): def get_lead(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond return webnotes.conn.sql ("""select `tabLead`.name, `tabLead`.lead_name FROM `tabLead` - where `tabLead`.%(key)s like "%(txt)s" %(mcond)s - order by `tabLead`.`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}) \ No newline at end of file + where `tabLead`.%(key)s like "%(txt)s" + %(mcond)s + order by `tabLead`.`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}) \ No newline at end of file diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index cfaf61172aa..0649f545127 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -199,7 +199,7 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query= return { query: 'selling.doctype.quotation.quotation.quotation_details', filters:{ - cond: cond, + cond: cond } } } diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 152e909a2b5..5bf8510a0a9 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -266,26 +266,35 @@ def quotation_details(doctype, txt, searchfield, start, page_len, filters): if filters.has_key('cust') and filters.has_key('precision'): return webnotes.conn.sql("""select item.name, - (select concat('Last Quote @ ', q.currency, ' ', format(q_item.export_rate, %(precision)s)) + (select concat('Last Quote @ ', q.currency, ' ', + format(q_item.export_rate, %(precision)s)) from `tabQuotation` q, `tabQuotation Item` q_item - where q.name = q_item.parent and q_item.item_code = item.name - and q.docstatus = 1 and q.customer = "%(cust)s" + where q.name = q_item.parent + and q_item.item_code = item.name + and q.docstatus = 1 + and q.customer = "%(cust)s" order by q.transaction_date desc limit 1) as quote_rate, - (select concat('Last Sale @ ', si.currency, ' ', format(si_item.basic_rate, %(precision)s)) + (select concat('Last Sale @ ', si.currency, ' ', + format(si_item.basic_rate, %(precision)s)) from `tabSales Invoice` si, `tabSales Invoice Item` si_item - where si.name = si_item.parent and si_item.item_code = item.name - and si.docstatus = 1 and si.customer ="%(cust)s" + where si.name = si_item.parent + and si_item.item_code = item.name + and si.docstatus = 1 + and si.customer ="%(cust)s" order by si.posting_date desc limit 1) as sales_rate, item.item_name, item.description from `tabItem` item - where %(cond)s %(mcond)s and item.%(searchfield)s like '%(txt)s' order by item.name desc limit %(start)s, - %(page_len)s """ % {'precision': filters["precision"], 'cust': filters['cust'], - 'cond': filters['cond'], 'searchfield': searchfield, 'txt': "%%%s%%" % txt, - 'mcond': get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len}) + where %(cond)s %(mcond)s + and item.%(searchfield)s like '%(txt)s' + order by item.name desc limit %(start)s, %(page_len)s """ % {'precision': filters["precision"], + 'cust': filters['cust'], 'cond': filters['cond'], 'searchfield': searchfield, + 'txt': "%%%s%%" % txt, 'mcond': get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) else: - webnotes.conn.sql(""" select name, item_name, description from `tabItem` item - where %s %s and %s like %s order by name desc limit %s, %s""" % - ("%s", get_match_cond(doctype, searchfield), searchfield, "%s", "%s", "%s"), (filters["cond"], "%%%s%%" % txt, start, page_len)) \ No newline at end of file + return webnotes.conn.sql(""" select name, item_name, description from `tabItem` item + where %s %s and %s like %s order by name desc limit %s, %s""" % + ("%s", get_match_cond(doctype, searchfield), searchfield, "%s", "%s", "%s"), + (filters["cond"], "%%%s%%" % txt, start, page_len)) \ No newline at end of file diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py index dfbfb489584..00825bb2650 100644 --- a/selling/doctype/sales_common/sales_common.py +++ b/selling/doctype/sales_common/sales_common.py @@ -370,20 +370,30 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters): if filters.has_key('warehouse'): return webnotes.conn.sql("""select batch_no from `tabStock Ledger Entry` sle - where item_code = '%(item_code)s' and warehouse = '%(warehouse)s' - and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%(txt)s' - and exists(select * from `tabBatch` where - name = sle.batch_no and expiry_date >= '%(posting_date)s' - and docstatus != 2) %(mcond)s + where item_code = '%(item_code)s' + and warehouse = '%(warehouse)s' + and ifnull(is_cancelled, 'No') = 'No' + and batch_no like '%(txt)s' + and exists(select * from `tabBatch` + where name = sle.batch_no + and expiry_date >= '%(posting_date)s' + and docstatus != 2) + %(mcond)s group by batch_no having sum(actual_qty) > 0 - order by batch_no desc limit %(start)s, %(page_len)s - """ % {'item_code': filters['item_code'], 'warehouse': filters['warehouse'], - 'posting_date': filters['posting_date'], 'txt': 'txt': "%%%s%%" % txt, - 'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len}) + order by batch_no desc + limit %(start)s, %(page_len)s """ % {'item_code': filters['item_code'], + 'warehouse': filters['warehouse'], 'posting_date': filters['posting_date'], + 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) else: - return webnotes.conn.sql("""select name from tabBatch where docstatus != 2 - and item = '%(item_code)s' and expiry_date >= '%(posting_date)s' - and name like '%(txt)s' %(mcond)s ORDER BY name DESC LIMIT 50""" % - {'item_code': filters['item_code'], 'posting_date': filters['posting_date'], - 'txt': 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), - 'start': start, 'page_len': page_len}) \ No newline at end of file + return webnotes.conn.sql("""select name from tabBatch + where docstatus != 2 + and item = '%(item_code)s' + and expiry_date >= '%(posting_date)s' + and name like '%(txt)s' + %(mcond)s + order by name desc + limit %(start)s, %(page_len)s""" % {'item_code': filters['item_code'], + 'posting_date': filters['posting_date'], 'txt': "%%%s%%" % txt, + 'mcond':get_match_cond(doctype, searchfield),'start': start, + 'page_len': page_len}) \ No newline at end of file diff --git a/stock/doctype/packing_slip/packing_slip.py b/stock/doctype/packing_slip/packing_slip.py index a46d77c6961..63aa6a9431b 100644 --- a/stock/doctype/packing_slip/packing_slip.py +++ b/stock/doctype/packing_slip/packing_slip.py @@ -177,7 +177,9 @@ def item_details(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond return webnotes.conn.sql("""select name, item_name, description from `tabItem` where name in ( select item_code FROM `tabDelivery Note Item` - where parent= %s and ifnull(qty, 0) > ifnull(packed_qty, 0)) - and %s like "%s" %s limit %s, %s """ % ("%s", searchfield, "%s", + where parent= %s + and ifnull(qty, 0) > ifnull(packed_qty, 0)) + and %s like "%s" %s + limit %s, %s """ % ("%s", searchfield, "%s", get_match_cond(doctype, searchfield), "%s", "%s"), (filters["delivery_note"], "%%%s%%" % txt, start, page_len)) \ No newline at end of file diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index fc4fadcf183..d985432b842 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -717,7 +717,8 @@ def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters): return webnotes.conn.sql("""select name, customer, customer_name from `tab%s` where docstatus = 1 - and (`%s` like %%(txt)s or `customer` like %%(txt)s) %s %s + and (`%s` like %%(txt)s + or `customer` like %%(txt)s) %s %s order by name, customer, customer_name limit %s""" % (doctype, searchfield, conditions, get_match_cond(doctype, searchfield), "%(start)s, %(page_len)s"), @@ -728,7 +729,8 @@ def query_purchase_return_doc(doctype, txt, searchfield, start, page_len, filter from controllers.queries import get_match_cond return webnotes.conn.sql("""select name, supplier, supplier_name from `tab%s` where docstatus = 1 - and (`%s` like %%(txt)s or `supplier` like %%(txt)s) %s + and (`%s` like %%(txt)s + or `supplier` like %%(txt)s) %s order by name, supplier, supplier_name limit %s""" % (doctype, searchfield, get_match_cond(doctype, searchfield), "%(start)s, %(page_len)s"), {"txt": "%%%s%%" % txt, "start": @@ -762,15 +764,21 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond return webnotes.conn.sql("""select batch_no from `tabStock Ledger Entry` sle - where item_code = '%(item_code)s' and warehouse = '%(s_warehouse)s' - and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%(txt)s' - and exists(select * from `tabBatch` where name = sle.batch_no - and expiry_date >= %(posting_date)s and docstatus != 2) %(mcond)s - group by batch_no having sum(actual_qty) > 0 - order by batch_no desc limit %(start)s, %(page_len)s """ - % {'item_code': filters['item_code'], 's_warehouse': filters['s_warehouse'], - 'posting_date': filters['posting_date'], 'txt': "%%%s%%" % txt, - 'mcond':get_match_cond(doctype, searchfield),"start": start, "page_len": page_len}) + where item_code = '%(item_code)s' + and warehouse = '%(s_warehouse)s' + and ifnull(is_cancelled, 'No') = 'No' + and batch_no like '%(txt)s' + and exists(select * from `tabBatch` + where name = sle.batch_no + and expiry_date >= %(posting_date)s + and docstatus != 2) + %(mcond)s + group by batch_no having sum(actual_qty) > 0 + order by batch_no desc + limit %(start)s, %(page_len)s """ % {'item_code': filters['item_code'], + 's_warehouse': filters['s_warehouse'], 'posting_date': filters['posting_date'], + 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), + "start": start, "page_len": page_len}) def get_stock_items_for_return(ref_doclist, parentfields): """return item codes filtered from doclist, which are stock items""" diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.py b/support/doctype/maintenance_schedule/maintenance_schedule.py index 6260acd74ba..56dceaa1468 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -335,12 +335,16 @@ def make_maintenance_visit(source_name, target_doclist=None): def get_sales_order_no(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond - return webnotes.conn.sql(""" select distinct `tabSales Order`.name from `tabSales Order`, - `tabSales Order Item`, `tabItem` - where `tabSales Order`.company = "%(company)s" and `tabSales Order`.docstatus = 1 - and `tabSales Order Item`.parent = `tabSales Order`.name - and `tabSales Order Item`.item_code = `tabItem`.name - and `tabItem`.is_service_item = "Yes" and %(cond)s `tabSales Order`.name LIKE "%(txt)s" %(mcond)s - ORDER BY `tabSales Order`.name desc LIMIT %(start)s, %(page_len)s""" - % 'company': filters["company"], 'cond': filters['cond'], 'txt': "%%%s%%" % txt, - 'mcond':get_match_cond(doctype, searchfield), "start": start, "page_len": page_len}) \ No newline at end of file + return webnotes.conn.sql(""" select distinct `tabSales Order`.name + from `tabSales Order`, `tabSales Order Item`, `tabItem` + where `tabSales Order`.company = "%(company)s" + and `tabSales Order`.docstatus = 1 + and `tabSales Order Item`.parent = `tabSales Order`.name + and `tabSales Order Item`.item_code = `tabItem`.name + and `tabItem`.is_service_item = "Yes" + and %(cond)s `tabSales Order`.name LIKE "%(txt)s" + %(mcond)s + order by `tabSales Order`.name desc + limit %(start)s, %(page_len)s """ % {'company': filters["company"], + 'cond': filters['cond'], 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), + 'start': start, 'page_len': page_len}) \ No newline at end of file From c0ebaae15aae025abcbd2dd48da7dd0f038c904f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Jul 2013 17:42:01 +0530 Subject: [PATCH 19/27] [fix][hr] fetch emp name in attendance and default value --- hr/doctype/attendance/attendance.js | 9 ++++----- hr/doctype/attendance/attendance.py | 6 ------ hr/doctype/attendance/attendance.txt | 18 +++++++++++------- hr/page/hr_home/hr_home.js | 22 +++++++++++----------- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/hr/doctype/attendance/attendance.js b/hr/doctype/attendance/attendance.js index 3ba986891b9..1749a6cb269 100644 --- a/hr/doctype/attendance/attendance.js +++ b/hr/doctype/attendance/attendance.js @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -cur_frm.add_fetch('employee', 'company', 'company'); +cur_frm.add_fetch('employee', 'company', 'company'); +cur_frm.add_fetch('employee', 'employee_name', 'employee_name'); -//get employee's name based on employee id selected -cur_frm.cscript.employee = function(doc,cdt,cdn){ - if(doc.employee) get_server_fields('get_emp_name', '', '', doc, cdt, cdn, 1); - refresh_field('employee_name'); +cur_frm.cscript.onload = function(doc, cdt, cdn) { + if(doc.__islocal) cur_frm.set_value("att_date", get_today()); } cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query; \ No newline at end of file diff --git a/hr/doctype/attendance/attendance.py b/hr/doctype/attendance/attendance.py index ac41acf8156..16e25470b0a 100644 --- a/hr/doctype/attendance/attendance.py +++ b/hr/doctype/attendance/attendance.py @@ -26,12 +26,6 @@ class DocType: def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist - - def get_emp_name(self): - return { - "employee_name": webnotes.conn.get_value("Employee", - self.doc.employee_name, "employee_name") - } def validate_duplicate_record(self): res = sql("""select name from `tabAttendance` where employee = %s and att_date = %s diff --git a/hr/doctype/attendance/attendance.txt b/hr/doctype/attendance/attendance.txt index aa917ed7bd8..d948d6fba12 100644 --- a/hr/doctype/attendance/attendance.txt +++ b/hr/doctype/attendance/attendance.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:13", "docstatus": 0, - "modified": "2013-07-05 14:25:19", + "modified": "2013-07-10 17:39:22", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -25,6 +25,7 @@ "permlevel": 0 }, { + "cancel": 1, "create": 1, "doctype": "DocPerm", "name": "__common__", @@ -33,6 +34,8 @@ "parenttype": "DocType", "permlevel": 0, "read": 1, + "report": 1, + "submit": 1, "write": 1 }, { @@ -80,6 +83,7 @@ "oldfieldtype": "Data" }, { + "default": "Present", "doctype": "DocField", "fieldname": "status", "fieldtype": "Select", @@ -157,15 +161,15 @@ "read_only": 1 }, { - "cancel": 1, "doctype": "DocPerm", - "report": 1, - "role": "HR User", - "submit": 1 + "role": "System Manager" }, { "doctype": "DocPerm", - "match": "owner", - "role": "Employee" + "role": "HR User" + }, + { + "doctype": "DocPerm", + "role": "HR Manager" } ] \ No newline at end of file diff --git a/hr/page/hr_home/hr_home.js b/hr/page/hr_home/hr_home.js index 517fb772c4c..dadc6fb02f2 100644 --- a/hr/page/hr_home/hr_home.js +++ b/hr/page/hr_home/hr_home.js @@ -23,9 +23,14 @@ wn.module_page["HR"] = [ doctype:"Expense Claim" }, { - label: wn._("Job Applicant"), - description: wn._("Applicant for a Job."), - doctype:"Job Applicant" + label: wn._("Salary Slip"), + description: wn._("Monthly salary statement."), + doctype:"Salary Slip" + }, + { + label: wn._("Attendance"), + description: wn._("Attendance record."), + doctype:"Attendance" }, ] }, @@ -34,14 +39,9 @@ wn.module_page["HR"] = [ icon: "icon-copy", items: [ { - label: wn._("Attendance"), - description: wn._("Attendance record."), - doctype:"Attendance" - }, - { - label: wn._("Salary Slip"), - description: wn._("Monthly salary statement."), - doctype:"Salary Slip" + label: wn._("Job Applicant"), + description: wn._("Applicant for a Job."), + doctype:"Job Applicant" }, { label: wn._("Appraisal"), From 982ad35fd23413ed8507bcad9ca4d529076b56db Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 18:39:06 +0530 Subject: [PATCH 20/27] [cleanup] Removed Warehouse Type --- public/js/complete_setup.js | 10 +-- setup/doctype/company/company.txt | 24 ++++-- setup/doctype/warehouse_type/README.md | 1 - setup/doctype/warehouse_type/__init__.py | 1 - .../warehouse_type/test_warehouse_type.py | 6 -- .../doctype/warehouse_type/warehouse_type.js | 26 ------ .../doctype/warehouse_type/warehouse_type.py | 22 ----- .../doctype/warehouse_type/warehouse_type.txt | 82 ------------------- startup/install.py | 24 +----- stock/doctype/bin/bin.py | 6 +- stock/doctype/bin/bin.txt | 11 +-- stock/doctype/item/item.py | 14 +--- stock/doctype/stock_ledger/stock_ledger.py | 3 - .../stock_ledger_entry/stock_ledger_entry.txt | 14 +--- stock/doctype/warehouse/test_warehouse.py | 3 - stock/doctype/warehouse/warehouse.py | 17 +--- stock/doctype/warehouse/warehouse.txt | 21 +---- utilities/cleanup_data.py | 3 - 18 files changed, 31 insertions(+), 257 deletions(-) delete mode 100644 setup/doctype/warehouse_type/README.md delete mode 100644 setup/doctype/warehouse_type/__init__.py delete mode 100644 setup/doctype/warehouse_type/test_warehouse_type.py delete mode 100644 setup/doctype/warehouse_type/warehouse_type.js delete mode 100644 setup/doctype/warehouse_type/warehouse_type.py delete mode 100644 setup/doctype/warehouse_type/warehouse_type.txt diff --git a/public/js/complete_setup.js b/public/js/complete_setup.js index cdc86624ac4..4fb29e30fce 100644 --- a/public/js/complete_setup.js +++ b/public/js/complete_setup.js @@ -44,7 +44,7 @@ $.extend(erpnext.complete_setup, { {fieldname:'timezone', label: 'Time Zone', reqd:1, options: "", fieldtype: 'Select'}, {fieldname:'industry', label: 'Industry', reqd:1, - options: erpnext.complete_setup.industry_list.join('\n'), fieldtype: 'Select'}, + options: erpnext.complete_setup.domains.join('\n'), fieldtype: 'Select'}, {fieldname:'update', label:'Setup',fieldtype:'Button'}, ], }); @@ -129,11 +129,5 @@ $.extend(erpnext.complete_setup, { fy_start_list: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'], - industry_list: ['', 'Aerospace and Defence', 'Agriculture', 'Apparel', 'Automobile', - 'Banking', 'Biotechnology', 'Chemical', 'Communications', 'Consulting', 'Customer Service', - 'Education', 'Electronics', 'Energy', 'Engineering', 'Entertainment', 'Environmental', - 'Finance', 'Food and Beverage', 'Government', 'Healthcare', 'Hospitality', - 'Information Technology', 'Insurance', 'Machinery', 'Manufacturing', 'Media', - 'Not For Profit', 'Recreation', 'Retail', 'Shipping', 'Technology', - 'Telecommunications', 'Transportation', 'Trading', 'Utilities', 'Other'], + domains: ['', "Manufacturing", "Retail", "Distribution", "Services"], }); \ No newline at end of file diff --git a/setup/doctype/company/company.txt b/setup/doctype/company/company.txt index e3afda13f34..134af2cf837 100644 --- a/setup/doctype/company/company.txt +++ b/setup/doctype/company/company.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-10 08:35:39", "docstatus": 0, - "modified": "2013-07-08 17:34:21", + "modified": "2013-07-10 18:17:55", "modified_by": "Administrator", "owner": "Administrator" }, @@ -52,6 +52,17 @@ "oldfieldtype": "Section Break", "read_only": 0 }, + { + "doctype": "DocField", + "fieldname": "company_name", + "fieldtype": "Data", + "label": "Company", + "no_copy": 0, + "oldfieldname": "company_name", + "oldfieldtype": "Data", + "read_only": 0, + "reqd": 1 + }, { "description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.", "doctype": "DocField", @@ -72,13 +83,10 @@ }, { "doctype": "DocField", - "fieldname": "company_name", - "fieldtype": "Data", - "label": "Company", - "no_copy": 0, - "oldfieldname": "company_name", - "oldfieldtype": "Data", - "read_only": 0, + "fieldname": "domain", + "fieldtype": "Select", + "label": "Domain", + "options": "Distribution\nManufacturing\nRetail\nServices", "reqd": 1 }, { diff --git a/setup/doctype/warehouse_type/README.md b/setup/doctype/warehouse_type/README.md deleted file mode 100644 index ad065d59365..00000000000 --- a/setup/doctype/warehouse_type/README.md +++ /dev/null @@ -1 +0,0 @@ -Warehouse classification. \ No newline at end of file diff --git a/setup/doctype/warehouse_type/__init__.py b/setup/doctype/warehouse_type/__init__.py deleted file mode 100644 index baffc488252..00000000000 --- a/setup/doctype/warehouse_type/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/setup/doctype/warehouse_type/test_warehouse_type.py b/setup/doctype/warehouse_type/test_warehouse_type.py deleted file mode 100644 index 208859bf75e..00000000000 --- a/setup/doctype/warehouse_type/test_warehouse_type.py +++ /dev/null @@ -1,6 +0,0 @@ -test_records = [ - [{ - "doctype": "Warehouse Type", - "warehouse_type": "_Test Warehouse Type" - }] -] \ No newline at end of file diff --git a/setup/doctype/warehouse_type/warehouse_type.js b/setup/doctype/warehouse_type/warehouse_type.js deleted file mode 100644 index 3cad9447a9b..00000000000 --- a/setup/doctype/warehouse_type/warehouse_type.js +++ /dev/null @@ -1,26 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - - - -//--------- ONLOAD ------------- -cur_frm.cscript.onload = function(doc, cdt, cdn) { - -} - -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - -} \ No newline at end of file diff --git a/setup/doctype/warehouse_type/warehouse_type.py b/setup/doctype/warehouse_type/warehouse_type.py deleted file mode 100644 index 77944303490..00000000000 --- a/setup/doctype/warehouse_type/warehouse_type.py +++ /dev/null @@ -1,22 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from __future__ import unicode_literals -import webnotes - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl diff --git a/setup/doctype/warehouse_type/warehouse_type.txt b/setup/doctype/warehouse_type/warehouse_type.txt deleted file mode 100644 index 31df7d6ff92..00000000000 --- a/setup/doctype/warehouse_type/warehouse_type.txt +++ /dev/null @@ -1,82 +0,0 @@ -[ - { - "creation": "2013-01-10 16:34:24", - "docstatus": 0, - "modified": "2013-07-05 15:02:15", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "autoname": "field:warehouse_type", - "doctype": "DocType", - "icon": "icon-flag", - "istable": 0, - "module": "Setup", - "name": "__common__" - }, - { - "doctype": "DocField", - "name": "__common__", - "parent": "Warehouse Type", - "parentfield": "fields", - "parenttype": "DocType", - "permlevel": 0 - }, - { - "amend": 0, - "doctype": "DocPerm", - "name": "__common__", - "parent": "Warehouse Type", - "parentfield": "permissions", - "parenttype": "DocType", - "permlevel": 0, - "read": 1, - "report": 1, - "submit": 0 - }, - { - "doctype": "DocType", - "name": "Warehouse Type" - }, - { - "doctype": "DocField", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "oldfieldtype": "Small Text", - "read_only": 1 - }, - { - "doctype": "DocField", - "fieldname": "warehouse_type", - "fieldtype": "Data", - "in_filter": 1, - "label": "Warehouse Type", - "oldfieldname": "warehouse_type", - "oldfieldtype": "Data", - "reqd": 1, - "search_index": 1 - }, - { - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "role": "Material Master Manager", - "write": 1 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "role": "Material Manager", - "write": 0 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "role": "Material User", - "write": 0 - } -] \ No newline at end of file diff --git a/startup/install.py b/startup/install.py index de60e3855a1..b665e3d3807 100644 --- a/startup/install.py +++ b/startup/install.py @@ -10,9 +10,9 @@ def pre_import(): def make_modules(): modules = [ - " Home", " System", " Utilities", " Website", " Setup", - " Selling", " Buying", " Projects", " Accounts", " Stock", - " Support", " HR", " Manufacturing"] + "Home", "System", "Utilities", "Website", "Setup", + "Selling", "Buying", "Projects", "Accounts", "Stock", + "Support", "HR", "Manufacturing"] for m in modules: doc = webnotes.doc(fielddata = { @@ -135,19 +135,7 @@ def import_defaults(): # supplier type {'doctype': 'Supplier Type', 'name': 'Default Supplier Type', 'supplier_type': 'Default Supplier Type'}, - - # warehouse type - {'doctype': 'Warehouse Type', 'name': 'Default Warehouse Type', 'warehouse_type': 'Default Warehouse Type'}, - {'doctype': 'Warehouse Type', 'name': 'Fixed Asset', 'warehouse_type': 'Fixed Asset'}, - {'doctype': 'Warehouse Type', 'name': 'Reserved', 'warehouse_type': 'Reserved'}, - {'doctype': 'Warehouse Type', 'name': 'Rejected', 'warehouse_type': 'Rejected'}, - {'doctype': 'Warehouse Type', 'name': 'Sample', 'warehouse_type': 'Sample'}, - {'doctype': 'Warehouse Type', 'name': 'Stores', 'warehouse_type': 'Stores'}, - {'doctype': 'Warehouse Type', 'name': 'WIP Warehouse', 'warehouse_type': 'WIP Warehouse'}, - - # warehouse - {'doctype': 'Warehouse', 'warehouse_name': 'Default Warehouse', 'name': 'Default Warehouse', 'warehouse_type': 'Default Warehouse Type'}, - + # Workstation {'doctype': 'Workstation', 'name': 'Default Workstation', 'workstation_name': 'Default Workstation', 'warehouse': 'Default Warehouse'}, @@ -157,11 +145,7 @@ def import_defaults(): # UOM {'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Unit'}, {'uom_name': 'Box', 'doctype': 'UOM', 'name': 'Box'}, - {'uom_name': 'Ft', 'doctype': 'UOM', 'name': 'Ft'}, {'uom_name': 'Kg', 'doctype': 'UOM', 'name': 'Kg'}, - {'uom_name': 'Ltr', 'doctype': 'UOM', 'name': 'Ltr'}, - {'uom_name': 'Meter', 'doctype': 'UOM', 'name': 'Meter'}, - {'uom_name': 'Mtr', 'doctype': 'UOM', 'name': 'Mtr'}, {'uom_name': 'Nos', 'doctype': 'UOM', 'name': 'Nos'}, {'uom_name': 'Pair', 'doctype': 'UOM', 'name': 'Pair'}, {'uom_name': 'Set', 'doctype': 'UOM', 'name': 'Set'}, diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py index 61baafafa2e..cf30c5a7429 100644 --- a/stock/doctype/bin/bin.py +++ b/stock/doctype/bin/bin.py @@ -31,11 +31,7 @@ class DocType: def validate(self): if not self.doc.stock_uom: self.doc.stock_uom = webnotes.conn.get_value('Item', self.doc.item_code, 'stock_uom') - - if not self.doc.warehouse_type: - self.doc.warehouse_type = webnotes.conn.get_value("Warehouse", self.doc.warehouse, - "warehouse_type") - + self.validate_mandatory() self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + \ diff --git a/stock/doctype/bin/bin.txt b/stock/doctype/bin/bin.txt index 34681a87f23..676976aeb4b 100644 --- a/stock/doctype/bin/bin.txt +++ b/stock/doctype/bin/bin.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:25", "docstatus": 0, - "modified": "2013-07-10 14:54:04", + "modified": "2013-07-10 18:32:13", "modified_by": "Administrator", "owner": "Administrator" }, @@ -52,15 +52,6 @@ "options": "Warehouse", "search_index": 1 }, - { - "doctype": "DocField", - "fieldname": "warehouse_type", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Warehouse Type", - "oldfieldname": "warehouse_type", - "oldfieldtype": "Data" - }, { "doctype": "DocField", "fieldname": "item_code", diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 85bb3d16cf5..4a4cd894402 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -51,7 +51,6 @@ class DocType(DocListController): self.fill_customer_code() self.check_item_tax() self.validate_barcode() - self.check_non_asset_warehouse() self.cant_change() self.validate_item_type_for_reorder() @@ -185,18 +184,7 @@ class DocType(DocListController): if duplicate: msgprint("Barcode: %s already used in item: %s" % (self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1) - - def check_non_asset_warehouse(self): - if not self.doc.__islocal and self.doc.is_asset_item == "Yes": - existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name) - for e in existing_qty: - msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." % - (e[1],e[0])) - if existing_qty: - self.doc.is_asset_item = 'No' - msgprint(_("""Please transfer the above quantities to an asset warehouse \ - before changing this item to an asset item"""), raise_exception=1) - + def cant_change(self): if not self.doc.fields.get("__islocal"): vals = webnotes.conn.get_value("Item", self.doc.name, diff --git a/stock/doctype/stock_ledger/stock_ledger.py b/stock/doctype/stock_ledger/stock_ledger.py index 8fdb50e7a44..5b3d660a3c6 100644 --- a/stock/doctype/stock_ledger/stock_ledger.py +++ b/stock/doctype/stock_ledger/stock_ledger.py @@ -222,9 +222,6 @@ class DocType: def make_entry(self, args): args.update({"doctype": "Stock Ledger Entry"}) - if args.get("warehouse"): - args["warehouse_type"] = webnotes.conn.get_value('Warehouse' , args["warehouse"], - 'warehouse_type') sle = webnotes.bean([args]) sle.ignore_permissions = 1 sle.insert() diff --git a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt index 38005f7769a..6ca9cc629eb 100644 --- a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt +++ b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-29 19:25:42", "docstatus": 0, - "modified": "2013-07-05 14:56:15", + "modified": "2013-07-10 18:34:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -91,18 +91,6 @@ "search_index": 1, "width": "100px" }, - { - "doctype": "DocField", - "fieldname": "warehouse_type", - "fieldtype": "Select", - "in_filter": 1, - "label": "Warehouse Type", - "oldfieldname": "warehouse_type", - "oldfieldtype": "Select", - "options": "link:Warehouse Type", - "read_only": 1, - "search_index": 0 - }, { "description": "The date at which current entry will get or has actually executed.", "doctype": "DocField", diff --git a/stock/doctype/warehouse/test_warehouse.py b/stock/doctype/warehouse/test_warehouse.py index 10b49b67c25..34cc28cf56a 100644 --- a/stock/doctype/warehouse/test_warehouse.py +++ b/stock/doctype/warehouse/test_warehouse.py @@ -2,19 +2,16 @@ test_records = [ [{ "doctype": "Warehouse", "warehouse_name": "_Test Warehouse", - "warehouse_type": "_Test Warehouse Type", "company": "_Test Company" }], [{ "doctype": "Warehouse", "warehouse_name": "_Test Warehouse 1", - "warehouse_type": "_Test Warehouse Type", "company": "_Test Company" }], [{ "doctype": "Warehouse", "warehouse_name": "_Test Warehouse 2", - "warehouse_type": "_Test Warehouse Type", "company": "_Test Company 1" }] ] diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py index 7eb407ca0a1..b233ec433ae 100644 --- a/stock/doctype/warehouse/warehouse.py +++ b/stock/doctype/warehouse/warehouse.py @@ -47,15 +47,7 @@ class DocType: bin_obj = get_obj('Bin', bin) return bin_obj - - def validate_asset(self, item_code): - if webnotes.conn.get_value("Item", item_code, "is_asset_item") == 'Yes' \ - and self.doc.warehouse_type != 'Fixed Asset': - msgprint("""Fixed Asset Item %s can only be transacted in a - Fixed Asset type Warehouse""" % item_code, raise_exception=1) - def update_bin(self, args): - self.validate_asset(args.get("item_code")) is_stock_item = webnotes.conn.get_value('Item', args.get("item_code"), 'is_stock_item') if is_stock_item == 'Yes': bin = self.get_bin(args.get("item_code")) @@ -68,14 +60,7 @@ class DocType: def validate(self): if self.doc.email_id and not validate_email_add(self.doc.email_id): msgprint("Please enter valid Email Id", raise_exception=1) - if not self.doc.warehouse_type: - msgprint("Warehouse Type is Mandatory", raise_exception=1) - - wt = sql("select warehouse_type from `tabWarehouse` where name ='%s'" % self.doc.name) - if wt and cstr(self.doc.warehouse_type) != cstr(wt[0][0]): - sql("""update `tabStock Ledger Entry` set warehouse_type = %s - where warehouse = %s""", (self.doc.warehouse_type, self.doc.name)) - + def merge_warehouses(self): webnotes.conn.auto_commit_on_many_writes = 1 diff --git a/stock/doctype/warehouse/warehouse.txt b/stock/doctype/warehouse/warehouse.txt index 38734081a73..1528a96c2c4 100644 --- a/stock/doctype/warehouse/warehouse.txt +++ b/stock/doctype/warehouse/warehouse.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 18:50:32", "docstatus": 0, - "modified": "2013-07-05 15:02:12", + "modified": "2013-07-10 18:37:24", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,8 +14,7 @@ "document_type": "Master", "icon": "icon-building", "module": "Stock", - "name": "__common__", - "search_fields": "warehouse_type" + "name": "__common__" }, { "doctype": "DocField", @@ -57,19 +56,6 @@ "permlevel": 0, "reqd": 1 }, - { - "doctype": "DocField", - "fieldname": "warehouse_type", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 1, - "label": "Warehouse Type", - "oldfieldname": "warehouse_type", - "oldfieldtype": "Link", - "options": "Warehouse Type", - "permlevel": 0, - "reqd": 1 - }, { "doctype": "DocField", "fieldname": "company", @@ -80,12 +66,13 @@ "oldfieldtype": "Link", "options": "Company", "permlevel": 0, + "reqd": 1, "search_index": 1 }, { "doctype": "DocField", "fieldname": "column_break_4", - "fieldtype": "Column Break", + "fieldtype": "Section Break", "permlevel": 0 }, { diff --git a/utilities/cleanup_data.py b/utilities/cleanup_data.py index df7f4be1593..db6d3ecdec0 100644 --- a/utilities/cleanup_data.py +++ b/utilities/cleanup_data.py @@ -42,8 +42,6 @@ def delete_masters(): print "Deleting masters...." masters = { 'Workstation': ['Default Workstation'], - 'Warehouse Type': ['Default Warehouse Type', 'Fixed Asset', 'Rejected', 'Reserved', - 'Sample', 'Stores', 'WIP Warehouse'], 'Warehouse': ['Default Warehouse'], 'UOM': ['Kg', 'Mtr', 'Box', 'Ltr', 'Nos', 'Ft', 'Pair', 'Set'], 'Territory': ['All Territories', 'Default Territory'], @@ -139,7 +137,6 @@ def reset_global_defaults(): 'default_item_group': 'Default', 'default_stock_uom': 'Nos', 'default_valuation_method': 'FIFO', - 'default_warehouse_type': 'Default Warehouse Type', 'tolerance': None, 'acc_frozen_upto': None, 'bde_auth_role': None, From ad71473f35361d4b2e8af130bffe6ec2657a7462 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 18:59:55 +0530 Subject: [PATCH 21/27] [cleanup] Default Warehouses created on Company creation. Warehouse names have Company abbreviation as suffix --- accounts/page/accounts_home/accounts_home.js | 16 +++++ setup/doctype/company/company.py | 74 ++++++++------------ startup/install.py | 21 ++++-- stock/doctype/warehouse/warehouse.py | 7 +- stock/doctype/warehouse/warehouse.txt | 3 +- website/page/website_home/website_home.js | 6 -- 6 files changed, 69 insertions(+), 58 deletions(-) diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js index aa527f7b820..e76255e293a 100644 --- a/accounts/page/accounts_home/accounts_home.js +++ b/accounts/page/accounts_home/accounts_home.js @@ -52,6 +52,22 @@ wn.module_page["Accounts"] = [ }, ] }, + { + title: wn._("Setup"), + icon: "icon-wrench", + items: [ + { + label: wn._("Company"), + description: wn._("Company Master."), + doctype:"Company" + }, + { + label: wn._("Fiscal Year"), + description: wn._("Accounting Year."), + doctype:"Fiscal Year" + }, + ] + }, { title: wn._("Tools"), icon: "icon-wrench", diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 55a17f74838..ea3d1b9cf08 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -33,9 +33,28 @@ class DocType: if self.doc.fields.get('__islocal') and len(self.doc.abbr) > 5: webnotes.msgprint("Abbreviation cannot have more than 5 characters", raise_exception=1) - - # Create default accounts - # --------------------------------------------------- + + def on_update(self): + if not webnotes.conn.sql("""select name from tabAccount + where company=%s and docstatus<2 limit 1""", self.doc.name): + self.create_default_accounts() + self.create_default_warehouses() + + if not self.doc.cost_center: + self.create_default_cost_center() + + self.set_default_accounts() + + if self.doc.default_currency: + webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1) + + def create_default_warehouses(self): + for whname in ("Stores", "Work In Progress", "Finished Goods"): + webnotes.bean({ + "doctype":"Warehouse", + "company": self.doc.name + }).insert() + def create_default_accounts(self): self.fld_dict = {'account_name':0,'parent_account':1,'group_or_ledger':2,'is_pl_account':3,'account_type':4,'debit_or_credit':5,'company':6,'tax_rate':7} acc_list_common = [ @@ -162,32 +181,16 @@ class DocType: for d in acc_list_india: self.add_acc(d) - # Create account - # --------------------------------------------------- def add_acc(self,lst): - ac = Document('Account') + account = webnotes.bean({ + "doctype": "Account", + "freeze_account": "No", + "master_type": "", + }) for d in self.fld_dict.keys(): - ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]] - ac_obj = get_obj(doc=ac) - ac_obj.doc.freeze_account='No' - ac_obj.doc.master_type = '' - ac_obj.validate() - ac_obj.doc.save(1) - ac_obj.on_update() - - - # Set letter head - # --------------------------------------------------- - def set_letter_head(self): - if not self.doc.letter_head: - if self.doc.address: - header = """ -

%(comp)s

%(add)s
- - """ % {'comp':self.doc.name, - 'add':self.doc.address.replace("\n",'
')} - - self.doc.letter_head = header + account.doc.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]] + + account.insert() def set_default_accounts(self): accounts = { @@ -209,8 +212,6 @@ class DocType: if not self.doc.stock_adjustment_cost_center: webnotes.conn.set(self.doc, "stock_adjustment_cost_center", self.doc.cost_center) - # Create default cost center - # --------------------------------------------------- def create_default_cost_center(self): cc_list = [ { @@ -237,21 +238,6 @@ class DocType: cc_bean.insert() webnotes.conn.set(self.doc, "cost_center", "Main - " + self.doc.abbr) - - def on_update(self): - self.set_letter_head() - - if not webnotes.conn.sql("""select name from tabAccount - where company=%s and docstatus<2 limit 1""", self.doc.name): - self.create_default_accounts() - - if not self.doc.cost_center: - self.create_default_cost_center() - - self.set_default_accounts() - - if self.doc.default_currency: - webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1) def on_trash(self): """ diff --git a/startup/install.py b/startup/install.py index b665e3d3807..5b948a9d28d 100644 --- a/startup/install.py +++ b/startup/install.py @@ -100,8 +100,10 @@ def import_country_and_currency(): def import_defaults(): records = [ # item group - {'doctype': 'Item Group', 'item_group_name': 'All Item Groups', 'is_group': 'Yes', 'name': 'All Item Groups', 'parent_item_group': ''}, - {'doctype': 'Item Group', 'item_group_name': 'Default', 'is_group': 'No', 'name': 'Default', 'parent_item_group': 'All Item Groups'}, + {'doctype': 'Item Group', 'item_group_name': 'All Item Groups', 'is_group': 'Yes', 'parent_item_group': ''}, + {'doctype': 'Item Group', 'item_group_name': 'Products', 'is_group': 'No', 'parent_item_group': 'All Item Groups'}, + {'doctype': 'Item Group', 'item_group_name': 'Raw Material', 'is_group': 'No', 'parent_item_group': 'All Item Groups'}, + {'doctype': 'Item Group', 'item_group_name': 'Services', 'is_group': 'No', 'parent_item_group': 'All Item Groups'}, # deduction type {'doctype': 'Deduction Type', 'name': 'Income Tax', 'description': 'Income Tax', 'deduction_name': 'Income Tax'}, @@ -131,16 +133,25 @@ def import_defaults(): # customer group {'doctype': 'Customer Group', 'customer_group_name': 'All Customer Groups', 'is_group': 'Yes', 'name': 'All Customer Groups', 'parent_customer_group': ''}, - {'doctype': 'Customer Group', 'customer_group_name': 'Default', 'is_group': 'No', 'name': 'Default Customer Group', 'parent_customer_group': 'All Customer Groups'}, + {'doctype': 'Customer Group', 'customer_group_name': 'Individual', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'}, + {'doctype': 'Customer Group', 'customer_group_name': 'Commercial', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'}, + {'doctype': 'Customer Group', 'customer_group_name': 'Non Profit', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'}, + {'doctype': 'Customer Group', 'customer_group_name': 'Government', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'}, # supplier type - {'doctype': 'Supplier Type', 'name': 'Default Supplier Type', 'supplier_type': 'Default Supplier Type'}, + {'doctype': 'Supplier Type', 'supplier_type': 'Services'}, + {'doctype': 'Supplier Type', 'supplier_type': 'Local'}, + {'doctype': 'Supplier Type', 'supplier_type': 'Raw Material'}, + {'doctype': 'Supplier Type', 'supplier_type': 'Electrical'}, + {'doctype': 'Supplier Type', 'supplier_type': 'Hardware'}, + {'doctype': 'Supplier Type', 'supplier_type': 'Pharmaceutical'}, + {'doctype': 'Supplier Type', 'supplier_type': 'Distributor'}, # Workstation {'doctype': 'Workstation', 'name': 'Default Workstation', 'workstation_name': 'Default Workstation', 'warehouse': 'Default Warehouse'}, # Sales Person - {'doctype': 'Sales Person', 'name': 'All Sales Persons', 'sales_person_name': 'All Sales Persons', 'is_group': "Yes", "parent_sales_person": ""}, + {'doctype': 'Sales Person', 'sales_person_name': 'Sales Team', 'is_group': "Yes", "parent_sales_person": ""}, # UOM {'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Unit'}, diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py index b233ec433ae..1f9a32a588e 100644 --- a/stock/doctype/warehouse/warehouse.py +++ b/stock/doctype/warehouse/warehouse.py @@ -27,7 +27,12 @@ class DocType: def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist - + + def autoname(self): + suffix = " - " + webnotes.conn.get_value("Company", self.doc.company, "abbr") + if not self.doc.warehouse_name.endswith(suffix): + self.doc.name = self.doc.warehouse_name + suffix + def get_bin(self, item_code, warehouse=None): warehouse = warehouse or self.doc.name bin = sql("select name from tabBin where item_code = %s and \ diff --git a/stock/doctype/warehouse/warehouse.txt b/stock/doctype/warehouse/warehouse.txt index 1528a96c2c4..95b0b52e546 100644 --- a/stock/doctype/warehouse/warehouse.txt +++ b/stock/doctype/warehouse/warehouse.txt @@ -2,13 +2,12 @@ { "creation": "2013-03-07 18:50:32", "docstatus": 0, - "modified": "2013-07-10 18:37:24", + "modified": "2013-07-10 18:46:40", "modified_by": "Administrator", "owner": "Administrator" }, { "allow_rename": 1, - "autoname": "field:warehouse_name", "description": "A logical Warehouse against which stock entries are made.", "doctype": "DocType", "document_type": "Master", diff --git a/website/page/website_home/website_home.js b/website/page/website_home/website_home.js index bdedcc90519..11a22d573f4 100644 --- a/website/page/website_home/website_home.js +++ b/website/page/website_home/website_home.js @@ -77,12 +77,6 @@ wn.module_page["Website"] = [ icon: "icon-wrench", right: true, items: [ - { - "route":"Form/Product Settings", - "label":wn._("Product Settings"), - "description":wn._("Settings for Product Catalog on the website."), - doctype:"Product Settings" - }, { "route":"Form/About Us Settings", "label":wn._("About Us Settings"), From 8f61991235077e720703c8ac7dbdd5f15c1fea1c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 19:02:07 +0530 Subject: [PATCH 22/27] [minor] --- stock/page/stock_home/stock_home.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js index 4528cd48322..6c315ad7bce 100644 --- a/stock/page/stock_home/stock_home.js +++ b/stock/page/stock_home/stock_home.js @@ -123,11 +123,6 @@ wn.module_page["Stock"] = [ "doctype":"Brand", "label": wn._("Brand"), "description": wn._("Brand master.") - }, - { - "label": wn._("Warehouse Type"), - "doctype":"Warehouse Type", - "description": wn._("Types of warehouse") } ] }, From 994c319c313ff27f21dd8eb3ce9398faa89c1973 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 19:03:09 +0530 Subject: [PATCH 23/27] [minor] --- home/page/latest_updates/latest_updates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 0d4165b53df..ea6ff49ad0a 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -21,7 +21,7 @@ wn.pages['latest-updates'].onload = function(wrapper) { var $tbody = $('
') .appendTo(parent).find("tbody"); $.each(r.message, function(i, log) { - if(log.message.indexOf("[")!==-1) { + if(log.message.indexOf("minor")!==-1 && log.message.indexOf("[")!==-1) { log.message = log.message.replace(/(\[[^\]]*\])/g, function(match, p1, offset, string) { match = match.toLowerCase(); From d96bfaf6af9d06ff3a203643fe3e7a98d4bbd12a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Jul 2013 20:30:00 +0530 Subject: [PATCH 24/27] [fix] get_query where options not mentioned --- accounts/doctype/account/account.js | 1 + .../payment_to_invoice_matching_tool.js | 13 ++++++++----- .../authorization_rule/authorization_rule.js | 8 ++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js index 44f7abd5de6..9a8115e850d 100644 --- a/accounts/doctype/account/account.js +++ b/accounts/doctype/account/account.js @@ -124,6 +124,7 @@ cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) { cur_frm.fields_dict['master_name'].get_query = function(doc) { if (doc.master_type) { return { + doctype: doc.master_type, query: "accounts.doctype.account.account.get_master_name", filters: { "master_type": doc.master_type } } diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js index ad0c1d05128..3230ecf9e85 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js @@ -36,11 +36,14 @@ cur_frm.fields_dict.voucher_no.get_query = function(doc) { // TO-do: check for pos, it should not come if (!doc.account) msgprint("Please select Account first"); else { - query: "accounts.doctype.payment_to_invoice_matching_tool.payment_to_invoice_matching_tool.gl_entry_details", - filters: { - "dt": doc.voucher_type, - "acc": doc.account, - "account_type": doc.account_type + return { + doctype: doc.voucher_type, + query: "accounts.doctype.payment_to_invoice_matching_tool.payment_to_invoice_matching_tool.gl_entry_details", + filters: { + "dt": doc.voucher_type, + "acc": doc.account, + "account_type": doc.account_type + } } } } diff --git a/setup/doctype/authorization_rule/authorization_rule.js b/setup/doctype/authorization_rule/authorization_rule.js index 1866cbcc5d6..fce04973f69 100644 --- a/setup/doctype/authorization_rule/authorization_rule.js +++ b/setup/doctype/authorization_rule/authorization_rule.js @@ -99,24 +99,20 @@ cur_frm.fields_dict['system_role'].get_query = function(doc) { } } -// Approving Role Trigger -// ----------------------- -// cur_frm.fields_dict['approving_role'].get_query = function(doc) { -// return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50' -// } - // Master Name Trigger // -------------------- cur_frm.fields_dict['master_name'].get_query = function(doc){ if(doc.based_on == 'Customerwise Discount') return { + doctype: "Customer", filters:[ ['Customer', 'docstatus', '!=', 2] ] } else if(doc.based_on == 'Itemwise Discount') return { + doctype: "Item", query: "controllers.queries.item_query" } else From e41bceb3dfd0e529b6798649d765286e02e3e7b6 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Jul 2013 20:42:44 +0530 Subject: [PATCH 25/27] [feature] [website] Create Default Home Page --- public/js/complete_setup.js | 11 ++++-- setup/doctype/company/company.py | 39 +++++++++++++++++++ setup/doctype/company/sample_home_page.html | 22 +++++++++++ .../notification_control.txt | 3 +- setup/doctype/setup_control/setup_control.py | 7 ++-- startup/install.py | 20 ++++------ website/css/website.css | 4 ++ .../style_settings/custom_template.css | 2 +- .../website_settings/website_settings.js | 2 +- .../website_settings/website_settings.txt | 2 +- website/templates/html/navbar.html | 2 +- 11 files changed, 91 insertions(+), 23 deletions(-) create mode 100644 setup/doctype/company/sample_home_page.html diff --git a/public/js/complete_setup.js b/public/js/complete_setup.js index 4fb29e30fce..a93aae6ce1d 100644 --- a/public/js/complete_setup.js +++ b/public/js/complete_setup.js @@ -75,6 +75,7 @@ $.extend(erpnext.complete_setup, { if(!data) return; $(this).set_working(); $c_obj('Setup Control','setup_account',data,function(r, rt){ + $(this).done_working(); if(!r.exc) { sys_defaults = r.message; user_fullname = r.message.user_fullname; @@ -84,12 +85,16 @@ $.extend(erpnext.complete_setup, { wn.container.wntoolbar.set_user_name(); setTimeout(function() { window.location.reload(); }, 3000); - } else { - $(this).done_working(); } }); }; - + + d.fields_dict.company_name.input.onchange = function() { + var parts = d.get_input("company_name").val().split(" "); + var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join(""); + d.get_input("company_abbr").val(abbr.toUpperCase()); + } + d.fields_dict.country.input.onchange = function() { var country = d.fields_dict.country.input.value; var $timezone = $(d.fields_dict.timezone.input); diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index ea3d1b9cf08..968296c9017 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -39,6 +39,7 @@ class DocType: where company=%s and docstatus<2 limit 1""", self.doc.name): self.create_default_accounts() self.create_default_warehouses() + self.create_default_web_page() if not self.doc.cost_center: self.create_default_cost_center() @@ -52,8 +53,46 @@ class DocType: for whname in ("Stores", "Work In Progress", "Finished Goods"): webnotes.bean({ "doctype":"Warehouse", + "warehouse_name": whname, "company": self.doc.name }).insert() + + def create_default_web_page(self): + if not webnotes.conn.get_value("Website Settings", None, "home_page"): + import os + with open(os.path.join(os.path.dirname(__file__), "sample_home_page.html"), "r") as webfile: + webpage = webnotes.bean({ + "doctype": "Web Page", + "title": self.doc.name + " Home", + "published": 1, + "description": "Standard Home Page for " + self.doc.company, + "main_section": webfile.read() % self.doc.fields + }).insert() + + # update in home page in settings + website_settings = webnotes.bean("Website Settings", "Website Settings") + website_settings.doc.home_page = webpage.doc.name + website_settings.doc.banner_html = """

""" + self.doc.name + "

" + website_settings.doc.copyright = self.doc.name + website_settings.doclist.append({ + "doctype": "Top Bar Item", + "parentfield": "top_bar_items", + "label":"Home", + "url": webpage.doc.name + }) + website_settings.doclist.append({ + "doctype": "Top Bar Item", + "parentfield": "top_bar_items", + "label":"Contact", + "url": "contact" + }) + website_settings.doclist.append({ + "doctype": "Top Bar Item", + "parentfield": "top_bar_items", + "label":"Blog", + "url": "blog" + }) + website_settings.save() def create_default_accounts(self): self.fld_dict = {'account_name':0,'parent_account':1,'group_or_ledger':2,'is_pl_account':3,'account_type':4,'debit_or_credit':5,'company':6,'tax_rate':7} diff --git a/setup/doctype/company/sample_home_page.html b/setup/doctype/company/sample_home_page.html new file mode 100644 index 00000000000..32e58bd5409 --- /dev/null +++ b/setup/doctype/company/sample_home_page.html @@ -0,0 +1,22 @@ +

Sample Home Page

+
+

This is a sample home page for your company %(name)s's website. This was + created from the Website Module inside ERPNext. ERPNext provides you with simple + tools to build and update your website. You can add sections like your Product Catalog, + Blog, Contact Us, About Us and so on. Messages entered in the "Contact" page are + automatically added as Leads in the system. + +

What you can do with your website:
+ +
    +
  • Automatically generate products / services catalog from your Items. +
  • Capture Leads from your website. +
  • Communicate with your customers by sharing your thoughts in your Blog. +
  • Introduce your company and team in the About Us page. +
+ +

Infact, + erpnext.com + website is built on ERPNext itself.

+ +

For more help, click here

diff --git a/setup/doctype/notification_control/notification_control.txt b/setup/doctype/notification_control/notification_control.txt index c1f559b99b5..81e08a552e7 100644 --- a/setup/doctype/notification_control/notification_control.txt +++ b/setup/doctype/notification_control/notification_control.txt @@ -2,7 +2,7 @@ { "creation": "2012-07-12 23:29:45", "docstatus": 0, - "modified": "2013-07-10 14:54:11", + "modified": "2013-07-10 19:24:07", "modified_by": "Administrator", "owner": "Administrator" }, @@ -12,6 +12,7 @@ "allow_print": 1, "description": "Send automatic emails to Contacts on Submitting transactions.", "doctype": "DocType", + "icon": "icon-envelope", "issingle": 1, "module": "Setup", "name": "__common__" diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py index c6b0b6ce283..a85384b2025 100644 --- a/setup/doctype/setup_control/setup_control.py +++ b/setup/doctype/setup_control/setup_control.py @@ -65,7 +65,7 @@ class DocType: webnotes.bean([{ "doctype":"Fiscal Year", 'year': curr_fiscal_year, - 'year_start_date': fy_start_date, + 'year_start_date': fy_start_date }]).insert() curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start')) @@ -79,9 +79,10 @@ class DocType: # Company webnotes.bean([{ "doctype":"Company", + 'domain': args.get("industry"), 'company_name':args.get('company_name'), 'abbr':args.get('company_abbr'), - 'default_currency':args.get('currency') + 'default_currency':args.get('currency'), }]).insert() self.curr_fiscal_year = curr_fiscal_year @@ -148,7 +149,7 @@ class DocType: # control panel cp = webnotes.doc("Control Panel", "Control Panel") - for k in ['industry', 'country', 'timezone', 'company_name']: + for k in ['country', 'timezone', 'company_name']: cp.fields[k] = args[k] cp.save() diff --git a/startup/install.py b/startup/install.py index 5b948a9d28d..896a6cdc726 100644 --- a/startup/install.py +++ b/startup/install.py @@ -146,9 +146,6 @@ def import_defaults(): {'doctype': 'Supplier Type', 'supplier_type': 'Hardware'}, {'doctype': 'Supplier Type', 'supplier_type': 'Pharmaceutical'}, {'doctype': 'Supplier Type', 'supplier_type': 'Distributor'}, - - # Workstation - {'doctype': 'Workstation', 'name': 'Default Workstation', 'workstation_name': 'Default Workstation', 'warehouse': 'Default Warehouse'}, # Sales Person {'doctype': 'Sales Person', 'sales_person_name': 'Sales Team', 'is_group': "Yes", "parent_sales_person": ""}, @@ -166,12 +163,11 @@ def import_defaults(): from webnotes.modules import scrub for r in records: - if not webnotes.conn.exists(r['doctype'], r['name']): - bean = webnotes.bean(r) - - # ignore mandatory for root - parent_link_field = ("parent_" + scrub(bean.doc.doctype)) - if parent_link_field in bean.doc.fields and not bean.doc.fields.get(parent_link_field): - bean.ignore_mandatory = True - - bean.insert() \ No newline at end of file + bean = webnotes.bean(r) + + # ignore mandatory for root + parent_link_field = ("parent_" + scrub(bean.doc.doctype)) + if parent_link_field in bean.doc.fields and not bean.doc.fields.get(parent_link_field): + bean.ignore_mandatory = True + + bean.insert() \ No newline at end of file diff --git a/website/css/website.css b/website/css/website.css index 816b3efd9db..21e1cb2d25e 100644 --- a/website/css/website.css +++ b/website/css/website.css @@ -41,6 +41,10 @@ img { margin-left: 5px; } +div.web-footer { + border-top: 1px solid #dddddd; + padding-top: 10px; +} .web-footer-menu ul { list-style: none; diff --git a/website/doctype/style_settings/custom_template.css b/website/doctype/style_settings/custom_template.css index 996774eaea4..eb422c96b16 100644 --- a/website/doctype/style_settings/custom_template.css +++ b/website/doctype/style_settings/custom_template.css @@ -9,7 +9,7 @@ body { background-color: #{{ doc.background_color }}; background-image: none; {% else %} - background-color: #edede7; + background-color: #ffffff; {% endif %} {% if doc.font or doc.google_web_font_for_text %} font-family: '{{ doc.google_web_font_for_text or doc.font }}', 'Helvetica Neue', Arial, Sans !important; diff --git a/website/doctype/website_settings/website_settings.js b/website/doctype/website_settings/website_settings.js index 57c32e90ccc..2322b7cbf43 100644 --- a/website/doctype/website_settings/website_settings.js +++ b/website/doctype/website_settings/website_settings.js @@ -34,7 +34,7 @@ $.extend(cur_frm.cscript, { url: function(doc, cdt, cdn) { this.label(doc, cdt, cdn); - } + }, set_parent_label_options: function() { wn.meta.get_docfield("Top Bar Item", "parent_label", cur_frm.docname).options = diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt index b3828a22f48..f8ceafe162f 100644 --- a/website/doctype/website_settings/website_settings.txt +++ b/website/doctype/website_settings/website_settings.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-30 12:58:46", "docstatus": 0, - "modified": "2013-07-05 15:02:50", + "modified": "2013-07-10 20:37:38", "modified_by": "Administrator", "owner": "Administrator" }, diff --git a/website/templates/html/navbar.html b/website/templates/html/navbar.html index 635cf349cc8..11f2fb000aa 100644 --- a/website/templates/html/navbar.html +++ b/website/templates/html/navbar.html @@ -1,4 +1,4 @@ -