Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Bricoleur
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Show fields in invoice report if checkbox ticked on sale order

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
sale.order.formifinvoicereport
1 Répondre
3184 Vues
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
Ignorer
Sunny Sheth

which ODOO Version are you using?

Matija
Auteur

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
Auteur

@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
Auteur

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
Auteur

That's it - thank you 🙏 😊

Avatar
Waleed Ali Mohsen
Meilleure réponse

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
Ignorer
Matija
Auteur

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
Auteur

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.

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
lock sales confirm
sale.order.form
Avatar
Avatar
1
août 24
1969
Sale Order Line Form Popup Odoo 14 Résolu
sale.order.form
Avatar
Avatar
1
févr. 22
5248
Option Duplicate in DropDown More Résolu
sale.order.form
Avatar
Avatar
Avatar
2
mai 19
4325
Module to know in Sales Order if order is already shipped? Résolu
sale.order.form
Avatar
Avatar
3
août 18
5439
Why Quotation 'Send by email' not sending email ?
sale.order.form
Avatar
Avatar
Avatar
Avatar
Avatar
8
févr. 16
11845
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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