From ad7ef0800d7472782bbe46dd0bc1824c8a78eee0 Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Tue, 13 Oct 2020 06:39:28 +0000 Subject: [PATCH] [FIX] pos_adyen: Adyen for Platforms fixes - The Adyen sync cron didn't call the function to sync terminals - Do not specify the merchantAccount when creating a store, the proxy will add it itself. closes odoo/odoo#59868 X-original-commit: d5b456a1f75320c8fdf1e989afad91fc74ec9ef3 Signed-off-by: pimodoo --- addons/pos_adyen/models/adyen_account.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/pos_adyen/models/adyen_account.py b/addons/pos_adyen/models/adyen_account.py index 2db95110ccb..533725a6933 100644 --- a/addons/pos_adyen/models/adyen_account.py +++ b/addons/pos_adyen/models/adyen_account.py @@ -14,6 +14,11 @@ class AdyenAccount(models.Model): store_ids = fields.One2many('adyen.store', 'adyen_account_id') terminal_ids = fields.One2many('adyen.terminal', 'adyen_account_id') + @api.model + def _sync_adyen_cron(self): + self.env['adyen.terminal']._sync_adyen_terminals() + super(AdyenAccount, self)._sync_adyen_cron() + def action_order_terminal(self): if not self.store_ids: raise ValidationError(_('Please create a store first.')) @@ -42,7 +47,7 @@ class AdyenStore(models.Model): @api.model def create(self, values): adyen_store_id = super(AdyenStore, self).create(values) - response = adyen_store_id.adyen_account_id._adyen_rpc('update_account_holder', adyen_store_id._format_data()) + response = adyen_store_id.adyen_account_id._adyen_rpc('create_store', adyen_store_id._format_data()) stores = response['accountHolderDetails']['storeDetails'] created_store = next(store for store in stores if store['storeReference'] == adyen_store_id.store_reference) adyen_store_id.with_context(update_from_adyen=True).sudo().write({ @@ -65,7 +70,6 @@ class AdyenStore(models.Model): 'storeDetails': [{ 'storeReference': self.store_reference, 'storeName': self.name, - 'merchantAccount': 'OdooMP_POS', 'merchantCategoryCode': '7999', 'address': { 'city': self.city,