diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py index 7a73b067565..9d7367ed2dd 100644 --- a/accounts/doctype/gl_entry/gl_entry.py +++ b/accounts/doctype/gl_entry/gl_entry.py @@ -135,17 +135,18 @@ def check_freezing_date(posting_date, adv_adj=False): def update_outstanding_amt(account, against_voucher_type, against_voucher, on_cancel=False): # get final outstanding amt - bal = flt(webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry` + bal = flt(webnotes.conn.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) + from `tabGL Entry` where against_voucher_type=%s and against_voucher=%s and account = %s""", (against_voucher_type, against_voucher, account))[0][0] or 0.0) if against_voucher_type == 'Purchase Invoice': bal = -bal elif against_voucher_type == "Journal Voucher": - against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit) + against_voucher_amount = flt(webnotes.conn.sql(""" + select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s and account = %s""", (against_voucher, account))[0][0]) - bal = against_voucher_amount + bal if against_voucher_amount < 0: bal = -bal diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index d3c19cbe9d4..6b8a616a55d 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -456,12 +456,17 @@ class DocType(BuyingController): @webnotes.whitelist() def get_expense_account(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond - + + # expense account can be any Debit account, + # but can also be a Liability account with account_type='Expense Account' in special circumstances. + # Hence the first condition is an "OR" return webnotes.conn.sql("""select tabAccount.name from `tabAccount` where (tabAccount.debit_or_credit="Debit" - or tabAccount.account_type = "Expense Account") + or tabAccount.account_type = "Expense Account") and tabAccount.group_or_ledger="Ledger" and tabAccount.docstatus!=2 + and ifnull(tabAccount.master_type, "")="" + and ifnull(tabAccount.master_name, "")="" and tabAccount.company = '%(company)s' and tabAccount.%(key)s LIKE '%(txt)s' %(mcond)s""" % {'company': filters['company'], 'key': searchfield, diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.txt b/accounts/doctype/purchase_invoice/purchase_invoice.txt index 7f0a65d11f6..f98c14a23f3 100755 --- a/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-11-03 14:11:34", + "modified": "2013-11-05 23:09:38", "modified_by": "Administrator", "owner": "Administrator" }, @@ -85,7 +85,7 @@ "depends_on": "supplier", "doctype": "DocField", "fieldname": "supplier_name", - "fieldtype": "Text", + "fieldtype": "Data", "hidden": 0, "in_list_view": 1, "label": "Name", @@ -248,7 +248,6 @@ "read_only": 0 }, { - "depends_on": "buying_price_list", "doctype": "DocField", "fieldname": "price_list_currency", "fieldtype": "Link", @@ -258,7 +257,6 @@ "read_only": 1 }, { - "depends_on": "buying_price_list", "doctype": "DocField", "fieldname": "plc_conversion_rate", "fieldtype": "Float", @@ -320,7 +318,6 @@ "read_only": 1 }, { - "description": "Add / Edit Taxes and Charges", "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", @@ -333,7 +330,7 @@ "doctype": "DocField", "fieldname": "purchase_other_charges", "fieldtype": "Link", - "label": "Purchase Taxes and Charges", + "label": "Tax Master", "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", "options": "Purchase Taxes and Charges Master", diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index cdae74eac49..e183590695a 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -897,11 +897,16 @@ def get_bank_cash_account(mode_of_payment): def get_income_account(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond + # income account can be any Credit account, + # but can also be a Asset account with account_type='Income Account' in special circumstances. + # Hence the first condition is an "OR" return webnotes.conn.sql("""select tabAccount.name from `tabAccount` where (tabAccount.debit_or_credit="Credit" or tabAccount.account_type = "Income Account") and tabAccount.group_or_ledger="Ledger" - and tabAccount.docstatus!=2 + and tabAccount.docstatus!=2 + and ifnull(tabAccount.master_type, "")="" + and ifnull(tabAccount.master_name, "")="" and tabAccount.company = '%(company)s' and tabAccount.%(key)s LIKE '%(txt)s' %(mcond)s""" % {'company': filters['company'], 'key': searchfield, 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 9841783f76d..3f64369a51c 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 @@ -7,7 +7,7 @@ wn.require("app/js/controllers/accounts.js"); cur_frm.cscript.onload = function(doc, cdt, cdn) { if(doc.doctype === "Sales Taxes and Charges Master") - erpnext.add_for_territory(); + erpnext.add_applicable_territory(); } cur_frm.cscript.refresh = function(doc, cdt, cdn) { diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt index 20e40768bd7..cddf10ec850 100644 --- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt +++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:09", "docstatus": 0, - "modified": "2013-07-22 15:22:14", + "modified": "2013-10-31 19:25:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -94,7 +94,7 @@ "fieldname": "valid_for_territories", "fieldtype": "Table", "label": "Valid for Territories", - "options": "For Territory", + "options": "Applicable Territory", "reqd": 1 }, { diff --git a/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py b/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py index 74b0b4edb4f..7a013fbf481 100644 --- a/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py +++ b/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py @@ -25,7 +25,7 @@ test_records = [ "rate": 6.36, }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "All Territories" } @@ -113,7 +113,7 @@ test_records = [ "row_id": 7 }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "_Test Territory India" } @@ -141,7 +141,7 @@ test_records = [ "rate": 4, }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "All Territories" } diff --git a/accounts/doctype/shipping_rule/shipping_rule.js b/accounts/doctype/shipping_rule/shipping_rule.js index 2aeb8ddcd35..2a0c4339965 100644 --- a/accounts/doctype/shipping_rule/shipping_rule.js +++ b/accounts/doctype/shipping_rule/shipping_rule.js @@ -3,6 +3,6 @@ $.extend(cur_frm.cscript, { onload: function() { - erpnext.add_for_territory(); + erpnext.add_applicable_territory(); } }); \ No newline at end of file diff --git a/accounts/doctype/shipping_rule/shipping_rule.txt b/accounts/doctype/shipping_rule/shipping_rule.txt index 43589b49a3c..27aaa70115f 100644 --- a/accounts/doctype/shipping_rule/shipping_rule.txt +++ b/accounts/doctype/shipping_rule/shipping_rule.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-25 11:48:03", "docstatus": 0, - "modified": "2013-07-05 14:55:00", + "modified": "2013-10-31 19:24:50", "modified_by": "Administrator", "owner": "Administrator" }, @@ -87,7 +87,7 @@ "fieldname": "valid_for_territories", "fieldtype": "Table", "label": "Valid For Territories", - "options": "For Territory", + "options": "Applicable Territory", "reqd": 1 }, { diff --git a/accounts/doctype/shipping_rule/test_shipping_rule.py b/accounts/doctype/shipping_rule/test_shipping_rule.py index f85909e2c01..a9aa4c702e5 100644 --- a/accounts/doctype/shipping_rule/test_shipping_rule.py +++ b/accounts/doctype/shipping_rule/test_shipping_rule.py @@ -62,7 +62,7 @@ test_records = [ "shipping_amount": 0.0 }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "_Test Territory" } diff --git a/accounts/page/general_ledger/general_ledger.js b/accounts/page/general_ledger/general_ledger.js index 93a23889bf0..dbc691b549a 100644 --- a/accounts/page/general_ledger/general_ledger.js +++ b/accounts/page/general_ledger/general_ledger.js @@ -24,7 +24,6 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({ }); }, setup_columns: function() { - var DEFAULT_COMPANY_VALUE = wn._("Select Company..."); this.columns = [ {id: "posting_date", name: wn._("Posting Date"), field: "posting_date", width: 100, formatter: this.date_formatter}, @@ -55,9 +54,9 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({ }, filters: [ - {fieldtype:"Select", label: wn._("Company"), link:"Company", default_value: DEFAULT_COMPANY_VALUE, + {fieldtype:"Select", label: wn._("Company"), link:"Company", default_value: wn._("Select Company..."), filter: function(val, item, opts) { - return item.company == val || val == DEFAULT_COMPANY_VALUE; + return item.company == val || val == opts.default_value; }}, {fieldtype:"Link", label: wn._("Account"), link:"Account", filter: function(val, item, opts, me) { diff --git a/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index 1c3cef3115d..4f11a61cc3d 100644 --- a/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -86,7 +86,7 @@ def get_tax_accounts(item_list, columns): item_wise_tax_detail = json.loads(item_wise_tax_detail) for item, tax_amount in item_wise_tax_detail.items(): item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \ - flt(tax_amount[1]) + flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount) except ValueError: continue diff --git a/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 48bc463f14f..ce8e3c566b5 100644 --- a/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -83,7 +83,7 @@ def get_tax_accounts(item_list, columns): item_wise_tax_detail = json.loads(item_wise_tax_detail) for item, tax_amount in item_wise_tax_detail.items(): item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \ - flt(tax_amount[1]) + flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount) except ValueError: continue diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 7e594e3a8e0..969c9be420c 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -425,15 +425,16 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ // toggle fields this.frm.toggle_display(["conversion_rate", "net_total", "grand_total", "in_words", "other_charges_added", "other_charges_deducted"], - this.frm.doc.currency != company_currency); - - this.frm.toggle_display(["plc_conversion_rate"], - this.frm.price_list_currency != company_currency); + this.frm.doc.currency !== company_currency); + this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], + this.frm.doc.price_list_currency !== company_currency); + // set labels $.each(field_label_map, function(fname, label) { me.frm.fields_dict[fname].set_label(label); }); + }, change_grid_labels: function(company_currency) { diff --git a/buying/doctype/purchase_order/purchase_order.txt b/buying/doctype/purchase_order/purchase_order.txt index 9536184bdf8..6a97eed8679 100644 --- a/buying/doctype/purchase_order/purchase_order.txt +++ b/buying/doctype/purchase_order/purchase_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-11-03 14:14:10", + "modified": "2013-11-05 23:09:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -215,7 +215,6 @@ "print_hide": 1 }, { - "depends_on": "buying_price_list", "doctype": "DocField", "fieldname": "price_list_currency", "fieldtype": "Link", @@ -225,7 +224,6 @@ "read_only": 1 }, { - "depends_on": "buying_price_list", "doctype": "DocField", "fieldname": "plc_conversion_rate", "fieldtype": "Float", @@ -308,7 +306,7 @@ "doctype": "DocField", "fieldname": "purchase_other_charges", "fieldtype": "Link", - "label": "Purchase Taxes and Charges", + "label": "Tax Master", "no_copy": 0, "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", @@ -491,7 +489,7 @@ "doctype": "DocField", "fieldname": "terms", "fieldtype": "Text Editor", - "label": "Terms and Conditions1", + "label": "Terms and Conditions", "oldfieldname": "terms", "oldfieldtype": "Text Editor" }, @@ -607,14 +605,6 @@ "print_hide": 1, "report_hide": 1 }, - { - "doctype": "DocField", - "fieldname": "instructions", - "fieldtype": "Text", - "label": "Instructions", - "oldfieldname": "instructions", - "oldfieldtype": "Text" - }, { "doctype": "DocField", "fieldname": "column_break5", @@ -652,26 +642,6 @@ "print_hide": 1, "read_only": 1 }, - { - "doctype": "DocField", - "fieldname": "payment_terms", - "fieldtype": "Text", - "label": "Payment Terms", - "no_copy": 1, - "oldfieldname": "payment_terms", - "oldfieldtype": "Text", - "print_hide": 0 - }, - { - "doctype": "DocField", - "fieldname": "remarks", - "fieldtype": "Text", - "label": "Remarks", - "no_copy": 1, - "oldfieldname": "remarks", - "oldfieldtype": "Text", - "print_hide": 1 - }, { "description": "Required raw materials issued to the supplier for producing a sub - contracted item.", "doctype": "DocField", diff --git a/controllers/queries.py b/controllers/queries.py index ed44f9b02dd..5248cb2f7d5 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -117,21 +117,30 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters): filters.get("company"), "%%%s%%" % txt, start, page_len])) def item_query(doctype, txt, searchfield, start, page_len, filters): + from webnotes.utils import nowdate + 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 + concat(substr(tabItem.description, 1, 40), "..."), description) as decription from tabItem - where tabItem.docstatus<2 - 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}) + where tabItem.docstatus < 2 + and (ifnull(tabItem.end_of_life, '') = '' or tabItem.end_of_life > %(today)s) + and (tabItem.`{key}` LIKE %(txt)s + or tabItem.item_name LIKE %(txt)s) + {fcond} {mcond} + limit %(start)s, %(page_len)s """.format(key=searchfield, + fcond=get_filters_cond(doctype, filters, conditions), + mcond=get_match_cond(doctype, searchfield)), + { + "today": nowdate(), + "txt": "%%%s%%" % txt, + "start": start, + "page_len": page_len + }) def bom(doctype, txt, searchfield, start, page_len, filters): conditions = [] @@ -206,4 +215,4 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters): 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 + 'page_len': page_len}) diff --git a/patches/1311/p01_cleanup.py b/patches/1311/p01_cleanup.py index 6c45aaeed95..cf7ae6e6ce2 100644 --- a/patches/1311/p01_cleanup.py +++ b/patches/1311/p01_cleanup.py @@ -1,6 +1,15 @@ import webnotes def execute(): - from core.doctype.custom_field.custom_field import delete_and_create_custom_field_if_values_exist - delete_and_create_custom_field_if_values_exist("Material Request", - {"fieldtype":"Text", "fieldname":"remark", "label":"Remarks","insert_after":"Fiscal Year"}) \ No newline at end of file + from core.doctype.custom_field.custom_field import create_custom_field_if_values_exist + create_custom_field_if_values_exist("Material Request", + {"fieldtype":"Text", "fieldname":"remark", "label":"Remarks","insert_after":"Fiscal Year"}) + create_custom_field_if_values_exist("Purchase Order", + {"fieldtype":"Text", "fieldname":"instructions", "label":"Instructions","insert_after":"% Billed"}) + create_custom_field_if_values_exist("Purchase Order", + {"fieldtype":"Text", "fieldname":"remarks", "label":"Remarks","insert_after":"% Billed"}) + create_custom_field_if_values_exist("Purchase Order", + {"fieldtype":"Text", "fieldname":"payment_terms", "label":"Payment Terms","insert_after":"Print Heading"}) + create_custom_field_if_values_exist("Lead", + {"fieldtype":"Text", "fieldname":"remark", "label":"Remark","insert_after":"Territory"}) + \ No newline at end of file diff --git a/patches/august_2013/p02_rename_price_list.py b/patches/august_2013/p02_rename_price_list.py index 0a1929925ba..dbe268f0adf 100644 --- a/patches/august_2013/p02_rename_price_list.py +++ b/patches/august_2013/p02_rename_price_list.py @@ -6,7 +6,7 @@ import webnotes def execute(): webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list") - webnotes.reload_doc("setup", "doctype", "item_price") + webnotes.reload_doc("stock", "doctype", "item_price") for t in [ ("Supplier Quotation", "price_list_name", "buying_price_list"), diff --git a/patches/june_2013/p03_buying_selling_for_price_list.py b/patches/june_2013/p03_buying_selling_for_price_list.py index ead97ab2a81..61cddd0b287 100644 --- a/patches/june_2013/p03_buying_selling_for_price_list.py +++ b/patches/june_2013/p03_buying_selling_for_price_list.py @@ -7,8 +7,8 @@ from webnotes.utils import cint import MySQLdb def execute(): - webnotes.reload_doc("setup", "doctype", "price_list") - webnotes.reload_doc("setup", "doctype", "item_price") + webnotes.reload_doc("stock", "doctype", "price_list") + webnotes.reload_doc("stock", "doctype", "item_price") try: for price_list in webnotes.conn.sql_list("""select name from `tabPrice List`"""): diff --git a/patches/june_2013/p07_taxes_price_list_for_territory.py b/patches/june_2013/p07_taxes_price_list_for_territory.py index f57ecf81736..f6663bf6af0 100644 --- a/patches/june_2013/p07_taxes_price_list_for_territory.py +++ b/patches/june_2013/p07_taxes_price_list_for_territory.py @@ -4,8 +4,8 @@ import webnotes def execute(): - webnotes.reload_doc("setup", "doctype", "for_territory") - webnotes.reload_doc("setup", "doctype", "price_list") + webnotes.reload_doc("setup", "doctype", "applicable_territory") + webnotes.reload_doc("stock", "doctype", "price_list") webnotes.reload_doc("accounts", "doctype", "sales_taxes_and_charges_master") webnotes.reload_doc("accounts", "doctype", "shipping_rule") @@ -14,12 +14,12 @@ def execute(): for parenttype in ["Sales Taxes and Charges Master", "Price List", "Shipping Rule"]: for name in webnotes.conn.sql_list("""select name from `tab%s` main - where not exists (select parent from `tabFor Territory` territory + where not exists (select parent from `tabApplicable Territory` territory where territory.parenttype=%s and territory.parent=main.name)""" % \ (parenttype, "%s"), (parenttype,)): doc = webnotes.doc({ - "doctype": "For Territory", + "doctype": "Applicable Territory", "__islocal": 1, "parenttype": parenttype, "parentfield": "valid_for_territories", diff --git a/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py b/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py index 209ebf35748..4a90b8c634b 100644 --- a/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py +++ b/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import webnotes def execute(): - webnotes.reload_doc("setup", "doctype", "item_price") + webnotes.reload_doc("stock", "doctype", "item_price") webnotes.conn.sql("""update `tabItem Price` ip, `tabItem` i set ip.item_name=i.item_name, ip.item_description=i.description diff --git a/patches/october_2013/p07_rename_for_territory.py b/patches/october_2013/p07_rename_for_territory.py new file mode 100644 index 00000000000..96c72f3bf56 --- /dev/null +++ b/patches/october_2013/p07_rename_for_territory.py @@ -0,0 +1,24 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes, os + +def execute(): + from webnotes.utils import get_base_path + import shutil + webnotes.reload_doc("core", "doctype", "doctype") + + tables = webnotes.conn.sql_list("show tables") + + if "tabApplicable Territory" not in tables: + webnotes.rename_doc("DocType", "For Territory", "Applicable Territory", force=True) + + webnotes.reload_doc("setup", "doctype", "applicable_territory") + + path = os.path.join(get_base_path(), "app", "setup", "doctype", "for_territory") + if os.path.exists(path): + shutil.rmtree(path) + + if webnotes.conn.exists("DocType", "For Territory"): + webnotes.delete_doc("DocType", "For Territory") diff --git a/patches/october_2013/p08_cleanup_after_item_price_module_change.py b/patches/october_2013/p08_cleanup_after_item_price_module_change.py new file mode 100644 index 00000000000..ba0ab8d389d --- /dev/null +++ b/patches/october_2013/p08_cleanup_after_item_price_module_change.py @@ -0,0 +1,14 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes, os + +def execute(): + import shutil + from webnotes.utils import get_base_path + + for dt in ("item_price", "price_list"): + path = os.path.join(get_base_path(), "app", "setup", "doctype", dt) + if os.path.exists(path): + shutil.rmtree(path) diff --git a/patches/patch_list.py b/patches/patch_list.py index 63f06f7232f..1581841872d 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -161,7 +161,6 @@ patch_list = [ "execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')", "patches.june_2013.p05_remove_unused_doctypes", "patches.june_2013.p06_drop_unused_tables", - "patches.june_2013.p07_taxes_price_list_for_territory", "patches.june_2013.p08_shopping_cart_settings", "patches.june_2013.p09_update_global_defaults", "patches.june_2013.p10_lead_address", @@ -235,4 +234,7 @@ patch_list = [ "patches.october_2013.p04_update_report_permission", "patches.october_2013.p05_delete_gl_entries_for_cancelled_vouchers", "patches.october_2013.p06_update_control_panel_and_global_defaults", + "patches.october_2013.p07_rename_for_territory", + "patches.june_2013.p07_taxes_price_list_for_territory", + "patches.october_2013.p08_cleanup_after_item_price_module_change", ] \ No newline at end of file diff --git a/patches/september_2013/p03_modify_item_price_include_in_price_list.py b/patches/september_2013/p03_modify_item_price_include_in_price_list.py index 8ca6d76f9c8..2400918473d 100644 --- a/patches/september_2013/p03_modify_item_price_include_in_price_list.py +++ b/patches/september_2013/p03_modify_item_price_include_in_price_list.py @@ -5,8 +5,8 @@ from __future__ import unicode_literals import webnotes def execute(): - webnotes.reload_doc("setup", "doctype", "price_list") - webnotes.reload_doc("setup", "doctype", "item_price") + webnotes.reload_doc("stock", "doctype", "price_list") + webnotes.reload_doc("stock", "doctype", "item_price") webnotes.reload_doc("stock", "doctype", "item") webnotes.conn.sql("""update `tabItem Price` set parenttype='Price List', diff --git a/public/js/utils.js b/public/js/utils.js index 2e5eea515b6..227aa32676e 100644 --- a/public/js/utils.js +++ b/public/js/utils.js @@ -28,10 +28,10 @@ $.extend(erpnext, { } }, - add_for_territory: function() { + add_applicable_territory: function() { if(cur_frm.doc.__islocal && wn.model.get_doclist(cur_frm.doc.doctype, cur_frm.doc.name).length === 1) { - var territory = wn.model.add_child(cur_frm.doc, "For Territory", + var territory = wn.model.add_child(cur_frm.doc, "Applicable Territory", "valid_for_territories"); territory.territory = wn.defaults.get_default("territory"); } diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 9f6412cfd17..d65338fe815 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -23,8 +23,7 @@ erpnext.LeadController = wn.ui.form.Controller.extend({ } if(in_list(user_roles,'System Manager')) { - cur_frm.footer.help_area.innerHTML = '
\ -

