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

Show fields in invoice report if checkbox ticked on sale order

Suscribirse

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

Se marcó esta pregunta
sale.order.formifinvoicereport
1 Responder
3179 Vistas
Avatar
Matija

Hi all,

I'm trying to show some fields on invoice report (pdf) when checkbox is ticked on sale order form. On sales order report I got to show it like this https://ibb.co/rcd7fFD

show_reference_1 is defined here https://ibb.co/VBb8mt3

And it work great on sales order but I can't get it to work on invoice report -> if checkbox is ticked on sales order form if condition should be true and it should show.

I tried to create related fields as described here
https://www.odoo.com/forum/help-1/odoo-10-show-field-of-model-sale-order-in-form-view-of-account-invoice-113470

but got ImportError: cannot import name 'account_invoice' from partially initialized module...

This is inside py file https://ibb.co/QfSzwcg

Maybe this error is due missing import inside __init__.py ? This is what I got inside it https://ibb.co/mt3FRgL

Anyway - does somebody know a way to trigger if condition on invoice report related to sale order form tickbox? Thank you.

0
Avatar
Descartar
Sunny Sheth

which ODOO Version are you using?

Matija
Autor

v15 - account.move has to be inherited. The problem is when this fields are inherited they aren't ticked - maybe I'm inheriting them wrong. Here is how it's done at the moment https://ibb.co/pWKdGv4

Waleed Ali Mohsen

You need to add sale order id to the form and select the sale order linked to the invoice manually in the form and then the related boolean field will have the values from sale order. You can override the method which create invoice from sale order to pass the sale order id to invoice sale order id and this will avoid you to select the sale order manually in the invoice.

Matija
Autor

@Waleed Mohsen I'm not sure I get it - how to add sale order id to the form to select the sale order linked to the invoice? I'd really appreciate if you can explain.

Waleed Ali Mohsen

You have added sale_order_id many2One field to account.move but the field will be empty in invoice so you need to add it to invoice form and then select the SO linked to the invoice. otherwise the sale_order_id will be false and the your boolean field will not have any value.

Waleed Ali Mohsen

Great. You got it.

Matija
Autor

Sorry - didn't realised that it just saved order ID when I selected it but it is not selected by default. Can you please tell me how to pass sale order id to this field so correct order in it is selected by default?

Waleed Ali Mohsen

You need to override method _prepare_invoice in sale.order model to pass sale order id to account.move sale_order_id field.

def _prepare_invoice(self):
invoice_vals = super(SaleOrder, self)._prepare_invoice()
invoice_vals['sale_order_id'] = self.id
return invoice_vals

So when you create invoice from sale order the sale_order_id will be set automatically. for already created invoice, you have to set it manually or by using export/import.

Matija
Autor

That's it - thank you 🙏 😊

Avatar
Waleed Ali Mohsen
Mejor respuesta

f you are using Odoo 13.0 and above, the account.invoice is replaced with account.move so you need to  inheritfrom account.move.

class AccountMove(models.Model)
    _inherit = 'account.move'






2
Avatar
Descartar
Matija
Autor

Yeah, I tried with account.move - no errors. But it doesn't show fields on invoice when checkbox are ticked. To test it I tried to show them on form and indeed they are not ticked but on sale order form they are ticked.

Here is code used for it https://ibb.co/pWKdGv4

Matija
Autor

Fields are inherited - they show up on account move form but their values (weather its ticked) are not. Do you have any idea how to inherit those values from sale order on account move?

Waleed Ali Mohsen

You added the sale order id field but you have to select the sale order in the form, Or you can pass it once you create invoice from sale order.

¿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
lock sales confirm
sale.order.form
Avatar
Avatar
1
ago 24
1969
Sale Order Line Form Popup Odoo 14 Resuelto
sale.order.form
Avatar
Avatar
1
feb 22
5248
Option Duplicate in DropDown More Resuelto
sale.order.form
Avatar
Avatar
Avatar
2
may 19
4325
Module to know in Sales Order if order is already shipped? Resuelto
sale.order.form
Avatar
Avatar
3
ago 18
5439
Why Quotation 'Send by email' not sending email ?
sale.order.form
Avatar
Avatar
Avatar
Avatar
Avatar
8
feb 16
11844
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