diff --git a/models/res_partner.py b/models/res_partner.py index 64fbd5c8588d9e9c394d4d5301399321c8d1ffc0..55d27896218da915c43d16916aee623f8b3a7beb 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -51,6 +51,10 @@ class ScopPartner(models.Model): # Infos générales - champs non affichés is_cooperative = fields.Boolean("Est une coopérative") + parent_is_cooperative = fields.Boolean( + string="Parent est une coopérative", + related="parent_id.is_cooperative", + ) current_user_ur_id = fields.Many2one( "union.regionale", string="Union Régionale de l'utilisateur", diff --git a/views/res_partner.xml b/views/res_partner.xml index bf8fade564c2e84732c0b0e7e72ca94045eae1da..a3783ec304a704248ef5a1e543b9bff6cf9ff05f 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -71,6 +71,7 @@ >{'invisible': [('is_cooperative','=', True)]}</attribute> <attribute name="col">3</attribute> </xpath> + <xpath expr="//div[hasclass('oe_title')]" position="attributes"> <attribute name="attrs" @@ -88,10 +89,9 @@ </field> <field name="parent_id" position="attributes"> <attribute name="options">{'no_create': True}</attribute> - <attribute - name="domain" - >[('is_company', '=', True), ('ur_id', '=', ur_id)]</attribute> + <attribute name="domain">[('is_company', '=', True), ('ur_id', '=', ur_id)]</attribute> <attribute name="placeholder">Société</attribute> + <attribute name="attrs" >{'invisible': [('is_company','=', True)]}</attribute> </field> <xpath expr="//div[hasclass('oe_title')]" position="attributes"> <attribute name="class">oe_title oe_title_cgscop</attribute> @@ -116,7 +116,6 @@ <attribute name="readonly">True</attribute> </xpath> - <field name="street" position="attributes"> <attribute name="placeholder">Rue</attribute> </field> @@ -127,9 +126,7 @@ <attribute name="placeholder">Rue 3</attribute> </field> <field name="zip_id" position="attributes"> - <attribute - name="placeholder" - >CP / Ville autocomplétion...</attribute> + <attribute name="placeholder">CP / Ville autocomplétion...</attribute> </field> <field name="zip" position="replace" /> <field name="city" position="before"> @@ -146,10 +143,44 @@ <attribute name="placeholder">Région</attribute> <attribute name="invisible">1</attribute> </field> + + <field name="vat" position="attributes"> + <attribute + name="attrs" + >{'invisible': [('is_company','=', False)]}</attribute> + </field> + + <field name="vat" position="before"> + <field name="user_ids" invisible="1" /> + <field + name="zip_departement" + string="N° de département" + attrs="{'invisible': [('is_company','=', False)]}" + /> + <field + name="region" + attrs="{'invisible': [('is_company','=', False)]}" + /> + </field> + + <field name="vat" position="after"> + <field name="phone" widget="phone" /> + <field + name="mobile" + widget="phone" + attrs="{'invisible': [('is_company','=', True)]}" + /> + <field name="email" widget="email" on_change="1" /> + <field + name="website" + attrs="{'invisible': [('is_company','=', False)]}" + /> + <field name="lang" invisible="1" /> + </field> + <xpath expr='//form/sheet/group/group[2]' position="replace"> <group col="1" name="partner_legal_info"> - <group - string="Informations juridiques" + <group string="Informations juridiques" attrs="{'invisible': [('is_company', '=', False)]}" > <label @@ -184,7 +215,49 @@ /> <field name="registration_date" /> </group> + + <group string="Informations contact" + name="contact_legal_info" + attrs="{'invisible': ['|', ('is_company', '=', True), ('type', '!=', 'contact')]}" + > + <field name="parent_is_cooperative" invisible="1" /> + + <field + name="title" + options='{"no_create": True, "no_open": True}' + attrs="{'invisible': [('is_company','=', True)]}" + /> + <field + name="birthyear" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <br/> + <field + name="mandate_id" + options='{"no_create": True, "no_open": True}' + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <field + name="function_lst_id" + options='{"no_create": True, "no_open": True}' + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', True)]}" + /> + <field + name="function" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <field + name="employee" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <field + name="associate" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + </group> + </group> + <group col="1" name="partner_segment_info" @@ -246,6 +319,19 @@ domain="[('ur_id', '=', ur_id)]" attrs="{'invisible':[('segment_4_nb', '=', 0)]}" /> + <field + name="staff_last" + attrs="{'invisible': [('organization_subtype_id','!=', %(cgscop_partner.riga_11528)d)]}" + /> + <br/> + <field + name="ur_id" + options='{"no_open": True, "no_create": True}' + on_change="1" + can_create="false" + can_write="false" + attrs="{'invisible': [('is_company','=', False)]}" + /> <field name="followup_delegate_id" widget="many2one_mailto" @@ -253,13 +339,8 @@ domain="[('active', '=', True),('ur_id', '=', ur_id)]" attrs="{'invisible': ['|', ('is_company','=', False), ('type', '!=', 'contact')]}" /> - <field - name="staff_last" - attrs="{'invisible': [('organization_subtype_id','!=', %(cgscop_partner.riga_11528)d)]}" - /> </group> - <group - string="Féd. communication" + <group string="Féd. communication" groups="cgscop_partner.group_federation_com" > <field name="copadev_member" widget="boolean_toggle" /> @@ -269,40 +350,13 @@ widget="many2many_tags" /> </group> - </group> - <group + <group string="Informations mouvement" name="contact_segment_info" attrs="{'invisible': ['|', ('is_company', '=', True), ('type', '!=', 'contact')]}" > - <field - name="title" - options='{"no_create": True, "no_open": True}' - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="mandate_id" - options='{"no_create": True, "no_open": True}' - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="function_lst_id" - options='{"no_create": True, "no_open": True}' - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field name="function" /> - <field - name="employee" - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="associate" - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="birthyear" - attrs="{'invisible': [('is_company','=', True)]}" - /> + <field name="parent_is_cooperative" invisible="1" /> + <field name="contact_origin_id" attrs="{'invisible': [('is_company','=', True)]}" @@ -313,14 +367,30 @@ readonly="True" attrs="{'invisible': [('is_company','=', True)]}" /> + <br/> + <field + name="ur_id" + options='{"no_open": True, "no_create": True}' + on_change="1" + can_create="false" + can_write="false" + /> <field name="followup_delegate_id" widget="many2one_mailto" options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" /> + <br/> + <field + name="category_id" + options='{"no_open": True, "no_create": True}' + widget="many2many_tags" + /> + </group> </xpath> + <xpath expr='//form/sheet/group' position="after"> <field name="subscription_ids" @@ -332,202 +402,168 @@ </tree> </field> </xpath> - <xpath expr="//field[@name='child_ids']" position="attributes"> - <attribute - name="context" - >{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_street3': street3, 'default_city': city, 'default_cedex': cedex, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_lang': lang, 'default_ur_id': ur_id, 'default_user_id': user_id}</attribute> - </xpath> - <!-- Kanban Child --> - <xpath - expr="//field[@name='child_ids']//kanban//field[@name='function']" - position="before" - > - <field name="mandate_id" /> - <field - name="ur_id" - options='{"no_open": True, "no_create": True}' - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//kanban//div[hasclass('oe_kanban_details')]//field[@name='name']" - position="after" - > - <div t-if="record.mandate_id.raw_value"><field - name="mandate_id" - /></div> - </xpath> - <!-- Form Child --> - <xpath - expr="//field[@name='child_ids']//form//field[@name='type']" - position="after" - > - <field - name="company_type" - widget="radio" - class="oe_edit_only" - options="{'horizontal': true}" - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='function']" - position="replace" - > - <field - name="ur_id" - invisible="1" - options='{"no_open": True, "no_create": True}' - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='street']" - position="attributes" - > - <attribute name="placeholder">Rue</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='street2']" - position="attributes" - > - <attribute name="placeholder">Rue 2</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='street3']" - position="attributes" - > - <attribute name="placeholder">Rue 3</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='zip_id']" - position="attributes" - > - <attribute - name="placeholder" - >CP / Ville autocomplétion...</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='zip']" - position="replace" - /> - <xpath - expr="//field[@name='child_ids']//form//field[@name='city']" - position="before" - > - <field - name="zip" - placeholder="Code postal" - class="o_address_city" - attrs="{'readonly': [('type', '=', 'contact'), ('parent_id', '!=', False)]}" - on_change="1" - modifiers="{'readonly':[['type','=','contact'], ['parent_id','!=',false]]}" - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='state_id']" - position="attributes" - > - <attribute name="placeholder">Région</attribute> - </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': [('type', '!=', 'contact')]}" - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='title']" - position="attributes" - > - <attribute - name="options" - >{'no_open': True, 'no_create': True}</attribute> + + <xpath expr="//page[@name='contact_addresses']" position="attributes"> + <attribute name="attrs">{'invisible': [('is_company','=', False)]}</attribute> </xpath> - <xpath - expr="//field[@name='child_ids']/form//group/group[2]" - position="after" - > - <group attrs="{'invisible': [('type', '!=', 'contact')]}"> - <field - name="mandate_id" - options='{"no_open": True, "no_create": True}' - /> - <field - name="function_lst_id" - options='{"no_open": True, "no_create": True}' - /> - <field name="function" /> - <field name="employee" /> - <field name="associate" /> - <field name="birthyear" /> - <field - name="contact_origin_id" - options="{'no_open': True, 'no_create': True}" - /> - <field name="contact_legality" readonly="1" /> - <field - name="followup_delegate_id" - widget="many2one_mailto" - options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" - domain="[('active', '=', True),('ur_id', '=', ur_id)]" + + <xpath expr="//field[@name='child_ids']" position="replace"> + <p> + <button + name="add_contact" + type="object" + class="btn-info" + string="Ajouter un contact" /> - </group> - </xpath> - <xpath expr="//field[@name='child_ids']/form//group" position="after"> - <field - name="subscription_ids" - attrs="{'invisible': [('type', '!=', 'contact')]}" - > - <tree string="Subscriptions" editable="bottom"> - <field name="newsletter_id" domain="[]" /> - <field name="consent" /> - </tree> + </p> + + <field name="child_ids" mode="kanban" readonly="1" style="pointer-events: none;"> + <kanban> + <field name="id" /> + <field name="color" /> + <field name="name" /> + <field name="title" /> + <field name="type" /> + <field name="email" /> + <field name="parent_id" /> + <field name="is_company" /> + <field name="mandate_id" /> + <field name="function" /> + <field name="function_lst_id" /> + <field name="phone" /> + <field name="street" /> + <field name="street2" /> + <field name="street3" /> + <field name="zip" /> + <field name="zip_id" /> + <field name="city" /> + <field name="city_id" /> + <field name="cedex" /> + <field name="country_id" /> + <field name="mobile" /> + <field name="state_id" /> + <field name="image_128" /> + <field name="lang" /> + <field name="comment" /> + <field name="display_name" /> + <field name="ur_id" /> + <field name="category_id" /> + <templates> + <t t-name="kanban-box"> + <t + t-set="color" + t-value="kanban_color(record.color.raw_value)" + /> + <div + t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '') + ' oe_kanban_global_click'" + > + <a + name="edit_contact" + type="object" + class="fa fa-2x fa-edit text-info pull-right" + title="Modifier" + style="pointer-events: visible;" + /> + <a + t-if="!read_only_mode" + name="partner_archive" + type="object" + class="fa fa-times pull-right" + title="Archiver" + /> + <div class="o_kanban_image"> + <img + alt="Contact image" + t-if="record.image_128.raw_value" + t-att-src="kanban_image('res.partner', 'image_128', record.id.raw_value)" + /> + <t t-if="!record.image_128.raw_value"> + <img + alt="Delivery" + t-if="record.type.raw_value === 'delivery'" + t-att-src='_s + "/base/static/img/truck.png"' + /> + <img + id="cgscop_partner_invoice_img" + alt="Invoice" + t-if="record.type.raw_value === 'invoice'" + t-att-src='_s + "/base/static/img/money.png"' + /> + <t + t-if="record.type.raw_value !== 'invoice' && record.type.raw_value !== 'delivery'" + > + <img + alt="Logo" + t-if="record.is_company.raw_value === true" + t-att-src="_s + '/base/static/img/company_image.png'" + /> + <img + alt="Avatar" + t-if="record.is_company.raw_value === false" + t-att-src='_s + "/base/static/img/avatar_grey.png"' + /> + </t> + </t> + </div> + <div class="oe_kanban_details"> + <field name="name" /> + <div + t-if="record.function_lst_id.raw_value" + ><field name="function_lst_id" /></div> + <div + t-if="record.email.raw_value" + ><field + name="email" + widget="email" + /></div> + <div + t-if="record.type.raw_value != 'contact'" + > + <div> + <field name="zip" /> + <field name="city" /> + <field name="cedex" /> + </div> + <field + t-if="record.state_id.raw_value" + name="state_id" + /> + <field name="country_id" /> + </div> + <div + t-if="record.phone.raw_value" + >Phone: <field name="phone" /></div> + <div + t-if="record.mobile.raw_value" + >Mobile: <field name="mobile" /></div> + <div + t-if="record.category_id.raw_value" + ><field + name="category_id" + widget="many2many_tags" + /></div> + </div> + </div> + </t> + </templates> + </kanban> </field> </xpath> - <field name="vat" position="after"> - <field name="user_ids" invisible="1" /> - <field name="zip_departement" string="N° de département" /> - <field name="region" /> - <field name="phone" widget="phone" /> - <field - name="mobile" - widget="phone" - attrs="{'invisible': [('is_company','=', True)]}" - /> - <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), ('type', '!=', 'contact')]}" - /> - <field name="lang" invisible="1" /> - </field> + + <xpath expr="//notebook/page" position="attributes"> <attribute name="attrs" >{'invisible': [('is_cooperative','=', True)]}</attribute> </xpath> + <xpath expr="//notebook/page[@name='internal_notes']" position="attributes" > <attribute name="string">Commentaires</attribute> </xpath> + <xpath expr="//field[@name='comment']" position="attributes"> <attribute name="placeholder">Commentaires...</attribute> </xpath> @@ -1172,7 +1208,7 @@ string="Ajouter un dirigeant" /> </p> - <field name="director_ids" readonly="1"> + <field name="director_ids" readonly="1" style="pointer-events:none;"> <kanban> <field name="id" /> <field name="color" /> @@ -1223,6 +1259,7 @@ type="object" class="fa fa-2x fa-edit text-info pull-right" title="Modifier" + style="pointer-events: visible;" /> <div class="o_kanban_image"> <img @@ -1288,7 +1325,7 @@ string="Ajouter un contact" /> </p> - <field name="other_child_ids" mode="kanban" readonly="1"> + <field name="other_child_ids" mode="kanban" readonly="1" style="pointer-events: none;"> <kanban> <field name="id" /> <field name="color" /> @@ -1332,6 +1369,7 @@ type="object" class="fa fa-2x fa-edit text-info pull-right" title="Modifier" + style="pointer-events: visible;" /> <a t-if="!read_only_mode" @@ -1801,15 +1839,25 @@ string="Nom de famille" required="1" /> + <field name="birthyear" /> + <br/> <field name="email" /> <field name="phone" widget="phone" /> <field name="mobile" widget="phone" /> + <br/> <field - name="category_id" - widget="many2many_tags" - options="{'color_field': 'color', 'no_create': True}" + name="contact_origin_id" + options="{'no_open': True, 'no_create': True}" + /> + <field name="contact_legality" readonly="1" /> + <br/> + <field name="ur_id" readonly="1" /> + <field + name="followup_delegate_id" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" + domain="[('active', '=', True),('ur_id', '=', ur_id)]" /> - <field name="comment" placeholder="Commentaires..." /> </group> <group> <field @@ -1817,26 +1865,15 @@ options="{'no_open': True, 'no_create': True}" required="1" /> - <field - name="function_lst_id" - options="{'no_open': True, 'no_create': True}" - /> <field name="function" /> <field name="employee" /> <field name="associate" /> - <field name="birthyear" /> + <br/> <field - name="contact_origin_id" - options="{'no_open': True, 'no_create': True}" - /> - <field name="contact_legality" readonly="1" /> - <field - name="followup_delegate_id" - widget="many2one_mailto" - options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" - domain="[('active', '=', True),('ur_id', '=', ur_id)]" + name="category_id" + widget="many2many_tags" + options="{'color_field': 'color', 'no_create': True}" /> - <field name="ur_id" readonly="1" /> </group> </group> <field name="subscription_ids"> @@ -1892,10 +1929,16 @@ /> <field name="parent_id_onchange" invisible="1" /> <field name="parent_id" invisible="1" /> + <field name="parent_is_cooperative" invisible="1" /> <hr /> <group> <group attrs="{'invisible': [('type', '=', 'contact')]}"> - <label for="street" string="Address" /> + <field + name="name" + string="Nom" + required="1" + /> + <label for="street" string="Adresse" /> <div> <div name="div_address" class="o_address_format"> <field @@ -1955,18 +1998,13 @@ </div> </div> </group> - <group> + <group attrs="{'invisible': [('type', '!=', 'contact')]}"> <field name="title" placeholder="Madame" attrs="{'invisible': [('type','!=', 'contact')]}" options='{"no_open": True, "no_create": True}' /> - <field - name="name" - string="Nom" - attrs="{'required' : [('type', '!=', 'contact')], 'invisible' : [('type', '=', 'contact')]}" - /> <field name="firstname" string="Prénom" @@ -1977,42 +2015,58 @@ string="Nom de famille" attrs="{'required' : [('type', '=', 'contact')], 'invisible' : [('type', '!=', 'contact')]}" /> + <field + name="birthyear" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" + /> + <br/> <field name="email" /> <field name="phone" widget="phone" /> <field name="mobile" widget="phone" /> + <br/> <field - name="category_id" - widget="many2many_tags" - options="{'color_field': 'color', 'no_create': True}" - attrs="{'invisible': [('type','!=', 'contact')]}" + name="contact_origin_id" + options="{'no_open': True, 'no_create': True}" + /> + <field name="contact_legality" readonly="1" /> + <br/> + <field name="ur_id" readonly="1" /> + <field + name="followup_delegate_id" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" + domain="[('active', '=', True),('ur_id', '=', ur_id)]" /> - <field name="comment" placeholder="internal note..." /> </group> <group attrs="{'invisible': [('type', '!=', 'contact')]}"> <field name="mandate_id" options="{'no_open': True, 'no_create': True}" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" + /> + <field + name="function" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" /> <field name="function_lst_id" options="{'no_open': True, 'no_create': True}" + attrs="{'invisible': [('parent_is_cooperative','!=', False)]}" /> - <field name="function" /> - <field name="employee" /> - <field name="associate" /> - <field name="birthyear" /> <field - name="contact_origin_id" - options="{'no_open': True, 'no_create': True}" + name="employee" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" /> - <field name="contact_legality" readonly="1" /> <field - name="followup_delegate_id" - widget="many2one_mailto" - options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" - domain="[('active', '=', True),('ur_id', '=', ur_id)]" + name="associate" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" + /> + <br/> + <field + name="category_id" + widget="many2many_tags" + options="{'color_field': 'color', 'no_create': True}" /> - <field name="ur_id" readonly="1" /> </group> </group> <field