Files
partner-tools/partner_profiles/views/res_partner_view.xml

291 lines
17 KiB
XML

<?xml version="1.0"?>
<odoo>
<data>
<record id="view_res_partner_filter_profiles" model="ir.ui.view">
<field name="name">res.partner.select.contact</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter" />
<field name="arch" type="xml">
<filter name="type_otherpositions" position="after">
<separator />
<filter
string="Main Profile"
name="type_admin"
context="{'search_show_all_positions': {'is_set': True, 'set_value': True}}"
domain="[('is_main_profile', '=', True)]"
/>
<filter
string="Public Profile"
name="type_public"
context="{'search_show_all_positions': {'is_set': True, 'set_value': True}}"
domain="[('is_public_profile', '=', True)]"
/>
<filter
string="Position Profile"
name="type_position"
context="{'search_show_all_positions': {'is_set': True, 'set_value': True}}"
domain="[('is_position_profile', '=', True)]"
/>
</filter>
</field>
</record>
<record id="partner_profiles_form_view" model="ir.ui.view">
<field name="name">Partner Profiles Form View</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="99" />
<field name="arch" type="xml">
<!-- ################### -->
<!-- MAIN DISPLAY UPDATE -->
<!-- ################### -->
<xpath expr="//field[@name='name']" position="after">
<p class="oe_read_only" style="font-size:small; font-style:italic"
attrs="{'invisible': [('is_main_profile','=',False)]}">Main Profile</p>
<p class="oe_read_only" style="font-size:small; font-style:italic"
attrs="{'invisible': [('is_public_profile','=',False)]}">Public Profile</p>
<p class="oe_read_only" style="font-size:small; font-style:italic"
attrs="{'invisible': [('is_position_profile','=',False)]}">Position Profile</p>
</xpath>
<xpath expr="//field[@name='parent_id']" position="replace" />
<xpath expr="//field[@name='is_company']/.." position="after">
<group name="profile_data" class="bg-200 mb24" attrs="{'invisible': [('type','!=', 'contact')]}">
<field name="partner_profile" readonly="1" invisible="1" />
<field name="is_main_profile" readonly="1" invisible="1" />
<field name="is_public_profile" readonly="1" invisible="1" />
<field name="is_position_profile" readonly="1" invisible="1" />
<group name="profile_status">
<field name="contact_id" widget="res_partner_many2one"
string="Main Profile" readonly="1"
attrs="{'invisible': [('is_main_profile','=',True)]}" />
<field name="parent_id" widget="res_partner_many2one"
placeholder="Company" domain="[('is_company', '=', True)]"
context="{'default_is_company': True, 'show_vat': True}"
attrs="{'invisible': ['|',('is_company', '=', True),'|',('contact_type','=','standalone'),('is_public_profile','=',True)]}"
readonly="1" />
<label for="public_profile_id"
attrs="{'invisible': [('is_main_profile','=',False)]}" />
<div class="o_row"
attrs="{'invisible': [('is_main_profile','=',False)]}">
<field name="public_profile_id" readonly="1" />
<button type="object" name="create_public_profile"
string="Create Public Profile"
attrs="{'invisible': [('public_profile_id','!=',False)]}" />
<button string="Sync data"
name="sync_admin_and_public_data" type="object"
icon="fa-refresh"
attrs="{'invisible': [('public_profile_id','=',False)]}" />
</div>
</group>
</group>
</xpath>
<!-- page Contacts & Adresses -->
<xpath
expr="//field[@name='child_ids']/form/sheet/group/group/field[@name='contact_type']"
position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath
expr="//field[@name='child_ids']" position="before">
<div class="alert alert-info" role="alert" style="margin-bottom:0px;"
attrs="{'invisible': [('is_company','=', False)]}">
<span>Please find here <strong>all</strong> the addresses/contacts linked to
this main profile. Contact creation from this tab <strong>only
generates new main profiles</strong>.</span>
</div>
<div class="alert alert-info" role="alert" style="margin-bottom:0px;"
attrs="{'invisible': [('is_company','=', True)]}">
<span>Please find here <strong>all</strong> the addresses linked with this
main profile. Adress creation from this tab <strong>only
generates new main profiles</strong>.</span>
</div>
</xpath>
<!-- page Structure's position -->
<xpath expr="//page[@name='other_position']" position="after">
<page name="structure_positions" string="Positions"
attrs="{'invisible': [('is_company','=', False)]}">
<div class="alert alert-info" role="alert" style="margin-bottom:0px;">
<span>Please find here <strong>all the position profiles</strong> linked
to this main profile.</span>
</div>
<field name="structure_position_ids" mode="kanban"
domain="[('is_position_profile', '=', True)]">
<kanban create="false">
<field name="id" />
<field name="color" />
<field name="name" />
<field name="title" />
<field name="email" />
<field name="function" />
<field name="phone" />
<field name="mobile" />
<field name="avatar_128" />
<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'">
<div class="o_kanban_image">
<img alt="" t-if="record.avatar_128.raw_value"
t-att-src="kanban_image('res.partner', 'avatar_128', record.id.raw_value)" />
</div>
<div class="oe_kanban_details">
<field name="name" />
<div t-if="record.function.raw_value">
<field name="function" />
</div>
<div t-if="record.email.raw_value">
<field name="email" widget="email" />
</div>
<div t-if="record.phone.raw_value">Phone: <field
name="phone" widget="phone" /></div>
<div t-if="record.mobile.raw_value">Mobile: <field
name="mobile" widget="phone" /></div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
<button name="%(action_create_position_profile_wizard)d"
string="Create New Position"
class="oe_highlight" type="action"
attrs="{'invisible': [('is_main_profile','=',False)]}" />
</page>
</xpath>
<!-- page Other Positions -->
<xpath expr="//page[@name='other_position']" position="attributes">
<attribute name="attrs">{'invisible': [('is_company','=',True)]}</attribute>
</xpath>
<xpath expr="//page[@name='other_position']" position="attributes">
<attribute name="string">Positions</attribute>
</xpath>
<xpath expr="//page[@name='other_position']/field[@name='other_contact_ids']/form"
position="replace" />
<xpath expr="//field[@name='other_contact_ids']" position="before">
<div class="alert alert-info" role="alert" style="margin-bottom:0px;">
<span>Please find here <strong>all the position profiles</strong> linked to
this main profile.</span>
</div>
</xpath>
<xpath expr="//field[@name='other_contact_ids']" position="after">
<button name="%(action_create_position_profile_wizard)d"
string="Create New Position"
class="oe_highlight" type="action"
attrs="{'invisible': [('is_main_profile','=',False)]}" />
</xpath>
<!-- #################################### -->
<!-- PUBLIC AND POSITION PROFILES DISPLAY -->
<!-- #################################### -->
<xpath expr="//div[@name='button_box']" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('is_public_profile','=', True),
('is_position_profile','=', True)]}</attribute>
</xpath>
<xpath expr="//field[@name='company_type']" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('is_public_profile','=', True),
('is_position_profile','=', True)]}</attribute>
</xpath>
<xpath expr="//field[@name='avatar_128']" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('is_public_profile','=', True),
('is_position_profile','=', True)]}</attribute>
</xpath>
<xpath expr="//notebook" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('is_public_profile','=', True),
('is_position_profile','=', True)]}</attribute>
</xpath>
<xpath expr="//field[@name='type']/../.." position="attributes">
<attribute name="attrs">{'invisible': ['|', ('is_public_profile','=', True),
('is_position_profile','=', True)]}</attribute>
</xpath>
<!-- ###################### -->
<!-- PUBLIC PROFILE DISPLAY -->
<!-- ###################### -->
<xpath expr="//field[@name='type']/../.." position="after">
<group id="public_data" attrs="{'invisible': [('is_public_profile','=',False)]}">
<group>
<label for="street" string="Address" />
<div class="o_address_format">
<field name="street" placeholder="Street..."
class="o_address_street"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" />
<field name="street2" placeholder="Street 2..."
class="o_address_street"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" />
<field name="city" placeholder="City" class="o_address_city"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" />
<field name="state_id" class="o_address_state" placeholder="State"
options='{"no_open": True}'
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'country_id': country_id, 'zip': zip}" />
<field name="zip" placeholder="ZIP" class="o_address_zip"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" />
<field name="country_id" placeholder="Country"
class="o_address_country"
options='{"no_open": True, "no_create": True}'
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" />
</div>
</group>
</group>
</xpath>
<!-- ######################## -->
<!-- POSITION PROFILE DISPLAY -->
<!-- ######################## -->
<xpath expr="//field[@name='category_id']/../.." position="after">
<group id="position_data"
attrs="{'invisible': [('is_position_profile','=',False)]}">
<group>
<field name="comment" />
</group>
</group>
</xpath>
</field>
</record>
<record id="partner_profiles_kanban_view" model="ir.ui.view">
<field name="name">Partner Profiles Kanban View</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view" />
<field name="priority" eval="99" />
<field name="arch" type="xml">
<xpath expr="//kanban" position="inside">
<field name="is_main_profile" />
<field name="is_public_profile" />
<field name="is_position_profile" />
</xpath>
<xpath
expr="//div[hasclass('oe_kanban_details')]/div/div[hasclass('o_kanban_tags_section')]"
position="before">
<div>
<span attrs="{'invisible': [('is_main_profile','=',False)]}"
style="color:#7c7bad;">
<b>Main profile</b>
</span>
<span attrs="{'invisible': [('is_public_profile','=',False)]}"
style="color:#7c7bad;">
<b>Public profile</b>
</span>
<span attrs="{'invisible': [('is_position_profile','=',False)]}"
style="color:#7c7bad;">
<b>Position profile</b>
</span>
</div>
</xpath>
</field>
</record>
<record id="sync_public_data_action_server" model="ir.actions.server">
<field name="name">Synchronize main and public data</field>
<field name="model_id" ref="model_res_partner" />
<field name="binding_model_id" ref="model_res_partner" />
<field name="groups_id" eval="[(4,ref('base.group_no_one'))]" />
<field name="state">code</field>
<field name="code">records.sync_admin_and_public_data() </field>
</record>
</data>
</odoo>