From 3e4bcfe2d8ba9d8640f178d928de07a429bb07a8 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 4 Jul 2017 10:49:37 +0530 Subject: [PATCH 1/4] [Fix] Opening Entry, Unknown column 'warehouse' in 'where clause' (#9585) * [Fix] Opening Entry, Unknown column 'warehouse' in 'where clause' * escaped company name in get_opening_accounts --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index a3de8da9a2..375d85d1b7 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -733,11 +733,10 @@ def get_opening_accounts(company): accounts = frappe.db.sql_list("""select name from tabAccount where - is_group=0 and - report_type='Balance Sheet' and - ifnull(warehouse, '') = '' and - company=%s - order by name asc""", company) + is_group=0 and report_type='Balance Sheet' and company=%s and + name not in(select distinct account from tabWarehouse where + account is not null and account != '') + order by name asc""", frappe.db.escape(company)) return [{"account": a, "balance": get_balance_on(a)} for a in accounts] From e5ca48a76a2f2a0901a05a6af30ab2fd44c5e88f Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 4 Jul 2017 10:54:23 +0530 Subject: [PATCH 2/4] [fix] Don't update the sales invoice number into the serial no if update stock is disabled in the invoice (#9593) --- .../doctype/sales_invoice/sales_invoice.js | 2 ++ .../doctype/sales_invoice/sales_invoice.py | 17 +++++++++-------- .../sales_invoice_item/sales_invoice_item.json | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 4a1685b04b..b0b9679bde 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -324,10 +324,12 @@ cur_frm.cscript.hide_fields = function(doc) { } } + /* var item_fields_stock = ['batch_no', 'actual_batch_qty', 'actual_qty', 'expense_account', 'warehouse', 'expense_account', 'quality_inspection'] cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock, (cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false)); + */ // India related fields if (frappe.boot.sysdefaults.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index fd4598cf0a..c545ee1d5d 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -131,6 +131,8 @@ class SalesInvoice(SellingController): if not self.is_return: self.update_billing_status_for_zero_amount_refdoc("Sales Order") self.check_credit_limit() + + if self.update_stock: self.update_serial_no() if not cint(self.is_pos) == 1 and not self.is_return: @@ -793,19 +795,18 @@ class SalesInvoice(SellingController): def update_serial_no(self, in_cancel=False): """ update Sales Invoice refrence in Serial No """ + invoice = None if (in_cancel or self.is_return) else self.name + if in_cancel and self.is_return: + invoice = self.return_against for item in self.items: if not item.serial_no: continue - serial_nos = ["'%s'"%serial_no for serial_no in item.serial_no.split("\n")] - - frappe.db.sql(""" update `tabSerial No` set sales_invoice='{invoice}' - where name in ({serial_nos})""".format( - invoice='' if in_cancel else self.name, - serial_nos=",".join(serial_nos) - ) - ) + for serial_no in item.serial_no.split("\n"): + sno = frappe.get_doc('Serial No', serial_no) + sno.sales_invoice = invoice + sno.db_update() def validate_serial_numbers(self): """ diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index 9f7085ad54..59af618525 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -1423,7 +1423,7 @@ "collapsible": 1, "collapsible_depends_on": "eval:doc.serial_no || doc.batch_no", "columns": 0, - "depends_on": "eval: parent.update_stock", + "depends_on": "", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", "hidden": 0, @@ -2165,7 +2165,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-05-10 17:14:42.681757", + "modified": "2017-07-03 19:34:14.820285", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", From 10a4a13e5e03f9a92207935e643685b17f0b48ee Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 4 Jul 2017 16:45:29 +0530 Subject: [PATCH 3/4] Remove gst reports for non indian accounts (#9553) * remove gst reports for non indian accounts * [Fix] GSN code auto name --- erpnext/patches.txt | 1 + ...roles_from_gst_report_non_indian_account.py | 18 ++++++++++++++++++ .../doctype/gst_hsn_code/gst_hsn_code.json | 5 +++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 111bf88999..30a24f8719 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -410,3 +410,4 @@ erpnext.patches.v8_0.save_system_settings erpnext.patches.v8_1.delete_deprecated_reports erpnext.patches.v8_1.setup_gst_india #2017-06-27 execute:frappe.reload_doc('regional', 'doctype', 'gst_hsn_code') +erpnext.patches.v8_1.removed_roles_from_gst_report_non_indian_account \ No newline at end of file diff --git a/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py b/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py new file mode 100644 index 0000000000..2feb4838e7 --- /dev/null +++ b/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py @@ -0,0 +1,18 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc('core', 'doctype', 'has_role') + company = frappe.get_all('Company', filters = {'country': 'India'}) + + if not company: + frappe.db.sql(""" + delete from + `tabHas Role` + where + parenttype = 'Report' and parent in('GST Sales Register', + 'GST Purchase Register', 'GST Itemised Sales Register', + 'GST Itemised Purchase Register')""") \ No newline at end of file diff --git a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.json b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.json index 6f1221352e..23cf082362 100644 --- a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.json +++ b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.json @@ -84,7 +84,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-06-29 21:28:09.053351", + "modified": "2017-06-30 20:12:57.903983", "modified_by": "Administrator", "module": "Regional", "name": "GST HSN Code", @@ -94,10 +94,11 @@ "quick_entry": 1, "read_only": 0, "read_only_onload": 0, - "search_fields": "description", + "search_fields": "hsn_code, description", "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", + "title_field": "hsn_code", "track_changes": 1, "track_seen": 0 } \ No newline at end of file From 4b7a30b52786ca17a17f68e03076d116c110c332 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Wed, 5 Jul 2017 11:55:14 +0600 Subject: [PATCH 4/4] bumped to version 8.2.4 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 95c5f8a858..55a78d8fa8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '8.2.3' +__version__ = '8.2.4' def get_default_company(user=None):