fix(MWS): add new regions to marketplace (#21196)
* fix(MWS): add marketplace region for uae * fix: rename the fields for mws integrations Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -121,7 +121,7 @@ def call_mws_method(mws_method, *args, **kwargs):
|
|||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
mws_settings.enable_synch = 0
|
mws_settings.enable_sync = 0
|
||||||
mws_settings.save()
|
mws_settings.save()
|
||||||
|
|
||||||
frappe.throw(_("Sync has been temporarily disabled because maximum retries have been exceeded"))
|
frappe.throw(_("Sync has been temporarily disabled because maximum retries have been exceeded"))
|
||||||
|
|||||||
@@ -39,16 +39,19 @@ __all__ = [
|
|||||||
# for a list of the end points and marketplace IDs
|
# for a list of the end points and marketplace IDs
|
||||||
|
|
||||||
MARKETPLACES = {
|
MARKETPLACES = {
|
||||||
"CA" : "https://mws.amazonservices.ca", #A2EUQ1WTGCTBG2
|
"CA": "https://mws.amazonservices.ca", #A2EUQ1WTGCTBG2
|
||||||
"US" : "https://mws.amazonservices.com", #ATVPDKIKX0DER",
|
"US": "https://mws.amazonservices.com", #ATVPDKIKX0DER",
|
||||||
"DE" : "https://mws-eu.amazonservices.com", #A1PA6795UKMFR9
|
"DE": "https://mws-eu.amazonservices.com", #A1PA6795UKMFR9
|
||||||
"ES" : "https://mws-eu.amazonservices.com", #A1RKKUPIHCS9HS
|
"ES": "https://mws-eu.amazonservices.com", #A1RKKUPIHCS9HS
|
||||||
"FR" : "https://mws-eu.amazonservices.com", #A13V1IB3VIYZZH
|
"FR": "https://mws-eu.amazonservices.com", #A13V1IB3VIYZZH
|
||||||
"IN" : "https://mws.amazonservices.in", #A21TJRUUN4KGV
|
"IN": "https://mws.amazonservices.in", #A21TJRUUN4KGV
|
||||||
"IT" : "https://mws-eu.amazonservices.com", #APJ6JRA9NG5V4
|
"IT": "https://mws-eu.amazonservices.com", #APJ6JRA9NG5V4
|
||||||
"UK" : "https://mws-eu.amazonservices.com", #A1F83G8C2ARO7P
|
"UK": "https://mws-eu.amazonservices.com", #A1F83G8C2ARO7P
|
||||||
"JP" : "https://mws.amazonservices.jp", #A1VC38T7YXB528
|
"JP": "https://mws.amazonservices.jp", #A1VC38T7YXB528
|
||||||
"CN" : "https://mws.amazonservices.com.cn", #AAHKV2X7AFYLW
|
"CN": "https://mws.amazonservices.com.cn", #AAHKV2X7AFYLW
|
||||||
|
"AE": " https://mws.amazonservices.ae", #A2VIGQ35RCS4UG
|
||||||
|
"MX": "https://mws.amazonservices.com.mx", #A1AM78C64UM0Y8
|
||||||
|
"BR": "https://mws.amazonservices.com", #A2Q3Y263D00KWC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,14 +7,15 @@ import frappe
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
import dateutil
|
import dateutil
|
||||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||||
|
from erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods import get_orders
|
||||||
|
|
||||||
class AmazonMWSSettings(Document):
|
class AmazonMWSSettings(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.enable_amazon == 1:
|
if self.enable_amazon == 1:
|
||||||
self.enable_synch = 1
|
self.enable_sync = 1
|
||||||
setup_custom_fields()
|
setup_custom_fields()
|
||||||
else:
|
else:
|
||||||
self.enable_synch = 0
|
self.enable_sync = 0
|
||||||
|
|
||||||
def get_products_details(self):
|
def get_products_details(self):
|
||||||
if self.enable_amazon == 1:
|
if self.enable_amazon == 1:
|
||||||
@@ -27,7 +28,7 @@ class AmazonMWSSettings(Document):
|
|||||||
|
|
||||||
def schedule_get_order_details():
|
def schedule_get_order_details():
|
||||||
mws_settings = frappe.get_doc("Amazon MWS Settings")
|
mws_settings = frappe.get_doc("Amazon MWS Settings")
|
||||||
if mws_settings.enable_synch and mws_settings.enable_amazon:
|
if mws_settings.enable_sync and mws_settings.enable_amazon:
|
||||||
after_date = dateutil.parser.parse(mws_settings.after_date).strftime("%Y-%m-%d")
|
after_date = dateutil.parser.parse(mws_settings.after_date).strftime("%Y-%m-%d")
|
||||||
get_orders(after_date = after_date)
|
get_orders(after_date = after_date)
|
||||||
|
|
||||||
|
|||||||
@@ -664,4 +664,5 @@ erpnext.patches.v12_0.rename_bank_reconciliation_fields # 2020-01-22
|
|||||||
erpnext.patches.v12_0.set_received_qty_in_material_request_as_per_stock_uom
|
erpnext.patches.v12_0.set_received_qty_in_material_request_as_per_stock_uom
|
||||||
erpnext.patches.v12_0.recalculate_requested_qty_in_bin
|
erpnext.patches.v12_0.recalculate_requested_qty_in_bin
|
||||||
erpnext.patches.v12_0.set_total_batch_quantity
|
erpnext.patches.v12_0.set_total_batch_quantity
|
||||||
|
erpnext.patches.v12_0.rename_mws_settings_fields
|
||||||
erpnext.patches.v12_0.set_updated_purpose_in_pick_list
|
erpnext.patches.v12_0.set_updated_purpose_in_pick_list
|
||||||
|
|||||||
11
erpnext/patches/v12_0/rename_mws_settings_fields.py
Normal file
11
erpnext/patches/v12_0/rename_mws_settings_fields.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Copyright (c) 2020, Frappe and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
count = frappe.db.sql("SELECT COUNT(*) FROM `tabSingles` WHERE doctype='Amazon MWS Settings' AND field='enable_sync';")[0][0]
|
||||||
|
if count == 0:
|
||||||
|
frappe.db.sql("UPDATE `tabSingles` SET field='enable_sync' WHERE doctype='Amazon MWS Settings' AND field='enable_synch';")
|
||||||
|
|
||||||
|
frappe.reload_doc("ERPNext Integrations", "doctype", "Amazon MWS Settings")
|
||||||
Reference in New Issue
Block a user