<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="account_tax_report_bf" 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.bf"/>
        <field name="filter_fiscal_position" eval="True"/>
        <field name="availability_condition">country</field>
        <field name="column_ids">
            <record id="account_tax_report_bf_balance" model="account.report.column">
                <field name="name">Balance</field>
                <field name="expression_label">balance</field>
            </record>
        </field>
        <field name="line_ids">
            <record id="account_tax_report_line_bf_turnover" model="account.report.line">
                <field name="name">III. Global Turnover Without VAT</field>
                <field name="code">BF_TURNOVER</field>
                <field name="hierarchy_level">0</field>
                <field name="children_ids">
                    <record id="account_tax_report_line_bf_taxable" model="account.report.line">
                        <field name="name">C1. Taxable operations</field>
                        <field name="code">BF_TAXABLE</field>
                        <field name="children_ids">
                            <record id="account_tax_report_line_bf_taxable_day" model="account.report.line">
                                <field name="name">a. Day-to-day operations</field>
                                <field name="code">BF_DAY</field>
                                <field name="children_ids">
                                     <record id="account_tax_report_line_bf_taxable_day_sales" model="account.report.line">
                                        <field name="name">01 Sales, services, building works</field>
                                        <field name="code">BF_DAY_SALES</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_day_sales_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_01</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_day_self" model="account.report.line">
                                        <field name="name">02 Self Delivery (SD)</field>
                                        <field name="code">BF_SELF</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_day_self_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_02</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_day_assets" model="account.report.line">
                                        <field name="name">03 Sale of fixed assets</field>
                                        <field name="code">BF_ASSETS</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_day_assets_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_03</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_day_sales_10" model="account.report.line">
                                        <field name="name">04 Taxable operations at a rate of 10%</field>
                                        <field name="code">BF_DAY_SALES_10</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_day_sales_10_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_04</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_day_sales_other" model="account.report.line">
                                        <field name="name">05 Other taxable operations</field>
                                        <field name="code">BF_DAY_SALES_OTHER</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_day_sales_other_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_05</field>
                                            </record>
                                        </field>
                                     </record>
                                </field>
                            </record>
                            <record id="account_tax_report_line_bf_taxable_contract" model="account.report.line">
                                <field name="name">b. Contracts, order letters, other public and private contracts</field>
                                <field name="code">BF_CONTRACT</field>
                                <field name="children_ids">
                                     <record id="account_tax_report_line_bf_taxable_contract_sales" model="account.report.line">
                                        <field name="name">06 Sales</field>
                                        <field name="code">BF_CONTRACT_SALES</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_contract_sales_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_06</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_contract_services" model="account.report.line">
                                        <field name="name">07 Services</field>
                                        <field name="code">BF_CONTRACT_SERVICES</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_contract_services_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_07</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_contract_immo" model="account.report.line">
                                        <field name="name">08 Building works, public works</field>
                                        <field name="code">BF_CONTRACT_WORKS</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_contract_immo_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_08</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_contract_sales_10" model="account.report.line">
                                        <field name="name">09 Taxable operations at a rate of 10%</field>
                                        <field name="code">BF_CONTRACT_SALES_10</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_contract_sales_10_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_09</field>
                                            </record>
                                        </field>
                                     </record>
                                     <record id="account_tax_report_line_bf_taxable_contract_sales_other" model="account.report.line">
                                        <field name="name">10 Other taxable operations</field>
                                        <field name="code">BF_CONTRACT_SALES_OTHER</field>
                                        <field name="expression_ids">
                                            <record id="account_tax_report_line_bf_taxable_contract_sales_other_balance" model="account.report.expression">
                                                <field name="label">balance</field>
                                                <field name="engine">tax_tags</field>
                                                <field name="formula">BF_10</field>
                                            </record>
                                        </field>
                                     </record>
                                </field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_non_taxable" model="account.report.line">
                        <field name="name">C2. Non-taxable operations</field>
                        <field name="code">BF_NON_TAXABLE</field>
                        <field name="children_ids">
                             <record id="account_tax_report_line_bf_non_taxable_export" model="account.report.line">
                                <field name="name">11 Exports</field>
                                <field name="code">BF_EXPORT</field>
                                <field name="expression_ids">
                                    <record id="account_tax_report_line_bf_non_taxable_export_balance" model="account.report.expression">
                                        <field name="label">balance</field>
                                        <field name="engine">tax_tags</field>
                                        <field name="formula">BF_11</field>
                                    </record>
                                </field>
                             </record>
                             <record id="account_tax_report_line_bf_non_taxable_foreign" model="account.report.line">
                                <field name="name">12 Other foreign trade transactions, tax-suspended sales</field>
                                <field name="code">BF_FOREIGN</field>
                                <field name="expression_ids">
                                    <record id="account_tax_report_line_bf_non_taxable_foreign_balance" model="account.report.expression">
                                        <field name="label">balance</field>
                                        <field name="engine">tax_tags</field>
                                        <field name="formula">BF_12</field>
                                    </record>
                                </field>
                             </record>
                             <record id="account_tax_report_line_bf_non_taxable_other" model="account.report.line">
                                <field name="name">13 Other non-taxable operations</field>
                                <field name="code">BF_NON_TAXABLE_OTHER</field>
                                <field name="expression_ids">
                                    <record id="account_tax_report_line_bf_non_taxable_other_balance" model="account.report.expression">
                                        <field name="label">balance</field>
                                        <field name="engine">tax_tags</field>
                                        <field name="formula">BF_13</field>
                                    </record>
                                </field>
                             </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_total_operations" model="account.report.line">
                        <field name="name">14 Total amount of operations</field>
                        <field name="code">BF_TOTAL_OPERATIONS</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_total_operations_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">aggregation</field>
                                <field name="formula">BF_DAY_SALES.balance + BF_SELF.balance + BF_ASSETS.balance + BF_DAY_SALES_10.balance + BF_DAY_SALES_OTHER.balance + BF_CONTRACT_SALES.balance + BF_CONTRACT_SERVICES.balance + BF_CONTRACT_WORKS.balance + BF_CONTRACT_SALES_10.balance + BF_CONTRACT_SALES_OTHER.balance + BF_EXPORT.balance + BF_FOREIGN.balance + BF_NON_TAXABLE_OTHER.balance</field>
                            </record>
                        </field>
                    </record>
                </field>
            </record>
            <record id="account_tax_report_line_bf_gross" model="account.report.line">
                <field name="name">IV. Gross VAT</field>
                <field name="code">BF_GROSS</field>
                <field name="hierarchy_level">0</field>
                <field name="children_ids">
                     <record id="account_tax_report_line_bf_taxable_18" model="account.report.line">
                        <field name="name">15 At normal rate (18%)</field>
                        <field name="code">BF_TAXABLE_18</field>
                        <field name="children_ids">
                            <record id="account_tax_report_line_bf_taxable_18_base" model="account.report.line">
                                <field name="name">Base tax excluded</field>
                                <field name="code">BF_TAXABLE_18_BASE</field>
                                <field name="expression_ids">
                                    <record id="account_tax_report_line_bf_taxable_18_base_balance" model="account.report.expression">
                                        <field name="label">balance</field>
                                        <field name="engine">tax_tags</field>
                                        <field name="formula">BF_15_base</field>
                                    </record>
                                </field>
                            </record>
                            <record id="account_tax_report_line_bf_taxable_18_tax" model="account.report.line">
                                <field name="name">Gross VAT amount</field>
                                <field name="code">BF_TAXABLE_18_TAX</field>
                                <field name="expression_ids">
                                    <record id="account_tax_report_line_bf_taxable_18_tax_balance" model="account.report.expression">
                                        <field name="label">balance</field>
                                        <field name="engine">tax_tags</field>
                                        <field name="formula">BF_15_tax</field>
                                    </record>
                                </field>
                            </record>
                        </field>
                     </record>
                     <record id="account_tax_report_line_bf_taxable_10" model="account.report.line">
                        <field name="name">16 At reduced rate (10%)</field>
                        <field name="code">BF_TAXABLE_10</field>
                        <field name="children_ids">
                            <record id="account_tax_report_line_bf_taxable_10_base" model="account.report.line">
                                <field name="name">Base tax excluded</field>
                                <field name="code">BF_TAXABLE_10_BASE</field>
                                <field name="expression_ids">
                                    <record id="account_tax_report_line_bf_taxable_10_base_balance" model="account.report.expression">
                                        <field name="label">balance</field>
                                        <field name="engine">tax_tags</field>
                                        <field name="formula">BF_16_base</field>
                                    </record>
                                </field>
                            </record>
                            <record id="account_tax_report_line_bf_taxable_10_tax" model="account.report.line">
                                <field name="name">Gross VAT amount</field>
                                <field name="code">BF_TAXABLE_10_TAX</field>
                                <field name="expression_ids">
                                    <record id="account_tax_report_line_bf_taxable_10_tax_balance" model="account.report.expression">
                                        <field name="label">balance</field>
                                        <field name="engine">tax_tags</field>
                                        <field name="formula">BF_16_tax</field>
                                    </record>
                                </field>
                            </record>
                        </field>
                     </record>
                     <record id="account_tax_report_line_bf_tax_omitted" model="account.report.line">
                        <field name="name">17 Previously omitted gross VAT to be repaid</field>
                        <field name="code">BF_TAX_OMITTED</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_tax_omitted_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">BF_17</field>
                            </record>
                        </field>
                     </record>
                     <record id="account_tax_report_line_bf_tax_deducted" model="account.report.line">
                        <field name="name">18 VAT previously deducted to be repaid</field>
                        <field name="code">BF_TAX_DEDUCTED</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_tax_deducted_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">BF_18</field>
                            </record>
                        </field>
                     </record>
                     <record id="account_tax_report_line_bf_gross_total" model="account.report.line">
                        <field name="name">19 Total gross VAT amount</field>
                        <field name="code">BF_GROSS_TOTAL</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_gross_total_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">aggregation</field>
                                <field name="formula">BF_TAXABLE_18_TAX.balance + BF_TAXABLE_10_TAX.balance + BF_TAX_OMITTED.balance + BF_TAX_DEDUCTED.balance</field>
                            </record>
                        </field>
                    </record>
                </field>
            </record>
            <record id="account_tax_report_line_bf_net" model="account.report.line">
                <field name="name">V. Net VAT</field>
                <field name="code">BF_NET</field>
                <field name="hierarchy_level">0</field>
                <field name="children_ids">
                    <record id="account_tax_report_line_bf_deductible" model="account.report.line">
                        <field name="name">20 Deductible VAT for the period</field>
                        <field name="code">BF_DEDUCTIBLE</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_deductible_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">BF_20</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_credit_reported" model="account.report.line">
                        <field name="name">21 VAT credit from previous period</field>
                        <field name="code">BF_CREDIT_REPORTED</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_credit_reported_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">external</field>
                                <field name="formula">most_recent</field>
                                <field name="date_scope">previous_tax_period</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_credit_asked" model="account.report.line">
                        <field name="name">22 VAT credit claimed for reimbursement</field>
                        <field name="code">BF_CREDIT_ASKED</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_credit_asked_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">external</field>
                                <field name="formula">sum</field>
                                <field name="subformula">editable;rounding=2</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_credit_not_asked" model="account.report.line">
                        <field name="name">23 VAT credit not claimed for reimbursement</field>
                        <field name="code">BF_CREDIT_NOT_ASKED</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_credit_not_asked_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">external</field>
                                <field name="formula">sum</field>
                                <field name="subformula">editable;rounding=2</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_irrecoverable" model="account.report.line">
                        <field name="name">24 VAT on unpaid sales or services (definitively irrecoverable debts)</field>
                        <field name="code">BF_IRRECOVERABLE</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_irrecoverable_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">external</field>
                                <field name="formula">BF_24</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_cancelled" model="account.report.line">
                        <field name="name">25 VAT paid on terminated or cancelled sales or services</field>
                        <field name="code">BF_CANCELLED</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_cancelled_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">BF_25</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_other_deduction" model="account.report.line">
                        <field name="name">26 Other deductions available to the company</field>
                        <field name="code">BF_OTHER_DEDUCTION</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_other_deduction_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">BF_26</field>
                            </record>
                        </field>
                    </record>
                    <record id="account_tax_report_line_bf_unpaid_credit_carried" model="account.report.line">
                        <field name="name">26 Unpaid VAT credit carried forward</field>
                        <field name="code">BF_UNPAID_CREDIT</field>
                        <field name="expression_ids">
                            <record id="account_tax_report_line_bf_unpaid_credit_carried_balance" model="account.report.expression">
                                <field name="label">balance</field>
                                <field name="engine">tax_tags</field>
                                <field name="formula">BF_27</field>
                            </record>
                        </field>
                    </record>
                </field>
            </record>
            <record id="account_tax_report_line_bf_net_vat_to_pay" model="account.report.line">
                <field name="name">Net VAT amount to pay [19 – (20+21-22+25+26+27)]</field>
                <field name="code">BF_NET_TO_PAY</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_bf_net_vat_to_pay_balance" model="account.report.expression">
                        <field name="label">balance</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">BF_GROSS_TOTAL.balance - BF_DEDUCTIBLE.balance - BF_CREDIT_REPORTED.balance + BF_CREDIT_ASKED.balance - BF_CANCELLED.balance - BF_OTHER_DEDUCTION.balance - BF_OTHER_DEDUCTION.balance - BF_UNPAID_CREDIT.balance</field>
                        <field name="subformula">if_above(EUR(0))</field>
                    </record>
                </field>
            </record>
            <record id="account_tax_report_line_bf_credit_to_report" model="account.report.line">
                <field name="name">Credit VAT to report [(20+21-22+25+26+27) - 19]</field>
                <field name="code">BF_CREDIT_TO_REPORT</field>
                <field name="hierarchy_level">0</field>
                <field name="expression_ids">
                    <record id="account_tax_report_line_bf_credit_to_report_balance" model="account.report.expression">
                        <field name="label">balance</field>
                        <field name="engine">aggregation</field>
                        <field name="formula">BF_DEDUCTIBLE.balance + BF_CREDIT_REPORTED.balance - BF_CREDIT_ASKED.balance + BF_OTHER_DEDUCTION.balance + BF_UNPAID_CREDIT.balance + BF_OTHER_DEDUCTION.balance - BF_GROSS_TOTAL.balance</field>
                        <field name="subformula">if_above(EUR(0))</field>
                        <field name="carryover_target">BF_REPORTED.balance</field>
                    </record>
                </field>
            </record>
        </field>
    </record>
</odoo>
