Merge pull request #13252 from achillesrasquinha/py3
sort by name accounts for trial balance.
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/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/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/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/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/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 3935f22..a97f80f 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'
@@ -277,4 +277,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/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/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/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/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