You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用PHP+Ripcord调用Odoo 10 API确认配送单无生效问题排查求助

PHP+Ripcord调用Odoo 10 API确认配送单无生效问题排查求助

各位大佬好,我遇到了一个棘手的问题,想请大家帮忙排查下:

我公司需要让拣货员通过HTML表单提交配送ID,然后用下方的PHP代码调用Odoo 10的API,找到对应的配送单并完成确认操作。目前页面执行后会返回“Delivery order confirmed successfully.”,看起来一切正常,但去Odoo后台查看对应的配送单,状态完全没有变化。

另外需要说明的是,我用的URL、数据库名、用户名和密码,在另一个业务脚本里是可以正常调用Odoo API的,所以这些参数应该没问题。

以下是我的代码:

<?php

$deliveryOrderId = $_POST['deliveryOrderId'];

require 'test/ripcord.php';

// Odoo server information
$url = 'xxxx';
$db = 'xxxx';
$username = 'xxx';
$password = 'xxxx';

// Connect to Odoo server and authenticate
$common = ripcord::client($url . '/xmlrpc/2/common');
$uid = $common->authenticate($db, $username, $password, array());

if ($uid) {
    // Connect to Odoo's 'stock.picking' model
    $models = ripcord::client($url . '/xmlrpc/2/object');

    // Search for the delivery order based on the provided $deliveryOrderId
    $deliveryOrderIds = $models->execute_kw(
        $db,
        $uid,
        $password,
        'stock.picking',
        'search',
        array(
            array(
                array('id', '=', $deliveryOrderId)
            )
        )
    );

    if ($deliveryOrderIds) {
        // Confirm the delivery order
        $models->execute_kw(
            $db,
            $uid,
            $password,
            'stock.picking',
            'action_confirm',
            array($deliveryOrderIds)
        );

        echo "Delivery order confirmed successfully.";
    } else {
        echo "Delivery order not found.";
    }
} else {
    echo "Authentication failed.";
}

?>

有没有大佬能帮我分析下,为什么API调用返回成功,但实际配送单状态没更新呢?麻烦大家了!

备注:内容来源于stack exchange,提问作者Pelingier

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 09:44:32