From ba87ff438d1cdf5e1f5c57563a16a17f6eea6529 Mon Sep 17 00:00:00 2001 From: Shivam Dudhat Date: Mon, 29 Aug 2016 15:49:13 +0200 Subject: [PATCH] [IMP] payment: avoid warning on payment.token creation Since the creates overrides needs some information that do not end up in the final record, let's avoid warning by removing all non-model fields from the call to super. --- addons/payment/models/payment_acquirer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index aed9564d234..d0733c16fe3 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -617,8 +617,10 @@ class PaymentToken(models.Model): custom_method_name = '%s_create' % acquirer.provider if hasattr(self, custom_method_name): values.update(getattr(self, custom_method_name)(values)) - - return super(PaymentToken, self).create(values) + # remove all non-model fields used by (provider)_create method to avoid warning + fields_wl = set(self._fields.keys()) & set(values.keys()) + clean_vals = {field: values[field] for field in fields_wl} + return super(PaymentToken, self).create(clean_vals) @api.multi @api.depends('name')