diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt index 980195642fb..09caf556c01 100644 --- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -2,14 +2,14 @@ { "creation": "2011-12-21 11:08:55", "docstatus": 0, - "modified": "2013-12-26 18:13:48", + "modified": "2014-01-27 17:26:10", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", + "html": "\n\t\n\n\t\t\n\t\t\n\n\t\t\n\t\t\n\t\n\n\t\n\t\t\n\t\t
\n\t\t
\n\t\t
\n\t\t
\n\t\t
\n\t\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py index 8671210de58..6eaab482a49 100644 --- a/erpnext/selling/doctype/sms_center/sms_center.py +++ b/erpnext/selling/doctype/sms_center/sms_center.py @@ -10,52 +10,49 @@ from webnotes.model.bean import copy_doclist from webnotes.model.code import get_obj from webnotes import msgprint - -# ---------- - class DocType: - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist - - def create_receiver_list(self): - rec, where_clause = '', '' - if self.doc.send_to == 'All Customer Contact': - where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(customer, '') != ''" - if self.doc.send_to == 'All Supplier Contact': - where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(supplier, '') != ''" - if self.doc.send_to == 'All Sales Partner Contact': - where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % self.doc.sales_partner or " and ifnull(sales_partner, '') != ''" + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist - if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']: - rec = webnotes.conn.sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause) - elif self.doc.send_to == 'All Lead (Open)': - rec = webnotes.conn.sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'") - elif self.doc.send_to == 'All Employee (Active)': - where_clause = self.doc.department and " and department = '%s'" % self.doc.department or "" - where_clause += self.doc.branch and " and branch = '%s'" % self.doc.branch or "" - rec = webnotes.conn.sql("select employee_name, cell_number from `tabEmployee` where status = 'Active' and docstatus < 2 and ifnull(cell_number,'')!='' %s" % where_clause) - elif self.doc.send_to == 'All Sales Person': - rec = webnotes.conn.sql("select sales_person_name, mobile_no from `tabSales Person` where docstatus != 2 and ifnull(mobile_no,'')!=''") - rec_list = '' - for d in rec: - rec_list += d[0] + ' - ' + d[1] + '\n' - self.doc.receiver_list = rec_list + def create_receiver_list(self): + rec, where_clause = '', '' + if self.doc.send_to == 'All Customer Contact': + where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(customer, '') != ''" + if self.doc.send_to == 'All Supplier Contact': + where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(supplier, '') != ''" + if self.doc.send_to == 'All Sales Partner Contact': + where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % self.doc.sales_partner or " and ifnull(sales_partner, '') != ''" - def get_receiver_nos(self): - receiver_nos = [] - for d in self.doc.receiver_list.split('\n'): - receiver_no = d - if '-' in d: - receiver_no = receiver_no.split('-')[1] - if receiver_no.strip(): - receiver_nos.append(cstr(receiver_no).strip()) - return receiver_nos + if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']: + rec = webnotes.conn.sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause) + elif self.doc.send_to == 'All Lead (Open)': + rec = webnotes.conn.sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'") + elif self.doc.send_to == 'All Employee (Active)': + where_clause = self.doc.department and " and department = '%s'" % self.doc.department or "" + where_clause += self.doc.branch and " and branch = '%s'" % self.doc.branch or "" + rec = webnotes.conn.sql("select employee_name, cell_number from `tabEmployee` where status = 'Active' and docstatus < 2 and ifnull(cell_number,'')!='' %s" % where_clause) + elif self.doc.send_to == 'All Sales Person': + rec = webnotes.conn.sql("select sales_person_name, mobile_no from `tabSales Person` where docstatus != 2 and ifnull(mobile_no,'')!=''") + rec_list = '' + for d in rec: + rec_list += d[0] + ' - ' + d[1] + '\n' + self.doc.receiver_list = rec_list - def send_sms(self): - if not self.doc.message: - msgprint("Please enter message before sending") - else: - receiver_list = self.get_receiver_nos() - if receiver_list: - msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, cstr(self.doc.message))) + def get_receiver_nos(self): + receiver_nos = [] + for d in self.doc.receiver_list.split('\n'): + receiver_no = d + if '-' in d: + receiver_no = receiver_no.split('-')[1] + if receiver_no.strip(): + receiver_nos.append(cstr(receiver_no).strip()) + return receiver_nos + + def send_sms(self): + if not self.doc.message: + msgprint("Please enter message before sending") + else: + receiver_list = self.get_receiver_nos() + if receiver_list: + msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, cstr(self.doc.message))) \ No newline at end of file diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py index 8fbb8fe7dce..41ff2a15159 100644 --- a/erpnext/utilities/doctype/sms_control/sms_control.py +++ b/erpnext/utilities/doctype/sms_control/sms_control.py @@ -7,7 +7,7 @@ import webnotes, json from webnotes.utils import nowdate, cstr from webnotes.model.code import get_obj from webnotes.model.doc import Document -from webnotes import msgprint +from webnotes import msgprint, throw, _ from webnotes.model.bean import getlist, copy_doclist class DocType: @@ -26,7 +26,7 @@ class DocType: validated_receiver_list.append(d) if not validated_receiver_list: - msgprint("Please enter valid mobile nos", raise_exception=1) + throw(_("Please enter valid mobile nos")) return validated_receiver_list @@ -37,12 +37,12 @@ class DocType: 'ERPNXT' if len(sender_name) > 6 and \ webnotes.conn.get_value("Control Panel", None, "country") == "India": - msgprint(""" + throw(_(""" As per TRAI rule, sender name must be exactly 6 characters. Kindly change sender name in Setup --> Global Defaults. Note: Hyphen, space, numeric digit, special characters are not allowed. - """, raise_exception=1) + """)) return sender_name def get_contact_number(self, arg):