Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Odoo 12: Show VAT in partner name for invoice, exactly as supplier bills

Suscribirse

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

Se marcó esta pregunta
xmlform_viewodoo12
7 Respuestas
6054 Vistas
Avatar
Paulo Matos

Dear all.

I hope everyone safe.

On Odoo, when we issue a supplier bill, we can see the VAT number right next to supplier name (suppler_name - vat_number on partner_id field), when we're choosing the supplier from the partner_id field.

I need to achieve the same effect on customer invoices.

So, when user clicks on the partner_id many2one field, I need to show "Customer Name - VAT_NUMBER".

I look into the supplier bill xml and found:

<group modifier = {}>...
<field string="Supplier" 
                name="partner_id" 
                widget="res_partner_many2one" 
                context="{'default_customer': 0, 
                        'search_default_supplier': 1, 
                        'default_supplier': 1, 
                        'default_is_company': True, 
                        'show_vat': True}" 
                domain="[('supplier', '=', True)]" 
                on_change="1" 
                can_create="true" 
                can_write="true" 
                modifiers="{'readonly':[['state','not in',['draft']]]}"/>
...
</group>


On the customer invoice I have:

<field string="Customer" 
                name="partner_id" 
                widget="res_partner_many2one" 
                context="{'search_default_customer':1, 
                        'show_address': 1, 
                        'default_is_company': True, 
                        'show_vat': True}" 
                options="{&quot;always_reload&quot;: True, 
                &quot;no_quick_create&quot;: True}" 
                domain="[('customer', '=', True)]" 
                required="1"/>
...


I cannot find any option, widget or field that allows me to achieve the same effect.

Looking for both codes, I thought the "show_vat" did the trick but it's already selected for the customer invoices and I cannot get the same effect.

Can anyone help me please?

Thank you all very much and keep safe

PM

UPDATE: I need do show the VAT number on the partner_id field itself when user is selecting the customer.


UPDATE II: Please refer to this image: https://ibb.co/567p81x

0
Avatar
Descartar
Avatar
Paresh Wagh
Mejor respuesta

Hi Paulo:

The value is displayed provided both of the following conditions are true:

  1. show_vat = True

  2. partner.vat has a value in it

Check to make sure the VAT field for that Partner has a value in it.

EDIT:

The context definition on the Invoice form has a parameter 'show_address' in it which causes the api to return the name + address + vat.

context="{'search_default_customer':1, 'show_address': 1, 'default_is_company': True, 'show_vat': True}"

If you customize the view and remove the 'show_address' parameter like so, you get the same result as on the Vendor Bill.

<xpath expr="//field[@name='partner_id']" position="attributes">
    <attribute name="context">{'search_default_customer':1, 'default_is_company': True, 'show_vat': True}</attribute>
</xpath>

NOTE: This will cause the address to be no longer displayed on the form. Only the name + vat will be displayed.


Screenshot of Invoice form with customized context on partner_id.


1
Avatar
Descartar
Paulo Matos
Autor

Thank you Paresh,

I think you correctly understood my question. I am referring to the VAT number shown on the partner_id field when we are choosing a supplier from the list, when issuing a new supplier bill.

If supplier has a VAT number, Odoo shows on partner_id many2one selection list:"Partner Name - VAT Number".

The same does not happens to customer invoices, and I need to achieve the same result.

Customer has a VAT number associated to his account.

Regards

Paresh Wagh

I have edited and added a screenshot to my earlier post. Taking care of the 2 things mentioned above works fine with the default out of the box functionality. Check whether some customization has been done at your site.

Paulo Matos
Autor

Paresh,

Thank you once again.

My English is not very good a perhaps I did not explain myself correctly. Please refer to the following image link for you to see what I need to achieve: https://ibb.co/567p81x

Regards

Paresh Wagh

Hi Paulo: I have updated the EDIT section in my earlier response based on your clarification.

Paulo Matos
Autor

Great Paresh,

It's working as expected. Thank you very much.

Best regards

PM

Avatar
Prakash
Mejor respuesta

Check partner python file name_get method, using this method can append two fields  and show in many2one dropdown list.

Edit,

https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/models/res_partner.py

Check _get_name method line no 657

if self._context.get('show_vat') and partner.vat:
name = "%s ‒ %s" % (name, partner.vat)
return name

def name_get(self):
res = []

for partner in self:

name = partner._get_name()

res.append((partner.id, name))
return res

The above code appending customer and vat number in many2one list.

check context set and get value. You can debug the above code

to check supplier bill form the above vat if statement is executed or not.





0
Avatar
Descartar
Paulo Matos
Autor

Dear Prakash,

I am using Odoo 12 and the core code for /base/models/res_partner.py is exactly as you described on your code sample.

Anyway, the same code is shared by both customer/supplier and the approach I need is working fine for supplier on core Odoo, and not for the customer.

I think it's something else and not this specific code.

Thank you very much

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

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Element cannot be located in parent view
xml odoo12
Avatar
0
feb 22
2567
AssertionError: Element data has extra content: record, line 3 Resuelto
xml odoo12
Avatar
Avatar
Avatar
6
ago 19
11198
How to prevent Odoo for creating a new record whenever I click on the menu item?
xml records odoo12
Avatar
Avatar
1
feb 24
3696
Odoo12's Button is not showing.
xml buttons odoo12
Avatar
0
feb 24
2267
How to change default form view in stock.picking model
form form_view odoo12
Avatar
Avatar
Avatar
2
sept 22
6079
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 totalmente integrado.

Website made with

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