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
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for 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

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
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

Custom code: Invoice has correct Total amount but has 0 for amount due

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
invoiceamountzero
2 Antwoorden
1937 Weergaven
Avatar
Johnny Solas

In my custom model I tried to create a function that will create an invoice. However when I tried to Post the invoice using this code


invoice = self.env['account.move'].create(vals)

invoice.action_post()


The record was actual created and it was Posted but the amount due is 0. All other computations in the invoice are correct. What seems to be the problem here? Thanks in advance

0
Avatar
Annuleer
Ray Carnes (ray)

Post the rest of your code, the contents of vals, and the types of each of the accounts you are using, there could be many things and readers can not guess from the information you have shared.

Johnny Solas
Auteur

Thanks for pointing out. This is the code snippet base on the query above.

def create_bill_invoiced(self, invoice_id, agent, vendor_name, amount=20000):
    # agent is a custom model
 
    # Create a service-type product template
    product = self.env['product.template'].create({
        'name': f"Bill from {vendor_name}",
        'list_price': amount,
        'type': 'service',
        'sale_ok': False,
        'purchase_ok': True,
        'company_id': agent.company_id.id,
        'taxes_id': [],
        'supplier_taxes_id': [],
    })

    variant = product.product_variant_id
    if not variant:
        return False

    # Build a single invoice line for the variant
    invoice_line = (0, 0, {
        'product_id': variant.id,
        'name': variant.name,
        'quantity': 1,
        'price_unit': amount,
        'account_id': self.get_product_account(product_id=variant.id, company_id=agent.company_id.id),
    })

    # Create the bill (vendor invoice)
    bill_invoiced = self.env['account.move'].create({
        'move_type': 'in_invoice',
        'partner_id': agent.portal_user.partner_id.id,
        'invoice_date': fields.Date.today(),
        'invoice_date_due': fields.Date.today() + timedelta(days=5),
        'invoice_line_ids': [invoice_line],
        'ref': f"Related Invoice ID: {invoice_id}",
    })

    bill_invoiced.action_post()
    return bill_invoiced


The

bill_invoiced = self.env['account.move'].create

 actually created a record and it is Posted automatically by

bill_invoiced.action_post()

.However the amount due is 0. I checked the other values and it seems the amount residual is also 0. Other values such as Total amount and subtotals are correct. I tried to manually reset the record to draft and post it again. It works, but I should be able to do this via code.

Avatar
Johnny Solas
Auteur Beste antwoord

Update, I found out at the Journal items section showed only 1 item with account name Income. There suppose to be 2 (Income and Account Payable) with correct amount values for debit and credit. However, still dont know what to do next.

0
Avatar
Annuleer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste antwoord

Hi,

The field "Amount Residual" is a computed field. To ensure it reflects the correct value, please verify the following:

  1. You're correctly passing the invoice_line_ids when creating the invoice—make sure each line includes the product, quantity, price, and account.
  2. The correct accounts are configured for the products and are included in the invoice lines.
  3. There is no custom code overriding or interfering with the computation of the residual amount.
  4. The taxes and journal are properly configured and correctly applied to the invoice.


Hope it helps.

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
Compute invoice amount (line and total)
invoice amount
Avatar
Avatar
Avatar
3
okt. 25
6501
Creating a new product makes amount not updating automatically in Time & Materials to Invoice
invoice time amount
Avatar
0
mrt. 15
3822
Add tax for invoice
invoice tax amount
Avatar
Avatar
Avatar
2
mrt. 15
7137
Get field amount from account tax from account.invoice.tax
invoice taxes amount percentage
Avatar
Avatar
2
apr. 22
5056
The Invoice Amount field has disappeared
invoice report amount studio odoo
Avatar
Avatar
Avatar
2
nov. 25
3638
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
  • Word een Partner
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 ภาษาไทย 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