[ADD]:Added Upstream patch for payment_transfer
This commit is contained in:
parent
0708710ecf
commit
bcdb9e3ed1
@ -3,3 +3,4 @@
|
|||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
from . import controllers
|
from . import controllers
|
||||||
|
from flectra.addons.payment.models.payment_acquirer import create_missing_journal_for_acquirers
|
||||||
|
@ -15,4 +15,5 @@
|
|||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'auto_install': True,
|
'auto_install': True,
|
||||||
|
'post_init_hook': 'create_missing_journal_for_acquirers',
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,19 @@ class TransferPaymentAcquirer(models.Model):
|
|||||||
|
|
||||||
provider = fields.Selection(selection_add=[('transfer', 'Wire Transfer')], default='transfer')
|
provider = fields.Selection(selection_add=[('transfer', 'Wire Transfer')], default='transfer')
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _create_missing_journal_for_acquirers(self, company=None):
|
||||||
|
# By default, the wire transfer method uses the default Bank journal.
|
||||||
|
company = company or 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(company=company)
|
||||||
|
|
||||||
def transfer_get_form_action_url(self):
|
def transfer_get_form_action_url(self):
|
||||||
return '/payment/transfer/feedback'
|
return '/payment/transfer/feedback'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user