From 4c133f1b3664870e46a3d25ed65cf5dd54217ec8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Tue, 21 Apr 2020 18:47:17 +0200
Subject: [PATCH] Fix invisible attributes

---
 views/res_partner.xml | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/views/res_partner.xml b/views/res_partner.xml
index 76aff6f..535a146 100644
--- a/views/res_partner.xml
+++ b/views/res_partner.xml
@@ -190,7 +190,7 @@
                 </xpath>
 
                 <xpath expr="//field[@name='child_ids']//form//field[@name='mobile']" position="after">
-                    <field name="category_id" options='{"no_open": True, "no_create": True}' widget="many2many_tags" attrs="{'invisible': [('is_company','=', True)]}"/>
+                    <field name="category_id" options='{"no_open": True, "no_create": True}' widget="many2many_tags" attrs="{'invisible': [('type', '!=', 'contact')]}"/>
                 </xpath>
 
                 <xpath expr="//field[@name='child_ids']//form//field[@name='title']" position="attributes">
@@ -226,7 +226,7 @@
                     <field name="email" widget="email" on_change="1"/>
                     <field name="website" attrs="{'invisible': [('is_company','=', False)]}"/>                   
                     <field name="ur_id" options='{"no_open": True, "no_create": True}' on_change="1" can_create="false" can_write="false"/>
-                    <field name="category_id" options='{"no_open": True, "no_create": True}' widget="many2many_tags" attrs="{'invisible': [('is_company','=', True)]}"/>
+                    <field name="category_id" options='{"no_open": True, "no_create": True}' widget="many2many_tags" attrs="{'invisible': ['|', ('is_company', '=', True), ('type', '!=', 'contact')]}"/>
                     <field name="lang" invisible="1"/>
                 </field>
                 <xpath expr="//notebook/page[@name='sales_purchases']" position="attributes">
@@ -755,19 +755,6 @@
                         <field name="parent_id_onchange" invisible="1"/>
                         <field name="parent_id" invisible="1"/>
                         <group col="2">
-                            <group invisible="1">
-                                <field name="street"/>
-                                <field name="street2"/>
-                                <field name="street3"/>
-                                <field name="zip_id"/>
-                                <field name="zip"/>
-                                <field name="city"/>
-                                <field name="cedex"/>
-                                <field name="state_id"/>
-                                <field name="country_id"/>
-                                <field name="type"/>
-                                <field name="category_id"/>
-                            </group>
                             <group>
                                 <field name="title" placeholder="Madame" options='{"no_open": True, "no_create": True}'/>
                                 <field name="firstname" string="Prénom" required="1"/>
@@ -851,7 +838,7 @@
                                 <field name="email"/>
                                 <field name="phone" widget="phone"/>
                                 <field name="mobile" widget="phone"/>
-                                <field name="category_id"  widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" />
+                                <field name="category_id"  widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" attrs="{'invisible': [('type','!=', 'contact')]}"/>
                                 <field name="comment" placeholder="internal note..."/>
                             </group>
                             <group attrs="{'invisible': [('type', '!=', 'contact')]}">
-- 
GitLab