From d2b63236e39dc3114d7314727e21a06499adaa46 Mon Sep 17 00:00:00 2001 From: hparfr Date: Wed, 29 Apr 2020 23:00:08 +0200 Subject: [PATCH] Fix stripe installation issue due to wrong account_type on transfert account template --- account_usability/account.py | 19 +++++++++++++++++++ account_usability/readme/DESCRIPTION.rst | 1 + 2 files changed, 20 insertions(+) diff --git a/account_usability/account.py b/account_usability/account.py index cb322adc..3b275ea6 100644 --- a/account_usability/account.py +++ b/account_usability/account.py @@ -693,3 +693,22 @@ class ResConfigSettings(models.TransientModel): transfer_account_id = fields.Many2one( related='company_id.transfer_account_id', readonly=False) + + +class AccountChartTemplate(models.Model): + _inherit = "account.chart.template" + + @api.model + def _prepare_transfer_account_template(self): + """Change the type of default account in order to be + compliant with _check_account_type_on_bank_journal + Used at installation of payment modules like stripe + See https://github.com/akretion/odoo-usability/issues/115 + """ + vals = super()._prepare_transfer_account_template() + current_assets_type = self.env.ref( + 'account.data_account_type_liquidity', raise_if_not_found=False) + vals.update({ + 'user_type_id': current_assets_type and current_assets_type.id or False, + }) + return vals diff --git a/account_usability/readme/DESCRIPTION.rst b/account_usability/readme/DESCRIPTION.rst index 36bac9f4..4a992970 100644 --- a/account_usability/readme/DESCRIPTION.rst +++ b/account_usability/readme/DESCRIPTION.rst @@ -31,6 +31,7 @@ This modules adds the following functions: * don't attach PDF upon invoice report generation on supplier invoices/refunds * Add filter on debit and credit amount for Move Lines * Add supplier invoice number in invoice tree view +* Change type from current_assets to liquidity for transfert account template. Together with this module, I recommend the use of the following modules: