diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js index c12c2d69640..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 } } @@ -132,7 +133,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/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/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/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/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js index 4e2b8deed8b..d273e53e56f 100644 --- a/accounts/doctype/cost_center/cost_center.js +++ b/accounts/doctype/cost_center/cost_center.js @@ -36,11 +36,25 @@ 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 + '" 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'] + ] } +} 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="'+ doc.company+'" AND `tabCost Center`.company 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'] + ] + } } //parent cost center diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js index 53c8764f750..ea077981789 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.js +++ b/accounts/doctype/journal_voucher/journal_voucher.js @@ -196,24 +196,32 @@ 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: doc.company} + 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 } + 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 } + filters: [ + ['Sales Invoice', 'debit_to', '=', d.account], + ['Sales Invoice', 'docstatus', '=', 1], + ['Sales Invoice', 'outstanding_amount', '>', 0] + ] } } 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/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/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..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,25 +36,15 @@ 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}); + 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/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..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 @@ -139,3 +139,30 @@ class DocType: msgprint("Successfully allocated.") else: msgprint("No amount allocated.", raise_exception=1) + +def gl_entry_details(doctype, txt, searchfield, start, page_len, filters): + 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/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/period_closing_voucher/period_closing_voucher.js b/accounts/doctype/period_closing_voucher/period_closing_voucher.js index 830092b284c..fd458417835 100644 --- a/accounts/doctype/period_closing_voucher/period_closing_voucher.js +++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.js @@ -23,5 +23,13 @@ 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" + } + } } diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index 1648bad4052..991c8daadf1 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -25,43 +25,72 @@ 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 + } + } } // 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" + } + } } // 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` = "' +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" + } + } } //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" + } + } } // ------------------ 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] + ] + } } cur_frm.fields_dict["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" } } } -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"} +} diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 512e036ae0f..efe0c2a990e 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -152,30 +152,55 @@ 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} + } } 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.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) { - 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 + } + } } // 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] + ] + } } 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 + } + } } cur_frm.cscript.expense_head = function(doc, cdt, cdn){ var d = locals[cdt][cdn]; @@ -190,8 +215,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: doc.company} + filters: { + 'company_name': doc.company, + 'group_or_ledger': 'Ledger' + } + } } @@ -232,9 +260,11 @@ 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'] + ] + } } 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 867cd7a1369..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-09 12:21:47", + "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", @@ -62,10 +65,18 @@ "read_only": 0, "width": "300px" }, + { + "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", @@ -77,6 +88,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "options": "UOM", "print_hide": 1, @@ -86,6 +98,7 @@ "doctype": "DocField", "fieldname": "import_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "options": "currency", "print_hide": 1, @@ -95,6 +108,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 0, "read_only": 0 @@ -103,6 +117,7 @@ "doctype": "DocField", "fieldname": "import_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate ", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -115,6 +130,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -126,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, @@ -135,6 +152,7 @@ "doctype": "DocField", "fieldname": "rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "rate", "oldfieldtype": "Currency", @@ -147,6 +165,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -155,10 +174,18 @@ "read_only": 1, "reqd": 1 }, + { + "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", @@ -174,6 +201,7 @@ "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", + "in_list_view": 0, "label": "Cost Center", "oldfieldname": "cost_center", "oldfieldtype": "Link", @@ -183,11 +211,19 @@ "read_only": 0, "width": "120px" }, + { + "doctype": "DocField", + "fieldname": "reference", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Reference" + }, { "doctype": "DocField", "fieldname": "project_name", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Project Name", "options": "Project", "print_hide": 1, @@ -198,6 +234,7 @@ "fieldname": "brand", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Data", @@ -210,6 +247,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -223,6 +261,7 @@ "fieldname": "purchase_order", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Purchase Order", "no_copy": 1, "oldfieldname": "purchase_order", @@ -238,6 +277,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Purchase Order Item", "no_copy": 1, "oldfieldname": "po_detail", @@ -251,6 +291,7 @@ "fieldname": "purchase_receipt", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Purchase Receipt", "no_copy": 1, "oldfieldname": "purchase_receipt", @@ -266,6 +307,7 @@ "fieldtype": "Data", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "PR Detail", "no_copy": 1, "oldfieldname": "pr_detail", @@ -280,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", @@ -292,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", @@ -306,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", @@ -316,6 +361,7 @@ "doctype": "DocField", "fieldname": "conversion_factor", "fieldtype": "Float", + "in_list_view": 0, "label": "Conversion Factor", "print_hide": 1, "read_only": 0 @@ -325,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", @@ -336,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/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 a147ac17b79..c9f78fbb332 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,18 +127,28 @@ 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` = "' +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" + } + } } - cur_frm.cscript.account_head = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; if(!d.charge_type && d.account_head){ diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index c7d7d25734a..70bf03b56c4 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -249,55 +249,84 @@ 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 + } + } } 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 + } + } } 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 + } + } } // 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="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"' + return{ + filters:{ + 'group_or_ledger': 'Ledger', + 'company_name': doc.company + } + } } //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} + } } //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'} + } } // 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", - "company": doc.company + filters: { + 'is_pl_account': 'Yes', + 'debit_or_credit': 'Debit', + 'company': doc.company, + 'group_or_ledger': 'Ledger' } } } @@ -307,15 +336,22 @@ 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] + ] + } } // 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: doc.company} + filters: { + 'company': doc.company, + 'group_or_ledger': 'Ledger' + } } } diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index e0147b12d38..e42cb733400 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -984,3 +984,16 @@ 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/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 b0fd7c7e339..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-09 12:46:12", + "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", @@ -81,10 +86,18 @@ "reqd": 1, "width": "200px" }, + { + "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", @@ -95,6 +108,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "read_only": 1 }, @@ -102,6 +116,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "oldfieldname": "ref_rate", "oldfieldtype": "Currency", @@ -114,6 +129,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount (%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -124,6 +140,7 @@ "doctype": "DocField", "fieldname": "export_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Basic Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -135,6 +152,7 @@ "doctype": "DocField", "fieldname": "export_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "export_amount", "oldfieldtype": "Currency", @@ -146,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", @@ -158,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", @@ -171,6 +191,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -181,21 +202,17 @@ }, { "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", + "in_list_view": 0, + "label": "Accounting" }, { "doctype": "DocField", "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", @@ -234,11 +253,32 @@ "reqd": 0, "width": "120px" }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Warehouse and Reference" + }, + { + "doctype": "DocField", + "fieldname": "warehouse", + "fieldtype": "Link", + "hidden": 0, + "in_list_view": 0, + "label": "Warehouse", + "oldfieldname": "warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "print_hide": 1, + "read_only": 0 + }, { "doctype": "DocField", "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/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 9f4cb08745c..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 @@ -137,11 +137,20 @@ 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] + ] + } } 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` = "' +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" + } } 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/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/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 1b7dcf0e473..ada4beb2ebf 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' } + } } }); }, @@ -191,7 +201,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, 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/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js index b378a40e213..bccd4a9559e 100644 --- a/buying/doctype/purchase_order/purchase_order.js +++ b/buying/doctype/purchase_order/purchase_order.js @@ -110,17 +110,23 @@ 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.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.cscript.get_last_purchase_rate = function(doc, cdt, cdn){ diff --git a/buying/doctype/purchase_order_item/purchase_order_item.txt b/buying/doctype/purchase_order_item/purchase_order_item.txt index dac9a7be05d..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-09 11:45:00", + "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", @@ -78,10 +82,18 @@ "reqd": 1, "search_index": 1 }, + { + "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", @@ -95,6 +107,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -107,6 +120,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -121,6 +135,7 @@ "doctype": "DocField", "fieldname": "import_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "options": "currency", "print_hide": 1, @@ -130,6 +145,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 0, "read_only": 0 @@ -139,6 +155,7 @@ "fieldname": "import_rate", "fieldtype": "Currency", "hidden": 0, + "in_list_view": 1, "label": "Rate ", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -150,6 +167,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -160,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, @@ -170,6 +189,7 @@ "doctype": "DocField", "fieldname": "purchase_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "purchase_rate", "oldfieldtype": "Currency", @@ -185,6 +205,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -193,11 +214,19 @@ "read_only": 1, "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, + "in_list_view": 0, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -211,6 +240,7 @@ "fieldname": "project_name", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Project Name", "options": "Project", "print_hide": 1, @@ -222,6 +252,7 @@ "fieldname": "conversion_factor", "fieldtype": "Float", "hidden": 0, + "in_list_view": 0, "label": "UOM Conversion Factor", "oldfieldname": "conversion_factor", "oldfieldtype": "Currency", @@ -236,6 +267,7 @@ "fieldname": "stock_uom", "fieldtype": "Data", "hidden": 0, + "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -250,6 +282,7 @@ "fieldname": "prevdoc_doctype", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Prevdoc DocType", "no_copy": 1, "oldfieldname": "prevdoc_doctype", @@ -263,6 +296,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Material Request No", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -280,6 +314,7 @@ "fieldtype": "Date", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Material Request Date", "no_copy": 1, "oldfieldname": "prevdoc_date", @@ -294,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", @@ -308,6 +344,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 0, + "in_list_view": 1, "label": "Supplier Quotation", "no_copy": 1, "options": "Supplier Quotation", @@ -319,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", @@ -329,6 +367,7 @@ "fieldname": "brand", "fieldtype": "Link", "hidden": 1, + "in_list_view": 1, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -342,6 +381,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 1, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -355,6 +395,7 @@ "fieldname": "stock_qty", "fieldtype": "Float", "hidden": 0, + "in_list_view": 1, "label": "Stock Qty", "no_copy": 1, "oldfieldname": "stock_qty", @@ -369,6 +410,7 @@ "fieldname": "received_qty", "fieldtype": "Float", "hidden": 0, + "in_list_view": 1, "label": "Received Qty", "no_copy": 1, "oldfieldname": "received_qty", @@ -380,6 +422,7 @@ "doctype": "DocField", "fieldname": "billed_amt", "fieldtype": "Currency", + "in_list_view": 1, "label": "Billed Amt", "no_copy": 1, "options": "currency", @@ -392,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", @@ -405,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/quality_inspection.js b/buying/doctype/quality_inspection/quality_inspection.js index 2dbb2854fdd..d40d81a4fa0 100644 --- a/buying/doctype/quality_inspection/quality_inspection.js +++ b/buying/doctype/quality_inspection/quality_inspection.js @@ -43,18 +43,26 @@ 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) { - 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'; - 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'; + 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 + } } // Serial No based on item_code cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) { + var 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" + } 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 { filters: filter } +} \ No newline at end of file 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/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/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js index ef688ec5cde..722ac002a04 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/buying/doctype/supplier_quotation/supplier_quotation.js @@ -65,10 +65,11 @@ 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.cscript.supplier_address = function(doc, dt, dn) { @@ -80,12 +81,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} + } +} \ No newline at end of file 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/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt index d4df4041be4..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-09 12:15:15", + "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", @@ -75,11 +79,19 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -92,6 +104,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -106,6 +119,7 @@ "doctype": "DocField", "fieldname": "import_ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "options": "currency", "print_hide": 1, @@ -115,6 +129,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 0, "read_only": 0 @@ -124,6 +139,7 @@ "fieldname": "import_rate", "fieldtype": "Currency", "hidden": 0, + "in_list_view": 1, "label": "Rate ", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -135,6 +151,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -145,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, @@ -155,6 +173,7 @@ "doctype": "DocField", "fieldname": "purchase_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "purchase_rate", "oldfieldtype": "Currency", @@ -170,6 +189,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -178,11 +198,19 @@ "read_only": 1, "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, + "in_list_view": 0, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -196,6 +224,7 @@ "fieldname": "project_name", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 0, "label": "Project Name", "options": "Project", "print_hide": 1, @@ -207,6 +236,7 @@ "fieldname": "prevdoc_doctype", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Prevdoc DocType", "no_copy": 1, "oldfieldname": "prevdoc_doctype", @@ -220,6 +250,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Material Request No", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -237,6 +268,7 @@ "fieldtype": "Date", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Material Request Date", "no_copy": 1, "oldfieldname": "prevdoc_date", @@ -251,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", @@ -264,6 +297,7 @@ "fieldname": "brand", "fieldtype": "Link", "hidden": 1, + "in_list_view": 0, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -277,6 +311,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -291,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", @@ -304,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/controllers/queries.py b/controllers/queries.py new file mode 100644 index 00000000000..e397420e3ed --- /dev/null +++ b/controllers/queries.py @@ -0,0 +1,221 @@ + # 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 +from webnotes.utils import cstr + +def get_filters_cond(doctype, filters, conditions): + if filters: + if isinstance(filters, dict): + 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(flt, 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}) + +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 diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 0d4165b53df..60539db9926 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(); diff --git a/hr/doctype/appraisal/appraisal.js b/hr/doctype/appraisal/appraisal.js index 601f3fc3cbb..2289064baa8 100644 --- a/hr/doctype/appraisal/appraisal.js +++ b/hr/doctype/appraisal/appraisal.js @@ -83,4 +83,6 @@ 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/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/attendance/attendance.js b/hr/doctype/attendance/attendance.js index 3ba986891b9..d1a66cea901 100644 --- a/hr/doctype/attendance/attendance.js +++ b/hr/doctype/attendance/attendance.js @@ -14,12 +14,15 @@ // 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 +cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { + return{ + query:"controllers.queries.employee_query" + } +} 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/doctype/employee/employee.js b/hr/doctype/employee/employee.js index 5a2dbab87f7..398d8f81c93 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() { @@ -30,13 +32,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 +43,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 +74,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/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/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/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_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/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/salary_slip.js b/hr/doctype/salary_slip/salary_slip.js index fc582713364..f6853fcddd2 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); @@ -139,4 +134,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" + } +} diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py index e3e43e471d0..2b1d80c1932 100644 --- a/hr/doctype/salary_slip/salary_slip.py +++ b/hr/doctype/salary_slip/salary_slip.py @@ -17,11 +17,11 @@ 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 -from webnotes import msgprint +from webnotes import msgprint, _ from setup.utils import get_company_currency sql = webnotes.conn.sql @@ -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,20 +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) - - 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] - + 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: @@ -92,7 +94,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']: 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/salary_structure.js b/hr/doctype/salary_structure/salary_structure.js index 29792431732..60c159dd467 100644 --- a/hr/doctype/salary_structure/salary_structure.js +++ b/hr/doctype/salary_structure/salary_structure.js @@ -72,4 +72,6 @@ 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/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/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/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"), 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) 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/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 77dce03d587..12f949048d6 100644 --- a/manufacturing/doctype/production_order/production_order.js +++ b/manufacturing/doctype/production_order/production_order.js @@ -101,18 +101,27 @@ 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'] + ] + } } 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.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/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/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/patches/patch_list.py b/patches/patch_list.py index 48e521d20c6..032297f12d3 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -20,6 +20,7 @@ patch_list = [ "execute:webnotes.reload_doc('core', 'doctype', 'docperm') # 2013-04-07", "execute:webnotes.reload_doc('core', 'doctype', 'report')", "execute:webnotes.reload_doc('core', 'doctype', 'doctype') # 2013-07-08", + "execute:webnotes.reload_doc('core', 'doctype', 'page') # 2013-06-24", "patches.mar_2012.clean_property_setter", "patches.april_2012.naming_series_patch", "patches.mar_2012.cleanup_control_panel", 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/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/task/task.js b/projects/doctype/task/task.js index 131b5fdfb5b..cb2c539d633 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.task.task.get_project" + } }; }, diff --git a/projects/doctype/task/task.py b/projects/doctype/task/task.py index 1df8547690c..0ea9eea1eb2 100644 --- a/projects/doctype/task/task.py +++ b/projects/doctype/task/task.py @@ -92,3 +92,13 @@ 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/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/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/public/js/complete_setup.js b/public/js/complete_setup.js index cdc86624ac4..a93aae6ce1d 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'}, ], }); @@ -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); @@ -129,11 +134,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/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js index 914836c934a..cd530a25bad 100644 --- a/selling/doctype/customer/customer.js +++ b/selling/doctype/customer/customer.js @@ -122,8 +122,14 @@ 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'} + } } -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/customer/customer.py b/selling/doctype/customer/customer.py index e7d46d2405d..9022cb5f9e6 100644 --- a/selling/doctype/customer/customer.py +++ b/selling/doctype/customer/customer.py @@ -184,7 +184,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/selling/doctype/installation_note/installation_note.js b/selling/doctype/installation_note/installation_note.js index 4fd8678eafc..4cbd67d729a 100644 --- a/selling/doctype/installation_note/installation_note.js +++ b/selling/doctype/installation_note/installation_note.js @@ -62,16 +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 cond = ''; - if(doc.customer) { - 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}); + + var filter = { + 'company': doc.company, + 'docstatus': 1, + 'per_installed': 99.99 + }; + if(doc.customer) filter['customer'] = doc.customer; + return { filters: filter } } - 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.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { @@ -79,11 +83,19 @@ 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.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/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/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..b87fee196d7 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,23 @@ 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} + } } 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} } } // 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" + } } cur_frm.cscript.lead = function(doc, cdt, cdn) { @@ -185,14 +186,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 +233,12 @@ 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'} + } -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..92d391b2de3 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -202,4 +202,14 @@ 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/opportunity_item/opportunity_item.txt b/selling/doctype/opportunity_item/opportunity_item.txt index ba7870e19d6..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-03-07 07:03:26", + "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", @@ -78,29 +83,39 @@ "print_hide": 1, "search_index": 0 }, + { + "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" + }, { "doctype": "DocField", "fieldname": "basic_rate", "fieldtype": "Currency", "hidden": 1, + "in_list_view": 0, "label": "Basic Rate", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", "options": "Company:company:default_currency", "print_hide": 1 }, - { - "doctype": "DocField", - "fieldname": "qty", - "fieldtype": "Float", - "label": "Qty", - "oldfieldname": "qty", - "oldfieldtype": "Currency" - }, { "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index 877f65c2528..0649f545127 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,21 @@ 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 + } + } } } diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 9792aced90e..6020c933e54 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -270,7 +270,7 @@ def _make_sales_order(source_name, target_doclist=None, ignore_permissions=False # postprocess: fetch shipping address, set missing values return [d.fields for d in doclist] - + def _make_customer(source_name, ignore_permissions=False): quotation = webnotes.conn.get_value("Quotation", source_name, ["lead", "order_type"]) if quotation and quotation[0]: @@ -295,4 +295,42 @@ def _make_customer(source_name, ignore_permissions=False): customer.insert() return customer else: - raise e \ No newline at end of file + raise e + +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: + 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)) diff --git a/selling/doctype/quotation_item/quotation_item.txt b/selling/doctype/quotation_item/quotation_item.txt index a15166af99e..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-09 12:24:21", + "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", @@ -79,12 +83,20 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", "in_filter": 0, + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -99,6 +111,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -113,6 +126,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "oldfieldname": "ref_rate", "oldfieldtype": "Currency", @@ -128,6 +142,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount (%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -142,6 +157,7 @@ "fieldname": "export_rate", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 1, "label": "Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -159,6 +175,7 @@ "fieldname": "export_amount", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 1, "label": "Amount", "oldfieldname": "export_amount", "oldfieldtype": "Currency", @@ -174,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", @@ -189,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", @@ -206,6 +225,7 @@ "fieldname": "amount", "fieldtype": "Currency", "in_filter": 0, + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -217,12 +237,20 @@ "search_index": 0, "width": "100px" }, + { + "doctype": "DocField", + "fieldname": "reference", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Reference" + }, { "doctype": "DocField", "fieldname": "item_group", "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -237,6 +265,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Brand", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -252,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", @@ -263,6 +293,7 @@ "doctype": "DocField", "fieldname": "prevdoc_docname", "fieldtype": "Data", + "in_list_view": 0, "label": "Against Docname", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -278,6 +309,7 @@ "fieldname": "prevdoc_doctype", "fieldtype": "Data", "hidden": 1, + "in_list_view": 0, "label": "Against Doctype", "no_copy": 1, "oldfieldname": "prevdoc_doctype", @@ -294,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/sales_bom.js b/selling/doctype/sales_bom/sales_bom.js index b6ba77953fa..7d793406781 100644 --- a/selling/doctype/sales_bom/sales_bom.js +++ b/selling/doctype/sales_bom/sales_bom.js @@ -24,9 +24,9 @@ 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" + } } 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_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.js b/selling/doctype/sales_common/sales_common.js index cf757a6ceae..8d869501f2c 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -36,32 +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 = 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); + this.frm.fields_dict.lead && this.frm.set_query("lead", function(doc,cdt,cdn) { + return{ query:"controllers.queries.lead_query" } }); if(!this.fname) { return; @@ -70,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' }} ; }); } @@ -82,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..00825bb2650 100644 --- a/selling/doctype/sales_common/sales_common.py +++ b/selling/doctype/sales_common/sales_common.py @@ -365,3 +365,35 @@ 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': "%%%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 %(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/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/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/selling/doctype/sales_order_item/sales_order_item.txt b/selling/doctype/sales_order_item/sales_order_item.txt index 0d1ca5ba2e4..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-09 12:28:31", + "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", @@ -76,11 +80,19 @@ "search_index": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -94,6 +106,7 @@ "fieldname": "stock_uom", "fieldtype": "Data", "hidden": 0, + "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -107,6 +120,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "oldfieldname": "ref_rate", "oldfieldtype": "Currency", @@ -122,6 +136,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount(%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -135,6 +150,7 @@ "doctype": "DocField", "fieldname": "export_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -149,6 +165,7 @@ "doctype": "DocField", "fieldname": "export_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "no_copy": 0, "oldfieldname": "export_amount", @@ -163,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", @@ -177,6 +195,7 @@ "doctype": "DocField", "fieldname": "basic_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Basic Rate (Company Currency)", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", @@ -192,6 +211,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "no_copy": 0, "oldfieldname": "amount", @@ -203,10 +223,18 @@ "reqd": 0, "width": "100px" }, + { + "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", @@ -224,6 +252,7 @@ "fieldname": "projected_qty", "fieldtype": "Float", "hidden": 1, + "in_list_view": 0, "label": "Projected Qty", "no_copy": 1, "oldfieldname": "projected_qty", @@ -238,6 +267,7 @@ "doctype": "DocField", "fieldname": "actual_qty", "fieldtype": "Float", + "in_list_view": 0, "label": "Actual Qty", "no_copy": 1, "print_hide": 1, @@ -252,6 +282,7 @@ "fieldtype": "Float", "hidden": 0, "in_filter": 0, + "in_list_view": 0, "label": "Delivered Qty", "no_copy": 1, "oldfieldname": "delivered_qty", @@ -266,6 +297,7 @@ "doctype": "DocField", "fieldname": "billed_amt", "fieldtype": "Currency", + "in_list_view": 0, "label": "Billed Amt", "no_copy": 1, "options": "currency", @@ -278,6 +310,7 @@ "fieldname": "planned_qty", "fieldtype": "Float", "hidden": 1, + "in_list_view": 0, "label": "Planned Quantity", "no_copy": 1, "oldfieldname": "planned_qty", @@ -294,6 +327,7 @@ "fieldname": "produced_qty", "fieldtype": "Float", "hidden": 1, + "in_list_view": 0, "label": "Produced Quantity", "oldfieldname": "produced_qty", "oldfieldtype": "Currency", @@ -309,6 +343,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Brand Name", "oldfieldname": "brand", "oldfieldtype": "Link", @@ -323,6 +358,7 @@ "fieldtype": "Link", "hidden": 1, "in_filter": 1, + "in_list_view": 0, "label": "Item Group", "oldfieldname": "item_group", "oldfieldtype": "Link", @@ -337,6 +373,7 @@ "fieldtype": "Link", "hidden": 0, "in_filter": 1, + "in_list_view": 0, "label": "Quotation", "no_copy": 1, "oldfieldname": "prevdoc_docname", @@ -351,6 +388,7 @@ "doctype": "DocField", "fieldname": "page_break", "fieldtype": "Check", + "in_list_view": 0, "label": "Page Break", "oldfieldname": "page_break", "oldfieldtype": "Check", @@ -363,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", @@ -377,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/authorization_rule/authorization_rule.js b/setup/doctype/authorization_rule/authorization_rule.js index 184c761b9d9..fce04973f69 100644 --- a/setup/doctype/authorization_rule/authorization_rule.js +++ b/setup/doctype/authorization_rule/authorization_rule.js @@ -81,20 +81,22 @@ 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' -} - -// 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' + return{ + filters:[ + ['Role', 'name', 'not in', 'Administrator, Guest, All'] + ] + } } @@ -102,11 +104,24 @@ cur_frm.fields_dict['approving_role'].get_query = function(doc) { // -------------------- 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 { + doctype: "Customer", + filters:[ + ['Customer', 'docstatus', '!=', 2] + ] + } 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 { + doctype: "Item", + query: "controllers.queries.item_query" + } 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'] + ] + } } -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..dfe8e2ae876 100644 --- a/setup/doctype/company/company.js +++ b/setup/doctype/company/company.js @@ -45,43 +45,48 @@ 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'; -} - -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'; + return{ + filters:{ + 'company': doc.name, + 'group_or_ledger': "Ledger", + 'account_type': "Bank or Cash" + } + } } +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'; -} - - -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'; + return{ + filters:{ + 'company': doc.name, + 'group_or_ledger': "Group" + } + } } 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", - "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", "filters": { "is_pl_account": "Yes", "debit_or_credit": "Debit", - "company": doc.name + "company": doc.name, + 'group_or_ledger': "Ledger" } } } @@ -91,18 +96,17 @@ 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", - "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", "filters": {"company": doc.name} } } diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 55a17f74838..968296c9017 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -33,9 +33,67 @@ 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() + self.create_default_web_page() + + 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", + "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} acc_list_common = [ @@ -162,32 +220,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 +251,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 +277,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/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/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/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js index c427ec09fd0..db0ed91bfdc 100755 --- a/setup/doctype/contact_control/contact_control.js +++ b/setup/doctype/contact_control/contact_control.js @@ -24,7 +24,11 @@ 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" + } + } } } 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/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js index af0c6f0b44b..e865860a249 100644 --- a/setup/doctype/customer_group/customer_group.js +++ b/setup/doctype/customer_group/customer_group.js @@ -30,8 +30,10 @@ 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" + } + } } \ 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/item_group/item_group.js b/setup/doctype/item_group/item_group.js index 6bb6fe309d9..b642735215c 100644 --- a/setup/doctype/item_group/item_group.js +++ b/setup/doctype/item_group/item_group.js @@ -34,5 +34,10 @@ 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] + ] + } } \ No newline at end of file diff --git a/setup/doctype/notification_control/notification_control.txt b/setup/doctype/notification_control/notification_control.txt index be86a962ca6..81e08a552e7 100644 --- a/setup/doctype/notification_control/notification_control.txt +++ b/setup/doctype/notification_control/notification_control.txt @@ -1,208 +1,218 @@ [ { - "owner": "Administrator", - "docstatus": 0, "creation": "2012-07-12 23:29:45", + "docstatus": 0, + "modified": "2013-07-10 19:24:07", "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", + "icon": "icon-envelope", + "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/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js index c5f0dba7dd0..acf6b312bdc 100644 --- a/setup/doctype/sales_partner/sales_partner.js +++ b/setup/doctype/sales_partner/sales_partner.js @@ -97,5 +97,7 @@ 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" } + } } \ 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..fd03a441ee0 100644 --- a/setup/doctype/sales_person/sales_person.js +++ b/setup/doctype/sales_person/sales_person.js @@ -35,11 +35,19 @@ 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] + ] + } } 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" } + } } -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/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/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/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/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/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js index 2932006013b..7fdfee54d62 100644 --- a/setup/doctype/territory/territory.js +++ b/setup/doctype/territory/territory.js @@ -30,11 +30,18 @@ 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] + ] + } } // ******************** 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"} + } } 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..896a6cdc726 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 = { @@ -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,37 +133,27 @@ 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'}, - - # 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'}, + {'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'}, # 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'}, {'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'}, @@ -171,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/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/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 cf3fbb17dcb..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-01-23 16:53:15", + "modified": "2013-07-10 18:32:13", "modified_by": "Administrator", "owner": "Administrator" }, @@ -45,25 +45,19 @@ "fieldname": "warehouse", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", "options": "Warehouse", "search_index": 1 }, - { - "doctype": "DocField", - "fieldname": "warehouse_type", - "fieldtype": "Data", - "label": "Warehouse Type", - "oldfieldname": "warehouse_type", - "oldfieldtype": "Data" - }, { "doctype": "DocField", "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -76,6 +70,7 @@ "fieldname": "reserved_qty", "fieldtype": "Float", "in_filter": 0, + "in_list_view": 1, "label": "Reserved Quantity", "oldfieldname": "reserved_qty", "oldfieldtype": "Currency", @@ -87,6 +82,7 @@ "fieldname": "actual_qty", "fieldtype": "Float", "in_filter": 1, + "in_list_view": 1, "label": "Actual Quantity", "oldfieldname": "actual_qty", "oldfieldtype": "Currency", @@ -98,6 +94,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/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index bbc22b9ade6..790d4096752 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -106,12 +106,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) { @@ -122,7 +122,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() { @@ -135,7 +137,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){ @@ -223,11 +227,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" } } } @@ -246,8 +250,11 @@ 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: doc.company} + + filters: { + 'company_name': doc.company, + 'group_or_ledger': "Ledger" + } } } } \ No newline at end of file diff --git a/stock/doctype/delivery_note_item/delivery_note_item.txt b/stock/doctype/delivery_note_item/delivery_note_item.txt index ef5a98435d9..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-09 12:42:09", + "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", @@ -82,11 +87,19 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Quantity and Rate" + }, { "default": "0.00", "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -99,6 +112,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -113,6 +127,7 @@ "doctype": "DocField", "fieldname": "ref_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Price List Rate", "no_copy": 0, "oldfieldname": "ref_rate", @@ -129,6 +144,7 @@ "doctype": "DocField", "fieldname": "adj_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount (%)", "oldfieldname": "adj_rate", "oldfieldtype": "Float", @@ -141,6 +157,7 @@ "doctype": "DocField", "fieldname": "export_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate", "oldfieldname": "export_rate", "oldfieldtype": "Currency", @@ -155,6 +172,7 @@ "doctype": "DocField", "fieldname": "export_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "export_amount", "oldfieldtype": "Currency", @@ -169,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", @@ -183,6 +202,7 @@ "doctype": "DocField", "fieldname": "basic_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "basic_rate", "oldfieldtype": "Currency", @@ -197,6 +217,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -207,10 +228,18 @@ "reqd": 0, "width": "100px" }, + { + "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", @@ -225,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/item.js b/stock/doctype/item/item.js index 7a731d28ecf..3d427ad3116 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -51,39 +51,64 @@ 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 + } + } } // 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 +119,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 +163,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/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/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/landed_cost_wizard/landed_cost_wizard.js b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js index eb0c3df0a30..a093d6f2640 100644 --- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js +++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js @@ -20,5 +20,12 @@ 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'] + ] + } } 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) diff --git a/stock/doctype/material_request_item/material_request_item.txt b/stock/doctype/material_request_item/material_request_item.txt index 992b4cf239e..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-09 11:37:12", + "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", @@ -64,10 +67,18 @@ "reqd": 1, "width": "250px" }, + { + "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", @@ -82,6 +93,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Quantity", "no_copy": 0, "oldfieldname": "qty", @@ -94,6 +106,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "Stock UOM", "no_copy": 0, "oldfieldname": "uom", @@ -108,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", @@ -120,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/packing_slip.js b/stock/doctype/packing_slip/packing_slip.js index 18a248660dd..e19ab493004 100644 --- a/stock/doctype/packing_slip/packing_slip.js +++ b/stock/doctype/packing_slip/packing_slip.js @@ -15,17 +15,18 @@ // 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} + } } 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..63aa6a9431b 100644 --- a/stock/doctype/packing_slip/packing_slip.py +++ b/stock/doctype/packing_slip/packing_slip.py @@ -171,4 +171,15 @@ 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/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/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/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt index 186ab3de825..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-09 12:20:50", + "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", @@ -65,11 +68,19 @@ "reqd": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "received_and_accepted", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Received and Accepted" + }, { "default": "0.00", "doctype": "DocField", "fieldname": "received_qty", "fieldtype": "Float", + "in_list_view": 0, "label": "Recd Quantity", "oldfieldname": "received_qty", "oldfieldtype": "Currency", @@ -84,6 +95,7 @@ "doctype": "DocField", "fieldname": "qty", "fieldtype": "Float", + "in_list_view": 1, "label": "Accepted Quantity", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -97,6 +109,7 @@ "fieldname": "rejected_qty", "fieldtype": "Float", "in_filter": 0, + "in_list_view": 0, "label": "Rejected Quantity", "oldfieldname": "rejected_qty", "oldfieldtype": "Currency", @@ -110,6 +123,7 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", + "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -120,10 +134,18 @@ "reqd": 1, "width": "100px" }, + { + "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, @@ -133,6 +155,7 @@ "doctype": "DocField", "fieldname": "discount_rate", "fieldtype": "Float", + "in_list_view": 0, "label": "Discount %", "print_hide": 1, "read_only": 0 @@ -142,6 +165,7 @@ "doctype": "DocField", "fieldname": "import_rate", "fieldtype": "Currency", + "in_list_view": 1, "label": "Rate", "oldfieldname": "import_rate", "oldfieldtype": "Currency", @@ -155,6 +179,7 @@ "doctype": "DocField", "fieldname": "import_amount", "fieldtype": "Currency", + "in_list_view": 1, "label": "Amount", "oldfieldname": "import_amount", "oldfieldtype": "Currency", @@ -165,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, @@ -175,6 +201,7 @@ "doctype": "DocField", "fieldname": "purchase_rate", "fieldtype": "Currency", + "in_list_view": 0, "label": "Rate (Company Currency)", "oldfieldname": "purchase_rate", "oldfieldtype": "Currency", @@ -190,6 +217,7 @@ "doctype": "DocField", "fieldname": "amount", "fieldtype": "Currency", + "in_list_view": 0, "label": "Amount (Company Currency)", "oldfieldname": "amount", "oldfieldtype": "Currency", @@ -200,11 +228,19 @@ "reqd": 0, "width": "100px" }, + { + "doctype": "DocField", + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Warehouse and Reference" + }, { "doctype": "DocField", "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, + "in_list_view": 0, "label": "Accepted Warehouse", "oldfieldname": "warehouse", "oldfieldtype": "Link", @@ -218,6 +254,7 @@ "doctype": "DocField", "fieldname": "conversion_factor", "fieldtype": "Float", + "in_list_view": 0, "label": "Conversion Factor", "oldfieldname": "conversion_factor", "oldfieldtype": "Currency", @@ -231,6 +268,7 @@ "doctype": "DocField", "fieldname": "stock_uom", "fieldtype": "Data", + "in_list_view": 0, "label": "Stock UOM", "oldfieldname": "stock_uom", "oldfieldtype": "Data", @@ -245,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/serial_no/serial_no.js b/stock/doctype/serial_no/serial_no.js index 9e1426c6a4d..0253ffbe839 100644 --- a/stock/doctype/serial_no/serial_no.js +++ b/stock/doctype/serial_no/serial_no.js @@ -46,7 +46,9 @@ 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"} + } } // Supplier @@ -59,11 +61,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 468d3d7a960..3fc03cb5ae6 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" + } } } } @@ -280,9 +284,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) { @@ -307,17 +314,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"); @@ -374,6 +385,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" } } diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index 2595f9b6564..4e2d484ca46 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 @@ -718,24 +719,31 @@ 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("%", "") @@ -761,6 +769,26 @@ 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_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.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/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/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/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/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/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..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 \ @@ -47,15 +52,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 +65,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..95b0b52e546 100644 --- a/stock/doctype/warehouse/warehouse.txt +++ b/stock/doctype/warehouse/warehouse.txt @@ -2,20 +2,18 @@ { "creation": "2013-03-07 18:50:32", "docstatus": 0, - "modified": "2013-07-05 15:02:12", + "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", "icon": "icon-building", "module": "Stock", - "name": "__common__", - "search_fields": "warehouse_type" + "name": "__common__" }, { "doctype": "DocField", @@ -57,19 +55,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 +65,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/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/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") } ] }, diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js index 558ef321b48..226849363ab 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() { @@ -65,24 +64,29 @@ 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['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 +101,16 @@ 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} + } } 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] + ] + } } } @@ -113,10 +118,10 @@ 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"} + } } -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" } } 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_schedule/maintenance_schedule.js b/support/doctype/maintenance_schedule/maintenance_schedule.js index ec75289290f..fab9b2a625a 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})); @@ -62,16 +71,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) { @@ -82,15 +97,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){ @@ -118,7 +124,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" } } 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_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 3a95b2c0a3f..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-03-07 07:03:24", + "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", @@ -57,11 +60,19 @@ "read_only": 1, "width": "300px" }, + { + "doctype": "DocField", + "fieldname": "schedule_details", + "fieldtype": "Section Break", + "in_list_view": 0, + "label": "Schedule Details" + }, { "doctype": "DocField", "fieldname": "start_date", "fieldtype": "Date", "in_filter": 1, + "in_list_view": 1, "label": "Start Date", "oldfieldname": "start_date", "oldfieldtype": "Date", @@ -73,6 +84,7 @@ "fieldname": "end_date", "fieldtype": "Date", "in_filter": 1, + "in_list_view": 1, "label": "End Date", "oldfieldname": "end_date", "oldfieldtype": "Date", @@ -83,6 +95,7 @@ "doctype": "DocField", "fieldname": "periodicity", "fieldtype": "Select", + "in_list_view": 1, "label": "Periodicity", "oldfieldname": "periodicity", "oldfieldtype": "Select", @@ -102,13 +115,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..0b0d0109bd6 100644 --- a/support/doctype/maintenance_visit/maintenance_visit.js +++ b/support/doctype/maintenance_visit/maintenance_visit.js @@ -17,6 +17,48 @@ 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: { + 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 +71,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 +81,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) { @@ -77,23 +93,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} + } } 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); + return{ + filters:{'customer': doc.customer} + } } 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) { @@ -104,36 +118,15 @@ 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'; + 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_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..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-03-07 07:03:24", + "modified": "2013-07-10 14:54:10", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -25,40 +25,11 @@ "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", "fieldtype": "Link", + "in_list_view": 1, "label": "Item Code", "oldfieldname": "item_code", "oldfieldtype": "Link", @@ -68,6 +39,7 @@ "doctype": "DocField", "fieldname": "item_name", "fieldtype": "Data", + "in_list_view": 1, "label": "Item Name", "oldfieldname": "item_name", "oldfieldtype": "Data", @@ -77,10 +49,51 @@ "doctype": "DocField", "fieldname": "serial_no", "fieldtype": "Small Text", + "in_list_view": 1, "label": "Serial No", "oldfieldname": "serial_no", "oldfieldtype": "Small Text" }, + { + "doctype": "DocField", + "fieldname": "description", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "print_width": "300px", + "reqd": 1, + "width": "300px" + }, + { + "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", + "options": "Sales Person", + "reqd": 1 + }, + { + "doctype": "DocField", + "fieldname": "work_done", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Work Done", + "oldfieldname": "work_done", + "oldfieldtype": "Small Text", + "reqd": 1 + }, { "doctype": "DocField", "fieldname": "prevdoc_docname", 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 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, 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/utilities/transaction_base.py b/utilities/transaction_base.py index a268564a9b4..db5cc072a02 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -274,24 +274,29 @@ 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: - if prevdoc_values[field] is not None: - 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: + if prevdoc_values[field] is not None: + self.validate_value(field, condition, prevdoc_values[field], doc) def get_default_address_and_contact(party_field, party_name, fetch_shipping_address=False): out = {} diff --git a/website/css/website.css b/website/css/website.css index 64cff7f9735..3ced12ffcc8 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/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/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/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_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/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", 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"), 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 @@ -