Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Show fields in invoice report if checkbox ticked on sale order

Subscriure's

Get notified when there's activity on this post

This question has been flagged
sale.order.formifinvoicereport
1 Respondre
3171 Vistes
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
Best Answer

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.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
lock sales confirm
sale.order.form
Avatar
Avatar
1
d’ag. 24
1968
Sale Order Line Form Popup Odoo 14 Solved
sale.order.form
Avatar
Avatar
1
de febr. 22
5248
Option Duplicate in DropDown More Solved
sale.order.form
Avatar
Avatar
Avatar
2
de maig 19
4325
Module to know in Sales Order if order is already shipped? Solved
sale.order.form
Avatar
Avatar
3
d’ag. 18
5437
Why Quotation 'Send by email' not sending email ?
sale.order.form
Avatar
Avatar
Avatar
Avatar
Avatar
8
de febr. 16
11844
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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