Files
odoo_source/odoo/addons/base/res/res_partner_view.xml
T
Nicolas Lempereur a0fddebe64 [FIX] base: prevent bin_size/binary visual defect
Changing the address type of a contact in the "Contact & Addresses" tab
could in some instance lead to a dead image (just visually, saving it
would not change it) because the image is set to something like
"data:image/png;base64,5.23 Kb" because of a combination of kanba/form
x2many view, onchange, the differences of field present.

In 9.0 this did not happen because the image was not a field in the form
view corresponding to a contact of the kanban contacts view.

In saa-15 thanks to bf26445 the image_small is different than image in
the kanban view and this got us out of the issue.

In saas-16 it is solved even further because new views only load missing
fields.

This commit just get out of the issue by preventing an update of the
records field (with bin_size which caused the issue of the image) when
opening the modal form view of a contact's contact.

Ideally we should solve this more deeply but this is dangerous code to
change (eg. removing the bin_size would solve it but this was done for a
reason and could affect performances) and the effect is just visual in a
very particular set of factors (if we save the form after the image is
dead, the previous image reappeared).

opw-765952
closes #19491
2017-09-20 13:36:51 +02:00

562 lines
34 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Partner Titles -->
<record id="view_partner_title_tree" model="ir.ui.view">
<field name="name">res.partner.title.tree</field>
<field name="model">res.partner.title</field>
<field name="arch" type="xml">
<tree string="Partner Titles">
<field name="name"/>
<field name="shortcut"/>
</tree>
</field>
</record>
<record id="view_partner_title_form" model="ir.ui.view">
<field name="name">res.partner.title.form</field>
<field name="model">res.partner.title</field>
<field name="arch" type="xml">
<form string="Partner Titles">
<group col="4">
<field name="name"/>
<field name="shortcut"/>
</group>
</form>
</field>
</record>
<record id="action_partner_title_contact" model="ir.actions.act_window">
<field name="name">Contact Titles</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.title</field>
<field name="view_type">form</field>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help">Manage the contact titles you want to have available in your system and the way you want to print them in letters and other documents. Some example: Mr., Mrs. </field>
</record>
<!-- Partner -->
<record id="view_partner_tree" model="ir.ui.view">
<field name="name">res.partner.tree</field>
<field name="model">res.partner</field>
<field eval="8" name="priority"/>
<field name="arch" type="xml">
<tree string="Contacts">
<field name="display_name" string="Name"/>
<field name="function" invisible="1"/>
<field name="phone"/>
<field name="email"/>
<field name="user_id" invisible="1"/>
<field name="is_company" invisible="1"/>
<field name="country_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<field name="active" invisible="1"/>
</tree>
</field>
</record>
<record id="view_partner_simple_form" model="ir.ui.view">
<field name="name">res.partner.simplified.form</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<form string="Contact">
<field name="is_company" invisible="1"/>
<field name="type" invisible="1"/>
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium"}'/>
<div class="oe_title">
<field name="company_type" options="{'horizontal': true}" class="oe_edit_only" widget="radio"/>
<h1>
<field name="name" default_focus="1" placeholder="Name" attrs="{'required' : [('type', '=', 'contact')]}"/>
</h1>
<field name="parent_id"
placeholder="Company"
domain="[('is_company', '=', True)]" context="{'default_is_company': True}"
attrs="{'invisible': [('is_company','=', True)]}"/>
</div>
<group>
<field name="function" placeholder="e.g. Sales Director"/>
<field name="user_ids" invisible="1"/>
<field name="email" widget="email" required="context.get('force_email', False)" attrs="{'required': [('user_ids','!=', [])]}"/>
<field name="phone" widget="phone"/>
<field name="mobile" widget="phone"/>
</group>
</form>
</field>
</record>
<!-- Open partner address -->
<record id="view_partner_address_form" model="ir.ui.view">
<field name="name">res.partner.form.address</field>
<field name="model">res.partner</field>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<form string="Partner">
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium", "size": [90, 90]}' readonly="1"/>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<field name="parent_id" invisible="1"/>
<group>
<group>
<label for="type" attrs="{'invisible': [('parent_id','=', False)]}" groups="base.group_no_one"/>
<div attrs="{'invisible': [('parent_id','=', False)]}" name="div_type" groups="base.group_no_one">
<field name="type" class="oe_inline"/>
</div>
<label for="street" string="Address"/>
<div class="o_address_format">
<field name="street" placeholder="Street..." class="o_address_street"/>
<field name="street2" placeholder="Street 2..." class="o_address_street"/>
<field name="city" placeholder="City" class="o_address_city"/>
<field name="state_id" class="o_address_state" placeholder="State" options='{"no_open": True}'/>
<field name="zip" placeholder="ZIP" class="o_address_zip"/>
<field name="country_id" placeholder="Country" class="o_address_country" options='{"no_open": True, "no_create": True}'/>
</div>
<field name="website" widget="url" placeholder="e.g. www.odoo.com"/>
</group>
<group>
</group>
</group>
</form>
</field>
</record>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<form string="Partners">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium", "size": [90, 90]}'/>
<div class="oe_title">
<field name="is_company" invisible="1"/>
<field name="commercial_partner_id" invisible="1"/>
<field name="company_type" widget="radio"
class="oe_edit_only"
options="{'horizontal': true}"/>
<h1>
<field name="name" default_focus="1" placeholder="Name" attrs="{'required' : [('type', '=', 'contact')]}"/>
</h1>
<div class="o_row">
<field name="parent_id"
placeholder="Company"
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'default_supplier': supplier, 'default_customer': customer}"
attrs="{'invisible': ['|', '&amp;', ('is_company','=', True),('parent_id', '=', False),('company_name', '!=', False),('company_name', '!=', '')]}"/>
<field name="company_name" attrs="{'invisible': ['|', '|', ('company_name', '=', False), ('company_name', '=', ''), ('is_company', '=', True)]}"/>
<button name="create_company" type="object" string="Create company" class="btn btn-sm oe_edit_only fa fa-external-link btn btn-link " attrs="{'invisible': ['|', '|', ('is_company','=', True), ('company_name', '=', ''), ('company_name', '=', False)]}"/>
</div>
</div>
<group>
<group>
<field name="type" attrs="{'invisible': [('parent_id','=', False)]}" groups="base.group_no_one"/>
<label for="street" string="Address"/>
<div class="o_address_format">
<div class="oe_edit_only">
<button name="open_parent" type="object" string="(edit)" class="oe_link"
attrs="{'invisible': ['|', ('parent_id', '=', False), ('type', '!=', 'contact')]}"/>
</div>
<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>
<field name="website" widget="url" placeholder="e.g. www.odoo.com"/>
<field name="category_id" widget="many2many_tags" placeholder="Tags..." options="{'no_create_edit': True}"/>
</group>
<group>
<field name="function" placeholder="e.g. Sales Director"
attrs="{'invisible': [('is_company','=', True)]}"/>
<field name="phone" widget="phone"/>
<field name="mobile" widget="phone"/>
<field name="fax"/>
<field name="user_ids" invisible="1"/>
<field name="email" widget="email" attrs="{'required': [('user_ids','!=', [])]}"/>
<field name="title" options='{"no_open": True}'
attrs="{'invisible': [('is_company', '=', True)]}"/>
<field name="lang"/>
</group>
</group>
<notebook colspan="4">
<page string="Contacts &amp; Addresses" autofocus="autofocus">
<field name="child_ids" mode="kanban" context="{'default_parent_id': active_id, '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, 'default_customer': customer, 'default_lang': lang,}">
<kanban>
<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="function"/>
<field name="phone"/>
<field name="street"/>
<field name="street2"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="mobile"/>
<field name="fax"/>
<field name="state_id"/>
<field name="image"/>
<field name="lang"/>
<!-- fields in form x2many view to diminish requests -->
<field name="comment"/>
<field name="customer"/>
<field name="display_name"/>
<field name="supplier"/>
<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 t-if="!read_only_mode" type="delete" class="fa fa-times pull-right"/>
<div class="o_kanban_image">
<img t-if="record.image.raw_value" t-att-src="'data:image/png;base64,'+record.image.raw_value"/>
<t t-if="!record.image.raw_value">
<img t-if="record.type.raw_value === 'delivery'" t-att-src='_s + "/base/static/src/img/truck.png"'/>
<img t-if="record.type.raw_value === 'invoice'" t-att-src='_s + "/base/static/src/img/money.png"'/>
<t t-if="record.type.raw_value !== 'invoice' &amp;&amp; record.type.raw_value !== 'delivery'">
<img t-if="record.is_company.raw_value === true" t-att-src='_s + "/base/static/src/img/company_image.png"'/>
<img t-if="record.is_company.raw_value === false" t-att-src='_s + "/base/static/src/img/avatar.png"'/>
</t>
</t>
</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"/></div>
<div t-if="record.type.raw_value != 'contact'">
<div>
<field name="zip"/>
<field name="city"/>
</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.fax.raw_value">Fax: <field name="fax"/></div>
</div>
</div>
</t>
</templates>
</kanban>
<form string="Contact / Address">
<sheet>
<field name="type" required="1" widget="radio" options="{'horizontal': true}"/>
<hr/>
<group>
<group attrs="{'invisible': [('type','=', 'contact')]}">
<label for="street" string="Address"/>
<div>
<div class="o_address_format" name="div_address">
<field name="street" placeholder="Street..." class="o_address_street"/>
<field name="street2" placeholder="Street 2..." class="o_address_street"/>
<field name="city" placeholder="City" class="o_address_city"/>
<field name="state_id" class="o_address_state" placeholder="State" options='{"no_open": True}' context="{'country_id': country_id, 'zip': zip}"/>
<field name="zip" placeholder="ZIP" class="o_address_zip"/>
<field name="country_id" placeholder="Country" class="o_address_country" options='{"no_open": True, "no_create": True}'/>
</div>
</div>
</group>
<group>
<field name="name" string="Contact Name" attrs="{'required' : [('type', '=', 'contact')]}"/>
<field name="title" placeholder="e.g. Mr."
attrs="{'invisible': [('type','&lt;&gt;', 'contact')]}"/>
<field name="function" placeholder="e.g. Sales Director"
attrs="{'invisible': [('type','&lt;&gt;', 'contact')]}"/>
<field name="email"/>
<field name="phone" widget="phone"/>
<field name="mobile" widget="phone"/>
<field name="comment" placeholder="internal note..."/>
</group>
</group>
<field name="supplier" invisible="True"/>
<field name="customer" invisible="True"/>
<field name="lang" invisible="True"/>
<field name="image" invisible="True"/>
</sheet>
</form>
</field>
</page>
<page name='internal_notes' string="Internal Notes">
<field name="comment" placeholder="Internal note..."/>
</page>
<page name='sales_purchases' string="Sales &amp; Purchases">
<group name="container_row_2">
<group string="Sale" name="sale">
<field name="customer"/>
<field name="user_id"/>
</group>
<group string="Purchase" name="purchase">
<field name="supplier"/>
</group>
<group string="Misc">
<field name="ref"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_res_partner_filter" model="ir.ui.view">
<field name="name">res.partner.select</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<search string="Search Partner">
<field name="name"
filter_domain="['|','|',('display_name','ilike',self),('ref','=',self),('email','ilike',self)]"/>
<filter help="My Partners" domain="[('user_id','=',uid)]"/>
<separator/>
<filter string="Persons" name="type_person" domain="[('is_company','=',0)]"/>
<filter string="Companies" name="type_company" domain="[('is_company','=',1)]"/>
<separator/>
<filter string="Customers" name="customer" domain="[('customer','=',1), ('parent_id', '=', False)]"/>
<filter string="Vendors" name="supplier" domain="[('supplier','=',1), ('parent_id', '=', False)]"/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<separator/>
<field name="category_id" string="Tag" filter_domain="[('category_id','ilike', self)]"/>
<field name="user_id"/>
<field name="parent_id" domain="[('is_company','=',1)]" operator="child_of"/>
<group expand="0" name="group_by" string="Group By">
<filter name="salesperson" string="Salesperson" domain="[]" context="{'group_by' : 'user_id'}" />
<filter string="Company" context="{'group_by': 'parent_id'}"/>
<filter string="Country" context="{'group_by': 'country_id'}"/>
</group>
</search>
</field>
</record>
<!-- Partner Kanban View -->
<record model="ir.ui.view" id="res_partner_kanban_view">
<field name="name">res.partner.kanban</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<kanban class="o_res_partner_kanban">
<field name="color"/>
<field name="display_name"/>
<field name="title"/>
<field name="email"/>
<field name="parent_id"/>
<field name="is_company"/>
<field name="function"/>
<field name="phone"/>
<field name="street"/>
<field name="street2"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="mobile"/>
<field name="state_id"/>
<field name="category_id"/>
<field name="image_small"/>
<field name="type"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_res_partner_kanban">
<div class="o_kanban_tags_section oe_kanban_partner_categories"/>
<div class="o_kanban_image">
<t t-if="record.image_small.raw_value">
<img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)"/>
</t>
<t t-if="!record.image_small.raw_value">
<t t-if="record.type.raw_value === 'delivery'">
<img t-att-src='_s + "/base/static/src/img/truck.png"' class="o_kanban_image oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.type.raw_value === 'invoice'">
<img t-att-src='_s + "/base/static/src/img/money.png"' class="o_kanban_image oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.type.raw_value != 'invoice' &amp;&amp; record.type.raw_value != 'delivery'">
<t t-if="record.is_company.raw_value === true">
<img t-att-src='_s + "/base/static/src/img/company_image.png"'/>
</t>
<t t-if="record.is_company.raw_value === false">
<img t-att-src='_s + "/base/static/src/img/avatar.png"'/>
</t>
</t>
</t>
</div>
<div class="oe_kanban_details">
<strong class="oe_partner_heading"><field name="display_name"/></strong>
<ul>
<li t-if="record.parent_id.raw_value and !record.function.raw_value"><field name="parent_id"/></li>
<li t-if="!record.parent_id.raw_value and record.function.raw_value"><field name="function"/></li>
<li t-if="record.parent_id.raw_value and record.function.raw_value"><field name="function"/> at <field name="parent_id"/></li>
<li t-if="record.city.raw_value and !record.country_id.raw_value"><field name="city"/></li>
<li t-if="!record.city.raw_value and record.country_id.raw_value"><field name="country_id"/></li>
<li t-if="record.city.raw_value and record.country_id.raw_value"><field name="city"/>, <field name="country_id"/></li>
<li t-if="record.email.raw_value" class="o_text_overflow"><field name="email"/></li>
</ul>
<div class="oe_kanban_partner_links"/>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="action_partner_form" model="ir.actions.act_window">
<field name="name">Customers</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_customer":1}</field>
<field name="search_view_id" ref="view_res_partner_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p><p>
Odoo helps you easily track all activities related to
a customer: discussions, history of business opportunities,
documents, etc.
</p>
</field>
</record>
<record id="action_partner_form_view1" model="ir.actions.act_window.view">
<field eval="0" name="sequence"/>
<field name="view_mode">kanban</field>
<field name="view_id" ref="res_partner_kanban_view"/>
<field name="act_window_id" ref="action_partner_form"/>
</record>
<record id="action_partner_form_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_partner_form"/>
<field name="act_window_id" ref="action_partner_form"/>
</record>
<record id="action_partner_tree_view1" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_partner_tree"/>
<field name="act_window_id" ref="action_partner_form"/>
</record>
<record id="action_partner_customer_form" model="ir.actions.act_window">
<field name="name">Customers</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[]</field>
<field name="context">{'default_customer':1, 'search_default_customer':1}</field>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p><p>
Odoo helps you easily track all activities related to
a customer: discussions, history of business opportunities,
documents, etc.
</p>
</field>
</record>
<record id="action_partner_supplier_form" model="ir.actions.act_window">
<field name="name">Vendors</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="domain">[]</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{'search_default_supplier': 1,'default_customer': 0,'default_supplier': 1}</field>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p><p>
Odoo helps you easily track all activities related to
a supplier: discussions, history of purchases,
documents, etc.
</p>
</field>
</record>
<record id="action_partner_employee_form" model="ir.actions.act_window">
<field name="name">Employees</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="domain">[('employee','=',1)]</field>
<field name="context">{'default_customer':0, 'default_supplier':0 , 'default_employee':1}</field>
<field name="filter" eval="True"/>
</record>
<record id="action_partner_other_form" model="ir.actions.act_window">
<field name="name">Other Partners</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="domain">[('supplier','&lt;&gt;',1),('customer','&lt;&gt;',1)]</field>
<field name="filter" eval="True"/>
</record>
<!-- Categories -->
<record id="view_partner_category_form" model="ir.ui.view">
<field name="name">Contact Tags</field>
<field name="model">res.partner.category</field>
<field name="arch" type="xml">
<form string="Contact Tag">
<group col="4">
<field name="name"/>
<field name="active"/>
<field name="parent_id"/>
</group>
</form>
</field>
</record>
<record id="view_partner_category_list" model="ir.ui.view">
<field name="name">Contact Tags</field>
<field name="model">res.partner.category</field>
<field eval="6" name="priority"/>
<field name="arch" type="xml">
<tree string="Contact Tags">
<field name="display_name"/>
</tree>
</field>
</record>
<record id="action_partner_category_form" model="ir.actions.act_window">
<field name="name">Contact Tags</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.category</field>
<field name="view_type">form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new partner tag.
</p>
<p>
Manage partner tags to better classify them for tracking and analysis purposes.
A partner may have several categories and categories have a hierarchical structure: a partner with a category has also the parent category.
</p>
</field>
</record>
</data>
</odoo>