From 4a1c897b2d5c3faf252d6050c71f4b77efb0c080 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 26 Jun 2014 12:34:27 +0530 Subject: [PATCH 1/3] Select field options in serial no --- erpnext/stock/doctype/serial_no/serial_no.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.json b/erpnext/stock/doctype/serial_no/serial_no.json index 3316582e0d9..8de04f03b43 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.json +++ b/erpnext/stock/doctype/serial_no/serial_no.json @@ -155,7 +155,7 @@ "fieldtype": "Select", "label": "Creation Document Type", "no_copy": 1, - "options": "\nPurchase Receipt\nStock Entry", + "options": "\nPurchase Receipt\nStock Entry\nSerial No", "permlevel": 0, "read_only": 1 }, @@ -418,7 +418,7 @@ "icon": "icon-barcode", "idx": 1, "in_create": 0, - "modified": "2014-05-27 03:49:19.131746", + "modified": "2014-06-26 12:33:49.911829", "modified_by": "Administrator", "module": "Stock", "name": "Serial No", From cf2632fe591c7361e9c7c752d4468392258b3168 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 26 Jun 2014 13:05:10 +0530 Subject: [PATCH 2/3] Fetch warehouse from pos settings --- .../doctype/sales_invoice/sales_invoice.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 614c13a315b..5d6171a7f94 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -383,20 +383,20 @@ class SalesInvoice(SellingController): def get_warehouse(self): - w = frappe.db.sql("""select warehouse from `tabPOS Setting` - where ifnull(user,'') = %s and company = %s""", - (frappe.session['user'], self.company)) - w = w and w[0][0] or '' - if not w: - ps = frappe.db.sql("""select name, warehouse from `tabPOS Setting` + user_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting` + where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company)) + warehouse = user_pos_setting[0][1] if user_pos_setting else None + + if not warehouse: + global_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = %s""", self.company) - if not ps: + + if global_pos_setting: + warehouse = global_pos_setting[0][1] if global_pos_setting else None + elif not user_pos_setting: msgprint(_("POS Setting required to make POS Entry"), raise_exception=True) - elif not ps[0][1]: - msgprint(_("Warehouse required in POS Setting")) - else: - w = ps[0][1] - return w + + return warehouse def on_update(self): if cint(self.update_stock) == 1: From 3e6586f58d5891c247e970bdbffb6676fae7c296 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 26 Jun 2014 14:56:47 +0530 Subject: [PATCH 3/3] minor fix --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 5d6171a7f94..262ac223862 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -392,7 +392,7 @@ class SalesInvoice(SellingController): where ifnull(user,'') = '' and company = %s""", self.company) if global_pos_setting: - warehouse = global_pos_setting[0][1] if global_pos_setting else None + warehouse = global_pos_setting[0][1] elif not user_pos_setting: msgprint(_("POS Setting required to make POS Entry"), raise_exception=True)