首页
/ OOOR 项目技术文档

OOOR 项目技术文档

2024-12-23 08:37:11作者:宣海椒Queenly

1. 安装指南

安装步骤

  1. 首先,确保你已经安装了Ruby环境。如果没有,请先安装Ruby。
  2. 使用以下命令安装OOOR gem:
    $ gem install ooor
    

注意事项

  • OOOR gem已经有一段时间没有发布新版本,建议使用git版本以获取最新功能和修复。

2. 项目的使用说明

基本使用

安装完成后,你可以通过以下命令启动OOOR命令行工具:

$ ooor username:password@host:port/database

这将启动一个IRB解释器,并连接到指定的Odoo服务器,你可以在其中直接操作Odoo模型。

示例

在IRB控制台中,你可以这样使用OOOR:

require 'rubygems'
require 'ooor'
Ooor.new(:url => 'http://localhost:8069/xmlrpc', :database => 'mybase', :username => 'admin', :password => 'admin')

这将加载所有Odoo模型到Ruby代理对象中。你可以通过以下命令查找用户ID为1的用户:

ResUsers.find(1)

3. 项目API使用文档

基本查找

ProductProduct.find(1)
ProductProduct.find([1,2])
ProductProduct.find([1])
ProductProduct.find(:all)
ProductProduct.find(:last)

Odoo域支持

ResPartner.find(:all, :domain=>[['supplier', '=', 1],['active','=',1]])

Odoo上下文支持

ProductProduct.find(1, :context => {:my_key => 'value'})

关系支持

SaleOrder.find(1).order_line #one2many relation
p = ProductProduct.find(1)
p.product_tmpl_id #many2one relation
p.taxes_id #automagically reads man2many relation inherited via the product_tmpl_id inheritance relation
p.taxes_id = [1,2] #save a many2many relation
p.save

加载特定字段

ProductProduct.find(1, :fields=>["state", "id"])

创建对象

pc = ProductCategory.new(:name => 'Categ From Rails!')
pc.create
pc.id

更新对象

pc.name = "A new name"
pc.save

复制对象

copied_object = pc.copy({:categ_id => 2})

4. 项目安装方式

通过Gem安装

$ gem install ooor

通过Git安装

如果你需要使用最新版本的OOOR,可以通过Git安装:

$ git clone https://github.com/akretion/ooor.git
$ cd ooor
$ bundle install

通过以上步骤,你可以成功安装并使用OOOR项目。

登录后查看全文

项目优选

收起
kernelkernel
openEuler内核是openEuler操作系统的核心,既是系统性能与稳定性的基石,也是连接处理器、设备与服务的桥梁。
C
471
465
kernelkernel
deepin linux kernel
C
32
16
atomcodeatomcode
Claude Code 的开源替代方案。连接任意大模型,编辑代码,运行命令,自动验证 — 全自动执行。用 Rust 构建,极致性能。 | An open-source alternative to Claude Code. Connect any LLM, edit code, run commands, and verify changes — autonomously. Built in Rust for speed. Get Started
Rust
2.09 K
218
ops-nnops-nn
本项目是CANN提供的神经网络类计算算子库,实现网络在NPU上加速计算。
C++
700
1.4 K
docsdocs
暂无描述
Dockerfile
780
5.08 K
pytorchpytorch
Ascend Extension for PyTorch
Python
758
968
flutter_flutterflutter_flutter
本仓库是 Flutter SDK 与 Flutter Engine 的 OpenHarmony 适配版本,由 CPF-Flutter 团队维护。开发者可使用熟悉的 Flutter 技术栈开发 OpenHarmony 应用,3.35.7 及以后的适配版本可基于本仓库源码构建支持 OpenHarmony 的 Flutter Engine。
Dart
1.04 K
271
ops-transformerops-transformer
本项目是CANN提供的transformer类大模型算子库,实现网络在NPU上加速计算。
C++
880
2.03 K
mindquantummindquantum
MindQuantum is a general software library supporting the development of applications for quantum computation.
Python
183
111
openHiTLSopenHiTLS
旨在打造算法先进、性能卓越、高效敏捷、安全可靠的密码套件,通过轻量级、可剪裁的软件技术架构满足各行业不同场景的多样化要求,让密码技术应用更简单,同时探索后量子等先进算法创新实践,构建密码前沿技术底座!
C
1.11 K
682