Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

account.move.line with API

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
apiaccount.moveaccount.move.line
3 Replies
21457 Rodiniai
Portretas
f.welter@netinteract.com

Hi all,

there are major differences between V12 and V13. In V13 i can add an invoice  via API and then i try to add account.move.line to that invoice. I always get the error

Cannot create unbalanced journal entry
Differences debit - credit

i set the following fields:

'account_id' => $account_id,
'move_id' => $odoo_move_id,
'product_id' => 174,
'tax_ids' => [[6, 0, [$odoo_tax_id]]],
'quantity' => 2.0,
'price_unit' => 1.99,
'name' => 'TEST'

Do i really have to add serveral lines in order to make it work? whatelse do i have to do in order to have odoo add the lines automatically just as it does when it do it via the UI?

Fritz


0
Portretas
Atmesti
Portretas
selvi
Best Answer

Hi, I have faced the same problem in v13.

Done some code changes, now its working for me.

I here share some of my changes, you may check if its useful for your's.

# Journal

journal_id = self.env['account.journal'].search([('type','=','sale')])[0]

# Move Line creation:

invoice_lines = []

for line in lines:

    invoice_lines.append((0,0,{

                                                            'name': line.name,

                                                            'display_name': line.name,

                                                            'price_unit': price,

                                                            'quantity': qty,

                                                            'product_uom_id': uoms.id,

                                                            'product_id': line.product_id.id,

                                                            'tax_ids': [(6, 0, tax.ids)],

                                                        }))


# Move creation:

    account_move = self.env['account.move'].sudo().create({

                                                            'name':  doc_name,

                                                            'invoice_origin': doc_name,

                                                            'invoice_date': date.today(),

                                                            'type': 'out_invoice',

                                                            'partner_id': partner.id,

                                                            'invoice_line_ids': invoice_lines,

                                                            'journal_id': journal_id.id,

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

                                        })


Thanks.

1
Portretas
Atmesti
Portretas
UAB Inovacijos
Best Answer

Hi,

Python code example for Odoo 13:

...

from odoo.tests.common import Form

class AccountMove(models.Model):
_inherit = 'account.move'

    def add_invoice_line(self):

         with Form(self) as move_form:
            with move_form.invoice_line_ids.new() as line:
                line.name ='Product Name'
                line.product_uom_id =
                line.price_unit = 1.0
                line.quantity = 1.0
                line.account_id =
            move_form.save()


0
Portretas
Atmesti
Portretas
Zbik
Best Answer

Read my answer in this question:
Create invoices/credit notes in odoo13 by code.

-2
Portretas
Atmesti
f.welter@netinteract.com
Autorius

Thanks, i had a lock on it.

I do a account.move create in the first place. Then i use the move_id to add account.move.line .

And there is the problem. as in former verions i expected that all nessesary lines are being created. at the moment with v13 it looks like i have to submit 3 lines in order to get the balance right.

Is there any way odoo api can add all lines by itself and automatically refere to the customer profile with all tax settings?

I would appreciate an example on how to add an invoice with all lines in V13. Is there any documentation available? I really could not find it.

Best regards and many thanks,

Fritz

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
Write permission problem in account.move via API
api account.move
Portretas
0
lapkr. 24
2242
account.invoice.line
account.move account.move.line
Portretas
Portretas
2
kov. 22
7843
Track Deletions via API and Efficiently Sync account.move.line Records (V17.2)
api account.move.line deleted
Portretas
0
rugs. 24
1857
[SOLVED] get data from mrp.production into account.move.line, but it won't show
account.move account.move.line mrp.production
Portretas
0
birž. 24
4108
add my custum field in account.move.line view in odoo 16 enterprise
account.move tree_view account.move.line
Portretas
Portretas
Portretas
2
lapkr. 23
4725
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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