IMP connector_walmart Important change to authentication methods used by API

This commit is contained in:
Jared Kipe
2019-08-22 12:58:14 -07:00
parent 0af4946d8e
commit a84903870a
9 changed files with 423 additions and 285 deletions

View File

@@ -20,21 +20,8 @@ class WalmartBackend(models.Model):
_inherit = 'connector.backend'
name = fields.Char(string='Name')
consumer_id = fields.Char(
string='Consumer ID',
required=True,
help='Walmart Consumer ID',
)
channel_type = fields.Char(
string='Channel Type',
required=True,
help='Walmart Channel Type',
)
private_key = fields.Char(
string='Private Key',
required=True,
help='Walmart Private Key'
)
client_id = fields.Char(string='Client ID')
client_secret = fields.Char(string='Client Secret')
warehouse_id = fields.Many2one(
comodel_name='stock.warehouse',
string='Warehouse',
@@ -89,7 +76,7 @@ class WalmartBackend(models.Model):
@api.multi
def work_on(self, model_name, **kwargs):
self.ensure_one()
walmart_api = Walmart(self.consumer_id, self.channel_type, self.private_key)
walmart_api = Walmart(self.client_id, self.client_secret)
_super = super(WalmartBackend, self)
with _super.work_on(model_name, walmart_api=walmart_api, **kwargs) as work:
yield work
@@ -98,9 +85,8 @@ class WalmartBackend(models.Model):
def _scheduler_import_sale_orders(self):
# potential hook for customization (e.g. pad from date or provide its own)
backends = self.search([
('consumer_id', '!=', False),
('channel_type', '!=', False),
('private_key', '!=', False),
('client_id', '!=', False),
('client_secret', '!=', False),
('import_orders_from_date', '!=', False),
])
return backends.import_sale_orders()