Odoo Help

Welcome!

This community 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.

0

Tax not calculated when creating invoice via werbservice API in Odoo 9

By
rolando
on 3/7/16, 8:51 AM 766 views

I am using the following PHP code to create a new invoice via webservice API

$id = $models->execute_kw($db, $uid, $password,'res.partner', 'create',array($datos_cliente));
$invoice_id = $models->execute_kw($db,$uid,$password,'account.invoice','create', array(array( 'partner_id'=>$id, account_id'=>193 )));

$result = $models->execute_kw($db, $uid, $password,'account.invoice.line', 'create', array(array( 'account_id'=>477, 'invoice_id'=>$invoice_id, 'quantity'=>1, 'name'=>'Venta de prueba', 'invoice_line_tax_ids' => array(array(4, 23,false)), 'price_unit'=>200.00 )));

The invoice is created and the line shows correct tax code but tax amount is not calculated (Other info tab is blank), but if the line is edited (say  quatity or price is modified) tax is calculated correctly.

What I am doing wrong or missed at invoice creation

0
Benjamin Borchert
On 5/19/16, 3:58 AM

account.invoice has a method called compute_taxes which you can call with the id of the invoice you want to update the taxes on as parameter.

Since I'm working with Python/Odoo, and it's been a while since I last used PHP,  I can only guess:

$models->execute_kw($db, $uid, $password, 'account.invoice', 'compute_taxes', $id_of_invoice); 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 3/7/16, 8:51 AM
Seen: 766 times
Last updated: 8/30/16, 8:51 AM