Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Clickable "Contacts & Addresses" inside res.partner

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
contactsres.partnerpartners
8 Respuestas
16146 Vistas
Avatar
David Todd

We have recently rolled out Odoo to our sales staff and one of the biggest features that they wish they could have is this. Basically when you create a contact in Odoo, you have the ability to create child contacts. This is great, except that the form to create the child contacts (inside the parent contact) has very little useful information available.

What I'm looking for is the ability to click one of the contacts, and instead of the "Open: Contacts" modal opening, to navigate to the contact in question (so it's the same view as the parent) possibly into a new tab. 

I have looked into the form view for res.partner and found a template where I could probably add more data, but that isn't helpful in my case. I have also looked at the page client side, but found that there is no information there that I can use to be able to redirect those clicks to a useful location.


Any help would be greatly appreciated 


0
Avatar
Descartar
Avatar
David Todd
Autor Mejor respuesta

Well this is unfortunate. The only answer to this problem I was able to find was to create my own solution.

This required two modifications that can easily be put into a custom module that inherits res.partner. 


The first modification I had to make was to make the document IDs available on the client. Inside res.partner.form, scroll down until the template is defined. In here, we are going to use a field to make the ID available; This can be put pretty much anywhere within the markup for the actual kanban boxes.


The modification that I had to make to this view is

<a class="partnerCardID" style="display:none"><field name="id"/></a>

I chose to put the ID into an anchor because they are easy to work with. This is invisible to the end user (thanks to display:none) so we can manipulate this all we want with JS

I chose to put the modification just above 

<div class="oe_kanban_details">


The other part of the modification is, naturally a little bit of JavaScript magic. I'll include the code that made it work, but you'll have to set it up to work directly on your page/run automatically.

// Select all divs that have the classes ow_kanvan_global_click and o_kanban_record that have a child anchor with a class of partnerCardID (our tag containing the ID)

$('div.oe_kanban_global_click.o_kanban_record > a.partnerCardID').each(function(){

// Wrap the above div with a link that navigates to the correct partner in a new tab

$(this).parent().wrapInner('<a href="//odoo/web#model=res.partner&view_type=form&id='+$(this).text()+'" target="odoo-'+$(this).text()+'"></a>');

});

Change the location of the link above to your own host, run this javascript after the page has loaded and all of your Contacts & Addresses will be clickable, with the full information available. Style the link as you see fit.


Note: I am opening these links in a new tab (through the use of target) because the user's current context will not follow, so if they are working from a search or something else, it isn't lost by navigating away

1
Avatar
Descartar
Cliff Kujala

This is still a problem in v16 and v17. Why do Odoo want these limited pop up views? It just means we have to customize the contact card layouts and the pop-up layouts.

I would prefer to just always open the full view.

Has anyone found a better solution than the above by David Todd for v16 and/or v17?

Avatar
HIGHCO - Nicolas Clavier
Mejor respuesta

Hi David,

If it's still of any help, to reformulate your question (for odoo 8 at least) :  

how can I instruct odoo to use a different view than the modal view displayed when clicking on a contact card from a Partner's form ?

And the answer lies in the partner_form_view code itself, below the kanban template, there is an inline form :

<form string="Contact"> 
 <sheet>
    <field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_medium"}'/>
<div class="oe_title">
...

The mechanism of choosing a view (when no action forces a specific one..)  is by evaluating the priority of a view (form or tree or any other one), the highest priority being given to the inline ones. View records with specific priorities defined in their code are then evaluated, and finally, if none of these are found, odoo will choose a default view (for example the only form view ever defined for a model) or again compose a default view with all existing fields for an object. 

Therefore what you have to do is force odoo to ignore this inline form by either forcing the priority of another view (impossible with partner view inside a partner view, it would lead to a mess). 

Or ... remove that inline view, and let odoo guess which default form should be used. In this case : the normal form.

It can be achieved by inheriting the base.view_partner_form and selecting / replacing with xpath the elements that are in your way:

<xpath expr="//sheet/notebook/page/field/form[@string='Contact']" position="replace"/>

Now, embed it in a record:

<record model="ir.ui.view" id="res_partner_form"> 
    <field name="name">res.partner.form</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="arch" type="xml">
        <xpath expr="//sheet/notebook/page/field/form[@string='Contact']" position="replace"/>
    </field>
</record>

Next you will need to heal other view records relying on the elements you just removed, and luckily by default there is only one in the sale module addons/sale/res_partner_view.xml :

You will have to overwrite that one (instead of inheriting it, up to you really there are pro's an con's..), here is the raw record :

