# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. # Copyright (c) 2022 WT-IO-IT GmbH (https://www.wt-io-it.at) # Mag. Wolfgang Taferner from odoo import models class L10n_AtEcSalesReportHandler(models.AbstractModel): _name = 'l10n_at.ec.sales.report.handler' _inherit = ['account.ec.sales.report.handler'] _description = 'Austrian EC Sales Report Custom Handler' def _custom_options_initializer(self, report, options, previous_options): """ Add the invoice lines search domain that is specific to the country. Typically, the taxes account.report.expression ids relative to the country for the triangular, sale of goods or services. :param dict options: Report options :return dict: The modified options dictionary """ super()._init_core_custom_options(report, options, previous_options) ec_operation_category = options.setdefault('sales_report_taxes', {}) ec_operation_category.update(self._get_tax_tags_for_at_sales_report()) # Change the names of the taxes to specific ones that are dependant to the tax type ec_operation_category['operation_category'] = { 'goods': 'L', 'triangular': 'D', 'services': 'S', } options.update({'sales_report_taxes': ec_operation_category}) def _get_tax_tags_for_at_sales_report(self): goods = self.env.ref('l10n_at.tax_report_line_l10n_at_tva_line_4_8_tag') goods |= self.env.ref('l10n_at.tax_report_line_l10n_at_tva_line_4_9_tag') triangular = self.env.ref('l10n_at.tax_report_line_l10n_at_tva_line_3_zm_igl3_tag') services = self.env.ref('l10n_at.tax_report_line_l10n_at_tva_line_3_zm_dl_tag') return { 'goods': tuple(goods._get_matching_tags().ids), 'triangular': tuple(triangular._get_matching_tags().ids), 'services': tuple(services._get_matching_tags().ids), }