<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="account_tax_report_cg" model="account.report">
        <field name="name">VAT Report</field>
        <field name="name@fr">Déclaration TVA</field>
        <field name="root_report_id" ref="account.generic_tax_report"/>
        <field name="country_id" ref="base.cg"/>
        <field name="allow_foreign_vat" eval="True"/>
        <field name="availability_condition">country</field>
        <field name="column_ids">
            <record id="account_tax_report_cg_balance" model="account.report.column">
                <field name="name">Base</field>
                <field name="name@fr">Base</field>
                <field name="expression_label">base</field>
            </record>
            <record id="account_tax_report_cg_tax" model="account.report.column">
                <field name="name">Tax</field>
                <field name="name@fr">Taxe</field>
                <field name="expression_label">tax</field>
            </record>
        </field>
        <field name="line_ids">
            <record id="account_tax_report_line_cg_sales" model="account.report.line">
                <field name="name">Outgoing</field>
                <field name="name@fr">Sortant</field>
                <field name="code">CG_SALES</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_cg_sales_base" model="account.report.expression">
                        <field name="label">base</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">CG_TAXABLE_18.base + CG_TAXABLE_9.base + CG_EXPORT.base + CG_SALE_EXEMPT.base</field>
                    </record>
                    <record id="account_tax_report_line_cg_sales_tax" model="account.report.expression">
                        <field name="label">tax</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">CG_TAXABLE_18.tax + CG_TAXABLE_9.tax</field>
                    </record>
                </field>
                <field name="children_ids">
                    <record id="account_tax_report_line_sales_18" model="account.report.line">
                        <field name="name">Taxable operations at 18%</field>
                        <field name="name@fr">Opérations taxable au taux de 18%</field>
                        <field name="code">CG_TAXABLE_18</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_sales_18_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">-base_18</field>
                            </record>
                            <record id="account_tax_report_line_sales_18_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">-tax_18</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_sales_additional_cents" model="account.report.line">
                        <field name="name">Additional cents</field>
                        <field name="name@fr">Cents additionels</field>
                        <field name="code">CG_TAXABLE_9</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_sales_cents_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">-base_cents</field>
                            </record>
                            <record id="account_tax_report_line_sales_cents_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">-tax_cents</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_sales_export" model="account.report.line">
                        <field name="name">Export</field>
                        <field name="name@fr">Exportations</field>
                        <field name="code">CG_EXPORT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_sales_export_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">-export</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_sales_exempt" model="account.report.line">
                        <field name="name">Exempt</field>
                        <field name="name@fr">Exonéré</field>
                        <field name="code">CG_SALE_EXEMPT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_sales_exempt_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">-sale_exempt</field>
                            </record>
                        </field>
                    </record>
                </field>
            </record>
            <record id="account_tax_report_line_cg_purchases" model="account.report.line">
                <field name="name">Incoming</field>
                <field name="name@fr">Entrant</field>
                <field name="code">CG_VAT_DEDUCT</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_cg_purchases_base" model="account.report.expression">
                        <field name="label">base</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">CG_PURC_TAXABLE.base + CG_IMPORT.base + CG_PURC_EXEMPT.base</field>
                    </record>
                    <record id="account_tax_report_line_cg_purchase_tax" model="account.report.expression">
                        <field name="label">tax</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">CG_PURC_TAXABLE.tax</field>
                    </record>
                </field>
                <field name="children_ids">
                    <record id="account_tax_report_line_cg_purchases_taxable" model="account.report.line">
                        <field name="name">Deductible</field>
                        <field name="name@fr">Déductible</field>
                        <field name="code">CG_PURC_TAXABLE</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_cg_purchases_taxable_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">purc_base</field>
                            </record>
                            <record id="account_tax_report_line_cg_purchases_taxable_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">purc_tax</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_cg_purchases_import" model="account.report.line">
                        <field name="name">Import</field>
                        <field name="name@fr">Importations</field>
                        <field name="code">CG_IMPORT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_cg_purchases_import_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">import_base</field>
                            </record>
                            <record id="account_tax_report_line_cg_purchases_import_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">import_tax</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_cg_purchases_exempt" model="account.report.line">
                        <field name="name">Exempt</field>
                        <field name="name@fr">Exonéré</field>
                        <field name="code">CG_PURC_EXEMPT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_cg_purchases_exempt_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">purc_exempt</field>
                            </record>
                        </field>
                    </record>
                </field>
            </record>
            <record id="account_tax_report_line_cg_net" model="account.report.line">
                <field name="name">Net VAT</field>
                <field name="name@fr">TVA nette</field>
                <field name="code">CG_NET</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_cg_net_tag" model="account.report.expression">
                        <field name="label">tax</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">CG_VAT_CREDIT.tax + CG_VAT_TO_PAY.tax</field>
                    </record>
                </field>
                <field name="children_ids">
                    <record id="account_tax_report_line_cg_credit" model="account.report.line">
                        <field name="name">VAT Credit</field>
                        <field name="name@fr">Crédit TVA</field>
                        <field name="code">CG_VAT_CREDIT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_cg_credit_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">aggregation</field>
                                <field name="formula">CG_VAT_DEDUCT.tax - CG_SALES.tax</field>
                                <field name="subformula">if_above(EUR(0))</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_cg_to_pay" model="account.report.line">
                        <field name="name">VAT to pay</field>
                        <field name="name@fr">TVA à payer</field>
                        <field name="code">CG_VAT_TO_PAY</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_cg_to_pay_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">aggregation</field>
                                <field name="formula">CG_SALES.tax - CG_VAT_DEDUCT.tax</field>
                                <field name="subformula">if_above(EUR(0))</field>
                            </record>
                        </field>
                    </record>
                </field>
            </record>
        </field>
    </record>
</odoo>