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

How to add partner to invoice template?

Suscribirse

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

Se marcó esta pregunta
account.invoicetemplateextend
2 Respuestas
6485 Vistas
Avatar
Pavel Pavlov

Hello,

I’m struggling to add some data that I need to my Invoice report…
In Delivery Slip(Tech name: stock.picking.list.out) I get the Invoice
Address from [[ display_address(picking.partner_invoice_id.parent_id) ]]
and Delivery Address from [[ display_address(picking.partner_shipping_id) ]]

I’d like to use same information in my Invoice(Tech name: account.invoice) template,
but the invoice object does not contain the Invoice and Delivery addresses. It has only
display_address(o.partner_id), which is not the one that I need for my invoice document.

I found a nice mapping table in the database “sale_order_invoice_rel” and managed to
build a SQL query that does what I need, but I can’t figure out how to perform the same thing
in the invoice report, when I modify it with Open Office. My query is

SELECT 
  account_invoice.id,
  sale_order.partner_id, 
  sale_order.partner_invoice_id, 
  sale_order.partner_shipping_id

FROM 
  public.sale_order_invoice_rel, 
  public.sale_order, 
  public.account_invoice
WHERE 
  sale_order_invoice_rel.order_id = sale_order.id AND
  account_invoice.id = sale_order_invoice_rel.invoice_id;

and it returns what I need… for example:
“id ;partner_id; partner_invoice_id; partner_shipping_id
1;5;6;7”

Question is how do I get those IDs in the Invoice template via RML tags or where can I extend a python method, that is being used to provide to the template this o object that contains the invoice data…
I found invoice_print method in account.account_invoice, that according to the comment should be ”This function prints the invoice and mark it as sent, so that we can see more easily the next step of the workflow”, but not sure how to extend it – it doesn’t return this o object, so that I could extend it…

If you’ve done something similar please tell me how it worked for you.
Can I somehow modify the report or extend the python code and which method?

Best Regards,
Pavel Pavlov

0
Avatar
Descartar
Avatar
Shashank Verma
Mejor respuesta

Hello pavel

py file

class account_invoice(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):
    super(account_invoice, self).__init__(cr, uid, name, context=context)
    self.localcontext.update({
       'my_new_detail':_my_new_detail
    })


 def _my_new_detail(self,ids):


    return obj_browse

rml file

para style="terp_default_2">[[repeatIn( _my_new_detail(picking), 'my_detail')]]</para>

<blocktable colwidths="410.0" style="Header_Order_Reference_Tbl" &gt;<="" p="">

 <tr>

    <td>
      <para style="terp_default_1cm_above_space">[my_detail.fieldname ]]</para>
    </td>

  </tr>

Hope this might help you.

0
Avatar
Descartar
Avatar
Pavel Pavlov
Autor Mejor respuesta

Hello,

shashank verma, thank you for sharing your idea! I believe what you wrote will work, thou I haven't tried it, because after banging my head in this almost whole night I found a smoother solution!

class account_invoice(osv.osv):
_inherit = 'account.invoice'
_columns = {
'zSO': fields.many2many('sale.order', 'sale_order_invoice_rel', 'invoice_id', 'order_id', 'Invoices', readonly=True, help="List of Sales Orders related to this Invoice"),              
}

Then in the Invoice report I do [[ display_address(o.zSOid[0].partner_shipping_id) ]] and it works! The benefit of using this approach instead of the other one above is that this way no native SQL shall be used and you go thru the openERP framework to get to the DB layer.

Both solutions will work, but please mark this one as answer. thank you!

Regards, Pavel Pavlov

0
Avatar
Descartar
¿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
qweb extend template doesn't show on view
qweb kanban template extend
Avatar
0
abr 21
3358
how to extend qweb template "wysiwyg.widgets.video" in odoo14?
qweb template extend v14
Avatar
Avatar
1
dic 20
4053
How to execute a funtion in JS file?
template js extend odoo9
Avatar
Avatar
1
may 16
6418
Related fields from sales orders in accounting invoices
account.invoice
Avatar
0
mar 25
1715
Template Color
template
Avatar
0
ene 25
1773
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.

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