From 94745051633c7918d81a314b7615b27bd9e5c5c7 Mon Sep 17 00:00:00 2001 From: Elvis Date: Mon, 11 Dec 2023 11:22:25 -0500 Subject: [PATCH] minor fix shopify --- shopify.py | 6 ++++-- web.py | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/shopify.py b/shopify.py index 30ec92f..e03c534 100644 --- a/shopify.py +++ b/shopify.py @@ -432,12 +432,13 @@ class Shopify: self.app_id = web_shop.app_id self.secret_key = web_shop.secret_key self.freight_product = web_shop.freight_product + self.invoice_type = web_shop.invoice_type def _get_context(self): user_ = self._get_user() return { 'company': user_.company.id, - 'user': user_.user.id, + 'user': user_.id, 'shops': [user_.shop.id], 'shop': user_.shop.id, 'language': 'es' @@ -570,7 +571,8 @@ class Shopify: 'invoice_address': Party.address_get(party, type='invoice'), 'shipment_address': Party.address_get(party, type='delivery'), 'description': 'VENTA SHOPIFY ' + sale_['name'], - 'channel': self.id, + 'web_shop': self.id, + 'web_id': str(sale_['id']), 'invoice_type': self.invoice_type, 'pack_id': '' }]) diff --git a/web.py b/web.py index c08b401..0114207 100644 --- a/web.py +++ b/web.py @@ -7,6 +7,7 @@ from .exceptions import ErrorSynchronizingSale from trytond.i18n import gettext from trytond.transaction import Transaction from . mercado_libre import MercadoLibre +from . shopify import Shopify from . import rappi @@ -274,18 +275,18 @@ class SynchronizeChannelOrders(Wizard): if not sale.invoices: Sale.process([sale]) 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': order_id = self.start.order_id 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) - result = Shopify.get_response(URI).json() + result = shopify.get_response(URI).json() if not result: raise ErrorSynchronizingSale( 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 \ sale_created.description.count('fulfilled'): Sale.process([sale_created])