Merge pull request #15920 from rohitwaghchaure/fix_patch_ascii_code_error
[Fix] Patch, ascii codec error
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index ba5a8c1..a9aa5ae 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
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'''
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index d030f5f..db733dd 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 @@
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
@@ -400,7 +402,6 @@
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 = []
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 6997776..a38b40b 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -85,8 +85,17 @@
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':
diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py
index 2356401..c236822 100644
--- a/erpnext/hub_node/api.py
+++ b/erpnext/hub_node/api.py
@@ -10,7 +10,6 @@
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/PageContainer.vue b/erpnext/public/js/hub/PageContainer.vue
index 5ec92d5..a101eaf 100644
--- a/erpnext/public/js/hub/PageContainer.vue
+++ b/erpnext/public/js/hub/PageContainer.vue
@@ -1,6 +1,6 @@
<template>
<div class="hub-page-container">
- <component :is="current_page"></component>
+ <component :is="current_page.component" :key="current_page.key"></component>
</div>
</template>
@@ -100,10 +100,16 @@
}
if (!route) {
- return NotFound;
+ return {
+ key: 'not-found',
+ component: NotFound
+ };
}
- return route_map[route];
+ return {
+ key: curr_route,
+ component: route_map[route]
+ }
}
}
}
diff --git a/erpnext/public/js/hub/components/ReviewArea.vue b/erpnext/public/js/hub/components/ReviewArea.vue
index 51b9ab1..5e4e439 100644
--- a/erpnext/public/js/hub/components/ReviewArea.vue
+++ b/erpnext/public/js/hub/components/ReviewArea.vue
@@ -113,6 +113,10 @@
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/event_emitter.js b/erpnext/public/js/hub/event_emitter.js
deleted file mode 100644
index 1e72881..0000000
--- 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 7ef87c4..a1596e0 100644
--- a/erpnext/public/js/hub/marketplace.js
+++ b/erpnext/public/js/hub/marketplace.js
@@ -8,14 +8,13 @@
// 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 }) {
diff --git a/erpnext/public/js/hub/pages/Item.vue b/erpnext/public/js/hub/pages/Item.vue
index 651533e..7735aa2 100644
--- a/erpnext/public/js/hub/pages/Item.vue
+++ b/erpnext/public/js/hub/pages/Item.vue
@@ -265,6 +265,9 @@
},
report_item() {
+ if (!hub.is_seller_registered()) {
+ frappe.throw(__('Please login as a Marketplace User to report this item.'));
+ }
this.report_item_dialog.show();
},
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 598504a..2039a26 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -85,9 +85,9 @@
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
@@ -304,8 +304,8 @@
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 \