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
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Guest House
    • Distributeur de boissons
    • Hotel
    Real Estate
    • Real Estate Agency
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consulting
    • Accounting Firm
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Solar Energy Systems
    • Cordonnier
    • Services de nettoyage
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all 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 for Partners
    • 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

New invoice created, state is 'paid' instead of 'open'

S'inscrire

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

Cette question a été signalée
accountinginvoiceaccount.invoicestateodoo10
10 Réponses
10526 Vues
Avatar
Deborah Joy Adeva

I created invoice through a customized button, and wanted that 'open' will be automatically it's state once it's created. Current output, 'paid' is the state. Hope you can help me, thank you.

Here's my code:

    @api.multi

    def create_invoice(self,count):

        # print 'create_invoice'

        customer = self.partner_id.id

        product = self.env['product.template'].search([('default_code', '=', 'HOST')]) 

        account_id = self.env['account.account'].search([('internal_type','=','receivable')]).id

        journal_id = self.env['account.journal'].search([('code','=','INV')]).id


        # create invoice

        invoice_header = self.env['account.invoice'].create({

            'partner_id': customer,

            # 'number': self.get_invoice_sequence(),

            # 'date_invoice': today_date,

            'account_id': account_id,

            'journal_id': journal_id,

            'user_id': self.env.user.id,

        })

        invoice_lines = self.env['account.invoice.line'].create({

            'invoice_id': invoice_header.id,

            'product_id': product[0].id,

            'name':product[0].name,

            'quantity': count,

            'price_unit': product[0].list_price,

            'account_id': account_id,

        })

        invoice_header.action_invoice_open()


1
Avatar
Ignorer
Avatar
Simplify-ERP® Developers
Meilleure réponse

When creating an invoice thru code on odoo, even though the default state is draft, i think that you will need to pass that again in your dict as follows,

      # create invoice

        invoice_header = self.env['account.invoice'].create({

            'partner_id': customer,

            # 'number': self.get_invoice_sequence(),

            # 'date_invoice': today_date,

            'account_id': account_id,

            'journal_id': journal_id,

            'user_id': self.env.user.id,

            'state': 'draft',

        })

After that call the action as you did before in your code and it will be okay:

invoice_header.action_invoice_open()

If there are other issues when this invoice is created, you can always inherit the action_invoice_open def and make your changes in the function itself to avoid complications.

Just make sure to call it with super so that other things get calculated as well.


I hope it is helpfull

Riste Kabranov

Odoo developer at simplify-erp.com

1
Avatar
Ignorer
Avatar
Mohammed Amal N
Meilleure réponse

Hi,

An open invoice with total amount  zero or is reconciled with full payment will be automatically converted to paid state.

Make sure your invoice's total amount is not zero and you are not creating any payment for this invoice.

1
Avatar
Ignorer
Deborah Joy Adeva
Auteur

Hello, I see that invoice that I create is reconciled. how can I make it to false? even though I assigned it to false, it automatically becomes false. Is there anything that triggers reconciled to true?

Mohammed Amal N

I think the code you provided cannot trigger a payment creation or reconcile.

Mohammed Amal N

Also check how a payment is created against the customer in the invoice.

Deborah Joy Adeva
Auteur

I really appreciate your help, can you please give me a sample code where it can trigger a payment creation or reconcile? thank you.

Mohammed Amal N

Journal entry for the invoice is called inside function action_invoice_open(), payment creation is maintained in validate button click in register payment wizard. Check if you have edited any of these files

Deborah Joy Adeva
Auteur

once I clicked validate, it doesn't go to register payment, instead, it's already in 'paid' state.

Avatar
subbarao
Meilleure réponse

Hello,

If you call validate button it will create one Journal entry for that invoice.

If the Journal entry  having debit and credit accounts both are payable/receivable then the invoice due amount is zero, so invoice moved to paid state.

Note : Either debit account or credit account only payable/receivable but not both.

0
Avatar
Ignorer
Avatar
Raul Contreras Martinez
Meilleure réponse

Hi.

Did you get a solution?... I am having the same problem...The invoice is getting the paid state instead of open state.



0
Avatar
Ignorer
Deborah Joy Adeva
Auteur

I removed the journal_id in the create of invoice_header, because it would automatically create it's journal_id

Dhivya N

Hi Raul, please check your accounting configuration in "Customer Invoice" Journal.

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é
How to make dynamic account_id based on parent field? v12
accounting invoice account.invoice
Avatar
Avatar
1
août 19
3523
How to show value from currency in account_invoice? Résolu
accounting invoice currency odoo10
Avatar
Avatar
1
sept. 17
4143
How to setup default account in invoices?
invoice account.invoice openerp odoo10
Avatar
Avatar
2
sept. 17
8984
How to Invoice to All Account Contacts
accounting invoice contacts account.invoice sending mail with attachment
Avatar
0
avr. 22
3299
[odoo10] How to filter payment_move_line_ids.date in account.invoice ?
invoice payment account.invoice odoo10 account.move.line
Avatar
Avatar
1
déc. 18
5098
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