<?xml version="1.0" encoding="utf-8" ?>
<!--
  Copyright 2017-2022 Akretion France (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
    <!-- The factur-X standard says that country is a required XML tag for
buyer and seller. So, to avoid getting error messages upon invoice generation
for missing country, it's better to put the field as required in the view
(I don't put it as required on the field definition, because it may
block other modules or data) -->
    <record id="view_partner_form" model="ir.ui.view">
        <field name="name">factur-x.country.required.on.res.partner</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="arch" type="xml">
            <xpath
                expr="//div[hasclass('o_address_format')]/field[@name='country_id']"
                position="attributes"
            >
                <attribute name="required">1</attribute>
            </xpath>
            <xpath
                expr="//field[@name='child_ids']/form//field[@name='country_id']"
                position="attributes"
            >
                <attribute name="required">1</attribute>
            </xpath>
        </field>
    </record>
</odoo>
