from odoo import models
from odoo.addons.account.models.chart_template import template


class AccountChartTemplate(models.AbstractModel):
    _inherit = 'account.chart.template'

    @template('bj')
    def _get_bj_template_data(self):
        return {
            'name': 'Syscohada for Benin',
            'parent': 'syscohada',
            'code_digits': '6',
        }

    @template('bj', 'res.company')
    def _get_bj_res_company(self):
        company_values = super()._get_syscohada_res_company()
        company_values[self.env.company.id].update(
            {
                'account_fiscal_country_id': 'base.bj',
                'account_sale_tax_id': 'tva_sale_18',
                'account_purchase_tax_id': 'tva_purchase_18',
            }
        )
        return company_values

    @template('bj', 'account.account')
    def _get_bj_account_account(self):
        return self._parse_csv('bj', 'account.account', module='l10n_syscohada')
