Dennis Mutegi
Dennis Mutegi

Reputation: 31

ODOO 10 Invoice Validation

Been trying to auto validate invoices in odoo 10 via php for a while now with no success. Am using the below php code to validate

    <?php

    $url = 'http://localhost:8069';
    $url_auth = $url . '/xmlrpc/2/common';
    $url_exec = $url . '/xmlrpc/2/object';

    $db = 'DATABASE';
    $username = 'Username';
    $password = 'Password';

    require_once('ripcord/ripcord.php');
    $common = ripcord::client($url_auth);
    $uid = $common->authenticate($db, $username, $password, array());

    $models = ripcord::client("$url/xmlrpc/2/object");
    $invoice_model = 'account.invoice';
    $id = $models->exec_workflow(
           $db, $uid, $password,
                'account.invoice', 
                'invoice_open',
                2948 //invoice Id
    );



    print_r($id);

When I execute the above I get no results. No error message, nothing.

Upvotes: 1

Views: 578

Answers (2)

TheStoryCoder
TheStoryCoder

Reputation: 3640

@ThongNguyenVan gave me the hint I needed. It led me to https://www.odoo.com/nl_NL/forum/help-1/question/odoo10-sending-invoice-email-via-xmlrpc-118915 which basically had the Python version of the code I needed. So it will convert to the following PHP code:

$models->execute($db, $uid, $password, 'account.invoice', 'action_invoice_open', array(2948));

Upvotes: 1

Thong Nguyen
Thong Nguyen

Reputation: 291

There is no method invoice_open in account.invoice, but there is an action_invoice_open. Could you check it again?

Ref: https://github.com/odoo/odoo/blob/10.0/addons/account/models/account_invoice.py#L576

Upvotes: 0

Related Questions