diff options
| author | qdp-odoo <qdp@odoo.com> | 2018-05-23 15:44:55 +0200 |
|---|---|---|
| committer | qdp-odoo <qdp@odoo.com> | 2018-05-23 15:44:55 +0200 |
| commit | 01216345e28374b554bfe95df82d607c591271cf (patch) | |
| tree | bf0472c263d72c13aa8a9c79c380c9a8930beea6 /addons/payment_transfer | |
| parent | 7a31a92afa9a2ad280a6ec110fc9547e48b89466 (diff) | |
[REF] account,payment(_*),sale*: downgrade transactions into debug items
It was very confusing for the user to distinct account.payment and payment.transaction. From now on, the transactions are
technical objects and, in the backend, we only refer to it in log messages (Front end will be adapted in the same fashion
later on). They are hidden in debug mode in accounting\configuration\payments as their purpose is now purely technical/log
This commit also aims to reduce the gap between the accounting app and the transactions: account.payment objects are
created/validated upon completion of transaction.
To ease the capture/voiding of pending transactions, the related buttons are now displayed directly on the SO/invoice
instead of the transactions.
Was task: https://www.odoo.com/web#id=35857&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720
Was PR #24043
[FIX] add domain based on journal to payment tokens
Was opw: https://www.odoo.com/web?debug#id=1828206&view_type=form&model=project.task&menu_id=5200
Diffstat (limited to 'addons/payment_transfer')
| -rw-r--r-- | addons/payment_transfer/__init__.py | 2 | ||||
| -rw-r--r-- | addons/payment_transfer/__manifest__.py | 1 | ||||
| -rw-r--r-- | addons/payment_transfer/models/payment.py | 16 |
3 files changed, 18 insertions, 1 deletions
diff --git a/addons/payment_transfer/__init__.py b/addons/payment_transfer/__init__.py index 8c67f893b37..3d944a17e8b 100644 --- a/addons/payment_transfer/__init__.py +++ b/addons/payment_transfer/__init__.py @@ -3,3 +3,5 @@ from . import models from . import controllers +from odoo.addons.payment.models.payment_acquirer import create_missing_journal_for_acquirers + diff --git a/addons/payment_transfer/__manifest__.py b/addons/payment_transfer/__manifest__.py index 9f8704467dc..530fe49ede4 100644 --- a/addons/payment_transfer/__manifest__.py +++ b/addons/payment_transfer/__manifest__.py @@ -14,4 +14,5 @@ ], 'installable': True, 'auto_install': True, + 'post_init_hook': 'create_missing_journal_for_acquirers', } diff --git a/addons/payment_transfer/models/payment.py b/addons/payment_transfer/models/payment.py index 00a34ac0ad4..f6234602505 100644 --- a/addons/payment_transfer/models/payment.py +++ b/addons/payment_transfer/models/payment.py @@ -15,6 +15,19 @@ class TransferPaymentAcquirer(models.Model): provider = fields.Selection(selection_add=[('transfer', 'Wire Transfer')], default='transfer') + @api.model + def _create_missing_journal_for_acquirers(self): + # By default, the wire transfer method uses the default Bank journal. + company = self.env.user.company_id + acquirers = self.env['payment.acquirer'].search( + [('provider', '=', 'transfer'), ('journal_id', '=', False), ('company_id', '=', company.id)]) + + bank_journal = self.env['account.journal'].search( + [('type', '=', 'bank'), ('company_id', '=', company.id)], limit=1) + if bank_journal: + acquirers.write({'journal_id': bank_journal.id}) + return super(TransferPaymentAcquirer, self)._create_missing_journal_for_acquirers() + def transfer_get_form_action_url(self): return '/payment/transfer/feedback' @@ -85,4 +98,5 @@ class TransferPaymentTransaction(models.Model): def _transfer_form_validate(self, data): _logger.info('Validated transfer payment for tx %s: set as pending' % (self.reference)) - return self.write({'state': 'pending'}) + self._set_transaction_pending() + return True |