<record id="res_partner_address_type" model="ir.ui.view"> 
<field name="name">res.partner.view.address_type</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath expr="//label[@for='type']" position="attributes">
<attribute name="groups">sale.group_delivery_invoice_address</attribute>
<attribute name="invisible">False</attribute>
</xpath>
<xpath expr="//div[@name='div_type']" position="attributes">
<attribute name="invisible">False</attribute>
<attribute name="groups">sale.group_delivery_invoice_address</attribute>
</xpath>
<!-- Version-specific hacks to avoid breaking view inheritance when the sale module is installed on top of an older 7.0 version of the base module (as the second embedded div_type was added later in the 7.0 release) TODO: remove the hacks in trunk -->
<xpath expr="//div[@name='div_type'][field[@name='use_parent_address']] | //field[@name='child_ids']//div[@name='div_type']" position="attributes">
<attribute name="invisible">False</attribute>
<attribute name="groups">sale.group_delivery_invoice_address</attribute>
</xpath>
<xpath expr="//label[@for='type'][following-sibling::div[@name='div_type']/field[@name='use_parent_address']] | //field[@name='child_ids']//label[@for='type']" position="attributes">
<attribute name="invisible">False</attribute>
<attribute name="groups">sale.group_delivery_invoice_address</attribute>
</xpath>
</field>
</record>

override it by taking out path selectors pointing to the code you just removed, here is the result:

<record id="sale.res_partner_address_type" model="ir.ui.view"> 
    <field name="name">res.partner.view.address_type</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form" />
    <field name="arch" type="xml">
        <xpath expr="//label[@for='type']" position="attributes">
            <attribute name="groups">sale.group_delivery_invoice_address</attribute>
            <attribute name="invisible">False</attribute>
        </xpath>
        <xpath expr="//div[@name='div_type']" position="attributes">
            <attribute name="invisible">False</attribute>
            <attribute name="groups">sale.group_delivery_invoice_address</attribute>
        </xpath>
    </field>
</record>

Make a custom module with this code, think of dependencies in the manifest (base, sale), load, force update with command line -u my_custom_module, and test..

Hope this helps, as this quick create view is nothing but a bogger, it leads people to enter incomplete partner records.

- Nicolas -

1
Avatar
Descartar
David Todd
Autor

Thank you for this incredibly concise answer! I'll definitely have to keep it in mind when I have to re-visit this part of the system for our Sales team to give them new features.

HIGHCO - Nicolas Clavier

Cheers - you can mark this post as the right answer if you are satisfied with it. tx.

Avatar
Remy
Mejor respuesta

A solution for Odoo 11, where instead of making the whole box clickable, I add a small link to it.

<!-- Add small "link button" to existing view. -->
<record model="ir.ui.view" id="partner_vendor_form_view">
<field
name="name">res.partner.with.buttons</field>
<field
name="model">res.partner</field>
<field
name="inherit_id" ref="base.view_partner_form"/>
<field
name="arch" type="xml">
<data>
<!-- Make sure that template has access to the 'id' value, before "Name". !-->
<xpath expr="//field[@name='child_ids']/kanban/field[@name='name']" position="before">
<field
name="id"/>
</xpath>
<!-- Add the actual link to the template. !-->
<xpath expr="//field[@name='child_ids']/kanban/templates//div[@class='oe_kanban_details']/field[@name='name']" position="before">
<a
t-att-href="'#id='+record.id.raw_value+'&amp;model=res.partner'" class="fa fa-fw o_button_icon fa-pencil-square-o pull-right">
</a>
</xpath>
</data>
</field>
</record>
0
Avatar
Descartar
Avatar
dbvieira
Mejor respuesta

What is really anoying is that it was working on V7... on V8+ disapeared... The new form is trully uselless as one need to get out and either update the contact OR get out of the partner to create a new contact with the propper form and assign it to the account.


Im waiting for V11 to see what happens...odoo has some really nice features, its a pitty on each new version they mess with something...


0
Avatar
Descartar
Avatar
Ray Carnes
Mejor respuesta

https://apps.openerp.com/apps/modules/8.0/web_tree_many2one_clickable/

Can you show the contacts in treeview instead of kanban view, and install the module to allow them to be clicked?


0
Avatar
Descartar
David Todd
Autor

I looked at the module that you linked and I'm pretty sure it won't do what I need. If you have an instance of Odoo available to you, if you go into Contacts and select any contact, you'll be taken into the form view for that specific contact. Now there is a notebook at the bottom of the form with a page that says "Contacts & Addresses". Normally when there are contacts in this page, they are their own contacts with their parent_id set. These specific contacts are what I'm looking to be able to click to be brought into the same form view that the parent was on. The reason being is that we have a couple extra pages in the notebook I mentioned above that contains information that we need access to when looking specifically at the contact from the company page. Thanks for the suggestion though, it might come in handy further down the line.

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Need help with [v15] ValueError: Invalid field 'total_due' on model 'res.partner' Resuelto
contacts res.partner
Avatar
Avatar
1
jun 23
5268
Partner_id name, name
contacts res.partner
Avatar
Avatar
1
jun 22
8048
Restricting view of contact persons of a Partner
contacts partners
Avatar
0
may 19
3013
Make 'opt-out' checkbox settable per each contact of a company (partner)
contacts res.partner
Avatar
0
mar 15
4973
prevent write on status field
contacts res.partner write
Avatar
Avatar
Avatar
Avatar
4
jul 25
1797
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now