From 46e03eadcae32b3d44c7a944c3382780907a3588 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 17 Feb 2015 10:45:50 +0530 Subject: [PATCH] [rename] Customer Issue -> Warranty Claim --- erpnext/config/support.py | 4 ++-- erpnext/controllers/js/contact_address_common.js | 2 +- erpnext/patches.txt | 1 + .../fix_naming_series_records_lost_by_reload.py | 2 +- .../v4_0/set_naming_series_property_setter.py | 2 +- erpnext/patches/v5_0/rename_customer_issue.py | 5 +++++ erpnext/public/js/feature_setup.js | 4 ++-- erpnext/startup/notifications.py | 2 +- erpnext/support/doctype/customer_issue/README.md | 1 - erpnext/support/doctype/customer_issue/__init__.py | 1 - .../support/doctype/customer_issue/test_records.json | 6 ------ .../doctype/maintenance_visit/maintenance_visit.js | 4 ++-- .../doctype/maintenance_visit/maintenance_visit.py | 6 +++--- erpnext/support/doctype/warranty_claim/__init__.py | 0 .../support/doctype/warranty_claim/test_records.json | 6 ++++++ .../test_warranty_claim.py} | 4 ++-- .../warranty_claim.js} | 10 +++++----- .../warranty_claim.json} | 6 +++--- .../warranty_claim.py} | 12 ++++++------ .../warranty_claim_list.js} | 2 +- 20 files changed, 42 insertions(+), 38 deletions(-) create mode 100644 erpnext/patches/v5_0/rename_customer_issue.py delete mode 100644 erpnext/support/doctype/customer_issue/README.md delete mode 100644 erpnext/support/doctype/customer_issue/__init__.py delete mode 100644 erpnext/support/doctype/customer_issue/test_records.json create mode 100644 erpnext/support/doctype/warranty_claim/__init__.py create mode 100644 erpnext/support/doctype/warranty_claim/test_records.json rename erpnext/support/doctype/{customer_issue/test_customer_issue.py => warranty_claim/test_warranty_claim.py} (59%) rename erpnext/support/doctype/{customer_issue/customer_issue.js => warranty_claim/warranty_claim.js} (90%) rename erpnext/support/doctype/{customer_issue/customer_issue.json => warranty_claim/warranty_claim.json} (98%) rename erpnext/support/doctype/{customer_issue/customer_issue.py => warranty_claim/warranty_claim.py} (86%) rename erpnext/support/doctype/{customer_issue/customer_issue_list.js => warranty_claim/warranty_claim_list.js} (64%) diff --git a/erpnext/config/support.py b/erpnext/config/support.py index 2ed2c5f9db..54219c5add 100644 --- a/erpnext/config/support.py +++ b/erpnext/config/support.py @@ -13,8 +13,8 @@ def get_data(): }, { "type": "doctype", - "name": "Customer Issue", - "description": _("Customer Issue against Serial No."), + "name": "Warranty Claim", + "description": _("Warranty Claim against Serial No."), }, { "type": "doctype", diff --git a/erpnext/controllers/js/contact_address_common.js b/erpnext/controllers/js/contact_address_common.js index 77f4742146..88a7f9e876 100644 --- a/erpnext/controllers/js/contact_address_common.js +++ b/erpnext/controllers/js/contact_address_common.js @@ -20,7 +20,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { docname = last_route.slice(2).join("/"); if(["Customer", "Quotation", "Sales Order", "Sales Invoice", "Delivery Note", - "Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit", + "Installation Note", "Opportunity", "Warranty Claim", "Maintenance Visit", "Maintenance Schedule"] .indexOf(doctype)!==-1) { var refdoc = frappe.get_doc(doctype, docname); diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 849e953f8d..147525e2cb 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -110,3 +110,4 @@ erpnext.patches.v5_0.remove_birthday_events erpnext.patches.v5_0.update_item_name_in_bom execute:frappe.reload_doc('crm', 'doctype', 'lead') execute:frappe.reload_doc('crm', 'doctype', 'opportunity') +erpnext.patches.v5_0.rename_customer_issue diff --git a/erpnext/patches/repair_tools/fix_naming_series_records_lost_by_reload.py b/erpnext/patches/repair_tools/fix_naming_series_records_lost_by_reload.py index 80e7437857..0baed6be2d 100644 --- a/erpnext/patches/repair_tools/fix_naming_series_records_lost_by_reload.py +++ b/erpnext/patches/repair_tools/fix_naming_series_records_lost_by_reload.py @@ -13,7 +13,7 @@ doctype_series_map = { 'Attendance': 'ATT-', 'C-Form': 'C-FORM-', 'Customer': 'CUST-', - 'Customer Issue': 'CI-', + 'Warranty Claim': 'CI-', 'Delivery Note': 'DN-', 'Installation Note': 'IN-', 'Item': 'ITEM-', diff --git a/erpnext/patches/v4_0/set_naming_series_property_setter.py b/erpnext/patches/v4_0/set_naming_series_property_setter.py index d62d845299..bd4ed91a3e 100644 --- a/erpnext/patches/v4_0/set_naming_series_property_setter.py +++ b/erpnext/patches/v4_0/set_naming_series_property_setter.py @@ -10,7 +10,7 @@ doctype_series_map = { 'Attendance': 'ATT-', 'C-Form': 'C-FORM-', 'Customer': 'CUST-', - 'Customer Issue': 'CI-', + 'Warranty Claim': 'CI-', 'Delivery Note': 'DN-', 'Installation Note': 'IN-', 'Item': 'ITEM-', diff --git a/erpnext/patches/v5_0/rename_customer_issue.py b/erpnext/patches/v5_0/rename_customer_issue.py new file mode 100644 index 0000000000..c3c38a7d8b --- /dev/null +++ b/erpnext/patches/v5_0/rename_customer_issue.py @@ -0,0 +1,5 @@ +import frappe + +def execute(): + if frappe.db.table_exists("tabCustomer Issue"): + frappe.rename_doc("DocType", "Customer Issue", "Warrany Claim") diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js index 536f956347..91720f2213 100644 --- a/erpnext/public/js/feature_setup.js +++ b/erpnext/public/js/feature_setup.js @@ -64,7 +64,7 @@ erpnext.feature_setup.feature_dict = { 'Stock Ledger Entry': {'fields':['batch_no']} }, 'fs_item_serial_nos': { - 'Customer Issue': {'fields':['serial_no']}, + 'Warranty Claim': {'fields':['serial_no']}, 'Delivery Note': {'items':['serial_no'],'packed_items':['serial_no']}, 'Installation Note': {'items':['serial_no']}, 'Item': {'fields':['has_serial_no']}, @@ -155,7 +155,7 @@ erpnext.feature_setup.feature_dict = { 'Sales Order': {'fields':['sales_team']} }, 'fs_more_info': { - "Customer Issue": {"fields": ["more_info"]}, + "Warranty Claim": {"fields": ["more_info"]}, 'Material Request': {'fields':['more_info']}, 'Lead': {'fields':['more_info']}, 'Opportunity': {'fields':['more_info']}, diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py index eccd1d2026..66bc83da18 100644 --- a/erpnext/startup/notifications.py +++ b/erpnext/startup/notifications.py @@ -8,7 +8,7 @@ def get_notification_config(): return { "for_doctype": { "Issue": {"status":"Open"}, - "Customer Issue": {"status":"Open"}, + "Warranty Claim": {"status":"Open"}, "Task": {"status":"Open"}, "Lead": {"status":"Open"}, "Contact": {"status":"Open"}, diff --git a/erpnext/support/doctype/customer_issue/README.md b/erpnext/support/doctype/customer_issue/README.md deleted file mode 100644 index 0560abed96..0000000000 --- a/erpnext/support/doctype/customer_issue/README.md +++ /dev/null @@ -1 +0,0 @@ -Issue raised by Customer, can be tagged against Invoice, Serial Number to verify warranty, service contract. \ No newline at end of file diff --git a/erpnext/support/doctype/customer_issue/__init__.py b/erpnext/support/doctype/customer_issue/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/erpnext/support/doctype/customer_issue/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/erpnext/support/doctype/customer_issue/test_records.json b/erpnext/support/doctype/customer_issue/test_records.json deleted file mode 100644 index cb3a3a1cee..0000000000 --- a/erpnext/support/doctype/customer_issue/test_records.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "doctype": "Customer Issue", - "name": "_Test Customer Issue 1" - } -] diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js index c58b2eeda8..5427b0f5f6 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js @@ -27,11 +27,11 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({ } }) }, "icon-download", "btn-default"); - cur_frm.add_custom_button(__('From Customer Issue'), + cur_frm.add_custom_button(__('From Warranty Claim'), function() { frappe.model.map_current_doc({ method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit", - source_doctype: "Customer Issue", + source_doctype: "Warranty Claim", get_query_filters: { status: ["in", "Open, Work in Progress"], customer: cur_frm.doc.customer || undefined, diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py index 6ad0a9d8c7..b7a9b9e1df 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py @@ -24,7 +24,7 @@ class MaintenanceVisit(TransactionBase): def update_customer_issue(self, flag): for d in self.get('purposes'): - if d.prevdoc_docname and d.prevdoc_doctype == 'Customer Issue' : + if d.prevdoc_docname and d.prevdoc_doctype == 'Warranty Claim' : if flag==1: mntc_date = self.mntc_date service_person = d.service_person @@ -48,11 +48,11 @@ class MaintenanceVisit(TransactionBase): service_person = '' work_done = '' - frappe.db.sql("update `tabCustomer Issue` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname)) + frappe.db.sql("update `tabWarranty Claim` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname)) def check_if_last_visit(self): - """check if last maintenance visit against same sales order/ customer issue""" + """check if last maintenance visit against same sales order/ Warranty Claim""" check_for_docname = None for d in self.get('purposes'): if d.prevdoc_docname: diff --git a/erpnext/support/doctype/warranty_claim/__init__.py b/erpnext/support/doctype/warranty_claim/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/support/doctype/warranty_claim/test_records.json b/erpnext/support/doctype/warranty_claim/test_records.json new file mode 100644 index 0000000000..b5b1904c45 --- /dev/null +++ b/erpnext/support/doctype/warranty_claim/test_records.json @@ -0,0 +1,6 @@ +[ + { + "doctype": "Warranty Claim", + "name": "_Test Warranty Claim 1" + } +] diff --git a/erpnext/support/doctype/customer_issue/test_customer_issue.py b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py similarity index 59% rename from erpnext/support/doctype/customer_issue/test_customer_issue.py rename to erpnext/support/doctype/warranty_claim/test_warranty_claim.py index 88f54e2def..238808cb30 100644 --- a/erpnext/support/doctype/customer_issue/test_customer_issue.py +++ b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py @@ -4,7 +4,7 @@ import frappe import unittest -test_records = frappe.get_test_records('Customer Issue') +test_records = frappe.get_test_records('Warranty Claim') -class TestCustomerIssue(unittest.TestCase): +class TestWarrantyClaim(unittest.TestCase): pass diff --git a/erpnext/support/doctype/customer_issue/customer_issue.js b/erpnext/support/doctype/warranty_claim/warranty_claim.js similarity index 90% rename from erpnext/support/doctype/customer_issue/customer_issue.js rename to erpnext/support/doctype/warranty_claim/warranty_claim.js index d2606777a4..e06255960e 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.js +++ b/erpnext/support/doctype/warranty_claim/warranty_claim.js @@ -4,14 +4,14 @@ frappe.provide("erpnext.support"); frappe.require("assets/erpnext/js/utils.js"); -frappe.ui.form.on_change("Customer Issue", "customer", function(frm) { +frappe.ui.form.on_change("Warranty Claim", "customer", function(frm) { erpnext.utils.get_party_details(frm) }); -frappe.ui.form.on_change("Customer Issue", "customer_address", +frappe.ui.form.on_change("Warranty Claim", "customer_address", erpnext.utils.get_address_display); -frappe.ui.form.on_change("Customer Issue", "contact_person", +frappe.ui.form.on_change("Warranty Claim", "contact_person", erpnext.utils.get_contact_details); -erpnext.support.CustomerIssue = frappe.ui.form.Controller.extend({ +erpnext.support.WarrantyClaim = frappe.ui.form.Controller.extend({ refresh: function() { if((cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) { cur_frm.add_custom_button(__('Make Maintenance Visit'), @@ -27,7 +27,7 @@ erpnext.support.CustomerIssue = frappe.ui.form.Controller.extend({ } }); -$.extend(cur_frm.cscript, new erpnext.support.CustomerIssue({frm: cur_frm})); +$.extend(cur_frm.cscript, new erpnext.support.WarrantyClaim({frm: cur_frm})); cur_frm.cscript.onload = function(doc,cdt,cdn){ if(!doc.status) diff --git a/erpnext/support/doctype/customer_issue/customer_issue.json b/erpnext/support/doctype/warranty_claim/warranty_claim.json similarity index 98% rename from erpnext/support/doctype/customer_issue/customer_issue.json rename to erpnext/support/doctype/warranty_claim/warranty_claim.json index 41c185e7ce..71fa5a0816 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.json +++ b/erpnext/support/doctype/warranty_claim/warranty_claim.json @@ -387,7 +387,7 @@ "no_copy": 1, "oldfieldname": "amended_from", "oldfieldtype": "Data", - "options": "Customer Issue", + "options": "Warranty Claim", "permlevel": 0, "print_hide": 1, "width": "150px" @@ -396,10 +396,10 @@ "icon": "icon-bug", "idx": 1, "is_submittable": 0, - "modified": "2015-02-05 05:11:36.857779", + "modified": "2015-02-17 00:12:52.430072", "modified_by": "Administrator", "module": "Support", - "name": "Customer Issue", + "name": "Warranty Claim", "owner": "harshada@webnotestech.com", "permissions": [ { diff --git a/erpnext/support/doctype/customer_issue/customer_issue.py b/erpnext/support/doctype/warranty_claim/warranty_claim.py similarity index 86% rename from erpnext/support/doctype/customer_issue/customer_issue.py rename to erpnext/support/doctype/warranty_claim/warranty_claim.py index 9e6300ea16..f548f6acd2 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.py +++ b/erpnext/support/doctype/warranty_claim/warranty_claim.py @@ -11,7 +11,7 @@ from frappe.utils import today from erpnext.utilities.transaction_base import TransactionBase -class CustomerIssue(TransactionBase): +class WarrantyClaim(TransactionBase): def get_feed(self): return _("{0}: From {1}").format(self.status, self.customer_name) @@ -20,7 +20,7 @@ class CustomerIssue(TransactionBase): frappe.throw(_("Customer is required")) if self.status=="Closed" and \ - frappe.db.get_value("Customer Issue", self.name, "status")!="Closed": + frappe.db.get_value("Warranty Claim", self.name, "status")!="Closed": self.resolution_date = today() def on_cancel(self): @@ -30,7 +30,7 @@ class CustomerIssue(TransactionBase): (self.name)) if lst: lst1 = ','.join([x[0] for x in lst]) - frappe.throw(_("Cancel Material Visit {0} before cancelling this Customer Issue").format(lst1)) + frappe.throw(_("Cancel Material Visit {0} before cancelling this Warranty Claim").format(lst1)) else: frappe.db.set(self, 'status', 'Cancelled') @@ -51,14 +51,14 @@ def make_maintenance_visit(source_name, target_doc=None): and t1.docstatus=1 and t1.completion_status='Fully Completed'""", source_name) if not visit: - target_doc = get_mapped_doc("Customer Issue", source_name, { - "Customer Issue": { + target_doc = get_mapped_doc("Warranty Claim", source_name, { + "Warranty Claim": { "doctype": "Maintenance Visit", "field_map": {} } }, target_doc) - source_doc = frappe.get_doc("Customer Issue", source_name) + source_doc = frappe.get_doc("Warranty Claim", source_name) if source_doc.get("item_code"): table_map = { "doctype": "Maintenance Visit Purpose", diff --git a/erpnext/support/doctype/customer_issue/customer_issue_list.js b/erpnext/support/doctype/warranty_claim/warranty_claim_list.js similarity index 64% rename from erpnext/support/doctype/customer_issue/customer_issue_list.js rename to erpnext/support/doctype/warranty_claim/warranty_claim_list.js index f47934ce0b..e162e137ba 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue_list.js +++ b/erpnext/support/doctype/warranty_claim/warranty_claim_list.js @@ -1,4 +1,4 @@ -frappe.listview_settings['Customer Issue'] = { +frappe.listview_settings['Warranty Claim'] = { add_fields: ["status", "customer", "item_code"], filters:[["status","=", "Open"]] };