Prevents the modification of the company type of res.partner: - if partner is a public or a position profile - if the partner has position profiles attached Also synchronize the company type between main and public profiles.
168 lines
10 KiB
XML
168 lines
10 KiB
XML
<?xml version="1.0"?>
|
|
<odoo>
|
|
<data>
|
|
<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="sequence">99</field>
|
|
<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">
|
|
<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)]}" />
|
|
</div>
|
|
</group>
|
|
</group>
|
|
</xpath>
|
|
|
|
<!-- page Contacts & Adresses -->
|
|
<xpath expr="//field[@name='child_ids']/.." position="attributes">
|
|
<attribute name="attrs">{'invisible': [('is_company','=', False)]}</attribute>
|
|
</xpath>
|
|
<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']/form/sheet/group/group/field[@name='name']"
|
|
position="before">
|
|
<field name="is_position_profile" readonly="1" invisible="1" />
|
|
<field name="partner_profile" string="Partner profile" invisible="1" />
|
|
</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']/field[@name='other_contact_ids']/kanban"
|
|
position="attributes">
|
|
<attribute name="create">true</attribute>
|
|
</xpath>
|
|
<xpath expr="//page[@name='other_position']/field[@name='other_contact_ids']"
|
|
position="attributes">
|
|
<attribute name="context">{'default_partner_profile': 3, 'default_contact_id':
|
|
active_id, 'default_name': name, 'default_street': street,
|
|
'default_street2': street2, 'default_city': city, 'default_state_id':
|
|
state_id, 'default_zip': zip, 'default_country_id': country_id,
|
|
'default_supplier': supplier}</attribute>
|
|
</xpath>
|
|
<xpath
|
|
expr="//field[@name='other_contact_ids']/form/sheet/group/group/field[@name='name']"
|
|
position="after">
|
|
<field name="is_position_profile" readonly="1" invisible="1" />
|
|
<field name="partner_profile" string="Partner profile" />
|
|
<field name="parent_id" widget="res_partner_many2one" placeholder="Company"
|
|
domain="[('is_company', '=', True),('is_main_profile','=', True)]"
|
|
context="{'default_partner_profile': 1, 'default_is_company': True, 'show_vat': True}" />
|
|
</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='image']" 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 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>
|
|
<field name="phone" widget="phone" />
|
|
<field name="mobile" widget="phone" />
|
|
<field name="email" widget="email" context="{'gravatar_image': True}" />
|
|
<field name="website" widget="url"
|
|
placeholder="e.g. https://www.odoo.com" />
|
|
</group>
|
|
</group>
|
|
</xpath>
|
|
<!-- ######################## -->
|
|
<!-- POSITION PROFILE DISPLAY -->
|
|
<!-- ######################## -->
|
|
<xpath expr="//field[@name='type']/../.." position="after">
|
|
<group attrs="{'invisible': [('is_position_profile','=',False)]}">
|
|
<group>
|
|
<field name="function" />
|
|
</group>
|
|
<group>
|
|
<field name="phone" widget="phone" />
|
|
<field name="email" widget="email" context="{'gravatar_image': True}" />
|
|
</group>
|
|
</group>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
</data>
|
|
</odoo> |