'+wn._('Sales Email Settings')+'
\ + cur_frm.footer.help_area.innerHTML = '

'+wn._('Sales Email Settings')+'
\ '+wn._('Automatically extract Leads from a mail box e.g.')+' "sales@example.com"

'; } }, diff --git a/selling/doctype/lead/lead.txt b/selling/doctype/lead/lead.txt index 0fbf1a3ff60..b6d3eab0e93 100644 --- a/selling/doctype/lead/lead.txt +++ b/selling/doctype/lead/lead.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-10 11:45:37", "docstatus": 0, - "modified": "2013-11-02 16:58:44", + "modified": "2013-11-06 11:27:57", "modified_by": "Administrator", "owner": "Administrator" }, @@ -256,14 +256,6 @@ "fieldname": "column_break2", "fieldtype": "Column Break" }, - { - "doctype": "DocField", - "fieldname": "remark", - "fieldtype": "Small Text", - "label": "Remark", - "oldfieldname": "remark", - "oldfieldtype": "Text" - }, { "doctype": "DocField", "fieldname": "phone", diff --git a/selling/doctype/shopping_cart_settings/shopping_cart_settings.py b/selling/doctype/shopping_cart_settings/shopping_cart_settings.py index f3954584e7b..d23f5e232de 100644 --- a/selling/doctype/shopping_cart_settings/shopping_cart_settings.py +++ b/selling/doctype/shopping_cart_settings/shopping_cart_settings.py @@ -72,7 +72,7 @@ class DocType(DocListController): # make a map of territory: [list of names] # if list against each territory has more than one element, raise exception territory_name = webnotes.conn.sql("""select `territory`, `parent` - from `tabFor Territory` + from `tabApplicable Territory` where `parenttype`=%s and `parent` in (%s)""" % ("%s", ", ".join(["%s"]*len(names))), tuple([parenttype] + names)) diff --git a/selling/sales_common.js b/selling/sales_common.js index 3af6c955be2..5a1ee083da6 100644 --- a/selling/sales_common.js +++ b/selling/sales_common.js @@ -537,7 +537,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ "grand_total", "rounded_total", "in_words"], this.frm.doc.currency != company_currency); - this.frm.toggle_display(["plc_conversion_rate"], + this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], this.frm.doc.price_list_currency != company_currency); // set labels diff --git a/setup/doctype/for_territory/__init__.py b/setup/doctype/applicable_territory/__init__.py similarity index 100% rename from setup/doctype/for_territory/__init__.py rename to setup/doctype/applicable_territory/__init__.py diff --git a/setup/doctype/for_territory/for_territory.py b/setup/doctype/applicable_territory/applicable_territory.py similarity index 69% rename from setup/doctype/for_territory/for_territory.py rename to setup/doctype/applicable_territory/applicable_territory.py index 784339de7db..3256c80d422 100644 --- a/setup/doctype/for_territory/for_territory.py +++ b/setup/doctype/applicable_territory/applicable_territory.py @@ -1,5 +1,5 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt +# MIT License. See license.txt # For license information, please see license.txt diff --git a/setup/doctype/for_territory/for_territory.txt b/setup/doctype/applicable_territory/applicable_territory.txt similarity index 90% rename from setup/doctype/for_territory/for_territory.txt rename to setup/doctype/applicable_territory/applicable_territory.txt index 7bdb6e56e2c..10d84d14c5d 100644 --- a/setup/doctype/for_territory/for_territory.txt +++ b/setup/doctype/applicable_territory/applicable_territory.txt @@ -21,7 +21,7 @@ "label": "Territory", "name": "__common__", "options": "Territory", - "parent": "For Territory", + "parent": "Applicable Territory", "parentfield": "fields", "parenttype": "DocType", "permlevel": 0, @@ -29,7 +29,7 @@ }, { "doctype": "DocType", - "name": "For Territory" + "name": "Applicable Territory" }, { "doctype": "DocField" diff --git a/setup/page/setup_wizard/setup_wizard.py b/setup/page/setup_wizard/setup_wizard.py index d506d419542..61af55b98b6 100644 --- a/setup/page/setup_wizard/setup_wizard.py +++ b/setup/page/setup_wizard/setup_wizard.py @@ -108,7 +108,7 @@ def create_price_lists(args): "currency": args["currency"] }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "All Territories" } @@ -124,7 +124,9 @@ def set_defaults(args): 'default_currency': args.get('currency'), 'default_company':args.get('company_name'), 'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"), - "float_precision": 4 + "float_precision": 3, + "country": args.get("country"), + "time_zone": args.get("time_zone") }) global_defaults.save() @@ -164,9 +166,7 @@ def set_defaults(args): # control panel cp = webnotes.doc("Control Panel", "Control Panel") - for k in ['country', 'timezone', 'company_name']: - cp.fields[k] = args[k] - + cp.company_name = args["company_name"] cp.save() def create_feed_and_todo(): diff --git a/setup/doctype/item_price/README.md b/stock/doctype/item_price/README.md similarity index 100% rename from setup/doctype/item_price/README.md rename to stock/doctype/item_price/README.md diff --git a/setup/doctype/item_price/__init__.py b/stock/doctype/item_price/__init__.py similarity index 100% rename from setup/doctype/item_price/__init__.py rename to stock/doctype/item_price/__init__.py diff --git a/setup/doctype/item_price/item_price.js b/stock/doctype/item_price/item_price.js similarity index 100% rename from setup/doctype/item_price/item_price.js rename to stock/doctype/item_price/item_price.js diff --git a/setup/doctype/item_price/item_price.py b/stock/doctype/item_price/item_price.py similarity index 73% rename from setup/doctype/item_price/item_price.py rename to stock/doctype/item_price/item_price.py index be235de27c3..b398326d028 100644 --- a/setup/doctype/item_price/item_price.py +++ b/stock/doctype/item_price/item_price.py @@ -7,7 +7,7 @@ from __future__ import unicode_literals import webnotes from webnotes import _ -class ItemPriceDuplicateItem(Exception): pass +class ItemPriceDuplicateItem(webnotes.ValidationError): pass class DocType: def __init__(self, d, dl): @@ -30,6 +30,10 @@ class DocType: if webnotes.conn.sql("""select name from `tabItem Price` where item_code=%s and price_list=%s and name!=%s""", (self.doc.item_code, self.doc.price_list, self.doc.name)): - webnotes.throw(_("Duplicate Item: ") + self.doc.item_code + - _(" already available in Price List: ") + self.doc.price_list, - ItemPriceDuplicateItem) \ No newline at end of file + webnotes.throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{ + "duplicate_item": _("Duplicate Item"), + "item_code": self.doc.item_code, + "already": _("already available in Price List"), + "price_list": self.doc.price_list + }), ItemPriceDuplicateItem) + \ No newline at end of file diff --git a/setup/doctype/item_price/item_price.txt b/stock/doctype/item_price/item_price.txt similarity index 97% rename from setup/doctype/item_price/item_price.txt rename to stock/doctype/item_price/item_price.txt index 779bbd47e05..fc411eb1d64 100644 --- a/setup/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-10-21 15:11:20", + "modified": "2013-10-31 12:59:02", "modified_by": "Administrator", "owner": "Administrator" }, @@ -14,7 +14,7 @@ "icon": "icon-flag", "in_create": 0, "istable": 0, - "module": "Setup", + "module": "Stock", "name": "__common__", "read_only": 0 }, diff --git a/setup/doctype/item_price/test_item_price.py b/stock/doctype/item_price/test_item_price.py similarity index 68% rename from setup/doctype/item_price/test_item_price.py rename to stock/doctype/item_price/test_item_price.py index 43694da8fa7..73b8a8cceca 100644 --- a/setup/doctype/item_price/test_item_price.py +++ b/stock/doctype/item_price/test_item_price.py @@ -4,12 +4,12 @@ from __future__ import unicode_literals import unittest import webnotes -from setup.doctype.item_price.item_price import ItemPriceDuplicateItem class TestItem(unittest.TestCase): def test_duplicate_item(self): - item_price = webnotes.bean(copy=test_records[0]) - self.assertRaises(ItemPriceDuplicateItem, item_price.insert) + from stock.doctype.item_price.item_price import ItemPriceDuplicateItem + bean = webnotes.bean(copy=test_records[0]) + self.assertRaises(ItemPriceDuplicateItem, bean.insert) test_records = [ [ diff --git a/setup/doctype/price_list/README.md b/stock/doctype/price_list/README.md similarity index 100% rename from setup/doctype/price_list/README.md rename to stock/doctype/price_list/README.md diff --git a/setup/doctype/price_list/__init__.py b/stock/doctype/price_list/__init__.py similarity index 100% rename from setup/doctype/price_list/__init__.py rename to stock/doctype/price_list/__init__.py diff --git a/setup/doctype/price_list/price_list.css b/stock/doctype/price_list/price_list.css similarity index 100% rename from setup/doctype/price_list/price_list.css rename to stock/doctype/price_list/price_list.css diff --git a/setup/doctype/price_list/price_list.js b/stock/doctype/price_list/price_list.js similarity index 90% rename from setup/doctype/price_list/price_list.js rename to stock/doctype/price_list/price_list.js index 84c4c2f9575..be3aeaab33f 100644 --- a/setup/doctype/price_list/price_list.js +++ b/stock/doctype/price_list/price_list.js @@ -3,7 +3,7 @@ $.extend(cur_frm.cscript, { onload: function() { - erpnext.add_for_territory(); + erpnext.add_applicable_territory(); }, refresh: function() { diff --git a/setup/doctype/price_list/price_list.py b/stock/doctype/price_list/price_list.py similarity index 97% rename from setup/doctype/price_list/price_list.py rename to stock/doctype/price_list/price_list.py index d94b78e19a6..993f4ea94b7 100644 --- a/setup/doctype/price_list/price_list.py +++ b/stock/doctype/price_list/price_list.py @@ -18,7 +18,7 @@ class DocType(DocListController): # if no territory, set default territory if webnotes.defaults.get_user_default("territory"): self.doclist.append({ - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": webnotes.defaults.get_user_default("territory") }) diff --git a/setup/doctype/price_list/price_list.txt b/stock/doctype/price_list/price_list.txt similarity index 95% rename from setup/doctype/price_list/price_list.txt rename to stock/doctype/price_list/price_list.txt index b93cfcc2c3a..d43076bcc87 100644 --- a/setup/doctype/price_list/price_list.txt +++ b/stock/doctype/price_list/price_list.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-25 11:35:09", "docstatus": 0, - "modified": "2013-10-18 13:33:07", + "modified": "2013-10-31 19:24:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -17,7 +17,7 @@ "document_type": "Master", "icon": "icon-tags", "max_attachments": 1, - "module": "Setup", + "module": "Stock", "name": "__common__" }, { @@ -81,7 +81,7 @@ "fieldname": "valid_for_territories", "fieldtype": "Table", "label": "Valid for Territories", - "options": "For Territory", + "options": "Applicable Territory", "reqd": 1 }, { diff --git a/setup/doctype/price_list/test_price_list.py b/stock/doctype/price_list/test_price_list.py similarity index 87% rename from setup/doctype/price_list/test_price_list.py rename to stock/doctype/price_list/test_price_list.py index d5174ed7fc4..e3fa791e42b 100644 --- a/setup/doctype/price_list/test_price_list.py +++ b/stock/doctype/price_list/test_price_list.py @@ -15,7 +15,7 @@ test_records = [ "buying_or_selling": "Selling" }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "All Territories" }, @@ -28,7 +28,7 @@ test_records = [ "buying_or_selling": "Selling" }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "_Test Territory Rest of the World" } @@ -41,7 +41,7 @@ test_records = [ "buying_or_selling": "Selling" }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "_Test Territory India" } @@ -54,12 +54,12 @@ test_records = [ "buying_or_selling": "Selling" }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "_Test Territory Rest of the World" }, { - "doctype": "For Territory", + "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "_Test Territory United States" } diff --git a/utilities/demo/demo-login.js b/utilities/demo/demo-login.js index 03fe6b96b91..509057b9ef9 100644 --- a/utilities/demo/demo-login.js +++ b/utilities/demo/demo-login.js @@ -14,9 +14,9 @@ $(document).ready(function() { callback: function(r) { $(me).prop("disabled", false); if(r.exc) { - alert(wn._("Error, please contact support@erpnext.com")); + alert("Error, please contact support@erpnext.com"); } else { - console.log(wn._("Logged In")); + console.log("Logged In"); window.location.href = "app.html"; } }