Merge branch 'develop' into new-subscription
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 99981bd..a4647e3 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
-__version__ = '10.1.6'
+__version__ = '10.1.7'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json
index 0294219..3ab73b7 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json
@@ -165,6 +165,36 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "include_pos_transactions",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Include POS Transactions",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "get_payment_entries",
"fieldtype": "Button",
"hidden": 0,
@@ -292,7 +322,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2017-04-21 16:58:26.902732",
+ "modified": "2018-03-07 18:58:48.658687",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation",
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index e8b60ac..7814b08 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -53,10 +53,26 @@
posting_date ASC, name DESC
""".format(condition),
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
-
- entries = sorted(list(payment_entries)+list(journal_entries),
+
+ pos_entries = []
+ if self.include_pos_transactions:
+ pos_entries = frappe.db.sql("""
+ select
+ "Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
+ si.posting_date, si.debit_to as against_account, sip.clearance_date,
+ account.account_currency, 0 as credit
+ from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
+ where
+ sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
+ and account.name = sip.account and si.posting_date >= %(from)s and si.posting_date <= %(to)s {0}
+ order by
+ si.posting_date ASC, si.name DESC
+ """.format(condition),
+ {"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
+
+ entries = sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate()))
-
+
self.set('payment_entries', [])
self.total_amount = 0.0
diff --git a/erpnext/accounts/doctype/bank_reconciliation/test_bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/test_bank_reconciliation.py
new file mode 100644
index 0000000..932fb33
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_reconciliation/test_bank_reconciliation.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestBankReconciliation(unittest.TestCase):
+ pass
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 8800a0a..7bdb6fb 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -685,6 +685,24 @@
return ret
+def get_outstanding_on_journal_entry(name):
+ res = frappe.db.sql(
+ 'SELECT '
+ 'CASE WHEN party_type IN ("Customer", "Student") '
+ 'THEN ifnull(sum(debit_in_account_currency - credit_in_account_currency), 0) '
+ 'ELSE ifnull(sum(credit_in_account_currency - debit_in_account_currency), 0) '
+ 'END as outstanding_amount '
+ 'FROM `tabGL Entry` WHERE (voucher_no=%s OR against_voucher=%s) '
+ 'AND party_type IS NOT NULL '
+ 'AND party_type != ""',
+ (name, name), as_dict=1
+ )
+
+ outstanding_amount = res[0].get('outstanding_amount', 0) if res else 0
+
+ return outstanding_amount
+
+
@frappe.whitelist()
def get_reference_details(reference_doctype, reference_name, party_account_currency):
total_amount = outstanding_amount = exchange_rate = None
@@ -695,6 +713,13 @@
total_amount = ref_doc.get("grand_total")
exchange_rate = 1
outstanding_amount = ref_doc.get("outstanding_amount")
+ elif reference_doctype == "Journal Entry" and ref_doc.docstatus == 1:
+ total_amount = ref_doc.get("total_amount")
+ if ref_doc.multi_currency:
+ exchange_rate = get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
+ else:
+ exchange_rate = 1
+ outstanding_amount = get_outstanding_on_journal_entry(reference_name)
elif reference_doctype != "Journal Entry":
if party_account_currency == company_currency:
if ref_doc.doctype == "Expense Claim":
diff --git a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
index 2fcd44f..3ae7d62 100644
--- a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
+++ b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
@@ -42,6 +42,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -73,6 +74,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -104,6 +106,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -135,6 +138,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -166,6 +170,39 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "mode_of_payment",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Mode of Payment",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Mode of Payment",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
}
],
@@ -179,8 +216,8 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-12-19 16:20:33.546984",
- "modified_by": "nabinhait@gmail.com",
+ "modified": "2018-03-08 11:26:18.266987",
+ "modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Schedule",
"name_case": "",
diff --git a/erpnext/accounts/doctype/payment_term/payment_term.json b/erpnext/accounts/doctype/payment_term/payment_term.json
index 10cfcf2..723d3bd 100644
--- a/erpnext/accounts/doctype/payment_term/payment_term.json
+++ b/erpnext/accounts/doctype/payment_term/payment_term.json
@@ -41,6 +41,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -71,6 +72,39 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "mode_of_payment",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Mode of Payment",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Mode of Payment",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -100,6 +134,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -131,6 +166,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -162,6 +198,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -193,6 +230,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -222,6 +260,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -252,6 +291,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
}
],
@@ -265,7 +305,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-01-24 11:13:42.800048",
+ "modified": "2018-03-08 10:47:32.830478",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Term",
diff --git a/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json b/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json
index f808a0f..ee2cfc0 100644
--- a/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json
+++ b/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json
@@ -42,6 +42,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -73,6 +74,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -105,6 +107,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -136,6 +139,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -169,6 +173,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -201,6 +206,39 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "mode_of_payment",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Mode of Payment",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Mode of Payment",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
}
],
@@ -214,7 +252,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-09-26 05:21:51.738319",
+ "modified": "2018-03-08 11:07:09.014151",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Terms Template Detail",
diff --git a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
index 531622d..b9e5c8d 100644
--- a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
+++ b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
@@ -227,6 +227,36 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "clearance_date",
+ "fieldtype": "Date",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Clearance Date",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
}
],
"has_web_view": 0,
@@ -239,7 +269,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-07-24 17:25:03.765856",
+ "modified": "2018-03-07 18:34:39.552769",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Payment",
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index ccb5553..e5bcba4 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -394,7 +394,8 @@
this.frm = {}
this.frm.doc = this.doc
this.set_transaction_defaults("Customer");
- this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
+ this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false;
+ this.frm.doc["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.wrapper.html(frappe.render_template("pos", this.frm.doc));
this.make_search();
this.make_customer();
@@ -1257,6 +1258,7 @@
$(this.wrapper).find('.selected-item').empty();
if(this.child_doc.length) {
this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
+ this.child_doc[0]["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
$(this.wrapper).find('.selected-item').html(this.selected_row)
}
@@ -1692,7 +1694,7 @@
setInterval(function () {
me.freeze_screen = false;
me.sync_sales_invoice()
- }, 60000)
+ }, 180000)
},
sync_sales_invoice: function () {
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
index 0f9fdd7..57fe4b0 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -28,5 +28,10 @@
"default": frappe.datetime.get_today(),
"reqd": 1
},
+ {
+ "fieldname":"include_pos_transactions",
+ "label": __("Include POS Transactions"),
+ "fieldtype": "Check"
+ },
]
-}
+}
\ No newline at end of file
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
index 95b7ff7..eca5975 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -138,7 +138,23 @@
and ifnull(clearance_date, '4000-01-01') > %(report_date)s
""", filters, as_dict=1)
- return sorted(list(payment_entries)+list(journal_entries),
+ pos_entries = []
+ if filters.include_pos_transactions:
+ pos_entries = frappe.db.sql("""
+ select
+ "Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
+ si.posting_date, si.debit_to as against_account, sip.clearance_date,
+ account.account_currency, 0 as credit
+ from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
+ where
+ sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
+ and account.name = sip.account and si.posting_date <= %(report_date)s and
+ ifnull(sip.clearance_date, '4000-01-01') > %(report_date)s
+ order by
+ si.posting_date ASC, si.name DESC
+ """, filters, as_dict=1)
+
+ return sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate()))
def get_amounts_not_reflected_in_system(filters):
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 610475a..73bb4dc 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -179,7 +179,7 @@
invoice_tax_map = {}
for d in tax_details:
if d.account_head in expense_accounts:
- if invoice_expense_map[d.parent].has_key(d.account_head):
+ if d.account_head in invoice_expense_map[d.parent]:
invoice_expense_map[d.parent][d.account_head] += flt(d.tax_amount)
else:
invoice_expense_map[d.parent][d.account_head] = flt(d.tax_amount)
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index ace8d54..4debbd6 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -189,7 +189,7 @@
invoice_tax_map = {}
for d in tax_details:
if d.account_head in income_accounts:
- if invoice_income_map[d.parent].has_key(d.account_head):
+ if d.account_head in invoice_income_map[d.parent]:
invoice_income_map[d.parent][d.account_head] += flt(d.tax_amount)
else:
invoice_income_map[d.parent][d.account_head] = flt(d.tax_amount)
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 7142c69..8c55df5 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -175,7 +175,7 @@
def prepare_data(accounts, filters, total_row, parent_children_map, company_currency):
data = []
- tmpaccnt = sorted(accounts)
+ tmpaccnt = sorted(accounts, key = lambda account: account.name)
if not (accounts[0].account_number is None):
accounts = tmpaccnt
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index c715fbd..6aa3b01 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -5,7 +5,7 @@
import frappe
import frappe.defaults
from frappe import msgprint, _
-from frappe.model.naming import make_autoname
+from frappe.model.naming import set_name_by_naming_series
from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
from erpnext.utilities.transaction_base import TransactionBase
from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this
@@ -28,7 +28,7 @@
if supp_master_name == 'Supplier Name':
self.name = self.supplier_name
else:
- self.name = make_autoname(self.naming_series + '.#####')
+ set_name_by_naming_series(self)
def on_update(self):
if not self.naming_series:
diff --git a/erpnext/config/crm.py b/erpnext/config/crm.py
index e51275c..dd67005 100644
--- a/erpnext/config/crm.py
+++ b/erpnext/config/crm.py
@@ -126,6 +126,11 @@
"link": "Tree/Sales Person",
"description": _("Manage Sales Person Tree."),
},
+ {
+ "type": "doctype",
+ "name": "Lead Source",
+ "description": _("Track Leads by Lead Source.")
+ },
]
},
{
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index fef902e..b48cafc 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -173,6 +173,11 @@
"name": "Industry Type",
"description": _("Track Leads by Industry Type.")
},
+ {
+ "type": "doctype",
+ "name": "Lead Source",
+ "description": _("Track Leads by Lead Source.")
+ },
]
},
{
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index c6d911a..3884bef 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -947,6 +947,7 @@
if getdate(term_details.due_date) < getdate(posting_date):
term_details.due_date = posting_date
+ term_details.mode_of_payment = term.mode_of_payment
return term_details
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index e8260d9..7749ac5 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -94,7 +94,10 @@
InvalidItemAttributeValueError, title=_('Invalid Attribute'))
def validate_item_attribute_value(attributes_list, attribute, attribute_value, item):
- if attribute_value not in attributes_list:
+ allow_rename_attribute_value = frappe.db.get_single_value('Item Variant Settings', 'allow_rename_attribute_value')
+ if allow_rename_attribute_value:
+ pass
+ elif attribute_value not in attributes_list:
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values for Item {2}").format(
attribute_value, attribute, item), InvalidItemAttributeValueError, title=_('Invalid Attribute'))
diff --git a/erpnext/education/doctype/instructor/instructor.py b/erpnext/education/doctype/instructor/instructor.py
index 78e4261..0756b5f 100644
--- a/erpnext/education/doctype/instructor/instructor.py
+++ b/erpnext/education/doctype/instructor/instructor.py
@@ -6,7 +6,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.model.naming import make_autoname
+from frappe.model.naming import set_name_by_naming_series
class Instructor(Document):
def autoname(self):
@@ -15,7 +15,7 @@
frappe.throw(_("Please setup Instructor Naming System in Education > Education Settings"))
else:
if naming_method == 'Naming Series':
- self.name = make_autoname(self.naming_series + '.####')
+ set_name_by_naming_series(self)
elif naming_method == 'Employee Number':
if not self.employee:
frappe.throw(_("Please select Employee"))
diff --git a/erpnext/education/doctype/instructor/test_records.json b/erpnext/education/doctype/instructor/test_records.json
index 3747c0d..220d84e 100644
--- a/erpnext/education/doctype/instructor/test_records.json
+++ b/erpnext/education/doctype/instructor/test_records.json
@@ -1,12 +1,12 @@
[
{
"naming_series": "_T-Instructor-",
- "employee": "_T-Employee-0001",
+ "employee": "_T-Employee-00001",
"instructor_name": "_Test Instructor"
},
{
"naming_series": "_T-Instructor-",
- "employee": "_T-Employee-0002",
+ "employee": "_T-Employee-00002",
"instructor_name": "_Test Instructor 2"
}
]
diff --git a/erpnext/education/report/final_assessment_grades/final_assessment_grades.py b/erpnext/education/report/final_assessment_grades/final_assessment_grades.py
index efc9aff..e6e0ba2 100644
--- a/erpnext/education/report/final_assessment_grades/final_assessment_grades.py
+++ b/erpnext/education/report/final_assessment_grades/final_assessment_grades.py
@@ -27,26 +27,27 @@
course_dict = values.get("course_dict")
for student in args.students:
- student_row = {}
- student_row["student"] = student
- student_row["student_name"] = student_details[student]
- for course in course_dict:
- scrub_course = frappe.scrub(course)
- if assessment_group in assessment_result[student][course]:
- student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
- student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
+ if student_details.get(student):
+ student_row = {}
+ student_row["student"] = student
+ student_row["student_name"] = student_details[student]
+ for course in course_dict:
+ scrub_course = frappe.scrub(course)
+ if assessment_group in assessment_result[student][course]:
+ student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
+ student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
- # create the list of possible grades
- if student_row["grade_" + scrub_course] not in grades:
- grades.append(student_row["grade_" + scrub_course])
+ # create the list of possible grades
+ if student_row["grade_" + scrub_course] not in grades:
+ grades.append(student_row["grade_" + scrub_course])
- # create the dict of for gradewise analysis
- if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
- course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
- else:
- course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
+ # create the dict of for gradewise analysis
+ if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
+ course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
+ else:
+ course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
- data.append(student_row)
+ data.append(student_row)
course_list = [d for d in course_dict]
columns = get_column(course_dict)
diff --git a/erpnext/healthcare/doctype/consultation/consultation.js b/erpnext/healthcare/doctype/consultation/consultation.js
index b0dbff5..dc4870f 100644
--- a/erpnext/healthcare/doctype/consultation/consultation.js
+++ b/erpnext/healthcare/doctype/consultation/consultation.js
@@ -15,23 +15,7 @@
{fieldname: 'test_comment', columns: 4}
];
},
- onload: function(frm){
- if(frm.doc.patient){
- frappe.call({
- "method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
- args: {
- patient: frm.doc.patient
- },
- callback: function (data) {
- var age = null;
- if(data.message.dob){
- age = calculate_age(data.message.dob);
- }
- frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
- }
- });
- }
- },
+
refresh: function(frm) {
refresh_field('drug_prescription');
refresh_field('test_prescription');
diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py
index b01f56a..d0332d8 100644
--- a/erpnext/healthcare/doctype/patient/patient.py
+++ b/erpnext/healthcare/doctype/patient/patient.py
@@ -8,7 +8,7 @@
from frappe.model.document import Document
from frappe.utils import cint, cstr, getdate
import dateutil
-from frappe.model.naming import make_autoname
+from frappe.model.naming import set_name_by_naming_series
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account,send_registration_sms
class Patient(Document):
@@ -42,10 +42,7 @@
if patient_master_name == 'Patient Name':
self.name = self.get_patient_name()
else:
- if not self.naming_series:
- frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
-
- self.name = make_autoname(self.naming_series+'.#####')
+ set_name_by_naming_series(self)
def get_patient_name(self):
name = self.patient_name
diff --git a/erpnext/healthcare/doctype/physician/physician.json b/erpnext/healthcare/doctype/physician/physician.json
index e29561e..300dc97 100644
--- a/erpnext/healthcare/doctype/physician/physician.json
+++ b/erpnext/healthcare/doctype/physician/physician.json
@@ -750,7 +750,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-01-19 15:25:43.166877",
+ "modified": "2018-03-09 15:25:43.166877",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Physician",
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 844763d..de70489 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -201,11 +201,11 @@
"Sales Invoice": {
'validate': 'erpnext.regional.india.utils.set_place_of_supply',
"on_submit": "erpnext.regional.france.utils.create_transaction_log",
- "on_trash": "erpnext.regional.france.utils.check_deletion_permission"
+ "on_trash": "erpnext.regional.check_deletion_permission"
},
"Payment Entry": {
"on_submit": ["erpnext.regional.france.utils.create_transaction_log", "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"],
- "on_trash": "erpnext.regional.france.utils.check_deletion_permission"
+ "on_trash": "erpnext.regional.check_deletion_permission"
},
'Address': {
'validate': 'erpnext.regional.india.utils.validate_gstin_for_india'
@@ -278,4 +278,4 @@
'Saudi Arabia': {
'erpnext.controllers.taxes_and_totals.update_itemised_tax_data': 'erpnext.regional.united_arab_emirates.utils.update_itemised_tax_data'
}
-}
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/attendance/test_records.json b/erpnext/hr/doctype/attendance/test_records.json
index 1c8f3b5..096f95c 100644
--- a/erpnext/hr/doctype/attendance/test_records.json
+++ b/erpnext/hr/doctype/attendance/test_records.json
@@ -2,7 +2,7 @@
{
"doctype": "Attendance",
"name": "_Test Attendance 1",
- "employee": "_T-Employee-0001",
+ "employee": "_T-Employee-00001",
"status": "Present",
"attendance_date": "2014-02-01",
"company": "_Test Company"
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 25d3ec4..5446a6e 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -5,7 +5,7 @@
import frappe
from frappe.utils import getdate, validate_email_add, today, add_years
-from frappe.model.naming import make_autoname
+from frappe.model.naming import set_name_by_naming_series
from frappe import throw, _, scrub
import frappe.permissions
from frappe.model.document import Document
@@ -24,7 +24,7 @@
throw(_("Please setup Employee Naming System in Human Resource > HR Settings"))
else:
if naming_method == 'Naming Series':
- self.name = make_autoname(self.naming_series + '.####')
+ set_name_by_naming_series(self)
elif naming_method == 'Employee Number':
self.name = self.employee_number
elif naming_method == 'Full Name':
diff --git a/erpnext/hr/doctype/employee_advance/test_employee_advance.py b/erpnext/hr/doctype/employee_advance/test_employee_advance.py
index cacf90e..2097e71 100644
--- a/erpnext/hr/doctype/employee_advance/test_employee_advance.py
+++ b/erpnext/hr/doctype/employee_advance/test_employee_advance.py
@@ -35,7 +35,7 @@
def make_employee_advance():
doc = frappe.new_doc("Employee Advance")
- doc.employee = "_T-Employee-0001"
+ doc.employee = "_T-Employee-00001"
doc.company = "_Test company"
doc.purpose = "For site visit"
doc.advance_amount = 1000
@@ -43,5 +43,5 @@
doc.advance_account = "_Test Employee Advance - _TC"
doc.insert()
doc.submit()
-
+
return doc
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
index e0ba088..f89beba 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
@@ -87,7 +87,7 @@
def make_expense_claim(payable_account,claim_amount, sanctioned_amount, company, account, project=None, task_name=None):
expense_claim = frappe.get_doc({
"doctype": "Expense Claim",
- "employee": "_T-Employee-0001",
+ "employee": "_T-Employee-00001",
"payable_account": payable_account,
"company": company,
"expenses":
diff --git a/erpnext/hr/doctype/leave_allocation/test_records.json b/erpnext/hr/doctype/leave_allocation/test_records.json
index 106ed0e..23acbb0 100644
--- a/erpnext/hr/doctype/leave_allocation/test_records.json
+++ b/erpnext/hr/doctype/leave_allocation/test_records.json
@@ -2,7 +2,7 @@
{
"docstatus": 1,
"doctype": "Leave Allocation",
- "employee": "_T-Employee-0001",
+ "employee": "_T-Employee-00001",
"from_date": "2013-01-01",
"to_date": "2013-12-31",
"leave_type": "_Test Leave Type",
@@ -11,7 +11,7 @@
{
"docstatus": 1,
"doctype": "Leave Allocation",
- "employee": "_T-Employee-0002",
+ "employee": "_T-Employee-00002",
"from_date": "2013-01-01",
"to_date": "2013-12-31",
"leave_type": "_Test Leave Type",
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index 4a9a001..38b10f7 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -14,7 +14,7 @@
{
"company": "_Test Company",
"doctype": "Leave Application",
- "employee": "_T-Employee-0001",
+ "employee": "_T-Employee-00001",
"from_date": "2013-05-01",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
@@ -23,7 +23,7 @@
{
"company": "_Test Company",
"doctype": "Leave Application",
- "employee": "_T-Employee-0002",
+ "employee": "_T-Employee-00002",
"from_date": "2013-05-01",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
@@ -32,7 +32,7 @@
{
"company": "_Test Company",
"doctype": "Leave Application",
- "employee": "_T-Employee-0001",
+ "employee": "_T-Employee-00001",
"from_date": "2013-01-15",
"leave_type": "_Test Leave Type LWP",
"posting_date": "2013-01-02",
@@ -188,7 +188,7 @@
application.half_day_date = application.from_date
self.assertRaises(OverlapError, application.insert)
-
+
def test_overlap_with_half_day_3(self):
self._clear_roles()
self._clear_applications()
@@ -206,14 +206,14 @@
application.half_day = 1
application.half_day_date = "2013-01-05"
application.insert()
-
+
# Apply leave from 4-7, half day on 5th
application = self.get_application(_test_records[0])
application.from_date = "2013-01-04"
application.to_date = "2013-01-07"
application.half_day = 1
application.half_day_date = "2013-01-05"
-
+
self.assertRaises(OverlapError, application.insert)
# Apply leave from 5-7, half day on 5th
@@ -230,15 +230,15 @@
from frappe.utils.user import add_role
add_role("test1@example.com", "Employee")
add_role("test@example.com", "Leave Approver")
- self._add_employee_leave_approver("_T-Employee-0002", "test@example.com")
+ self._add_employee_leave_approver("_T-Employee-00002", "test@example.com")
- make_allocation_record(employee="_T-Employee-0002")
+ make_allocation_record(employee="_T-Employee-00002")
application = self.get_application(_test_records[1])
frappe.db.set_value("Leave Block List", "_Test Leave Block List",
"applies_to_all_departments", 1)
- frappe.db.set_value("Employee", "_T-Employee-0002", "department",
+ frappe.db.set_value("Employee", "_T-Employee-00002", "department",
"_Test Department")
frappe.set_user("test1@example.com")
@@ -255,7 +255,7 @@
allocation = frappe.get_doc({
"doctype": "Leave Allocation",
- "employee": employee or "_T-Employee-0001",
+ "employee": employee or "_T-Employee-00001",
"leave_type": leave_type or "_Test Leave Type",
"from_date": "2013-01-01",
"to_date": "2015-12-31",
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index c6463fa..ea33f4e 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -573,7 +573,7 @@
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
for item in items:
- if item_dict.has_key(item.item_code):
+ if item.item_code in item_dict:
item_dict[item.item_code]["qty"] += flt(item.qty)
else:
item_dict[item.item_code] = item
@@ -653,4 +653,4 @@
bom_list.append(child_bom)
count += 1
- return bom_list
\ No newline at end of file
+ return bom_list
diff --git a/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py b/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py
index bf28644..139751a 100644
--- a/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py
+++ b/erpnext/patches/v10_0/remove_and_copy_fields_in_physician.py
@@ -1,12 +1,13 @@
import frappe
def execute():
- if frappe.db.exists("DocType", "Physician"):
- frappe.reload_doc("healthcare", "doctype", "physician")
- frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule")
- if frappe.db.has_column('Physician', 'physician_schedule'):
- for doc in frappe.get_all('Physician'):
- _doc = frappe.get_doc('Physician', doc.name)
- if _doc.physician_schedule:
- _doc.append('physician_schedules', {'schedule': _doc.physician_schedule})
- _doc.save()
+ if frappe.db.exists("DocType", "Physician"):
+ frappe.reload_doc("healthcare", "doctype", "physician")
+ frappe.reload_doc("healthcare", "doctype", "physician_service_unit_schedule")
+
+ if frappe.db.has_column('Physician', 'physician_schedule'):
+ for doc in frappe.get_all('Physician'):
+ _doc = frappe.get_doc('Physician', doc.name)
+ if _doc.physician_schedule:
+ _doc.append('physician_schedules', {'schedule': _doc.physician_schedule})
+ _doc.save()
diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py
index 58c3f21..67d76eb 100644
--- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py
+++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py
@@ -13,7 +13,7 @@
frappe.db.sql("delete from `tabActivity Cost`")
activity_cost1 = frappe.new_doc('Activity Cost')
activity_cost1.update({
- "employee": "_T-Employee-0001",
+ "employee": "_T-Employee-00001",
"employee_name": "_Test Employee",
"activity_type": "_Test Activity Type 1",
"billing_rate": 100,
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index 793355e..2458db0 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -14,8 +14,8 @@
class TestTimesheet(unittest.TestCase):
def test_timesheet_billing_amount(self):
- make_salary_structure("_T-Employee-0001")
- timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1)
+ make_salary_structure("_T-Employee-00001")
+ timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 2)
@@ -24,8 +24,8 @@
self.assertEqual(timesheet.total_billable_amount, 100)
def test_timesheet_billing_amount_not_billable(self):
- make_salary_structure("_T-Employee-0001")
- timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=0)
+ make_salary_structure("_T-Employee-00001")
+ timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=0)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 0)
@@ -34,8 +34,8 @@
self.assertEqual(timesheet.total_billable_amount, 0)
def test_salary_slip_from_timesheet(self):
- salary_structure = make_salary_structure("_T-Employee-0001")
- timesheet = make_timesheet("_T-Employee-0001", simulate = True, billable=1)
+ salary_structure = make_salary_structure("_T-Employee-00001")
+ timesheet = make_timesheet("_T-Employee-00001", simulate = True, billable=1)
salary_slip = make_salary_slip(timesheet.name)
salary_slip.submit()
@@ -44,7 +44,7 @@
self.assertEqual(salary_slip.net_pay, 150)
self.assertEqual(salary_slip.timesheets[0].time_sheet, timesheet.name)
self.assertEqual(salary_slip.timesheets[0].working_hours, 2)
-
+
timesheet = frappe.get_doc('Timesheet', timesheet.name)
self.assertEqual(timesheet.status, 'Payslip')
salary_slip.cancel()
@@ -53,7 +53,7 @@
self.assertEqual(timesheet.status, 'Submitted')
def test_sales_invoice_from_timesheet(self):
- timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1)
+ timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1)
sales_invoice = make_sales_invoice(timesheet.name, '_Test Item', '_Test Customer')
sales_invoice.due_date = nowdate()
sales_invoice.submit()
@@ -68,7 +68,7 @@
self.assertEqual(item.rate, 50.00)
def test_timesheet_billing_based_on_project(self):
- timesheet = make_timesheet("_T-Employee-0001", simulate=True, billable=1, project = '_Test Project', company='_Test Company')
+ timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1, project = '_Test Project', company='_Test Company')
sales_invoice = create_sales_invoice(do_not_save=True)
sales_invoice.project = '_Test Project'
sales_invoice.submit()
@@ -85,7 +85,7 @@
update_activity_type("_Test Activity Type")
timesheet = frappe.new_doc("Timesheet")
- timesheet.employee = "_T-Employee-0001"
+ timesheet.employee = "_T-Employee-00001"
timesheet.append(
'time_logs',
{
@@ -140,11 +140,11 @@
"base": 1200,
"from_date": add_months(nowdate(),-1)
})
-
-
+
+
es = salary_structure.append('earnings', {
"salary_component": "_Test Allowance",
- "amount": 100
+ "amount": 100
})
ds = salary_structure.append('deductions', {
diff --git a/erpnext/public/js/pos/pos.html b/erpnext/public/js/pos/pos.html
index 1d9fd7c..af90756 100644
--- a/erpnext/public/js/pos/pos.html
+++ b/erpnext/public/js/pos/pos.html
@@ -37,20 +37,22 @@
<div class="cell price-cell text-right tax-table">
</div>
</div>
- <div class="pos-list-row discount-amount-area">
- <div class="cell"></div>
- <div class="cell text-right">{%= __("Discount") %}</div>
- <div class="cell price-cell discount-field-col">
- <div class="input-group input-group-sm">
- <span class="input-group-addon">%</span>
- <input type="text" class="form-control discount-percentage text-right">
- </div>
- <div class="input-group input-group-sm">
- <span class="input-group-addon">{%= get_currency_symbol(currency) %}</span>
- <input type="text" class="form-control discount-amount text-right" placeholder="{%= 0.00 %}">
+ {% if(allow_user_to_edit_discount) { %}
+ <div class="pos-list-row discount-amount-area">
+ <div class="cell"></div>
+ <div class="cell text-right">{%= __("Discount") %}</div>
+ <div class="cell price-cell discount-field-col">
+ <div class="input-group input-group-sm">
+ <span class="input-group-addon">%</span>
+ <input type="text" class="form-control discount-percentage text-right">
+ </div>
+ <div class="input-group input-group-sm">
+ <span class="input-group-addon">{%= get_currency_symbol(currency) %}</span>
+ <input type="text" class="form-control discount-amount text-right" placeholder="{%= 0.00 %}">
+ </div>
</div>
</div>
- </div>
+ {% } %}
<div class="pos-list-row grand-total-area collapse-btn" style="border-bottom:1px solid #d1d8dd;">
<div class="cell">
<a class="">
@@ -71,7 +73,7 @@
{% for(var j=i*3; j
<(i+1)*3; j++) { %} <button type="button" class="btn btn-default numeric-keypad" val="{{j+1}}">{{j+1}}</button>
{% } %}
- <button type="button" {% if(!allow_user_to_edit_rate && chartData[i] == __("Price")) { %} disabled {% } %} id="pos-item-{{ chartData[i].toLowerCase() }}" class="btn text-center btn-default numeric-keypad pos-operation">{{ __(chartData[i]) }}</button>
+ <button type="button" {% if((!allow_user_to_edit_rate && chartData[i] == __("Price")) || (!allow_user_to_edit_discount && chartData[i] == __("Disc"))) { %} disabled {% } %} id="pos-item-{{ chartData[i].toLowerCase() }}" class="btn text-center btn-default numeric-keypad pos-operation">{{ __(chartData[i]) }}</button>
</div>
{% } %}
<div class="row text-right">
diff --git a/erpnext/public/js/pos/pos_selected_item.html b/erpnext/public/js/pos/pos_selected_item.html
index 085e048..03c7341 100644
--- a/erpnext/public/js/pos/pos_selected_item.html
+++ b/erpnext/public/js/pos/pos_selected_item.html
@@ -9,7 +9,7 @@
</div>
<div class="pos-list-row">
<div class="cell">{{ __("Discount") }}: %</div>
- <input type="tel" class="form-control cell pos-item-disc" value="{%= discount_percentage %}">
+ <input type="tel" class="form-control cell pos-item-disc" {% if !allow_user_to_edit_discount %} disabled {% endif %} value="{%= discount_percentage %}">
</div>
<div class="pos-list-row">
<div class="cell">{{ __("Price") }}:</div>
diff --git a/erpnext/regional/__init__.py b/erpnext/regional/__init__.py
index e69de29..510ed58 100644
--- a/erpnext/regional/__init__.py
+++ b/erpnext/regional/__init__.py
@@ -0,0 +1,11 @@
+# Copyright (c) 2018, Frappe Technologies and contributors
+# For license information, please see license.txt
+
+import frappe
+from frappe import _
+from erpnext import get_region
+
+def check_deletion_permission(doc, method):
+ region = get_region()
+ if region in ["Nepal", "France"]:
+ frappe.throw(_("Deletion is not permitted for country {0}".format(region)))
\ No newline at end of file
diff --git a/erpnext/regional/france/utils.py b/erpnext/regional/france/utils.py
index c963d74..9e9f0ad 100644
--- a/erpnext/regional/france/utils.py
+++ b/erpnext/regional/france/utils.py
@@ -9,9 +9,7 @@
region = get_region()
if region not in ["France"]:
return
-
else:
-
data = str(doc.as_dict())
frappe.get_doc({
@@ -21,14 +19,6 @@
"data": data
}).insert(ignore_permissions=True)
-def check_deletion_permission(doc, method):
- region = get_region()
- if region not in ["France"]:
- return
-
- else:
- frappe.throw(_("Deletion is not permitted for country {0}".format(region)))
-
# don't remove this function it is used in tests
def test_method():
'''test function'''
diff --git a/erpnext/selling/doctype/campaign/campaign.py b/erpnext/selling/doctype/campaign/campaign.py
index 6ce457d..1094542 100644
--- a/erpnext/selling/doctype/campaign/campaign.py
+++ b/erpnext/selling/doctype/campaign/campaign.py
@@ -5,11 +5,11 @@
import frappe
from frappe.model.document import Document
-from frappe.model.naming import make_autoname
+from frappe.model.naming import set_name_by_naming_series
class Campaign(Document):
def autoname(self):
if frappe.defaults.get_global_default('campaign_naming_by') != 'Naming Series':
self.name = self.campaign_name
else:
- self.name = make_autoname(self.naming_series+'.#####')
+ set_name_by_naming_series(self)
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index ccf4082..78f892b 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.model.naming import make_autoname
+from frappe.model.naming import set_name_by_naming_series
from frappe import _, msgprint, throw
import frappe.defaults
from frappe.utils import flt, cint, cstr
@@ -31,10 +31,7 @@
if cust_master_name == 'Customer Name':
self.name = self.get_customer_name()
else:
- if not self.naming_series:
- frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
-
- self.name = make_autoname(self.naming_series+'.#####')
+ set_name_by_naming_series(self)
def get_customer_name(self):
if frappe.db.get_value("Customer", self.customer_name):
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index a9eb7db..03e519a 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -48,6 +48,15 @@
});
frappe.ui.form.on("Sales Order Item", {
+ item_code: function(frm,cdt,cdn) {
+ var row = locals[cdt][cdn];
+ if (frm.doc.delivery_date) {
+ row.delivery_date = frm.doc.delivery_date;
+ refresh_field("delivery_date", cdn, "items");
+ } else {
+ this.frm.script_manager.copy_from_first_row("items", row, ["delivery_date"]);
+ }
+ },
delivery_date: function(frm, cdt, cdn) {
if(!frm.doc.delivery_date) {
erpnext.utils.copy_value_in_all_row(frm.doc, cdt, cdn, "items", "delivery_date");
@@ -433,17 +442,6 @@
if(cint(frappe.boot.notification_settings.sales_order)) {
this.frm.email_doc(frappe.boot.notification_settings.sales_order_message);
}
- },
-
- items_add: function(doc, cdt, cdn) {
- var row = frappe.get_doc(cdt, cdn);
- if(doc.delivery_date) {
- row.delivery_date = doc.delivery_date;
- refresh_field("delivery_date", cdn, "items");
- } else {
- this.frm.script_manager.copy_from_first_row("items", row, ["delivery_date"]);
- }
}
});
-
$.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));
\ No newline at end of file
diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py
index a5afbdb..83b2998 100644
--- a/erpnext/setup/doctype/company/test_company.py
+++ b/erpnext/setup/doctype/company/test_company.py
@@ -2,13 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-test_ignore = ["Account", "Cost Center"]
-
import frappe
import unittest
from frappe.utils import random_string
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import get_charts_for_country
+test_ignore = ["Account", "Cost Center", "Payment Terms Template"]
test_records = frappe.get_test_records('Company')
class TestCompany(unittest.TestCase):
diff --git a/erpnext/setup/doctype/sales_person/test_records.json b/erpnext/setup/doctype/sales_person/test_records.json
index 75d6cd3..536552a 100644
--- a/erpnext/setup/doctype/sales_person/test_records.json
+++ b/erpnext/setup/doctype/sales_person/test_records.json
@@ -1,23 +1,23 @@
[
{
- "doctype": "Sales Person",
- "employee": "_T-Employee-0001",
- "is_group": 0,
- "parent_sales_person": "Sales Team",
+ "doctype": "Sales Person",
+ "employee": "_T-Employee-00001",
+ "is_group": 0,
+ "parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person"
- },
+ },
{
- "doctype": "Sales Person",
- "employee": "_T-Employee-0002",
- "is_group": 0,
- "parent_sales_person": "Sales Team",
+ "doctype": "Sales Person",
+ "employee": "_T-Employee-00002",
+ "is_group": 0,
+ "parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person 1"
- },
+ },
{
- "doctype": "Sales Person",
- "employee": "_T-Employee-0003",
- "is_group": 0,
- "parent_sales_person": "Sales Team",
+ "doctype": "Sales Person",
+ "employee": "_T-Employee-00003",
+ "is_group": 0,
+ "parent_sales_person": "Sales Team",
"sales_person_name": "_Test Sales Person 2"
}
]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index ff01a19..9092176 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -170,6 +170,35 @@
}
})
+frappe.ui.form.on('Item Customer Detail', {
+ customer_items_add: function(frm, cdt, cdn) {
+ frappe.model.set_value(cdt, cdn, 'customer_group', "");
+ },
+ customer_name: function(frm, cdt, cdn) {
+ set_customer_group(frm, cdt, cdn);
+ },
+ customer_group: function(frm, cdt, cdn) {
+ if(set_customer_group(frm, cdt, cdn)){
+ frappe.msgprint(__("Changing Customer Group for the selected Customer is not allowed."));
+ }
+ }
+});
+
+var set_customer_group = function(frm, cdt, cdn) {
+ var row = frappe.get_doc(cdt, cdn);
+
+ if (!row.customer_name) {
+ return false;
+ }
+
+ frappe.model.with_doc("Customer", row.customer_name, function() {
+ var customer = frappe.model.get_doc("Customer", row.customer_name);
+ row.customer_group = customer.customer_group;
+ refresh_field("customer_group", cdn, "customer_items");
+ });
+ return true;
+}
+
$.extend(erpnext.item, {
setup_queries: function(frm) {
frm.fields_dict['expense_account'].get_query = function(doc) {
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 689089c..0c834c5 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -44,6 +44,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -74,6 +75,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
+ "translatable": 0,
"unique": 0
},
{
@@ -106,6 +108,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -139,6 +142,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
+ "translatable": 0,
"unique": 0
},
{
@@ -170,6 +174,7 @@
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -199,6 +204,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -232,6 +238,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -262,6 +269,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -295,6 +303,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -323,6 +332,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -353,6 +363,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -387,6 +398,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -418,6 +430,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -449,6 +462,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -480,6 +494,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -510,6 +525,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
+ "translatable": 0,
"unique": 0
},
{
@@ -542,6 +558,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -575,6 +592,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -606,6 +624,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -636,6 +655,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -668,6 +688,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -699,69 +720,72 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "sb_barcodes",
- "fieldtype": "Section Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Barcodes",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "sb_barcodes",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Barcodes",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
- },
+ },
{
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "barcodes",
- "fieldtype": "Table",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Barcodes",
- "length": 0,
- "no_copy": 0,
- "options": "Item Barcode",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "barcodes",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Barcodes",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item Barcode",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
- },
+ },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@@ -793,6 +817,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -827,6 +852,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -857,6 +883,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -890,6 +917,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -922,6 +950,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -952,6 +981,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0,
"width": "50%"
},
@@ -984,6 +1014,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
+ "translatable": 0,
"unique": 0
},
{
@@ -1016,6 +1047,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1047,6 +1079,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1078,6 +1111,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1110,6 +1144,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1142,6 +1177,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1173,6 +1209,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1207,6 +1244,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1239,6 +1277,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1273,6 +1312,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1305,6 +1345,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1336,6 +1377,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1367,6 +1409,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1399,6 +1442,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1428,6 +1472,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1463,6 +1508,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1494,6 +1540,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1526,6 +1573,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1560,6 +1608,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1593,6 +1642,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
+ "translatable": 0,
"unique": 0
},
{
@@ -1625,6 +1675,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1656,6 +1707,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1687,6 +1739,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1718,6 +1771,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1752,6 +1806,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1782,6 +1837,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1812,6 +1868,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1845,6 +1902,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1879,6 +1937,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1913,6 +1972,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1945,6 +2005,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -1976,6 +2037,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2007,6 +2069,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2037,6 +2100,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2068,6 +2132,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2098,6 +2163,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2129,6 +2195,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0,
"width": "50%"
},
@@ -2161,6 +2228,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2191,6 +2259,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2222,6 +2291,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2251,6 +2321,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2282,6 +2353,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2313,37 +2385,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "default": "1",
- "fieldname": "is_sales_item",
- "fieldtype": "Check",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Is Sales Item",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2375,6 +2417,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2406,6 +2449,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2414,6 +2458,71 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "default": "1",
+ "fieldname": "is_sales_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Sales Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "column_break3",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldtype": "Column Break",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0,
+ "width": "50%"
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "selling_cost_center",
"fieldtype": "Link",
@@ -2437,70 +2546,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "depends_on": "",
- "fieldname": "column_break3",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Customer Item Codes",
- "length": 0,
- "no_copy": 0,
- "oldfieldtype": "Column Break",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0,
- "width": "50%"
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "depends_on": "",
- "description": "",
- "fieldname": "customer_items",
- "fieldtype": "Table",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Customer Items",
- "length": 0,
- "no_copy": 0,
- "options": "Item Customer Detail",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2533,6 +2579,71 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "fieldname": "customer_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Customer Details",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "description": "",
+ "fieldname": "customer_items",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Customer Items",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item Customer Detail",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2564,6 +2675,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2597,6 +2709,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2628,6 +2741,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2661,6 +2775,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2691,38 +2806,40 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)",
- "fieldname": "quality_inspection_template",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Quality Inspection Template",
- "length": 0,
- "no_copy": 0,
- "options": "Quality Inspection Template",
- "permlevel": 0,
- "precision": "",
- "print_hide": 1,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)",
+ "fieldname": "quality_inspection_template",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Quality Inspection Template",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Quality Inspection Template",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2755,6 +2872,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2788,6 +2906,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2822,6 +2941,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2851,6 +2971,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2880,6 +3001,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2910,6 +3032,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2940,6 +3063,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -2971,6 +3095,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3002,6 +3127,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3033,6 +3159,7 @@
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3065,6 +3192,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3097,6 +3225,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3127,6 +3256,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3155,6 +3285,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3187,6 +3318,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3219,6 +3351,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3250,6 +3383,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3280,6 +3414,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3311,6 +3446,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3341,6 +3477,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3371,6 +3508,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3402,6 +3540,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3434,6 +3573,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3465,6 +3605,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3497,6 +3638,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
},
{
@@ -3528,6 +3670,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0
}
],
@@ -3543,7 +3686,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
- "modified": "2018-02-19 13:48:35.779089",
+ "modified": "2018-03-06 10:21:48.715529",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
@@ -3715,7 +3858,7 @@
"read_only_onload": 0,
"search_fields": "item_name,description,item_group,customer_code",
"show_name_in_global_search": 1,
- "sort_field": "idx desc, modified desc",
+ "sort_field": "idx desc,modified desc",
"sort_order": "DESC",
"title_field": "item_name",
"track_changes": 1,
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 1c85ecd..42a63ee 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -53,8 +53,8 @@
template_item_name = frappe.db.get_value("Item", self.variant_of, "item_name")
self.item_code = make_variant_item_code(self.variant_of, template_item_name, self)
else:
- from frappe.model.naming import make_autoname
- self.item_code = make_autoname(self.naming_series + '.#####')
+ from frappe.model.naming import set_name_by_naming_series
+ set_name_by_naming_series(self)
elif not self.item_code:
msgprint(_("Item Code is mandatory because Item is not automatically numbered"), raise_exception=1)
diff --git a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json
index 46d480e..c0305a9 100644
--- a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json
+++ b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
@@ -12,16 +13,20 @@
"editable_grid": 1,
"fields": [
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
+ "in_global_search": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Customer Name",
"length": 0,
"no_copy": 0,
@@ -33,24 +38,62 @@
"print_hide_if_no_value": 0,
"print_width": "180px",
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
"search_index": 1,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0,
"width": "180px"
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
+ "bold": 1,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "customer_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 1,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Customer Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Customer Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "ref_code",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
+ "in_global_search": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Ref Code",
"length": 0,
"no_copy": 0,
@@ -61,25 +104,27 @@
"print_hide_if_no_value": 0,
"print_width": "120px",
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
+ "translatable": 0,
"unique": 0,
"width": "120px"
}
],
+ "has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
- "in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-11 03:28:00.992064",
+ "modified": "2018-03-08 14:22:38.019369",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Customer Detail",
@@ -88,5 +133,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "track_changes": 0,
"track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
index 8ad73d1..14808c2 100644
--- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
+++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
@@ -78,6 +78,38 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "default": "",
+ "description": "Rename Attribute Value in Item Attribute.",
+ "fieldname": "allow_rename_attribute_value",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Allow Rename Attribute Value",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "copy_fields_to_variant",
"fieldtype": "Section Break",
"hidden": 0,
@@ -144,7 +176,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-11-14 15:54:12.190518",
+ "modified": "2018-02-19 11:39:54.401128",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Variant Settings",
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 9834183..7ddea71 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -32,10 +32,10 @@
so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
for d in self.get('items'):
if d.sales_order:
- if not so_items.has_key(d.sales_order):
+ if not d.sales_order in so_items:
so_items[d.sales_order] = {d.item_code: flt(d.qty)}
else:
- if not so_items[d.sales_order].has_key(d.item_code):
+ if not d.item_code in so_items[d.sales_order]:
so_items[d.sales_order][d.item_code] = flt(d.qty)
else:
so_items[d.sales_order][d.item_code] += flt(d.qty)
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 35d76a5..067acc7 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -396,8 +396,16 @@
def get_party_item_code(args, item_doc, out):
if args.transaction_type=="selling" and args.customer:
+ out.customer_item_code = None
customer_item_code = item_doc.get("customer_items", {"customer_name": args.customer})
- out.customer_item_code = customer_item_code[0].ref_code if customer_item_code else None
+
+ if customer_item_code:
+ out.customer_item_code = customer_item_code[0].ref_code
+ else:
+ customer_group = frappe.db.get_value("Customer", args.customer, "customer_group")
+ customer_group_item_code = item_doc.get("customer_items", {"customer_group": customer_group})
+ if customer_group_item_code and not customer_group_item_code[0].customer_name:
+ out.customer_item_code = customer_group_item_code[0].ref_code
if args.transaction_type=="buying" and args.supplier:
item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier})
diff --git a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
index e1249ea..cc47ad9 100644
--- a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
+++ b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
@@ -51,7 +51,7 @@
sum(se_item.transfer_qty) as 'consume_qty'
from `tabStock Entry` se, `tabStock Entry Detail` se_item
where se.name = se_item.parent and se.docstatus = 1
- and ifnull(se_item.t_warehouse, '') = '' %s
+ and (ifnull(se_item.t_warehouse, '') = '' or se.purpose = 'Subcontract') %s
group by se_item.item_code""" % (condition), as_dict=1)
cn_items_map = {}
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 6f8b2c9..0e9f500 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -43,7 +43,7 @@
sle_map = {}
for sle in stock_ledger_entries:
- if not sle_map.has_key((sle.item_code, sle.warehouse)):
+ if not (sle.item_code, sle.warehouse) in sle_map:
sle_map[(sle.item_code, sle.warehouse)] = flt(sle.stock_value)
return sum(sle_map.values())
diff --git a/erpnext/tests/test_regional.py b/erpnext/tests/test_regional.py
index 7524ccc..7bd6fa8 100644
--- a/erpnext/tests/test_regional.py
+++ b/erpnext/tests/test_regional.py
@@ -9,8 +9,8 @@
frappe.flags.country = 'India'
self.assertEqual(test_method(), 'overridden')
- frappe.flags.country = 'Nepal'
+ frappe.flags.country = 'Maldives'
self.assertEqual(test_method(), 'original')
frappe.flags.country = 'France'
- self.assertEqual(test_method(), 'overridden')
+ self.assertEqual(test_method(), 'overridden')
\ No newline at end of file