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
    • 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
    • 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
    • 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
    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

Create invoice automatically after delivery transfer is done

S'inscrire

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

Cette question a été signalée
triggerinvoicedeliveryorder
4 Réponses
8696 Vues
Avatar
Dan Witting

Hello,

i have my invoice policy set to 'delivered quantities'.

I am trying to find an automated solution to create a draft invoice after the delivery is 'done' without going manually to the sales order and click Create invoice.

I was trying to use the ODOO app Automated Actions to trigger the Invoice from the Delivery. But i did not find out how to did.

Anyone has an idea how to do it ? 

Thanks

0
Avatar
Ignorer
Avatar
Dan Witting
Auteur Meilleure réponse

Hello, many thanks for your solution. I have paste the Python code as you proposed. 

res = (records.origin).startswith("S0")
if res:
sale_id = env['sale.order'].search([('name','=',records.origin)])
sale_id._create_invoices()

But when i save, i receive the following Validation error message : 

IndentationError : expected an indented block at line 3 sale_id = env['sale.order'].search([('name','=',records.origin)])

Also, I am not much familar with the Python code, but i see the first line startwith("SO"). Does it mean that my Sales Order have to start with SO ? Our sales order come from different source and not all Sales Order start with 'SO". For example : Imported Sales order from an US Shopify website starts with "US", EU Shopify starts with "EU", etc. 

Many thanks

2
Avatar
Ignorer
Avatar
Don Chau
Meilleure réponse

Do u solve it yet?  Trying to automated invoice for Month end too. 

1
Avatar
Ignorer
Dan Witting
Auteur

Yes. solved.
With Automated Actions (Technical -> Automated Actions) (with debug mode on and Automated actions module installed)

Model: Transfer
Trigger: On Update
Before Update Domain:
- Status is not 'done'
- Sales Order is Set
- Type of Operations = "outgoing"

Apply On:
- Sales Order is set
- Status = done
- Type of Operation = "outgoing"

Action to do : Execute Python code

Code used :
sale_ids = records.mapped('sale_id')
invoice_ids = []
for sale_id in sale_ids.filtered(lambda x: x.invoice_status == 'to invoice'):
invoice_ids.append(sale_id._create_invoices())
if invoice_ids:
log('Invoice created with id: %s' % ', '.join([str(i.id) for i in invoice_ids if i]), level='info')

Don Chau

Thank you, you are amazing!

Avatar
MUHAMMAD Imran
Meilleure réponse

In Odoo, you can create an invoice automatically after a delivery transfer is done by creating a new module and overriding the _action_done method of the stock.picking model.


Here is an example of how you can create an invoice automatically after a delivery transfer is done:


Create a new module, for example stock_invoice_auto.


In the models folder of your module, create a new file called stock.py and add the following code:


Copy code

from odoo import api, fields, models


class StockPicking(models.Model):

    _inherit = 'stock.picking'


    def _action_done(self):

        res = super(StockPicking, self)._action_done()

        for picking in self:

            if picking.picking_type_id.code == 'outgoing':

                invoice_id = self.env['account.move'].create({

                    'type': 'out_invoice',

                    'partner_id': picking.partner_id.id,

                    'invoice_line_ids': [

                        (0, 0, {

                            'product_id': move.product_id.id,

                            'name': move.product_id.name,

                            'quantity': move.product_uom_qty,

                            'price_unit': move.product_id.lst_price,

                            'account_id': move.product_id.categ_id.property_account_income_categ_id.id,

                        })

                        for move in picking.move_lines

                    ],

                })

                invoice_id.post()

        return res

Add the dependencies in the manifest.py file of your module

Copy code

    'depends': ['base','sale','stock'],

Update the module list and install the stock_invoice_auto module.


Once the installation is done, you can test it by creating a delivery order, and confirm it, you should see the invoice created automatically.


Please note that the above code is an example, you might need to adapt it to your specific requirements

0
Avatar
Ignorer
Avatar
Jainesh Shah(Aktiv Software)
Meilleure réponse

Hello Dan Witting,

You Can Create Draft Invoice using Automated Action.


Find Example in comment.

Steps -
1) Confirm Sale Order.
2) Validate the quantity.
3) When the state changes from Ready to Done State, then your invoice will be generated.

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

0
Avatar
Ignorer
Jainesh Shah(Aktiv Software)

For Example -

- Create an Automated action by adding name, model (Transfer as per your requirement), trigger (update as per your requirement), trigger fields(Status), Before Update domain (Status = "assigned"), filter domain (Status = "done") and Action to do ( Execute Python Code as per your requirement )

- In the Python Code Below Paste this code:-
res = (records.origin).startswith("S0")
if res:
sale_id = env['sale.order'].search([('name','=',records.origin)])
sale_id._create_invoices()

Dan Witting
Auteur

Hello, many thanks for your solution. I have paste the Python code as you proposed.

res = (records.origin).startswith("S0")
if res:
sale_id = env['sale.order'].search([('name','=',records.origin)])
sale_id._create_invoices()

But when i save, i receive the following Validation error message :

IndentationError : expected an indented block at line 3 sale_id = env['sale.order'].search([('name','=',records.origin)])

Also, I am not much familar with the Python code, but i see the first line startwith("SO"). Does it mean that my Sales Order have to start with SO ? Our sales order come from different source and not all Sales Order start with 'SO". For example : Imported Sales order from an US Shopify website starts with "US", EU Shopify starts with "EU", etc.

Many thanks

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é
A trigger that can be used to determine if an invoice has been issued Résolu
trigger invoice
Avatar
Avatar
1
août 24
1790
Show invoice number at delivery order page
invoice custom deliveryorder
Avatar
0
nov. 17
4195
How to block deliveryorder while invoice is not paid ?
invoice v7 deliveryorder
Avatar
Avatar
3
mars 15
9498
How to view the Delivery Order associated with an Invoice
invoice v7 deliveryorder
Avatar
0
mars 15
6220
Add Invoice to Delivery Order print dialog?
invoice inventory deliveryorder odoo10
Avatar
0
juin 18
3205
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