<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="account_tax_report_gw" model="account.report">
        <field name="name">VAT Report</field>
        <field name="root_report_id" ref="account.generic_tax_report"/>
        <field name="country_id" ref="base.gw"/>
        <field name="filter_fiscal_position" eval="True"/>
        <field name="availability_condition">country</field>
        <field name="column_ids">
            <record id="account_tax_report_gw_balance" model="account.report.column">
                <field name="name">Base</field>
                <field name="expression_label">base</field>
            </record>
            <record id="account_tax_report_gw_tax" model="account.report.column">
                <field name="name">Tax</field>
                <field name="expression_label">tax</field>
            </record>
        </field>
        <field name="line_ids">
            <record id="account_tax_report_line_gw_sales" model="account.report.line">
                <field name="name">Outgoing</field>
                <field name="code">GW_SALES</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_gw_sales_base" model="account.report.expression">
                        <field name="label">base</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">GW_TAXABLE_19.base + GW_TAXABLE_10.base + GW_EXPORT.base + GW_SALE_EXEMPT.base + GW_SIMPLIFIED.base</field>
                    </record>
                    <record id="account_tax_report_line_gw_sales_tax" model="account.report.expression">
                        <field name="label">tax</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">GW_TAXABLE_19.tax + GW_TAXABLE_10.tax + GW_SIMPLIFIED.tax</field>
                    </record>
                </field>
                <field name="children_ids">
                    <record id="account_tax_report_line_gw_sales_19" model="account.report.line">
                        <field name="name">Taxable operations at 19%</field>
                        <field name="code">GW_TAXABLE_19</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_sales_19_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">base_19</field>
                            </record>
                            <record id="account_tax_report_line_gw_sales_19_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">tax_19</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_gw_sales_10" model="account.report.line">
                        <field name="name">Taxable operations at 10%</field>
                        <field name="code">GW_TAXABLE_10</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_sales_10_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">base_10</field>
                            </record>
                            <record id="account_tax_report_line_gw_sales_10_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">tax_10</field>
                            </record>
                        </field>
                    </record>

                    <record id="account_tax_report_line_gw_simplified_5" model="account.report.line">
                        <field name="name">Operations at 5% under simplified regime</field>
                        <field name="code">GW_SIMPLIFIED</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_simplified_5_base" model="account.report.expression">
                                <field name="label">base</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">GW_5_base</field>
                            </record>
                            <record id="account_tax_report_line_gw_simplified_5_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">GW_5_tax</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_gw_sales_export" model="account.report.line">
                        <field name="name">Export</field>
                        <field name="code">GW_EXPORT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_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_gw_sales_exempt" model="account.report.line">
                        <field name="name">Exempt</field>
                        <field name="code">GW_SALE_EXEMPT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_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_gw_purchases" model="account.report.line">
                <field name="name">Incoming</field>
                <field name="code">GW_VAT_DEDUCT</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_gw_purchases_base" model="account.report.expression">
                        <field name="label">base</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">GW_PURC_TAXABLE.base + GW_IMPORT.base + GW_PURC_EXEMPT.base</field>
                    </record>
                    <record id="account_tax_report_line_gw_purchase_tax" model="account.report.expression">
                        <field name="label">tax</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">GW_PURC_TAXABLE.tax</field>
                    </record>
                </field>
                <field name="children_ids">
                    <record id="account_tax_report_line_gw_purchases_taxable" model="account.report.line">
                        <field name="name">Taxable</field>
                        <field name="code">GW_PURC_TAXABLE</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_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_gw_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_gw_purchases_import" model="account.report.line">
                        <field name="name">Import</field>
                        <field name="code">GW_IMPORT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_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_gw_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_gw_purchases_exempt" model="account.report.line">
                        <field name="name">Exempt</field>
                        <field name="code">GW_PURC_EXEMPT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_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_gw_withholding" model="account.report.line">
                <field name="name">Tax withheld</field>
                <field name="code">GW_WITHHOLDING</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_gw_withholding_tax" model="account.report.expression">
                        <field name="label">tax</field>
                        <field name="engine">tax_tags</field>
                        <field name="formula">GW_withholding</field>
                    </record>
                </field>
            </record>

            <record id="account_tax_report_line_gw_net" model="account.report.line">
                <field name="name">Net VAT</field>
                <field name="code">GW_NET</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_gw_net_tag" model="account.report.expression">
                        <field name="label">tax</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">GW_VAT_CREDIT.tax + GW_VAT_TO_PAY.tax</field>
                    </record>
                </field>
                <field name="children_ids">
                    <record id="account_tax_report_line_gw_credit" model="account.report.line">
                        <field name="name">VAT Credit</field>
                        <field name="code">GW_VAT_CREDIT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_credit_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">aggregation</field>
                                <field name="formula">GW_VAT_DEDUCT.tax - GW_SALES.tax</field>
                                <field name="subformula">if_above(EUR(0))</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_gw_to_pay" model="account.report.line">
                        <field name="name">VAT to pay</field>
                        <field name="code">GW_VAT_TO_PAY</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_gw_to_pay_tax" model="account.report.expression">
                                <field name="label">tax</field>
                                <field name="engine">aggregation</field>
                                <field name="formula">GW_SALES.tax - GW_VAT_DEDUCT.tax</field>
                                <field name="subformula">if_above(EUR(0))</field>
                            </record>
                        </field>
                    </record>
                </field>
            </record>
        </field>
    </record>
</odoo>