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

Odoo 11 Cash Rounding via External API.

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
apiodoo11
1 Beantwoorden
4464 Weergaven
Avatar
Hypeworkz Pte Ltd, Terence Ng

I am trying to add the cash rounding line via API and wonder whether it is possible. I have created the invoice and define the cash rounding method but it will not add the cash rounding line as invoice_line is added later. I wonder whether there is a method to trigger the cash rounding like compute_tax. Below is the code I use, for testing purpose i have include adding invoice_line as part of the code.

@app.route("/create_invoice")

def create_invoice():

    date_invoice = request.args.get("date_invoice")

    invoice_id = models.execute_kw(db, uid, password, 'account.invoice', 'create', [{

    'date_invoice':date_invoice,

    'type': 'out_invoice',

    'partner_id': 92,

    'account_id': 38,

    'cash_rounding_id': 1,

    }])

    product_id = request.args.get("product_id")

    name = request.args.get("name")

    quantity = request.args.get("quantity")

    price_unit = request.args.get("price_unit")

    account_id = request.args.get("account_id")

    invoice_line_id = models.execute_kw(db, uid, password, 'account.invoice.line', 'create', [{

    'invoice_id': invoice_id,

    'product_id': product_id,

    'name': name,

    'quantity': quantity,

    'price_unit': price_unit,

    'account_id': account_id,

    'invoice_line_tax_ids':  [ (4,6) ],

    }])

    invoice_tax_id = models.execute_kw(db, uid, password, 'account.invoice', 'compute_taxes', [(invoice_id)])

    return jsonify(invoice_id)

0
Avatar
Annuleer
Avatar
Hypeworkz Pte Ltd, Terence Ng
Auteur Beste antwoord

I did manually in the end.

    rounding_line_id = models.execute_kw(db, uid, password,'account.invoice.line', 'search',[[['invoice_id', '=', invoice_id], ['is_rounding_line', '=', True]]])
if rounding_line_id:
models.execute_kw(db, uid, password, 'account.invoice.line', 'unlink', [rounding_line_id]) models.execute_kw(db, uid, password, 'account.invoice', 'compute_taxes', [(invoice_id)])
total = models.execute_kw(db, uid, password,'account.invoice', 'search_read', [[['id', '=', invoice_id]]], {'fields': ['amount_total']})
total_value = total[0].get('amount_total')
normalized_value = total_value/0.05
sign = math.copysign(1.0, normalized_value)
epsilon_magnitude = math.log(abs(normalized_value), 2)
epsilon = 2**(epsilon_magnitude-53)
normalized_value += sign*epsilon
rounded_value = math.floor(abs(normalized_value)) * sign * 0.05
rounding_difference = rounded_value - total_value
if rounding_difference:
models.execute_kw(db, uid, password, 'account.invoice.line', 'create', [{
'invoice_id': invoice_id,
'name': 'Rounding',
'quantity': 1,
'price_unit': rounding_difference,
'account_id': 126,
'is_rounding_line': True,
'sequence': 9999
}])
return jsonify(invoice_line_id)
1
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
create GET API for backend team from odoo
api controller odoo11
Avatar
Avatar
1
nov. 23
6193
Scheduled Actions
api scheduled odoo11
Avatar
Avatar
1
mrt. 23
7755
How to access external API given by someone else from Odoo 11?
external api odoo11
Avatar
Avatar
Avatar
2
dec. 19
18358
How to retrieve invoices using the web API in Odoo 11?
api invoices odoo11
Avatar
Avatar
Avatar
Avatar
Avatar
7
okt. 19
12941
ODOO 11 AND 12 : What are the differnces between API odoo 11 and odoo 12 ? Opgelost
api odoo11 odoo12
Avatar
Avatar
1
jul. 19
4825
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