minor fix shopify
This commit is contained in:
parent
cd02efa318
commit
9474505163
|
@ -432,12 +432,13 @@ class Shopify:
|
||||||
self.app_id = web_shop.app_id
|
self.app_id = web_shop.app_id
|
||||||
self.secret_key = web_shop.secret_key
|
self.secret_key = web_shop.secret_key
|
||||||
self.freight_product = web_shop.freight_product
|
self.freight_product = web_shop.freight_product
|
||||||
|
self.invoice_type = web_shop.invoice_type
|
||||||
|
|
||||||
def _get_context(self):
|
def _get_context(self):
|
||||||
user_ = self._get_user()
|
user_ = self._get_user()
|
||||||
return {
|
return {
|
||||||
'company': user_.company.id,
|
'company': user_.company.id,
|
||||||
'user': user_.user.id,
|
'user': user_.id,
|
||||||
'shops': [user_.shop.id],
|
'shops': [user_.shop.id],
|
||||||
'shop': user_.shop.id,
|
'shop': user_.shop.id,
|
||||||
'language': 'es'
|
'language': 'es'
|
||||||
|
@ -570,7 +571,8 @@ class Shopify:
|
||||||
'invoice_address': Party.address_get(party, type='invoice'),
|
'invoice_address': Party.address_get(party, type='invoice'),
|
||||||
'shipment_address': Party.address_get(party, type='delivery'),
|
'shipment_address': Party.address_get(party, type='delivery'),
|
||||||
'description': 'VENTA SHOPIFY ' + sale_['name'],
|
'description': 'VENTA SHOPIFY ' + sale_['name'],
|
||||||
'channel': self.id,
|
'web_shop': self.id,
|
||||||
|
'web_id': str(sale_['id']),
|
||||||
'invoice_type': self.invoice_type,
|
'invoice_type': self.invoice_type,
|
||||||
'pack_id': ''
|
'pack_id': ''
|
||||||
}])
|
}])
|
||||||
|
|
9
web.py
9
web.py
|
@ -7,6 +7,7 @@ from .exceptions import ErrorSynchronizingSale
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from . mercado_libre import MercadoLibre
|
from . mercado_libre import MercadoLibre
|
||||||
|
from . shopify import Shopify
|
||||||
|
|
||||||
from . import rappi
|
from . import rappi
|
||||||
|
|
||||||
|
@ -274,18 +275,18 @@ class SynchronizeChannelOrders(Wizard):
|
||||||
if not sale.invoices:
|
if not sale.invoices:
|
||||||
Sale.process([sale])
|
Sale.process([sale])
|
||||||
if channel.type == 'shopify':
|
if channel.type == 'shopify':
|
||||||
Shopify = pool.get('sale.web_channel.shopify')
|
shopify = Shopify(channel)
|
||||||
|
|
||||||
channel, = Shopify.search([('shop', '=', self.start.shop.id), ])
|
# channel, = Shopify.search([('shop', '=', self.start.shop.id), ])
|
||||||
if operation == 'especific_order':
|
if operation == 'especific_order':
|
||||||
order_id = self.start.order_id
|
order_id = self.start.order_id
|
||||||
URI = 'https://%s:%s@%s/admin/api/2020-10/orders.json?status=any&ids=%s' % (
|
URI = 'https://%s:%s@%s/admin/api/2020-10/orders.json?status=any&ids=%s' % (
|
||||||
channel.api_key, channel.password_api, channel.host_name, order_id)
|
channel.api_key, channel.password_api, channel.host_name, order_id)
|
||||||
result = Shopify.get_response(URI).json()
|
result = shopify.get_response(URI).json()
|
||||||
if not result:
|
if not result:
|
||||||
raise ErrorSynchronizingSale(
|
raise ErrorSynchronizingSale(
|
||||||
gettext('sale_web_channel.msg_error_synchronizing_sale', s=result))
|
gettext('sale_web_channel.msg_error_synchronizing_sale', s=result))
|
||||||
sale_created = channel._create_sale(result['orders'][0])
|
sale_created = shopify._create_sale(result['orders'][0])
|
||||||
if sale_created and \
|
if sale_created and \
|
||||||
sale_created.description.count('fulfilled'):
|
sale_created.description.count('fulfilled'):
|
||||||
Sale.process([sale_created])
|
Sale.process([sale_created])
|
||||||
|
|
Loading…
Reference in New Issue