[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.
This commit is contained in:
Shivam Dudhat
2016-09-01 15:58:41 +02:00
committed by Damien Bouvy
parent a2d249f1a4
commit ba87ff438d
+4 -2
View File
@@ -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')