From 68dbf7f99cb8e4282f1493cc19d0cbc8096fead0 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 2 Nov 2018 13:30:51 +0530 Subject: [PATCH 01/10] fix: Use frappe.utils.make_event_emitter --- erpnext/public/js/hub/event_emitter.js | 31 -------------------------- erpnext/public/js/hub/marketplace.js | 5 ++--- 2 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 erpnext/public/js/hub/event_emitter.js diff --git a/erpnext/public/js/hub/event_emitter.js b/erpnext/public/js/hub/event_emitter.js deleted file mode 100644 index 1e7288191d..0000000000 --- a/erpnext/public/js/hub/event_emitter.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Simple EventEmitter which uses jQuery's event system - */ -class EventEmitter { - init() { - this.jq = jQuery(this); - } - - trigger(evt, data) { - !this.jq && this.init(); - this.jq.trigger(evt, data); - } - - once(evt, handler) { - !this.jq && this.init(); - this.jq.one(evt, (e, data) => handler(data)); - } - - on(evt, handler) { - !this.jq && this.init(); - this.jq.bind(evt, (e, data) => handler(data)); - } - - off(evt, handler) { - !this.jq && this.init(); - this.jq.unbind(evt, (e, data) => handler(data)); - } -} - - -export default EventEmitter; \ No newline at end of file diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js index 7ef87c4eb6..a1596e0043 100644 --- a/erpnext/public/js/hub/marketplace.js +++ b/erpnext/public/js/hub/marketplace.js @@ -8,14 +8,13 @@ import { ProfileDialog } from './components/profile_dialog'; // helpers import './hub_call'; -import EventEmitter from './event_emitter'; frappe.provide('hub'); frappe.provide('erpnext.hub'); frappe.provide('frappe.route'); -$.extend(erpnext.hub, EventEmitter.prototype); -$.extend(frappe.route, EventEmitter.prototype); +frappe.utils.make_event_emitter(frappe.route); +frappe.utils.make_event_emitter(erpnext.hub); erpnext.hub.Marketplace = class Marketplace { constructor({ parent }) { From 3e6663d47ed5ee970dd2725efa930c8ea6818486 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 5 Nov 2018 14:01:59 +0530 Subject: [PATCH 02/10] fix(serial no): Set supplier info based on pur invoice if serial no is created from Purchase Invoice (#15820) --- erpnext/stock/doctype/serial_no/serial_no.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 3d1979dd81..e04343dc42 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -81,9 +81,9 @@ class SerialNo(StockController): self.purchase_date = purchase_sle.posting_date self.purchase_time = purchase_sle.posting_time self.purchase_rate = purchase_sle.incoming_rate - if purchase_sle.voucher_type == "Purchase Receipt": + if purchase_sle.voucher_type in ("Purchase Receipt", "Purchase Invoice"): self.supplier, self.supplier_name = \ - frappe.db.get_value("Purchase Receipt", purchase_sle.voucher_no, + frappe.db.get_value(purchase_sle.voucher_type, purchase_sle.voucher_no, ["supplier", "supplier_name"]) # If sales return entry @@ -253,8 +253,8 @@ def has_duplicate_serial_no(sn, sle): status = False if sn.purchase_document_no: - if sle.voucher_type in ['Purchase Receipt', 'Stock Entry'] and \ - sn.delivery_document_type not in ['Purchase Receipt', 'Stock Entry']: + if sle.voucher_type in ['Purchase Receipt', 'Stock Entry', "Purchase Invoice"] and \ + sn.delivery_document_type not in ['Purchase Receipt', 'Stock Entry', "Purchase Invoice"]: status = True if status and sle.voucher_type == 'Stock Entry' and \ From 0d08da50c69cb90920fa01bab41c98bbdd3c518d Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 5 Nov 2018 15:47:26 +0530 Subject: [PATCH 03/10] fix: Refresh PageContainer component based on current route --- erpnext/public/js/hub/PageContainer.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/hub/PageContainer.vue b/erpnext/public/js/hub/PageContainer.vue index 5ec92d581b..a101eaf4d3 100644 --- a/erpnext/public/js/hub/PageContainer.vue +++ b/erpnext/public/js/hub/PageContainer.vue @@ -1,6 +1,6 @@ @@ -100,10 +100,16 @@ export default { } if (!route) { - return NotFound; + return { + key: 'not-found', + component: NotFound + }; } - return route_map[route]; + return { + key: curr_route, + component: route_map[route] + } } } } From 1b2ceadc93e3e8b8e4e06cdd55f2505b91de954e Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 5 Nov 2018 16:04:04 +0530 Subject: [PATCH 04/10] [Fix] Asset date validation (#15887) * [Fix] Asset date validation * Update asset.py --- erpnext/assets/doctype/asset/asset.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 6997776701..a38b40bc60 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -85,8 +85,17 @@ class Asset(AccountsController): elif not self.finance_books: frappe.throw(_("Enter depreciation details")) - if self.available_for_use_date and getdate(self.available_for_use_date) < getdate(nowdate()): - frappe.throw(_("Available-for-use Date is entered as past date")) + if self.is_existing_asset: + return + + date = nowdate() + docname = self.purchase_receipt or self.purchase_invoice + if docname: + doctype = 'Purchase Receipt' if self.purchase_receipt else 'Purchase Invoice' + date = frappe.db.get_value(doctype, docname, 'posting_date') + + if self.available_for_use_date and getdate(self.available_for_use_date) < getdate(date): + frappe.throw(_("Available-for-use Date should be after purchase date")) def make_depreciation_schedule(self): if self.depreciation_method != 'Manual': From d6b664f7eecb86b9befd2dd845be72c91f7bfe87 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 5 Nov 2018 19:18:48 +0530 Subject: [PATCH 05/10] fix(hub): Prevent registered actions --- erpnext/hub_node/api.py | 1 - erpnext/public/js/hub/components/ReviewArea.vue | 4 ++++ erpnext/public/js/hub/pages/Item.vue | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py index 23564010e7..c236822490 100644 --- a/erpnext/hub_node/api.py +++ b/erpnext/hub_node/api.py @@ -10,7 +10,6 @@ import requests from frappe import _ from frappe.frappeclient import FrappeClient from frappe.desk.form.load import get_attachments -from frappe.utils.file_manager import get_file_path from six import string_types current_user = frappe.session.user diff --git a/erpnext/public/js/hub/components/ReviewArea.vue b/erpnext/public/js/hub/components/ReviewArea.vue index 51b9ab1502..5e4e439f3d 100644 --- a/erpnext/public/js/hub/components/ReviewArea.vue +++ b/erpnext/public/js/hub/components/ReviewArea.vue @@ -113,6 +113,10 @@ export default { content: this.review_content.get_value() }); + if (!hub.is_seller_registered()) { + frappe.throw(__('You need to login as a Marketplace User before you can add any reviews.')); + } + hub.call('add_item_review', { hub_item_name: this.hub_item_name, review: JSON.stringify(review) diff --git a/erpnext/public/js/hub/pages/Item.vue b/erpnext/public/js/hub/pages/Item.vue index 651533eae3..7735aa2337 100644 --- a/erpnext/public/js/hub/pages/Item.vue +++ b/erpnext/public/js/hub/pages/Item.vue @@ -265,6 +265,9 @@ export default { }, report_item() { + if (!hub.is_seller_registered()) { + frappe.throw(__('Please login as a Marketplace User to report this item.')); + } this.report_item_dialog.show(); }, From 614b042ed37fa6b408b8fe059935a45abd8359e3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 6 Nov 2018 11:48:51 +0530 Subject: [PATCH 06/10] fix(encoding): Fixed encoding issue in financial statements --- erpnext/accounts/report/financial_statements.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index d030f5f706..1d382484e9 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -1,7 +1,9 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - +from __future__ import unicode_literals import re from past.builtins import cmp @@ -342,7 +344,7 @@ def set_gl_entries_by_account( accounts = frappe.db.sql_list("""select name from `tabAccount` where lft >= %s and rgt <= %s""", (root_lft, root_rgt)) additional_conditions += " and account in ('{}')"\ - .format("', '".join([frappe.safe_encode(frappe.db.escape(d)) for d in accounts])) + .format("', '".join([frappe.db.escape(d) for d in accounts])) gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening, fiscal_year, debit_in_account_currency, credit_in_account_currency, account_currency from `tabGL Entry` where company=%(company)s From 9eafe8c23e4f314ceb99bf329b0bc08f12b63184 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 6 Nov 2018 13:28:18 +0530 Subject: [PATCH 07/10] Update financial_statements.py --- erpnext/accounts/report/financial_statements.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 1d382484e9..db733dd1e1 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -402,7 +402,6 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters): def get_cost_centers_with_children(cost_centers): if not isinstance(cost_centers, list): - cost_centers = frappe.safe_encode(cost_centers) cost_centers = [d.strip() for d in cost_centers.strip().split(',') if d] all_cost_centers = [] From a97a520aa85fdf31e0a753993d638361973841f6 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Tue, 6 Nov 2018 11:02:04 +0000 Subject: [PATCH 08/10] bumped to version 10.1.68 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7461fda9f7..7c307b760b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.67' +__version__ = '10.1.68' def get_default_company(user=None): '''Get default company for user''' From 56bf39bfea43cedf58618123de774ef7053b9e60 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 6 Nov 2018 16:32:29 +0530 Subject: [PATCH 09/10] [Fix] Patch --- erpnext/patches/v11_0/update_department_lft_rgt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/patches/v11_0/update_department_lft_rgt.py b/erpnext/patches/v11_0/update_department_lft_rgt.py index 5a8837ee2c..b2f407b18e 100644 --- a/erpnext/patches/v11_0/update_department_lft_rgt.py +++ b/erpnext/patches/v11_0/update_department_lft_rgt.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import frappe from frappe import _ from frappe.utils.nestedset import rebuild_tree From 675636cd031b5df8422b7e71c67090c1f496a7b5 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Tue, 6 Nov 2018 11:13:36 +0000 Subject: [PATCH 10/10] bumped to version 11.0.3-beta.19 --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 38738d25dd..2005147e7b 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" develop_version = '11.x.x-develop' -staging_version = '11.0.3-beta.18' +staging_version = '11.0.3-beta.19' error_report_email = "support@erpnext.com"