From 256a3fef95b1aa2cf7f891f105bca53af24d7aa5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 14 Nov 2016 11:10:22 +0530 Subject: [PATCH] Fixed multiple minor issues --- erpnext/crm/doctype/opportunity/opportunity.js | 11 +++++------ erpnext/crm/doctype/opportunity/opportunity.py | 3 +++ erpnext/patches/v7_1/set_prefered_contact_email.py | 4 +--- erpnext/utilities/doctype/contact/contact.py | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 2f1169d7902..b6346f86042 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -23,20 +23,19 @@ frappe.ui.form.on("Opportunity", { refresh: function(frm) { var doc = frm.doc; frm.events.enquiry_from(frm); - if(doc.status!=="Lost") { if(doc.with_items){ frm.add_custom_button(__('Supplier Quotation'), function() { frm.trigger("make_supplier_quotation") }, __("Make")); - - frm.add_custom_button(__('Quotation'), - cur_frm.cscript.create_quotation, __("Make")); - - frm.page.set_inner_btn_group_as_primary(__("Make")); } + frm.add_custom_button(__('Quotation'), + cur_frm.cscript.create_quotation, __("Make")); + + frm.page.set_inner_btn_group_as_primary(__("Make")); + if(doc.status!=="Quotation") { frm.add_custom_button(__('Lost'), cur_frm.cscript['Declare Opportunity Lost']); diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 8bd3a2346e6..6be0768bf41 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -39,6 +39,9 @@ class Opportunity(TransactionBase): if not self.title: self.title = self.customer_name + + if not self.with_items: + self.items = [] def make_new_lead_if_required(self): diff --git a/erpnext/patches/v7_1/set_prefered_contact_email.py b/erpnext/patches/v7_1/set_prefered_contact_email.py index d662e0dc049..d083811c84e 100644 --- a/erpnext/patches/v7_1/set_prefered_contact_email.py +++ b/erpnext/patches/v7_1/set_prefered_contact_email.py @@ -14,6 +14,4 @@ def execute(): employee.prefered_contact_email = "User ID" employee.prefered_email = employee.user_id - employee.flags.ignore_mandatory = True - employee.flags.ignore_validate = True - employee.save() \ No newline at end of file + employee.db_update() \ No newline at end of file diff --git a/erpnext/utilities/doctype/contact/contact.py b/erpnext/utilities/doctype/contact/contact.py index a6878809efe..dd6aa10f95c 100644 --- a/erpnext/utilities/doctype/contact/contact.py +++ b/erpnext/utilities/doctype/contact/contact.py @@ -103,4 +103,5 @@ def update_contact(doc, method): for key in ("first_name", "last_name", "phone"): if doc.get(key): contact.set(key, doc.get(key)) + contact.flags.ignore_mandatory = True contact.save(ignore_permissions=True)