diff --git a/patches/december_2012/clear_web_cache.py b/patches/december_2012/clear_web_cache.py index da71492814..b92f4bde08 100644 --- a/patches/december_2012/clear_web_cache.py +++ b/patches/december_2012/clear_web_cache.py @@ -1,5 +1,10 @@ import webnotes def execute(): + webnotes.reload_doc("website", "doctype", "web_page") + webnotes.reload_doc("website", "doctype", "blog") + webnotes.reload_doc("stock", "doctype", "item") + webnotes.reload_doc("setup", "doctype", "item_group") + # build wn-web.js and wn-web.css from website.helpers.make_web_include_files import make make() diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 81c0d88de7..9423135352 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -16,7 +16,7 @@ from __future__ import unicode_literals import webnotes - +from webnotes import _ from webnotes.utils import cstr, validate_email_add from webnotes.model.doc import Document, addchild from webnotes import session, msgprint @@ -51,10 +51,23 @@ class DocType(SellingController): if not validate_email_add(self.doc.email_id): msgprint('Please enter valid email id.') raise Exception + def on_update(self): if self.doc.contact_date: self.add_calendar_event() + + self.check_email_id_is_unique() + + def check_email_id_is_unique(self): + if self.doc.email_id: + # validate email is unique + email_list = webnotes.conn.sql("""select name from tabLead where email_id=%s""", + self.doc.email_id) + if len(email_list) > 1: + items = [e[0] for e in email_list if e[0]!=self.doc.name] + webnotes.msgprint(_("""Email Id must be unique, already exists for: """) + \ + ", ".join(items), raise_exception=True) def add_calendar_event(self): # delete any earlier event by this lead diff --git a/selling/doctype/opportunity/opportunity.txt b/selling/doctype/opportunity/opportunity.txt index afa6fa81a3..fce7dda5b0 100644 --- a/selling/doctype/opportunity/opportunity.txt +++ b/selling/doctype/opportunity/opportunity.txt @@ -1,220 +1,207 @@ [ { - "owner": "Administrator", + "creation": "2013-01-18 12:35:41", "docstatus": 0, - "creation": "2012-12-03 10:31:06", + "modified": "2013-01-22 12:08:56", "modified_by": "Administrator", - "modified": "2012-12-03 17:10:41" + "owner": "Administrator" }, { + "autoname": "naming_series:", + "description": "Potential Sales Deal", + "doctype": "DocType", "document_type": "Transaction", "is_submittable": 1, - "description": "Potential Sales Deal", - "autoname": "naming_series:", "module": "Selling", - "doctype": "DocType", - "search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company", - "name": "__common__" + "name": "__common__", + "search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company" }, { - "name": "__common__", - "parent": "Opportunity", "doctype": "DocField", - "parenttype": "DocType", - "parentfield": "fields" - }, - { "name": "__common__", "parent": "Opportunity", - "read": 1, + "parentfield": "fields", + "parenttype": "DocType" + }, + { "doctype": "DocPerm", + "name": "__common__", + "parent": "Opportunity", + "parentfield": "permissions", "parenttype": "DocType", - "parentfield": "permissions" + "read": 1 }, { - "name": "Opportunity", - "doctype": "DocType" + "doctype": "DocType", + "name": "Opportunity" }, { + "default": "OPPTY", "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", - "options": "ENQUIRY\nENQ", "fieldname": "naming_series", "fieldtype": "Select", - "reqd": 1, - "permlevel": 0 + "label": "Naming Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "\nOPPTY", + "permlevel": 0, + "reqd": 1 }, { - "print_hide": 1, - "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", - "label": "Opportunity From", - "oldfieldname": "enquiry_from", - "permlevel": 0, - "trigger": "Client", "fieldname": "enquiry_from", "fieldtype": "Select", - "reqd": 1, + "label": "Opportunity From", + "oldfieldname": "enquiry_from", + "oldfieldtype": "Select", "options": "\nLead\nCustomer", - "report_hide": 0 + "permlevel": 0, + "print_hide": 1, + "report_hide": 0, + "reqd": 1 }, { - "print_hide": 1, - "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", - "label": "Customer", - "oldfieldname": "customer", - "permlevel": 0, - "trigger": "Client", "fieldname": "customer", "fieldtype": "Link", - "search_index": 0, - "reqd": 0, "hidden": 0, + "in_filter": 1, + "label": "Customer", + "oldfieldname": "customer", + "oldfieldtype": "Link", "options": "Customer", - "in_filter": 1 + "permlevel": 0, + "print_hide": 1, + "reqd": 0, + "search_index": 0 }, { - "print_hide": 1, - "oldfieldtype": "Link", "doctype": "DocField", - "label": "Lead", - "oldfieldname": "lead", - "trigger": "Client", "fieldname": "lead", "fieldtype": "Link", "hidden": 0, + "in_filter": 1, + "label": "Lead", + "oldfieldname": "lead", + "oldfieldtype": "Link", "options": "Lead", "permlevel": 0, - "in_filter": 1 + "print_hide": 1 }, { - "oldfieldtype": "Column Break", "doctype": "DocField", - "width": "50%", "fieldname": "column_break0", "fieldtype": "Column Break", - "permlevel": 0 + "oldfieldtype": "Column Break", + "permlevel": 0, + "width": "50%" }, { - "no_copy": 1, - "oldfieldtype": "Select", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Status", - "oldfieldname": "status", "default": "Draft", - "options": "\nDraft\nSubmitted\nQuotation Sent\nOrder Confirmed\nOpportunity Lost\nCancelled", + "doctype": "DocField", "fieldname": "status", "fieldtype": "Select", - "reqd": 1, - "permlevel": 1 + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nQuotation Sent\nOrder Confirmed\nOpportunity Lost\nCancelled", + "permlevel": 1, + "reqd": 1 }, { - "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", - "label": "Opportunity Type", - "oldfieldname": "enquiry_type", - "permlevel": 0, "fieldname": "enquiry_type", "fieldtype": "Select", - "reqd": 1, - "options": "\nSales\nMaintenance" + "label": "Opportunity Type", + "oldfieldname": "enquiry_type", + "oldfieldtype": "Select", + "options": "\nSales\nMaintenance", + "permlevel": 0, + "reqd": 1 }, { - "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", - "label": "Items", "fieldname": "items", "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break", "permlevel": 0 }, { "description": "Items which do not exist in Item master can also be entered on customer's request", - "oldfieldtype": "Table", - "colour": "White:FFF", "doctype": "DocField", - "label": "Opportunity Items", - "oldfieldname": "enquiry_details", - "permlevel": 0, "fieldname": "enquiry_details", "fieldtype": "Table", - "options": "Opportunity Item" + "label": "Opportunity Items", + "oldfieldname": "enquiry_details", + "oldfieldtype": "Table", + "options": "Opportunity Item", + "permlevel": 0 }, { "description": "Keep a track of communication related to this enquiry which will help for future reference.", - "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "fieldname": "communication_history", "fieldtype": "Section Break", + "oldfieldtype": "Section Break", "permlevel": 0 }, { - "oldfieldtype": "Table", - "colour": "White:FFF", "allow_on_submit": 1, "doctype": "DocField", - "label": "Communication HTML", - "oldfieldname": "follow_up", "fieldname": "communication_html", "fieldtype": "HTML", + "label": "Communication HTML", + "oldfieldname": "follow_up", + "oldfieldtype": "Table", "permlevel": 0 }, { "doctype": "DocField", - "label": "Contact Info", "fieldname": "contact_info", "fieldtype": "Section Break", + "label": "Contact Info", "permlevel": 0 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Contact Person", - "permlevel": 0, - "trigger": "Client", "fieldname": "contact_person", "fieldtype": "Link", + "in_filter": 1, + "label": "Contact Person", "options": "Contact", - "in_filter": 1 + "permlevel": 0, + "print_hide": 1 }, { - "print_hide": 1, "doctype": "DocField", - "label": "Customer Address", - "permlevel": 0, - "trigger": "Client", "fieldname": "customer_address", "fieldtype": "Link", + "in_filter": 1, + "label": "Customer Address", "options": "Address", - "in_filter": 1 + "permlevel": 0, + "print_hide": 1 }, { - "print_hide": 0, "doctype": "DocField", - "label": "Customer Name", "fieldname": "customer_name", "fieldtype": "Data", - "permlevel": 1 + "label": "Customer Name", + "permlevel": 1, + "print_hide": 0 }, { - "oldfieldtype": "Small Text", "doctype": "DocField", - "label": "Address", - "oldfieldname": "address", "fieldname": "address_display", "fieldtype": "Small Text", "hidden": 0, + "label": "Address", + "oldfieldname": "address", + "oldfieldtype": "Small Text", "permlevel": 1 }, { @@ -225,301 +212,288 @@ }, { "doctype": "DocField", - "label": "Contact", "fieldname": "contact_display", "fieldtype": "Small Text", + "label": "Contact", "permlevel": 1 }, { "doctype": "DocField", - "label": "Contact Email", "fieldname": "contact_email", "fieldtype": "Text", + "label": "Contact Email", "permlevel": 1 }, { "doctype": "DocField", - "label": "Contact Mobile No", "fieldname": "contact_mobile", "fieldtype": "Text", + "label": "Contact Mobile No", "permlevel": 1 }, { - "oldfieldtype": "Data", "doctype": "DocField", - "label": "Name", - "oldfieldname": "lead_name", "fieldname": "lead_name", "fieldtype": "Data", "hidden": 0, + "label": "Name", + "oldfieldname": "lead_name", + "oldfieldtype": "Data", "permlevel": 1 }, { - "print_hide": 1, - "doctype": "DocField", + "depends_on": "eval:doc.enquiry_from==\"Customer\"", "description": "To manage Territory, click here", - "search_index": 1, - "colour": "White:FFF", - "oldfieldtype": "Link", - "label": "Customer Group", - "oldfieldname": "customer_group", - "permlevel": 0, - "trigger": "Client", + "doctype": "DocField", "fieldname": "customer_group", "fieldtype": "Link", - "depends_on": "eval:doc.enquiry_from==\"Customer\"", - "reqd": 0, "hidden": 0, + "in_filter": 1, + "label": "Customer Group", + "oldfieldname": "customer_group", + "oldfieldtype": "Link", "options": "Customer Group", - "in_filter": 1 + "permlevel": 0, + "print_hide": 1, + "reqd": 0, + "search_index": 1 }, { - "print_hide": 1, "description": "To manage Territory, click here", - "search_index": 1, - "colour": "White:FFF", "doctype": "DocField", - "label": "Territory", - "permlevel": 0, - "trigger": "Client", "fieldname": "territory", "fieldtype": "Link", - "reqd": 0, + "in_filter": 1, + "label": "Territory", "options": "Territory", - "in_filter": 1 + "permlevel": 0, + "print_hide": 1, + "reqd": 0, + "search_index": 1 }, { "description": "Filing in Additional Information about the Opportunity will help you analyze your data better.", - "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", - "label": "More Info", "fieldname": "more_info", "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", "permlevel": 0 }, { - "oldfieldtype": "Column Break", "doctype": "DocField", - "width": "50%", "fieldname": "column_break1", "fieldtype": "Column Break", - "permlevel": 0 + "oldfieldtype": "Column Break", + "permlevel": 0, + "width": "50%" }, { - "description": "The date at which current entry is made in system.", "default": "Today", - "oldfieldtype": "Date", + "description": "The date at which current entry is made in system.", "doctype": "DocField", - "label": "Opportunity Date", - "oldfieldname": "transaction_date", - "width": "50px", "fieldname": "transaction_date", "fieldtype": "Date", + "label": "Opportunity Date", + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "permlevel": 0, "reqd": 1, - "permlevel": 0 + "width": "50px" }, { - "print_hide": 1, - "oldfieldtype": "Select", "doctype": "DocField", - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "options": "link:Fiscal Year", "fieldname": "fiscal_year", "fieldtype": "Select", - "search_index": 1, - "reqd": 1, + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "link:Fiscal Year", "permlevel": 0, - "in_filter": 1 + "print_hide": 1, + "reqd": 1, + "search_index": 1 }, { - "oldfieldtype": "Select", "doctype": "DocField", - "label": "Source", - "oldfieldname": "source", - "permlevel": 0, "fieldname": "source", "fieldtype": "Select", - "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In" + "label": "Source", + "oldfieldname": "source", + "oldfieldtype": "Select", + "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In", + "permlevel": 0 }, { "description": "Enter name of campaign if source of enquiry is campaign", - "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", - "label": "Campaign", - "oldfieldname": "campaign", - "permlevel": 0, "fieldname": "campaign", "fieldtype": "Link", - "options": "Campaign" + "label": "Campaign", + "oldfieldname": "campaign", + "oldfieldtype": "Link", + "options": "Campaign", + "permlevel": 0 }, { - "no_copy": 1, - "oldfieldtype": "Small Text", - "colour": "White:FFF", + "depends_on": "eval:!doc.__islocal", "doctype": "DocField", - "label": "Quotation Lost Reason", - "oldfieldname": "order_lost_reason", "fieldname": "order_lost_reason", "fieldtype": "Small Text", - "depends_on": "eval:!doc.__islocal", + "label": "Quotation Lost Reason", + "no_copy": 1, + "oldfieldname": "order_lost_reason", + "oldfieldtype": "Small Text", "permlevel": 1, "report_hide": 0 }, { - "print_hide": 1, - "oldfieldtype": "Link", "doctype": "DocField", - "label": "Company", - "oldfieldname": "company", - "options": "Company", "fieldname": "company", "fieldtype": "Link", - "search_index": 1, - "reqd": 1, + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", "permlevel": 0, - "in_filter": 1 + "print_hide": 1, + "reqd": 1, + "search_index": 1 }, { - "oldfieldtype": "Column Break", "doctype": "DocField", - "width": "50%", "fieldname": "column_break2", "fieldtype": "Column Break", - "permlevel": 0 + "oldfieldtype": "Column Break", + "permlevel": 0, + "width": "50%" }, { "description": "Your sales person who will contact the customer in future", - "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", - "label": "Next Contact By", - "oldfieldname": "contact_by", - "width": "75px", - "options": "Profile", "fieldname": "contact_by", "fieldtype": "Link", + "in_filter": 1, + "label": "Next Contact By", + "oldfieldname": "contact_by", + "oldfieldtype": "Link", + "options": "Profile", "permlevel": 0, - "in_filter": 1 + "width": "75px" }, { "description": "Your sales person will get a reminder on this date to contact the customer", - "oldfieldtype": "Date", - "colour": "White:FFF", "doctype": "DocField", - "label": "Next Contact Date", - "oldfieldname": "contact_date", "fieldname": "contact_date", "fieldtype": "Date", + "label": "Next Contact Date", + "oldfieldname": "contact_date", + "oldfieldtype": "Date", "permlevel": 0 }, { - "print_hide": 1, - "description": "Date on which the lead was last contacted", - "no_copy": 1, - "oldfieldtype": "Date", - "colour": "White:FFF", "allow_on_submit": 0, + "depends_on": "eval:!doc.__islocal", + "description": "Date on which the lead was last contacted", "doctype": "DocField", - "label": "Last Contact Date", - "oldfieldname": "last_contact_date", "fieldname": "last_contact_date", "fieldtype": "Date", - "depends_on": "eval:!doc.__islocal", - "permlevel": 1 + "label": "Last Contact Date", + "no_copy": 1, + "oldfieldname": "last_contact_date", + "oldfieldtype": "Date", + "permlevel": 1, + "print_hide": 1 }, { - "no_copy": 1, - "oldfieldtype": "Small Text", "doctype": "DocField", - "label": "To Discuss", - "oldfieldname": "to_discuss", "fieldname": "to_discuss", "fieldtype": "Small Text", + "label": "To Discuss", + "no_copy": 1, + "oldfieldname": "to_discuss", + "oldfieldtype": "Small Text", "permlevel": 0 }, { - "print_hide": 1, - "no_copy": 1, - "oldfieldtype": "Data", "doctype": "DocField", - "label": "Amended From", - "oldfieldname": "amended_from", - "width": "150px", "fieldname": "amended_from", "fieldtype": "Data", - "permlevel": 1 + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "permlevel": 1, + "print_hide": 1, + "width": "150px" }, { - "print_hide": 1, - "no_copy": 1, - "oldfieldtype": "Date", "doctype": "DocField", - "label": "Amendment Date", - "oldfieldname": "amendment_date", - "width": "150px", "fieldname": "amendment_date", "fieldtype": "Date", - "permlevel": 1 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales Manager", - "cancel": 0, - "permlevel": 1 - }, - { - "amend": 1, - "create": 1, - "doctype": "DocPerm", - "submit": 1, - "write": 1, - "report": 1, - "role": "System Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "role": "System Manager", + "label": "Amendment Date", + "no_copy": 1, + "oldfieldname": "amendment_date", + "oldfieldtype": "Date", "permlevel": 1, - "doctype": "DocPerm" - }, - { - "amend": 1, - "create": 1, - "doctype": "DocPerm", - "submit": 1, - "write": 1, - "report": 1, - "role": "Sales User", - "cancel": 1, - "permlevel": 0 + "print_hide": 1, + "width": "150px" }, { "amend": 0, + "cancel": 0, "create": 0, "doctype": "DocPerm", + "permlevel": 1, + "role": "Sales Manager", "submit": 0, - "write": 0, - "role": "Sales User", - "cancel": 0, - "permlevel": 1 + "write": 0 }, { "amend": 1, + "cancel": 1, "create": 1, "doctype": "DocPerm", + "permlevel": 0, + "role": "System Manager", "submit": 1, - "write": 1, - "report": 1, - "role": "Sales Manager", + "write": 1 + }, + { + "doctype": "DocPerm", + "permlevel": 1, + "role": "System Manager" + }, + { + "amend": 1, "cancel": 1, - "permlevel": 0 + "create": 1, + "doctype": "DocPerm", + "permlevel": 0, + "role": "Sales User", + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 1, + "role": "Sales User", + "submit": 0, + "write": 0 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "doctype": "DocPerm", + "permlevel": 0, + "role": "Sales Manager", + "submit": 1, + "write": 1 } ] \ No newline at end of file diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 145bcb4ccf..6c1300b28d 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -239,10 +239,6 @@ class DocType(SellingController): # ========================================================================= def on_submit(self): self.check_item_table() - if not self.doc.amended_from: - webnotes.conn.set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been sent') - else: - webnotes.conn.set(self.doc, 'message', 'Quotation has been amended. New Quotation no:'+self.doc.name) # Check for Approving Authority get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self) @@ -257,24 +253,11 @@ class DocType(SellingController): # ON CANCEL # ========================================================================== def on_cancel(self): - webnotes.conn.set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been cancelled') - #update enquiry status self.update_enquiry('cancel') webnotes.conn.set(self.doc,'status','Cancelled') - - -# SEND SMS -# ============================================================================= - def send_sms(self): - if not self.doc.customer_mobile_no: - msgprint("Please enter customer mobile no") - elif not self.doc.message: - msgprint("Please enter the message you want to send") - else: - msgprint(get_obj("SMS Control", "SMS Control").send_sms([self.doc.contact_mobile,], self.doc.message)) - + # Print other charges # =========================================================================== def print_other_charges(self,docname):