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
    • Intelligence artificielle
    • 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
    • Supermarché
    • 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
    • Homme à tout faire
    • 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
    • Devenir 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
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

How do you set-up products or services for Multicompany invoicing

S'inscrire

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

Cette question a été signalée
accountinginvoicemulticompanyOdoo17
1018 Vues
Avatar
Sonny

We used a 3rd party app for Freight Management and it used the default invoice template without activating the Accounting module of Odoo for the Exports and Imports. I have modified the code to have a new model for Cartage and this is used by another (sister) company and based the new invoicing method snippet on the original. So far there is no error in the code, but more on the setting for the product/service. The company for cartage is invoicing its sisters company. The error so far we are encountering is "Invalid Operation: Any journal item on a receivable account must have a due date and vice versa." I do not know if our code is the issue or we really have config issues. Where should I enter the due date and vice-versa?


Here is the code snippet:

def action_create_invoice(self):
        current_company = self.env.company
        
        cartage_charges = self.env['cartage.service.charge'].with_company(current_company).search([
            ('commissioned_vehicle_id', '=', self.id),
            ('invoiced', '=', False)
        ])
        
        if not cartage_charges:
            raise UserError("No cartage service charges found to invoice.")
            
        bill_cartage_list = cartage_charges.mapped('bill_cartage')
        
        sale_journal = self.env['account.journal'].search([
            ('company_id', '=', current_company.id),
            ('type', '=', 'sale')
        ], limit=1)

        if not sale_journal:
            raise UserError(
                f"Configuration Error: No Sales Journal of type 'sale' found for company '{current_company.name}'."
            )
        
        for bill_cartage in set(bill_cartage_list):
            partner = self._get_partner_from_bill_cartage(bill_cartage)
            
            charges_to_invoice = cartage_charges.filtered(
                lambda c: c.bill_cartage == bill_cartage and not c.invoiced
            )
            
            if not charges_to_invoice:
                continue
            
            _logger.info(f"DEBUG: Creating invoice for bill_cartage: {bill_cartage}")
            _logger.info(f"DEBUG: Partner: {partner.name} (ID: {partner.id})")
            _logger.info(f"DEBUG: Current Company: {current_company.name} (ID: {current_company.id})")
            _logger.info(f"DEBUG: Sale Journal: {sale_journal.name} (ID: {sale_journal.id})")
            _logger.info(f"DEBUG: Number of charges to invoice: {len(charges_to_invoice)}")
    
            # Build invoice lines

            invoice_line_ids = []
            for charge in charges_to_invoice:
                if not charge.service_id:
                    raise UserError(f"Service ID is missing for charge.")
                
                product = charge.service_id
                
                # Verify income account exists
                income_account = product.property_account_income_id or \
                            product.categ_id.property_account_income_categ_id
                
                if not income_account:
                    raise UserError(
                        f"No income account configured for product '{product.display_name}'."
                    )
                
                invoice_line_ids.append((0, 0, {
                    'product_id': product.id,
                    'name': charge.name or product.name,
                    'quantity': 1.0,
                    'price_unit': charge.amount_price,
                }))
            
            # Create invoice - Odoo will auto-compute payment terms from partner
            invoice = self.env['account.move'].with_context(
                default_move_type='out_invoice'
            ).create({
                'partner_id': partner.id,
                'move_type': 'out_invoice',
                'invoice_date': fields.Date.today(),
                'invoice_date_due': fields.Date.today(),
                'commissioned_vehicle_id': self.id,
                'company_id': current_company.id,
                'journal_id': sale_journal.id,
                'invoice_line_ids': invoice_line_ids,
            })
            
            # Mark as invoiced
            charges_to_invoice.write({'invoiced': True})
        
        return self.button_customer_invoices()
0
Avatar
Ignorer
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é
Invoice number pattern and controll per company Résolu
accounting invoice multicompany invoice_number
Avatar
Avatar
Avatar
4
mai 15
7456
How do I Invoice time? I need to switch the pay period.
accounting invoice
Avatar
Avatar
1
déc. 25
2233
Invoice PDF preview Issue
accounting pdf invoice report Odoo17
Avatar
Avatar
1
oct. 25
4078
Automating Invoice Sending to Accountant Email
accounting invoice
Avatar
Avatar
1
sept. 25
2917
Unselect the Show in Invoices Footer option Résolu
accounting invoice
Avatar
Avatar
Avatar
3
nov. 25
5981
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
  • Devenir 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 Svenska ภาษาไทย 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