From f702d72c3542f5bcf7d2c66ed8861787170e5ecd Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 27 Sep 2017 15:31:30 +0530 Subject: [PATCH 1/5] [minor] [performance] push hsn code creation after setup (#10928) --- erpnext/regional/india/setup.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index 106a3d5740..2798cfbd53 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -12,7 +12,7 @@ def setup(company=None, patch=True): make_custom_fields() add_permissions() add_custom_roles_for_reports() - add_hsn_sac_codes() + frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes') add_print_formats() if not patch: update_address_template() @@ -47,12 +47,14 @@ def add_hsn_sac_codes(): def create_hsn_codes(data, code_field): for d in data: - if not frappe.db.exists("GST HSN Code", d[code_field]): - hsn_code = frappe.new_doc('GST HSN Code') - hsn_code.description = d["description"] - hsn_code.hsn_code = d[code_field] - hsn_code.name = d[code_field] + hsn_code = frappe.new_doc('GST HSN Code') + hsn_code.description = d["description"] + hsn_code.hsn_code = d[code_field] + hsn_code.name = d[code_field] + try: hsn_code.db_insert() + except frappe.DuplicateEntryError: + pass def add_custom_roles_for_reports(): for report_name in ('GST Sales Register', 'GST Purchase Register', From 566a0a05c856e8cf1a371f1b0794389dfa98904c Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 27 Sep 2017 15:57:48 +0530 Subject: [PATCH 2/5] [fix] 'NoneType' object is not iterable while saving quotation --- erpnext/accounts/doctype/tax_rule/tax_rule.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py index 2d91a3c85f..9c091e8c9d 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py @@ -8,6 +8,7 @@ from frappe import _ from frappe.model.document import Document from frappe.utils import cstr, cint from frappe.contacts.doctype.address.address import get_default_address +from frappe.utils.nestedset import get_root_of from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups class IncorrectCustomerGroup(frappe.ValidationError): pass @@ -136,7 +137,7 @@ def get_tax_template(posting_date, args): if key=="use_for_shopping_cart": conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0)) if key == 'customer_group': - if not value: value = _("All Customer Groups") + if not value: value = get_root_of("Customer Group") customer_group_condition = get_customer_group_condition(value) conditions.append("ifnull({0}, '') in ('', {1})".format(key, customer_group_condition)) else: From da8de2f0c7059203da2367088176e98338e4741d Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 27 Sep 2017 17:11:40 +0530 Subject: [PATCH 3/5] Re-order patch sequence (#10936) --- erpnext/patches.txt | 4 ++-- .../patches/v8_7/make_subscription_from_recurring_data.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 19d713e5c7..c6bd9ec50f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -408,6 +408,8 @@ erpnext.patches.v8_0.update_stock_qty_value_in_bom_item erpnext.patches.v8_0.update_sales_cost_in_project erpnext.patches.v8_0.save_system_settings erpnext.patches.v8_1.delete_deprecated_reports +erpnext.patches.v9_0.remove_subscription_module +erpnext.patches.v8_7.make_subscription_from_recurring_data 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 @@ -439,8 +441,6 @@ erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17 erpnext.patches.v8_9.add_setup_progress_actions #08-09-2017 #26-09-2017 erpnext.patches.v8_9.rename_company_sales_target_field erpnext.patches.v8_8.set_bom_rate_as_per_uom -erpnext.patches.v9_0.remove_subscription_module -erpnext.patches.v8_7.make_subscription_from_recurring_data erpnext.patches.v8_9.set_print_zero_amount_taxes erpnext.patches.v8_9.set_default_customer_group erpnext.patches.v8_9.remove_employee_from_salary_structure_parent diff --git a/erpnext/patches/v8_7/make_subscription_from_recurring_data.py b/erpnext/patches/v8_7/make_subscription_from_recurring_data.py index ab0fc121fc..c5d7d7279a 100644 --- a/erpnext/patches/v8_7/make_subscription_from_recurring_data.py +++ b/erpnext/patches/v8_7/make_subscription_from_recurring_data.py @@ -8,9 +8,15 @@ from frappe.utils import today def execute(): frappe.reload_doc('accounts', 'doctype', 'subscription') frappe.reload_doc('selling', 'doctype', 'sales_order') + frappe.reload_doc('selling', 'doctype', 'quotation') frappe.reload_doc('buying', 'doctype', 'purchase_order') + frappe.reload_doc('buying', 'doctype', 'supplier_quotation') frappe.reload_doc('accounts', 'doctype', 'sales_invoice') frappe.reload_doc('accounts', 'doctype', 'purchase_invoice') + frappe.reload_doc('stock', 'doctype', 'purchase_receipt') + frappe.reload_doc('stock', 'doctype', 'delivery_note') + frappe.reload_doc('accounts', 'doctype', 'journal_entry') + frappe.reload_doc('accounts', 'doctype', 'payment_entry') for doctype in ['Sales Order', 'Sales Invoice', 'Purchase Invoice', 'Purchase Invoice']: From 283922daa292d62f2d9772fb5d2d2b5157964065 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Wed, 27 Sep 2017 17:12:28 +0530 Subject: [PATCH 4/5] [fix] Check for stock_qty, else use qty (#10937) --- erpnext/stock/doctype/batch/batch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index a2e4c571b5..043dc73d37 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -103,14 +103,15 @@ def split_batch(batch_no, item_code, warehouse, qty, new_batch_id = None): def set_batch_nos(doc, warehouse_field, throw = False): '''Automatically select `batch_no` for outgoing items in item table''' for d in doc.items: + qty = d.get('stock_qty') or d.get('qty') or 0 has_batch_no = frappe.db.get_value('Item', d.item_code, 'has_batch_no') warehouse = d.get(warehouse_field, None) - if has_batch_no and warehouse and d.stock_qty > 0: + if has_batch_no and warehouse and qty > 0: if not d.batch_no: - d.batch_no = get_batch_no(d.item_code, warehouse, d.stock_qty, throw) + d.batch_no = get_batch_no(d.item_code, warehouse, qty, throw) else: batch_qty = get_batch_qty(batch_no=d.batch_no, warehouse=warehouse) - if flt(batch_qty) < flt(d.stock_qty): + if flt(batch_qty) < flt(qty): frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, d.qty)) def get_batch_no(item_code, warehouse, qty, throw=False): From 76615c800130fa7bc5d4e5d9d6af3386323e74d3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 27 Sep 2017 17:49:55 +0600 Subject: [PATCH 5/5] bumped to version 9.0.2 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1c78709e5a..636bfe981a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.0.1' +__version__ = '9.0.2' def get_default_company(user=None): '''Get default company for user'''