Search code examples
phpodooxml-rpcodoo-8

How to update the tax amount in invoice using XML-RPC?


I am using Odoo 8.0. Currently I am accessing the odoo models using XML-RPC API in php. I have updated the percentage of tax in invoice line items. It was updated successfully, but the problem is the tax amount is not updated in the subtotal.

Here my code is:

<?php
    include("../ripcord-master/ripcord.php");

    $url = "http://localhost:8069";
    $db="migration_three";
    $username = "admin";
    $password = "admin";

    $models = ripcord::client("$url/xmlrpc/2/object");
    $common = ripcord::client("$url/xmlrpc/2/common");
    $uid = $common->authenticate($db, $username, $password, array());
    $invoice_id = 28;
    $validate = $models->execute_kw($db, $uid, $password, 'account.invoice','button_reset_taxes',array($invoice_id));
    print_r($validate);
?>

It returns 1. But the tax amount is not updated in the subtotal view. Thanks in advance


Solution

  • We don't need to mention the key for invoice_id. Change the update code into

    $validate = $models->execute_kw($db, $uid, $password, 'account.invoice','button_reset_taxes',array($invoice_id));
    print_r($validate);