From 40ca2c681ac74942eeaf88ebda1c68c8a42216ea Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 19 Dec 2012 12:46:03 +0530 Subject: [PATCH] removed next_contact in quotation, fixed regex to convert relative links to absolute --- .../remove_quotation_next_contact.py | 16 + patches/patch_list.py | 4 + selling/doctype/lead/lead.py | 2 +- selling/doctype/quotation/quotation.js | 5 - selling/doctype/quotation/quotation.py | 47 --- selling/doctype/quotation/quotation.txt | 283 ++++++------------ 6 files changed, 111 insertions(+), 246 deletions(-) create mode 100644 patches/december_2012/remove_quotation_next_contact.py diff --git a/patches/december_2012/remove_quotation_next_contact.py b/patches/december_2012/remove_quotation_next_contact.py new file mode 100644 index 0000000000..d7e0dc761d --- /dev/null +++ b/patches/december_2012/remove_quotation_next_contact.py @@ -0,0 +1,16 @@ +from __future__ import unicode_literals +import webnotes + +def execute(): + from webnotes.widgets.form.assign_to import add + for t in webnotes.conn.sql("""select * from tabQuotation + where ifnull(contact_by, '')!=''""", as_dict=1): + add({ + 'doctype': "Quotation", + 'name': t['name'], + 'assign_to': t['contact_by'], + 'assigned_by': t['owner'], + 'description': "Contact regarding quotation.", + 'date': t['creation'], + "no_notification": True + }) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 90f908e3ca..090bbc9f89 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -745,4 +745,8 @@ patch_list = [ 'patch_module': 'patches.december_2012', 'patch_file': 'clear_web_cache', }, + { + 'patch_module': 'patches.december_2012', + 'patch_file': 'remove_quotation_next_contact', + }, ] \ No newline at end of file diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index d844b8d8fd..63f9bd0258 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -80,5 +80,5 @@ class DocType(TransactionBase): def on_trash(self): webnotes.conn.sql("""update tabCommunication set lead='' where lead=%s""", self.doc.name) - webnotes.conn.sql("""update `tabSupport Ticket` set contact='' where contact=%s""", + webnotes.conn.sql("""update `tabSupport Ticket` set lead='' where lead=%s""", self.doc.name) \ No newline at end of file diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index 1b0a7748a9..3673b07d9a 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -47,11 +47,6 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']); } } - //cur_frm.cscript.make_communication_body(); - - if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) { - cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query; - } } cur_frm.cscript.onload_post_render = function(doc, dt, dn) { diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 37a750f95e..0e7554497e 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -195,58 +195,11 @@ class DocType(TransactionBase): self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export) def on_update(self): - # Add to calendar - if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date: - if self.doc.contact_by: - self.add_calendar_event() - webnotes.conn.set(self.doc, 'contact_date_ref',self.doc.contact_date) - # Set Quotation Status webnotes.conn.set(self.doc, 'status', 'Draft') # subject for follow self.doc.subject = '[%(status)s] To %(customer)s worth %(currency)s %(grand_total)s' % self.doc.fields - - - # Add to Calendar - # ==================================================================================================================== - def add_calendar_event(self): - desc='' - user_lst =[] - if self.doc.customer: - if self.doc.contact_person: - desc = 'Contact '+cstr(self.doc.contact_person) - else: - desc = 'Contact customer '+cstr(self.doc.customer) - elif self.doc.lead: - if self.doc.lead_name: - desc = 'Contact '+cstr(self.doc.lead_name) - else: - desc = 'Contact lead '+cstr(self.doc.lead) - desc = desc+ '.By : ' + cstr(self.doc.contact_by) - - if self.doc.to_discuss: - desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss) - - ev = Document('Event') - ev.description = desc - ev.event_date = self.doc.contact_date - ev.event_hour = '10:00' - ev.event_type = 'Private' - ev.ref_type = 'Opportunity' - ev.ref_name = self.doc.name - ev.save(1) - - user_lst.append(self.doc.owner) - - chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by) - if chk: - user_lst.append(chk[0][0]) - - for d in user_lst: - ch = addchild(ev, 'event_individuals', 'Event User', 0) - ch.person = d - ch.save(1) #update enquiry #------------------ diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt index 2c9f880674..3ebdb80e94 100644 --- a/selling/doctype/quotation/quotation.txt +++ b/selling/doctype/quotation/quotation.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-11-28 11:26:20", + "creation": "2012-12-07 15:15:27", "modified_by": "Administrator", - "modified": "2012-12-03 17:10:41" + "modified": "2012-12-19 12:13:38" }, { "is_submittable": 1, @@ -51,7 +51,6 @@ "description": "To manage multiple series please go to Setup > Manage Series", "no_copy": 1, "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Naming Series", "oldfieldname": "naming_series", @@ -64,12 +63,10 @@ { "print_hide": 1, "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Quotation To", "oldfieldname": "quotation_to", "permlevel": 0, - "trigger": "Client", "fieldname": "quotation_to", "fieldtype": "Select", "reqd": 1, @@ -80,12 +77,10 @@ { "print_hide": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Customer", "oldfieldname": "customer", "permlevel": 0, - "trigger": "Client", "fieldname": "customer", "fieldtype": "Link", "search_index": 1, @@ -96,20 +91,17 @@ { "print_hide": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Lead", "oldfieldname": "lead", - "permlevel": 0, - "trigger": "Client", + "options": "Lead", "fieldname": "lead", "fieldtype": "Link", "hidden": 0, - "options": "Lead", + "permlevel": 0, "in_filter": 1 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Lead Name", "fieldname": "lead_name", @@ -119,7 +111,6 @@ "in_filter": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Customer Name", "fieldname": "customer_name", @@ -138,7 +129,6 @@ { "print_hide": 0, "oldfieldtype": "Small Text", - "colour": "White:FFF", "doctype": "DocField", "label": "Address", "oldfieldname": "customer_address", @@ -152,7 +142,6 @@ }, { "print_hide": 0, - "colour": "White:FFF", "doctype": "DocField", "label": "Contact", "fieldname": "contact_display", @@ -163,7 +152,6 @@ }, { "print_hide": 0, - "colour": "White:FFF", "doctype": "DocField", "label": "Mobile No", "fieldname": "contact_mobile", @@ -173,7 +161,6 @@ }, { "print_hide": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Email", "fieldname": "contact_email", @@ -183,7 +170,6 @@ }, { "oldfieldtype": "Column Break", - "colour": "White:FFF", "doctype": "DocField", "width": "50%", "fieldname": "column_break1", @@ -210,7 +196,6 @@ "print_hide": 1, "default": "Sales", "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Order Type", "oldfieldname": "order_type", @@ -225,7 +210,6 @@ { "print_hide": 0, "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Items", "fieldname": "items", @@ -235,7 +219,6 @@ }, { "oldfieldtype": "Table", - "colour": "White:FFF", "allow_on_submit": 1, "doctype": "DocField", "label": "Quotation Items", @@ -278,7 +261,6 @@ "oldfieldtype": "Button", "doctype": "DocField", "label": "Re-Calculate Values", - "trigger": "Client", "fieldname": "recalculate_values", "fieldtype": "Button", "permlevel": 0 @@ -295,7 +277,6 @@ "description": "To create Quotation against Opportunity, Select Opportunity No. and click on 'Pull Opportunity Details' ", "no_copy": 0, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Opportunity No", "oldfieldname": "enq_no", @@ -314,7 +295,6 @@ "oldfieldtype": "Button", "doctype": "DocField", "label": "Pull Opportunity Detail", - "trigger": "Client", "fieldname": "pull_enquiry_detail", "fieldtype": "Button", "hidden": 0, @@ -322,7 +302,6 @@ "report_hide": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Price List and Currency", "fieldname": "section_break0", @@ -334,12 +313,10 @@ "description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.", "permlevel": 0, "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Price List", "oldfieldname": "price_list_name", "width": "100px", - "trigger": "Client", "fieldname": "price_list_name", "fieldtype": "Select", "search_index": 0, @@ -350,7 +327,6 @@ { "print_hide": 1, "description": "Select the currency in which price list is maintained", - "colour": "White:FFF", "doctype": "DocField", "label": "Price List Currency", "options": "link:Currency", @@ -362,7 +338,6 @@ { "print_hide": 1, "description": "Rate at which Price list currency is converted to company's base currency", - "colour": "White:FFF", "doctype": "DocField", "label": "Price List Currency Conversion Rate", "fieldname": "plc_conversion_rate", @@ -382,12 +357,10 @@ "description": "Customer's currency - If you want to select a currency that is not the default currency, then you must also specify the Currency Conversion Rate.", "permlevel": 0, "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Currency", "oldfieldname": "currency", "width": "100px", - "trigger": "Client", "fieldname": "currency", "fieldtype": "Select", "search_index": 0, @@ -400,12 +373,10 @@ "description": "Rate at which customer's currency is converted to company's base currency", "default": "1.00", "oldfieldtype": "Currency", - "colour": "White:FFF", "doctype": "DocField", "label": "Conversion Rate", "oldfieldname": "conversion_rate", "width": "100px", - "trigger": "Client", "fieldname": "conversion_rate", "fieldtype": "Float", "reqd": 1, @@ -413,7 +384,6 @@ }, { "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Taxes", "fieldname": "taxes", @@ -426,11 +396,10 @@ "doctype": "DocField", "label": "Sales Taxes and Charges", "oldfieldname": "charge", - "trigger": "Client", + "options": "Sales Taxes and Charges Master", "fieldname": "charge", "fieldtype": "Link", "hidden": 0, - "options": "Sales Taxes and Charges Master", "permlevel": 0 }, { @@ -438,7 +407,6 @@ "oldfieldtype": "Button", "doctype": "DocField", "label": "Get Taxes and Charges", - "trigger": "Client", "fieldname": "get_charges", "fieldtype": "Button", "hidden": 0, @@ -457,10 +425,8 @@ { "print_hide": 1, "oldfieldtype": "Button", - "colour": "White:FFF", "doctype": "DocField", "label": "Calculate Taxes and Charges", - "trigger": "Client", "fieldname": "calculate_charges", "fieldtype": "Button", "permlevel": 0 @@ -487,7 +453,6 @@ { "print_hide": 1, "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Totals", "fieldname": "totals", @@ -515,7 +480,6 @@ "label": "Rounded Total", "oldfieldname": "rounded_total", "width": "200px", - "trigger": "Client", "fieldname": "rounded_total", "fieldtype": "Currency", "permlevel": 1 @@ -525,7 +489,6 @@ "description": "In Words will be visible once you save the Quotation.", "no_copy": 0, "oldfieldtype": "Data", - "colour": "White:FFF", "doctype": "DocField", "label": "In Words", "oldfieldname": "in_words", @@ -573,7 +536,6 @@ "print_hide": 0, "no_copy": 0, "oldfieldtype": "Data", - "colour": "White:FFF", "doctype": "DocField", "label": "In Words", "oldfieldname": "in_words_export", @@ -586,7 +548,6 @@ "print_hide": 0, "description": "Add Terms and Conditions for the Quotation like Payment Terms, Validity of Offer etc. You can also prepare a Terms and Conditions Master and use the Template", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Terms and Conditions", "fieldname": "terms_section_break", @@ -649,26 +610,22 @@ }, { "print_hide": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Customer Address", - "trigger": "Client", + "options": "Address", "fieldname": "customer_address", "fieldtype": "Link", "hidden": 0, - "options": "Address", "permlevel": 0, "in_filter": 1 }, { "print_hide": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Person", "oldfieldname": "contact_person", "permlevel": 0, - "trigger": "Client", "fieldname": "contact_person", "fieldtype": "Link", "reqd": 0, @@ -687,11 +644,9 @@ "print_hide": 1, "description": "Will be fetched from Customer", "search_index": 0, - "colour": "White:FFF", "doctype": "DocField", "label": "Territory", "permlevel": 0, - "trigger": "Client", "fieldname": "territory", "fieldtype": "Link", "reqd": 1, @@ -702,12 +657,10 @@ { "print_hide": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Customer Group", "oldfieldname": "customer_group", "permlevel": 0, - "trigger": "Client", "fieldname": "customer_group", "fieldtype": "Link", "search_index": 0, @@ -719,7 +672,6 @@ "print_hide": 1, "description": "Filling in additional information about the Quotation will help you analyze your data better.", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "More Info", "fieldname": "more_info", @@ -743,12 +695,10 @@ "description": "Select the relevant company name if you have multiple companies.", "permlevel": 0, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Company", "oldfieldname": "company", "width": "150px", - "trigger": "Client", "fieldname": "company", "fieldtype": "Link", "search_index": 0, @@ -756,10 +706,23 @@ "in_filter": 1, "options": "Company" }, + { + "print_hide": 1, + "no_copy": 0, + "oldfieldtype": "Select", + "doctype": "DocField", + "label": "Source", + "oldfieldname": "source", + "permlevel": 0, + "fieldname": "source", + "fieldtype": "Select", + "hidden": 0, + "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", + "report_hide": 0 + }, { "print_hide": 1, "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Fiscal Year", "oldfieldname": "fiscal_year", @@ -775,7 +738,6 @@ "print_hide": 1, "no_copy": 0, "oldfieldtype": "Text", - "colour": "White:FFF", "doctype": "DocField", "label": "Opportunity Item", "oldfieldname": "enq_det", @@ -785,61 +747,6 @@ "permlevel": 1, "report_hide": 0 }, - { - "print_hide": 1, - "no_copy": 0, - "oldfieldtype": "Select", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Source", - "oldfieldname": "source", - "permlevel": 0, - "fieldname": "source", - "fieldtype": "Select", - "hidden": 0, - "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", - "report_hide": 0 - }, - { - "print_hide": 1, - "no_copy": 0, - "oldfieldtype": "Link", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Campaign", - "oldfieldname": "campaign", - "permlevel": 0, - "fieldname": "campaign", - "fieldtype": "Link", - "hidden": 0, - "options": "Campaign", - "report_hide": 0 - }, - { - "print_hide": 1, - "no_copy": 1, - "oldfieldtype": "Data", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Cancel Reason", - "oldfieldname": "cancel_reason", - "fieldname": "cancel_reason", - "fieldtype": "Data", - "permlevel": 1, - "report_hide": 0 - }, - { - "print_hide": 1, - "no_copy": 1, - "oldfieldtype": "Small Text", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Quotation Lost Reason", - "oldfieldname": "order_lost_reason", - "fieldname": "order_lost_reason", - "fieldtype": "Small Text", - "permlevel": 1 - }, { "print_hide": 1, "oldfieldtype": "Column Break", @@ -854,7 +761,6 @@ "permlevel": 1, "no_copy": 1, "oldfieldtype": "Select", - "colour": "White:FFF", "allow_on_submit": 0, "doctype": "DocField", "label": "Status", @@ -867,6 +773,32 @@ "options": "\nDraft\nSubmitted\nOrder Confirmed\nOrder Lost\nCancelled", "in_filter": 1 }, + { + "print_hide": 1, + "no_copy": 0, + "oldfieldtype": "Link", + "doctype": "DocField", + "label": "Campaign", + "oldfieldname": "campaign", + "permlevel": 0, + "fieldname": "campaign", + "fieldtype": "Link", + "hidden": 0, + "options": "Campaign", + "report_hide": 0 + }, + { + "print_hide": 1, + "no_copy": 1, + "oldfieldtype": "Small Text", + "allow_on_submit": 1, + "doctype": "DocField", + "label": "Quotation Lost Reason", + "oldfieldname": "order_lost_reason", + "fieldname": "order_lost_reason", + "fieldtype": "Small Text", + "permlevel": 0 + }, { "print_hide": 1, "no_copy": 1, @@ -881,52 +813,6 @@ "options": "Print Heading", "report_hide": 1 }, - { - "print_hide": 1, - "description": "Your sales person who will contact the customer/lead in future", - "oldfieldtype": "Link", - "doctype": "DocField", - "label": "Next Contact By", - "oldfieldname": "contact_by", - "options": "Profile", - "fieldname": "contact_by", - "fieldtype": "Link", - "permlevel": 0 - }, - { - "print_hide": 1, - "description": "Your sales person will get a reminder on this date to contact the customer/lead", - "oldfieldtype": "Date", - "doctype": "DocField", - "label": "Next Contact Date", - "oldfieldname": "contact_date", - "fieldname": "contact_date", - "fieldtype": "Date", - "permlevel": 0 - }, - { - "print_hide": 1, - "description": "Date on which the lead/customer was last contacted", - "no_copy": 1, - "oldfieldtype": "Date", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Last Contact Date", - "oldfieldname": "last_contact_date", - "fieldname": "last_contact_date", - "fieldtype": "Date", - "permlevel": 1 - }, - { - "print_hide": 1, - "oldfieldtype": "Small Text", - "doctype": "DocField", - "label": "To Discuss", - "oldfieldname": "to_discuss", - "fieldname": "to_discuss", - "fieldtype": "Small Text", - "permlevel": 0 - }, { "print_hide": 1, "no_copy": 1, @@ -956,7 +842,6 @@ "print_hide": 1, "description": "Keep a track on communications regarding this Quotation. This will help you remember earlier communications in case the Customer comes back again", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Communication History", "fieldname": "communication_history", @@ -966,7 +851,6 @@ { "print_hide": 1, "oldfieldtype": "Table", - "colour": "White:FFF", "allow_on_submit": 1, "doctype": "DocField", "label": "Communication HTML", @@ -979,7 +863,6 @@ { "print_hide": 1, "no_copy": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "File List", "fieldname": "file_list", @@ -987,14 +870,34 @@ "hidden": 1, "permlevel": 0 }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "cancel": 0, + "role": "Sales Manager", + "permlevel": 1 + }, { "amend": 1, "create": 1, "doctype": "DocPerm", "submit": 1, "write": 1, - "role": "Sales User", "cancel": 1, + "role": "Sales Manager", + "permlevel": 0 + }, + { + "amend": 1, + "create": 1, + "doctype": "DocPerm", + "submit": 1, + "write": 1, + "cancel": 1, + "role": "Sales User", "permlevel": 0 }, { @@ -1003,15 +906,29 @@ "doctype": "DocPerm", "submit": 0, "write": 0, - "role": "Sales User", "cancel": 0, + "role": "Sales User", "permlevel": 1 }, { + "amend": 0, + "create": 0, "doctype": "DocPerm", + "submit": 0, + "write": 0, + "cancel": 0, "role": "Customer", - "permlevel": 0, - "match": "customer_name" + "permlevel": 0 + }, + { + "amend": 1, + "create": 1, + "doctype": "DocPerm", + "submit": 1, + "write": 1, + "cancel": 1, + "role": "Maintenance Manager", + "permlevel": 0 }, { "amend": 0, @@ -1019,32 +936,7 @@ "doctype": "DocPerm", "submit": 0, "write": 0, - "role": "Sales Manager", "cancel": 0, - "permlevel": 1 - }, - { - "amend": 1, - "create": 1, - "doctype": "DocPerm", - "submit": 1, - "write": 1, - "role": "Sales Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "amend": 1, - "create": 1, - "doctype": "DocPerm", - "submit": 1, - "write": 1, - "role": "Maintenance Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "doctype": "DocPerm", "role": "Maintenance Manager", "permlevel": 1 }, @@ -1054,12 +946,17 @@ "doctype": "DocPerm", "submit": 1, "write": 1, + "cancel": 1, "role": "Maintenance User", - "cancel": 1, "permlevel": 0 }, { + "amend": 0, + "create": 0, "doctype": "DocPerm", + "submit": 0, + "write": 0, + "cancel": 0, "role": "Maintenance User", "permlevel": 1 }