From 627c42bdb6ad73bf7a9952244659ba40ecfa404d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Sep 2013 15:34:24 +0530 Subject: [PATCH] [fix] [minor] quotation to sales order, if not able to create customer, show message --- selling/doctype/customer/customer.py | 3 +-- selling/doctype/quotation/quotation.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py index cb19d4f931..fb3c0062a7 100644 --- a/selling/doctype/customer/customer.py +++ b/selling/doctype/customer/customer.py @@ -40,8 +40,7 @@ class DocType(TransactionBase): def validate_values(self): if webnotes.defaults.get_global_default('cust_master_name') == 'Naming Series' and not self.doc.naming_series: - msgprint("Series is Mandatory.") - raise Exception + webnotes.throw("Series is Mandatory.", webnotes.MandatoryError) def validate(self): self.validate_values() diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index c1b529ca69..6ac254298c 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -7,7 +7,7 @@ import webnotes from webnotes.utils import cstr, getdate from webnotes.model.bean import getlist from webnotes.model.code import get_obj -from webnotes import msgprint +from webnotes import _, msgprint sql = webnotes.conn.sql @@ -276,5 +276,8 @@ def _make_customer(source_name, ignore_permissions=False): customer.doc.name += "-" + lead_name customer.insert() return customer + elif webnotes.MandatoryError: + msgprint(_("You will need to make Customer from Lead") + (" - %s" % lead_name)) + return else: raise e