From a9ff4f66887aabc544c837be1429e66aaa18657c Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Thu, 26 Sep 2019 13:58:00 +0530 Subject: [PATCH 1/3] fix(Report): Sales Register --- erpnext/accounts/report/sales_register/sales_register.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index 2b32fa9378..0e2821ac16 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import flt from frappe import msgprint, _ +from frappe.model.meta import get_field_precision from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions def execute(filters=None): @@ -273,4 +274,4 @@ def get_mode_of_payments(invoice_list): for d in inv_mop: mode_of_payments.setdefault(d.parent, []).append(d.mode_of_payment) - return mode_of_payments \ No newline at end of file + return mode_of_payments From 5dfc74c85100a2a910de232b838c1f7bfa60a45d Mon Sep 17 00:00:00 2001 From: Chinmay Pai Date: Mon, 30 Sep 2019 16:59:58 +0530 Subject: [PATCH 2/3] fix(amazon-mws): python3 compatibility changes (#19210) Signed-off-by: Chinmay D. Pai --- .../doctype/amazon_mws_settings/amazon_methods.py | 12 +++++------- .../doctype/amazon_mws_settings/amazon_mws_api.py | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py index b9be9c0b9c..2f39dc596b 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py @@ -4,10 +4,7 @@ from __future__ import unicode_literals import frappe, time, dateutil, math, csv -try: - from StringIO import StringIO -except ImportError: - from io import StringIO +from six import StringIO import erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_mws_api as mws from frappe import _ @@ -26,7 +23,7 @@ def get_products_details(): listings_response = reports.get_report(report_id=report_id) #Get ASIN Codes - string_io = StringIO(listings_response.original) + string_io = StringIO(frappe.safe_decode(listings_response.original)) csv_rows = list(csv.reader(string_io, delimiter=str('\t'))) asin_list = list(set([row[1] for row in csv_rows[1:]])) #break into chunks of 10 @@ -294,7 +291,8 @@ def create_sales_order(order_json,after_date): so.submit() except Exception as e: - frappe.log_error(message=e, title="Create Sales Order") + import traceback + frappe.log_error(message=traceback.format_exc(), title="Create Sales Order") def create_customer(order_json): order_customer_name = "" @@ -451,7 +449,7 @@ def get_charges_and_fees(market_place_order_id): shipment_item_list = return_as_list(shipment_event.ShipmentEvent.ShipmentItemList.ShipmentItem) for shipment_item in shipment_item_list: - charges, fees = [] + charges, fees = [], [] if 'ItemChargeList' in shipment_item.keys(): charges = return_as_list(shipment_item.ItemChargeList.ChargeComponent) diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py index 68c2b9c324..9925dc4a08 100755 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py @@ -65,7 +65,8 @@ def calc_md5(string): """ md = hashlib.md5() md.update(string) - return base64.encodestring(md.digest()).strip('\n') + return base64.encodestring(md.digest()).strip('\n') if six.PY2 \ + else base64.encodebytes(md.digest()).decode().strip() def remove_empty(d): """ @@ -87,8 +88,7 @@ class DictWrapper(object): self.original = xml self._rootkey = rootkey self._mydict = xml_utils.xml2dict().fromstring(remove_namespace(xml)) - self._response_dict = self._mydict.get(self._mydict.keys()[0], - self._mydict) + self._response_dict = self._mydict.get(list(self._mydict)[0], self._mydict) @property def parsed(self): From 80ed98c87a3ebae1b431cb166712dfd25a49e2e1 Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Wed, 2 Oct 2019 16:56:54 +0550 Subject: [PATCH 3/3] bumped to version 12.1.6 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ce9731e6ba..686d5492ca 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__ = '12.1.5' +__version__ = '12.1.6' def get_default_company(user=None): '''Get default company for user'''