odoo 相关问题

Odoo是一套用Python编写的开源业务应用程序,根据AGPL许可证发布。它被全球370万用户用于管理各种规模的公司。主要的Odoo组件是服务器,270个核心模块(也称为官方模块)和大约15000个社区模块。

回答 2 投票 0



使用XMLRPC

我可以进行身份验证,但是当试图获取数据时,它给了我一个错误 这是我遇到的错误。 我正在使用Laravel版本9.46,检查使用PHP Artisan -V使用 我能够进行身份验证,但是当试图获取数据时,它会给我一个错误 这是我遇到的错误。 我正在使用Laravel版本9.46,检查使用PHP Artisan-V使用 <?php namespace App\Console\Commands; use Illuminate\Console\Command; use PhpXmlRpc\Client; use PhpXmlRpc\Request; use PhpXmlRpc\Value; use DB; class FetchOdooData extends Command { protected $signature = 'fetch:odoo-data'; protected $description = 'Fetch data from Odoo and update local database'; public function __construct() { parent::__construct(); } public function handle() { // Odoo credentials $url = 'http://urltoodoo::8049'; $db = 'DBNAME'; $username = 'username'; $password = 'APIKEY'; // Define XML-RPC endpoints $common_url = "{$url}/xmlrpc/2/common"; $object_url = "{$url}/xmlrpc/2/object"; // Create a client instance for common services $client = new Client($common_url); // Prepare the authentication request $request = new Request('authenticate', array( new Value($db, 'string'), new Value($username, 'string'), new Value($password, 'string'), new Value(array(), 'struct') )); // Send the authentication request $response = $client->send($request); //var_dump($response); if ($response->faultCode()) { $this->error('Error: ' . $response->faultString()); return; } // Retrieve the user ID from the response $user_id = $response->value()->scalarval(); if ($user_id) { $this->info("Authenticated successfully. User ID: $user_id"); } else { $this->error("Authentication failed."); return; } // Function to call Odoo methods function callOdooMethod($client, $method, $params) { var_dump($method); var_dump($params); var_dump($client); $msg = new Request($method, array(new Value($params, 'array'))); var_dump($msg); $resp = $client->send($msg); var_dump($resp); if ($resp->faultCode()) { return 'Error: ' . $resp->faultString(); } return $resp->value(); } // Fetch last sync time for a model function getLastSyncTime($model_name) { return DB::table('last_sync')->where('model_name', $model_name)->value('last_update'); } // Update last sync time for a model function updateLastSyncTime($model_name) { DB::table('last_sync')->updateOrInsert( ['model_name' => $model_name], ['last_update' => now()] ); } // Fetch data from Odoo function fetchData($models, $db, $user_id, $password, $model_name, $fields, $last_sync_time=0) { //$domain = $last_sync_time ? [['write_date', '>', $last_sync_time]] : []; $params = array( new Value($db, 'string'), new Value($user_id, 'int'), new Value($password, 'string'), new Value($model_name, 'string'), new Value('search_read', 'string'), new Value(array( //new Value($domain, 'array'), // Domain filter new Value($fields, 'array'), // Fields to retrieve ), 'array') ); return callOdooMethod($models, 'execute_kw', $params); } // Update local database with fetched data function updateLocalDatabase($model_name, $data) { foreach ($data as $record) { } } // Create a client instance for object services $models = new Client($object_url); var_dump($models); // Define fields to retrieve for each model $project_fields = array('name', 'user_id', 'date_start', 'date_end', 'tasks'); $task_fields = array('name', 'user_id', 'date_deadline', 'stage_id', 'description'); $ticket_fields = array('name', 'stage_id', 'user_id', 'priority', 'description'); $incident_fields = array('name', 'stage_id', 'user_id', 'priority', 'description'); // Replace with actual fields // Define models $models_to_fetch = array( 'project.project' => $project_fields, 'project.task' => $task_fields, 'helpdesk.ticket' => $ticket_fields ); /*, 'your_incident_model_name' => $incident_fields // Replace with actual model name */ foreach ($models_to_fetch as $model_name => $fields) { //$last_sync_time = getLastSyncTime($model_name); $data = fetchData($models, $db, $user_id, $password, $model_name, $fields); //, $last_sync_time if (is_string($data)) { $this->error("Error fetching $model_name: " . $data); } else { $this->info(ucfirst(str_replace('.', ' ', $model_name)) . " Data:\n"); print_r($data); updateLocalDatabase($model_name, $data); updateLastSyncTime($model_name); } } } } 我正在使用“ phpxmlrpc/phpxmlrpc”:“^4.10”软件包我如何从Odoo进行身份验证并获取门票和任务数据? the错误消息和代码,在new Value($fields, 'array')方法中的行中看起来像是在fetchData方法中,$fields是普通PHP字符串的数组。它应该是XmlRpc\Value对象的数组。 您可以手动进行转换,也可以通过使用XmlRpc\Value方法将本机PHP值递归包装到XmlRpc\Encoder::encode()对象中来简化您的代码,如Sew f.e.在https://github.com/gggeek/phpxmlrpc/blob/master/demo/client/proxy.php

回答 1 投票 0


Odoo 16 系统中未找到外部 ID:website.assets_frontend

我对 Odoo 有点陌生,我想制作自己的 odoo 模块片段。但是当我尝试激活我的代码片段时,我收到此错误: RPC_错误 Odoo 服务器错误 回溯(最近一次调用最后一次): ...

回答 1 投票 0

如何仅显示选择字段的选项子集?

我正在使用 Odoo v17。我扩展了 account.move 模型以包含“serie”字段 类 AccountMove(models.Model): _inherit = "账户.移动" 系列=字段.选择...

回答 1 投票 0

如何下载推送的 Odoo 版本并上传到 Github

为了提供一些有关正在发生的事情的背景信息,几个月前我受雇于购买的 Odoo ERP 系统,并使用第三方公司对其进行了一些自定义修改...

回答 2 投票 0

我想重命名odoo字段名称

我在创建模型时创建一个带有类型的字段: error_field = fields.Char('错误') 现在,我想更正此字段并将日期迁移到新字段。我在 odoo 文档中找到了关键字“oldname”...

回答 2 投票 0

psycopg2.errors.UndefinedColumn:列website.sequence不存在

当我们团队的用户对 odoo 模块进行更改时,我在 docker 中重新启动 odoo 服务器时遇到了上述错误。之后我无法重新启动odoo。 当我使用 \d 网站时

回答 1 投票 0

如何阻止 Odoo 自定义按钮自动保存?

我在视图中创建了一个按钮,该按钮触发模块内的方法。但是,单击按钮后,临时编辑的字段将被保存,并且单击“放弃”按钮时不会恢复...

回答 3 投票 0

在odoo中确认销售订单时如何自动创建发票和自动验证发票

'如何在确认销售报价的同时自动转移发货/提货。 在 odoo 中确认销售订单时自动创建发票并自动验证发票。'

回答 2 投票 0

Odoo v17:自动化规则 - 触发器丢失?

在 Odoo 17 中我想仅为创建创建自动化规则?我可以看到有一个“保存”触发器,但它也适用于“创建”和“更新”。我希望它仅在创建时执行代码。这是公关...

回答 2 投票 0

Odoo 如何使用 docker-compose 刷新文件(开发者功能)?

我设置Odoo在激活开发模式的情况下运行,但它不起作用。 在他们的文档中,他们解释说只需添加参数 --dev all 即可允许系统在 f...

回答 1 投票 0

报表有库存变动时,如何读取选股、库存变动行字段?

我很难从字段中获取信息。 mrp_product_id 和批次在库存挑选中,expiration_date 在库存移动行中。 我很难从字段中获取信息。 mrp_product_id 和批次在库存挑选中,expiration_date 在库存移动线中。 <!-- Report Template --> <template id="report_stock_picking_template"> <t t-call="web.html_container"> <t t-call="stock_picking_report.report_stock_picking_styles"/> <t t-foreach="docs" t-as="doc"> <div class="label-container"> <h4 class="label-title">Weighing Label</h4> <table class="label-table"> <tr> <td class="label-cell">Product: <span t-esc="doc.picking_id.mrp_product_id.name"/></td> <td class="label-cell">ID: <span t-esc="doc.picking_id.mrp_product_id.id"/></td> </tr> <tr> <td class="label-cell" colspan="2">Batch No: <span t-esc="doc.picking_id.batch"/></td> </tr> <tr> <td class="label-cell">Item: <span t-esc="doc.picking_id.product_id.name"/></td> <td class="label-cell">ID: <span t-esc="doc.picking_id.product_id.id"/></td> </tr> <tr> <td class="label-cell">Exp: <span t-if="doc.picking_id.move_line_ids.filtered(lambda line: line.lot_id == doc.picking_id.lot_id) and doc.picking_id.move_line_ids.filtered(lambda line: line.lot_id == doc.picking_id.lot_id)[0].expiration_date" t-esc="doc.picking_id.move_line_ids.filtered(lambda line: line.lot_id == doc.picking_id.lot_id)[0].expiration_date" t-options='{"widget": "date"}'/> </td> <td class="label-cell">Control No: <span t-esc="doc.lot_ids.name"/></td> </tr> </table> </div> </t> </t> </template> <!-- Report Action --> <record id="action_report_stock_picking" model="ir.actions.report"> <field name="name">Weighing Label</field> <field name="model">stock.move</field> <field name="report_type">qweb-pdf</field> <field name="report_name">stock_picking_report.report_stock_picking_template</field> <field name="report_file">stock_picking_report.report_stock_picking_template</field> <field name="binding_model_id" ref="stock.model_stock_move"/> <field name="binding_type">report</field> </record> </data> 在此输入图片描述 在此输入图片描述 帮我修正这份报告。 这些模型(stock.picking、stock.move、stock.move.line)彼此有直接关系,所以你可以使用doc.move_line_ids.expiration_date,它只会显示相关的库存移动线。

回答 1 投票 0

为什么 Odoo 16 中的 JS 方法有时只能在类似的环境中工作?

我正在使用 Odoo 16。我已经安装了 Enterprise Barcode 应用程序,并对其进行了通用开发。 条形码应用程序有一个菜单,可在看板视图中显示选择。我正在做什么...

回答 1 投票 0

odoo 13错误:ValueError:res.config.settings.module_procurement_jit的值错误:1

我使用来自已运行服务器的备份 .zip 文件(包括所有插件)创建了一个新的 Odoo 服务器。原始服务器运行正常,但新服务器显示此错误。 T...

回答 1 投票 0

使用 Zpl 命令在 ZPL 打印机上打印越南语文本

我正在尝试使用 Zpl 编码在 Zebra 标签上打印越南语文本。 但我在越南语字符方面遇到问题。例如,我正在尝试打印带有文本“Nhập khẩu”的标签...

回答 2 投票 0

在Odoo 17中,在xml域中设置复杂的逻辑

我需要更新标准 Odoo 17 mrp 模块中现有操作的逻辑: 成为: 莫...

回答 1 投票 0

我们可以根据odoo的情况隐藏主树视图中的列吗

我一直在odoo 16中自定义库存模块,我们有多种操作类型,每个单独的操作类型我在表单字段中有不同的字段,所以我想在(...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.