Odoo Help


Odoo Calculate tax via api (erppeek)

on 8/2/15, 12:59 AM 729 views

How do I trigger calculation of tax in odoo via ERPPEEK. I want to trigger the tax calculation without me calculating the tax. Is there some possibility from erppeek

I manually create the invoice header and line, I get all the product and tax details, and then I want the trigger.

My code is as below.

import erppeek

from datetime import datetime,date

api = erppeek.Client('','bitnami_openerp','**@gmail.com','******')


#now create an invoice for the user

#Prepare data

#Get Currency

m_currency = api.model('res.currency')

r_currency = m_currency.read(['name=INR'],['id','name'])

#Get Company

m_company = api.model('res.company')

r_company = m_company.read(['name=Your Company'],['id','name'])

#Get Journal

m_journal = api.model('account.journal')

r_journal = m_journal.read(['name=Sales Journal'],['id','name'])

#Get Account

m_account = api.model('account.account')

r_account = m_account.read(['name=Sundry Debtors'],['id','name'])

#Get Partner

m_partner = api.model('res.partner')

r_partner = m_partner.read(['email=jayanth.bagare@gmail.com'],['id','name'])

#Get Account

m_account = api.model('account.account')

r_account = m_account.read(['id=190'],['id','name'])

#Get Product

m_product = api.model('product.product')

r_product = m_product.read(['id=2'],['id','lst_price','name'])

#Get Tax

m_tax = api.model('account.tax')

r_tax = m_tax.read(['id=49'],['id'])

#Consolidate Invoice Header

data = {"partner_id":r_partner[0]["id"],










"amount_total":r_product[0]["lst_price"] + 12.36


print data

#Create the invoice header

m_invoice = api.model('account.invoice')

invoice_id = m_invoice.create(data)

#Create Invoice Lines

#Consolidate Invoice Lines

product_id = r_product[0]["id"]

price_unit = r_product[0]["lst_price"]

quantity = "1"

ln_invoice_id = invoice_id.id

account_id = r_account[0]["id"]

print 'Tax is ',r_tax[0]["id"]

data_line = {"product_id":r_product[0]["id"],











m_invoice_line = api.model('account.invoice.line')

invoice_line_id = m_invoice_line.create(data_line)

print invoice_line_id.id

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/2/15, 12:59 AM
Seen: 729 times
Last updated: 8/2/15, 12:59 AM