<?xml version="1.0" encoding="utf-8"?>
<odoo>
  <record id="res_config_settings_view_form" model="ir.ui.view">
    <field name="name">res.config.settings.view.form.inherit.account.accountant</field>
    <field name="model">res.config.settings</field>
    <field name="inherit_id" ref="account.res_config_settings_view_form"/>
    <field name="arch" type="xml">
      <app name="account" position="attributes">
        <attribute name="data-string">Accounting</attribute>
        <attribute name="string">Accounting</attribute>
        <attribute name="logo">/fusion_accounting/static/description/icon.png</attribute>
      </app>
      <setting id="fiscalyear" position="replace">
        <setting id="fiscalyear" string="Fiscal Year">
          <div class="content-group">
            <div class="d-flex mt16 align-items-baseline">
              <label for="fiscalyear_last_month" string="Last Day" class="col-lg-3 o_light_label pe-2 pe-lg-0"/>
              <div class="col-lg-9">
                <field name="fiscalyear_last_month" class="pe-2"/>
                <field name="fiscalyear_last_day"/>
              </div>
            </div>
          </div>
        </setting>
        <setting groups="account.group_account_manager"
                 help="The invoices up to this date will not be taken into account as accounting entries">
          <field name="invoicing_switch_threshold"/>
        </setting>
        <setting help="Define fiscal years of more or less than one year">
          <field name="group_fiscal_year"/>
          <div class="mt16">
            <button name="%(fusion_accounting.actions_account_fiscal_year)d" icon="oi-arrow-right"
                    type="action" string="Fiscal Years" class="btn-link"
                    invisible="not group_fiscal_year"/>
          </div>
        </setting>
      </setting>
      <setting id="dynamic_report" position="attributes">
        <attribute name="invisible">0</attribute>
      </setting>
      <block id="bank_cash" position="inside">
        <setting groups="base.group_no_one" company_dependent="1"
                 help="Record cost of goods sold in your journal entries">
          <field name="use_anglo_saxon"/>
        </setting>
      </block>
      <block id="invoicing_settings" position="inside">
        <setting company_dependent="1" help="To enhance authenticity, add a signature to your invoices">
          <field name="sign_invoice"/>
          <label for="signing_user" string="Legal signatory" class="col-lg-5 o_light_label"
                 invisible="not sign_invoice"/>
          <field name="signing_user" invisible="not sign_invoice"/>
        </setting>
      </block>
      <xpath expr="//block[@id='account_vendor_bills']" position="inside">
        <setting string="Predict vendor bill product"
                 help="The system will try to predict the product on vendor bill lines based on the label of the line">
          <field name="predict_bill_product"/>
        </setting>
      </xpath>

      <setting id="post_bank_transactions_and_payments_setting" position="after">
        <setting string="Deferred expense entries:" company_dependent="1">
          <div class="content-group">
            <div class="row mt8">
              <label for="deferred_expense_journal_id" class="col-lg-5 o_light_label" string="Journal"/>
              <field name="deferred_expense_journal_id" domain="[('type', '=', 'general'), ('active', '=', True)]"/>
            </div>
            <div class="row mt8">
              <label for="deferred_expense_account_id" class="col-lg-5 o_light_label" string="Deferred expense"/>
              <field name="deferred_expense_account_id"
                     domain="[('account_type', '=', 'asset_current')]"/>
            </div>
            <div class="row mt8">
              <label for="generate_deferred_expense_entries_method" class="col-lg-5 o_light_label"
                     string="Generate Entries"/>
              <field name="generate_deferred_expense_entries_method"/>
            </div>
            <div class="row mt8">
              <label for="deferred_expense_amount_computation_method" class="col-lg-5 o_light_label" string="Based on"/>
              <field name="deferred_expense_amount_computation_method"/>
            </div>
          </div>
        </setting>
        <setting string="Deferred revenue entries:" company_dependent="1">
          <div class="content-group">
            <div class="row mt8">
              <label for="deferred_revenue_journal_id" class="col-lg-5 o_light_label" string="Journal"/>
              <field name="deferred_revenue_journal_id" domain="[('type', '=', 'general'), ('active', '=', True)]"/>
            </div>
            <div class="row mt8">
              <label for="deferred_revenue_account_id" class="col-lg-5 o_light_label" string="Deferred revenue"/>
              <field name="deferred_revenue_account_id"
                     domain="[('account_type', '=', 'liability_current')]"/>
            </div>
            <div class="row mt8">
              <label for="generate_deferred_revenue_entries_method" class="col-lg-5 o_light_label"
                     string="Generate Entries"/>
              <field name="generate_deferred_revenue_entries_method"/>
            </div>
            <div class="row mt8">
              <label for="deferred_revenue_amount_computation_method" class="col-lg-5 o_light_label" string="Based on"/>
              <field name="deferred_revenue_amount_computation_method"/>
            </div>
          </div>
        </setting>
      </setting>
      <!--            <setting id="dynamic_report" position="attributes">-->
      <!--                <attribute name="invisible">not module_account_reports</attribute>-->
      <!--            </setting>-->

      <setting id="default_taxes" position="after">
        <setting id="account_tax_periodicity" string="Tax Return Periodicity" company_dependent="1"
                 help="How often tax returns have to be made"
                 documentation="/applications/finance/accounting/reporting/declarations/tax_returns.html">
          <div class="content-group">
            <div class="row mt16">
              <label string="Periodicity" for="account_tax_periodicity" class="col-lg-3 o_light_label"/>
              <field name="account_tax_periodicity"/>
            </div>
            <div class="row">
              <label string="Reminder" for="account_tax_periodicity_reminder_day" class="col-lg-3 o_light_label"/>
              <div class="col-lg-auto content-group">
                <field name="account_tax_periodicity_reminder_day" class="text-center oe_inline"/>
                days after period
              </div>
            </div>
            <div class="row">
              <label string="Journal" for="account_tax_periodicity_journal_id" class="col-lg-3 o_light_label"/>
              <field name="account_tax_periodicity_journal_id" required="has_chart_of_accounts"/>
            </div>
            <div class="mt8">
              <button name="open_tax_group_list" icon="oi-arrow-right" type="object"
                      string="Configure your tax accounts" class="btn-link"/>
            </div>
            <div class="mt8" invisible="not account_reports_show_per_company_setting">
              <button name="open_company_dependent_report_settings" icon="oi-arrow-right" type="object"
                      string="Configure start dates" class="btn-link"/>
            </div>
          </div>
        </setting>
      </setting>

      <block id="analytic" position="after">
        <block title="Reporting" id="account_reports_settings" groups="account.group_account_user"
               invisible="not module_account_reports">
          <setting title="This allows you to choose the position of totals in your financial reports."
                   company_dependent="1"
                   help="When ticked, totals and subtotals appear below the sections of the report">
            <field name="totals_below_sections"/>
          </setting>
          <setting>
            <button name="%(account.action_check_hash_integrity)d" type="action"
                    string="Download the Data Inalterability Check Report" class="oe_link" id="action_hash_integrity"/>
          </setting>
        </block>
      </block>
      <xpath expr="//block[@id='default_accounts']" position="after">
        <block title="Stock Valuation" id="stock_valuation">
          <setting string="General Account Properties" id="general_accounts">
            <div class="content-group">
              <div class="row mt8">
                <label for="property_account_income_categ_id" class="col-lg-4 o_light_label"/>
                <field name="property_account_income_categ_id"/>
              </div>
              <div class="row mt8">
                <label for="property_account_expense_categ_id" class="col-lg-4 o_light_label"/>
                <field name="property_account_expense_categ_id"/>
              </div>
            </div>
          </setting>
          <setting help="Default stock valuation accounts" id="default_stock_valuation_accounts">
            <div name="default_accounts" class="content-group">
              <div class="text-muted">
                The below accounts will be used by default for inventory valuation.
              </div>
              <div class="row mt8">
                <label for="property_stock_valuation_account_id" class="col-lg-5 o_light_label"/>
                <field name="property_stock_valuation_account_id"/>
              </div>
              <div class="row mt8">
                <label for="property_stock_account_input_categ_id" class="col-lg-5 o_light_label"/>
                <field name="property_stock_account_input_categ_id"/>
              </div>
              <div class="row mt8">
                <label for="property_stock_account_output_categ_id" class="col-lg-5 o_light_label"/>
                <field name="property_stock_account_output_categ_id"/>
              </div>
            </div>
          </setting>
        </block>
      </xpath>

      <xpath expr="//setting[@id='dynamic_report']" position="replace">
        <setting id="dynamic_report" groups="account.group_account_user"
                 help="Navigate easily through reports and see what is behind the numbers">
          <field name="module_account_reports"/>
        </setting>
      </xpath>
      <setting id="dynamic_report" position="attributes">
        <attribute name="invisible">not module_account_reports</attribute>
      </setting>


    </field>
  </record>
  <record id="account_override_autopost_bills" model="ir.ui.view">
    <field name="name">account.res_config_settings.autopost_bills.override</field>
    <field name="model">res.config.settings</field>
    <field name="inherit_id" ref="account.res_config_settings_view_form"/>
    <field name="priority" eval="50"/>
    <field name="arch" type="xml">
      <xpath expr="//block[@id='account_vendor_bills']/setting[@id='autopost_bills']" position="replace">
        <setting id="autopost_bills"
                 help="After importing three bills for a vendor without making changes, your ERP will suggest automatically validating future bills..."
                 groups="account.group_account_user">
          <field name="autopost_bills"/>
        </setting>
      </xpath>
    </field>
  </record>

</odoo>
