Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelwinkel
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
accountinginvoicemulticompanyOdoo17
1015 Weergaven
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
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Invoice number pattern and controll per company Opgelost
accounting invoice multicompany invoice_number
Avatar
Avatar
Avatar
4
mei 15
7446
How do I Invoice time? I need to switch the pay period.
accounting invoice
Avatar
Avatar
1
dec. 25
2223
Invoice PDF preview Issue
accounting pdf invoice report Odoo17
Avatar
Avatar
1
okt. 25
4075
Automating Invoice Sending to Accountant Email
accounting invoice
Avatar
Avatar
1
sep. 25
2902
Unselect the Show in Invoices Footer option Opgelost
accounting invoice
Avatar
Avatar
Avatar
3
nov. 25
5964
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Partner worden
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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