This commit adds the auto-creation journal for installed acquirers. This is not easy because: - The acquirers are created on the 'payment' module but are enabled only when the specific module is installed. E.g. Paypal is enabled with 'payment_paypal'. - To create a journal, a chart of accounts is required. However, the post_init_hook on the 'account' module makes the installation order harder. E.g install payment_paypal directly: The module are installed in the order: account -> payment -> payment_paypal -> l10n_generic_coa. To fix the problem, the journals are created at two moments: - During the installation of the chart of accounts. - At the installation of an acquirer module. E.g. payment_paypal. Was PR #23904 Was task: 1831620
15 lines
522 B
Python
15 lines
522 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import api, fields, models, _
|
|
|
|
|
|
class WizardMultiChartsAccounts(models.TransientModel):
|
|
_inherit = 'wizard.multi.charts.accounts'
|
|
|
|
@api.multi
|
|
def _create_bank_journals_from_o2m(self, company, acc_template_ref):
|
|
res = super(WizardMultiChartsAccounts, self)._create_bank_journals_from_o2m(company, acc_template_ref)
|
|
|
|
# Try to generate the missing journals
|
|
return res + self.env['payment.acquirer']._create_missing_journal_for_acquirers(company=company)
|