| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
from odoo import models |
| 3 |
|
| 4 |
from odoo.addons.account.models.chart_template import template |
| 5 |
|
| 6 |
class AccountChartTemplate(models.AbstractModel): |
| 7 |
_inherit = 'account.chart.template' |
| 8 |
|
| 9 |
@template('be', 'account.tax') |
| 10 |
def _get_be_pos_restaurant_account_tax(self): |
| 11 |
be_restaurant_tax = self._parse_csv('be', 'account.tax', module='l10n_be_pos_restaurant') |
| 12 |
existing_taxes = self.env['account.tax'].search([('company_id', 'child_of', self.env.company.root_id.id)]) |
| 13 |
# Filter out taxes that already exist |
| 14 |
existing_tax_names = set(existing_taxes.mapped('name')) |
| 15 |
taxes_to_create = {name: tax for name, tax in be_restaurant_tax.items() if tax['name'] not in existing_tax_names} |
| 16 |
self._deref_account_tags('be_comp', be_restaurant_tax) |
| 17 |
return taxes_to_create |