<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Moduon Team S.L.
     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) -->
<data>
    <record id="view_order_form" model="ir.ui.view">
        <field name="name">sale.order.invoice.frequency.form</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form" />
        <field name="arch" type="xml">
            <xpath expr="//group[@name='sale_info']" position="inside">
                <field
                    name="invoice_frequency_id"
                    options="{'no_create': True}"
                    groups="account.group_account_invoice"
                />
            </xpath>
        </field>
    </record>

    <record id="sale_order_tree" model="ir.ui.view">
        <field name="name">sale.order.invoice.frequency.tree</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.sale_order_tree" />
        <field name="arch" type="xml">
            <xpath expr="//list" position="inside">
                <field
                    name="invoice_frequency_id"
                    options="{'no_create': True}"
                    groups="account.group_account_invoice"
                    optional="hide"
                />
            </xpath>
        </field>
    </record>

    <record id="view_sales_order_filter" model="ir.ui.view">
        <field name="name">sale.order.invoice.frequency.list.select</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_sales_order_filter" />
        <field name="arch" type="xml">
            <xpath expr="//search/group" position="inside">
                <filter
                    name="group_invoice_frequency_id"
                    string="Invoice frequency"
                    groups="account.group_account_invoice"
                    domain="[]"
                    context="{'group_by': 'invoice_frequency_id'}"
                />
            </xpath>
        </field>
    </record>
</data>
