summaryrefslogtreecommitdiff
path: root/addons/payment_transfer/models/payment.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/payment_transfer/models/payment.py')
-rw-r--r--addons/payment_transfer/models/payment.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/payment_transfer/models/payment.py b/addons/payment_transfer/models/payment.py
index 996294bf287..00a34ac0ad4 100644
--- a/addons/payment_transfer/models/payment.py
+++ b/addons/payment_transfer/models/payment.py
@@ -46,6 +46,13 @@ class TransferPaymentAcquirer(models.Model):
values['post_msg'] = self._format_transfer_data()
return super(TransferPaymentAcquirer, self).create(values)
+ @api.multi
+ def write(self, values):
+ """ Hook in write to create a default post_msg. See create(). """
+ if all(not acquirer.post_msg and acquirer.provider != 'transfer' for acquirer in self) and values.get('provider') == 'transfer':
+ values['post_msg'] = self._format_transfer_data()
+ return super(TransferPaymentAcquirer, self).write(values)
+
class TransferPaymentTransaction(models.Model):
_inherit = 'payment.transaction'