From e84f8b23aaa509511415bcac0a2a7b01730eba9b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Jun 2014 10:03:23 +0530 Subject: [PATCH 1/3] minor fix in sales invoice --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 6 +++--- erpnext/selling/doctype/sms_center/sms_center.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 0d8eb50f03..0f11af42c9 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -263,10 +263,10 @@ class SalesInvoice(SellingController): for d in self.get('entries'): item = frappe.db.sql("""select name,is_asset_item,is_sales_item from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life > now())""", d.item_code) - acc = frappe.db.sql("""select account_type from `tabAccount` + acc = frappe.db.sql("""select account_type from `tabAccount` where name = %s and docstatus != 2""", d.income_account) - if item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset': - msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(d.item_code), raise_exception=True) + if item and item[0][1] == 'Yes' and acc and acc[0][0] != 'Fixed Asset': + msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(acc[0][0], d.item_code), raise_exception=True) def validate_with_previous_doc(self): super(SalesInvoice, self).validate_with_previous_doc(self.tname, { diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py index 81939546bf..8c4cad3207 100644 --- a/erpnext/selling/doctype/sms_center/sms_center.py +++ b/erpnext/selling/doctype/sms_center/sms_center.py @@ -12,7 +12,6 @@ from frappe.model.document import Document from erpnext.setup.doctype.sms_settings.sms_settings import send_sms class SMSCenter(Document): - def create_receiver_list(self): rec, where_clause = '', '' if self.send_to == 'All Customer Contact': @@ -71,6 +70,7 @@ class SMSCenter(Document): return receiver_nos def send_sms(self): + receiver_list = [] if not self.message: msgprint(_("Please enter message before sending")) else: From 36da171a3dbfeb632fab044e2996a7b9ff6babf8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Jun 2014 15:36:06 +0530 Subject: [PATCH 2/3] Set status button in serial no --- erpnext/stock/doctype/serial_no/serial_no.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/stock/doctype/serial_no/serial_no.js b/erpnext/stock/doctype/serial_no/serial_no.js index bb131f35c1..f7c484b5f3 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.js +++ b/erpnext/stock/doctype/serial_no/serial_no.js @@ -17,4 +17,12 @@ cur_frm.cscript.onload = function() { frappe.ui.form.on("Serial No", "refresh", function(frm) { frm.toggle_enable("item_code", frm.doc.__islocal); + + if(frm.doc.status == "Sales Returned" && frm.doc.warehouse) + cur_frm.add_custom_button(__('Set Status as Available'), cur_frm.cscript.set_status_as_available); }); + +cur_frm.cscript.set_status_as_available = function() { + cur_frm.set_value("status", "Available"); + cur_frm.save() +} From da490e3f5353be00b9deb384813b48952a8db3cc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 23 Jun 2014 15:51:03 +0530 Subject: [PATCH 3/3] Set status button in serial no --- erpnext/stock/doctype/serial_no/serial_no.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.js b/erpnext/stock/doctype/serial_no/serial_no.js index f7c484b5f3..dce9d4569c 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.js +++ b/erpnext/stock/doctype/serial_no/serial_no.js @@ -19,10 +19,8 @@ frappe.ui.form.on("Serial No", "refresh", function(frm) { frm.toggle_enable("item_code", frm.doc.__islocal); if(frm.doc.status == "Sales Returned" && frm.doc.warehouse) - cur_frm.add_custom_button(__('Set Status as Available'), cur_frm.cscript.set_status_as_available); + cur_frm.add_custom_button(__('Set Status as Available'), function() { + cur_frm.set_value("status", "Available"); + cur_frm.save(); + }); }); - -cur_frm.cscript.set_status_as_available = function() { - cur_frm.set_value("status", "Available"); - cur_frm.save() -}