From 5528145a204fec56904365ae15a55907e1575734 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Thu, 3 Feb 2022 14:11:05 +0000 Subject: [PATCH] [MIG] connector_walmart: to 14.0 (from 12.0) --- connector_walmart/__manifest__.py | 2 +- .../data/connector_walmart_data.xml | 4 ---- .../models/account/account_fiscal_position.py | 1 - connector_walmart/models/sale_order/common.py | 7 ------ .../models/sale_order/importer.py | 4 ++-- .../models/stock_picking/common.py | 4 ---- .../models/walmart_backend/common.py | 3 --- .../models/walmart_binding/common.py | 23 ------------------- .../views/walmart_backend_views.xml | 3 +-- 9 files changed, 4 insertions(+), 47 deletions(-) diff --git a/connector_walmart/__manifest__.py b/connector_walmart/__manifest__.py index c22f077b..ecfa6217 100644 --- a/connector_walmart/__manifest__.py +++ b/connector_walmart/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Walmart Connector', - 'version': '12.0.1.2.0', + 'version': '14.0.1.0.0', 'category': 'Connector', 'depends': [ 'account', diff --git a/connector_walmart/data/connector_walmart_data.xml b/connector_walmart/data/connector_walmart_data.xml index f346075a..2be65d70 100644 --- a/connector_walmart/data/connector_walmart_data.xml +++ b/connector_walmart/data/connector_walmart_data.xml @@ -26,10 +26,8 @@ Resolution: Check your taxes and fiscal positions configuration and correct them if necessary. 30 sale.order - sale if sale.walmart_bind_ids and abs(sale.amount_total - sale.walmart_bind_ids[0].total_amount) >= 0.01: failed = True - @@ -43,11 +41,9 @@ Resolution: Check your taxes and fiscal positions configuration and correct them if necessary. 30 sale.order - sale # By default, a cent of difference for the tax amount is allowed, feel free to customise it in your own module if sale.walmart_bind_ids and abs(sale.amount_tax - sale.walmart_bind_ids[0].total_amount_tax) > 0.01: failed = True - diff --git a/connector_walmart/models/account/account_fiscal_position.py b/connector_walmart/models/account/account_fiscal_position.py index b8ce30c3..064af512 100644 --- a/connector_walmart/models/account/account_fiscal_position.py +++ b/connector_walmart/models/account/account_fiscal_position.py @@ -14,7 +14,6 @@ class AccountFiscalPosition(models.Model): is_connector_walmart = fields.Boolean(string='Use Walmart Order Item Rate') - @api.multi def map_tax(self, taxes, product=None, partner=None, order_line=None): if not taxes or not self.is_connector_walmart: diff --git a/connector_walmart/models/sale_order/common.py b/connector_walmart/models/sale_order/common.py index 389820a9..50e725fb 100644 --- a/connector_walmart/models/sale_order/common.py +++ b/connector_walmart/models/sale_order/common.py @@ -7,7 +7,6 @@ import odoo.addons.decimal_precision as dp from urllib.parse import parse_qs from odoo import models, fields, api -from odoo.addons.queue_job.job import job from odoo.addons.component.core import Component from odoo.addons.queue_job.exception import RetryableJobError @@ -50,19 +49,16 @@ class WalmartSaleOrder(models.Model): required=False, ) - @job(default_channel='root.walmart') @api.model def import_batch(self, backend, filters=None): """ Prepare the import of Sales Orders from Walmart """ return super(WalmartSaleOrder, self).import_batch(backend, filters=filters) - @api.multi def action_confirm(self): for order in self: if order.backend_id.acknowledge_order == 'order_confirm': self.with_delay().acknowledge_order(order.backend_id, order.external_id) - @job(default_channel='root.walmart') @api.model def acknowledge_order(self, backend, external_id): with backend.work_on(self._name) as work: @@ -79,7 +75,6 @@ class SaleOrder(models.Model): string="Walmart Bindings", ) - @api.multi def action_confirm(self): res = super(SaleOrder, self).action_confirm() self.walmart_bind_ids.action_confirm() @@ -132,8 +127,6 @@ class SaleOrderLine(models.Model): string="Walmart Bindings", ) - - @api.multi def _compute_tax_id(self): """ This overrides core behavior because we need to get the order_line into the order diff --git a/connector_walmart/models/sale_order/importer.py b/connector_walmart/models/sale_order/importer.py index f10518d3..3c589e46 100644 --- a/connector_walmart/models/sale_order/importer.py +++ b/connector_walmart/models/sale_order/importer.py @@ -134,9 +134,9 @@ class SaleOrderImportMapper(Component): return {'payment_mode_id': self.backend_record.payment_mode_id.id} @mapping - def project_id(self, record): + def analytic_account_id(self, record): if self.backend_record.analytic_account_id: - return {'project_id': self.backend_record.analytic_account_id.id} + return {'analytic_account_id': self.backend_record.analytic_account_id.id} @mapping def warehouse_id(self, record): diff --git a/connector_walmart/models/stock_picking/common.py b/connector_walmart/models/stock_picking/common.py index 459c6e78..6d2d10d1 100644 --- a/connector_walmart/models/stock_picking/common.py +++ b/connector_walmart/models/stock_picking/common.py @@ -3,7 +3,6 @@ import logging from odoo import api, models, fields -from odoo.addons.queue_job.job import job, related_action from odoo.addons.component.core import Component from odoo.addons.queue_job.exception import RetryableJobError @@ -24,9 +23,6 @@ class WalmartStockPicking(models.Model): string='Walmart Sale Order', ondelete='set null') - @job(default_channel='root.walmart') - @related_action(action='related_action_unwrap_binding') - @api.multi def export_picking_done(self): """ Export a complete or partial delivery order. """ self.ensure_one() diff --git a/connector_walmart/models/walmart_backend/common.py b/connector_walmart/models/walmart_backend/common.py index 93936a36..677fb956 100644 --- a/connector_walmart/models/walmart_backend/common.py +++ b/connector_walmart/models/walmart_backend/common.py @@ -73,7 +73,6 @@ class WalmartBackend(models.Model): ) @contextmanager - @api.multi def work_on(self, model_name, **kwargs): self.ensure_one() walmart_api = Walmart(self.client_id, self.client_secret) @@ -91,12 +90,10 @@ class WalmartBackend(models.Model): ]) return backends.import_sale_orders() - @api.multi def import_sale_orders(self): self._import_from_date('walmart.sale.order', 'import_orders_from_date') return True - @api.multi def _import_from_date(self, model_name, from_date_field): import_start_time = datetime.now() for backend in self: diff --git a/connector_walmart/models/walmart_binding/common.py b/connector_walmart/models/walmart_binding/common.py index 01c39d92..f5fb0391 100644 --- a/connector_walmart/models/walmart_binding/common.py +++ b/connector_walmart/models/walmart_binding/common.py @@ -2,7 +2,6 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import api, models, fields -from odoo.addons.queue_job.job import job, related_action class WalmartBinding(models.AbstractModel): @@ -27,8 +26,6 @@ class WalmartBinding(models.AbstractModel): ('walmart_uniq', 'unique(backend_id, external_id)', 'A binding already exists for this Walmart ID.'), ] - @job(default_channel='root.walmart') - @related_action(action='related_action_walmart_link') @api.model def import_batch(self, backend, filters=None): """ Prepare the import of records modified on Walmart """ @@ -38,29 +35,9 @@ class WalmartBinding(models.AbstractModel): importer = work.component(usage='batch.importer') return importer.run(filters=filters) - @job(default_channel='root.walmart') - @related_action(action='related_action_walmart_link') @api.model def import_record(self, backend, external_id, force=False): """ Import a Walmart record """ with backend.work_on(self._name) as work: importer = work.component(usage='record.importer') return importer.run(external_id, force=force) - - # @job(default_channel='root.walmart') - # @related_action(action='related_action_unwrap_binding') - # @api.multi - # def export_record(self, fields=None): - # """ Export a record on Walmart """ - # self.ensure_one() - # with self.backend_id.work_on(self._name) as work: - # exporter = work.component(usage='record.exporter') - # return exporter.run(self, fields) - # - # @job(default_channel='root.walmart') - # @related_action(action='related_action_walmart_link') - # def export_delete_record(self, backend, external_id): - # """ Delete a record on Walmart """ - # with backend.work_on(self._name) as work: - # deleter = work.component(usage='record.exporter.deleter') - # return deleter.run(external_id) diff --git a/connector_walmart/views/walmart_backend_views.xml b/connector_walmart/views/walmart_backend_views.xml index f2d0bbb0..4258ae5a 100644 --- a/connector_walmart/views/walmart_backend_views.xml +++ b/connector_walmart/views/walmart_backend_views.xml @@ -60,7 +60,7 @@

-