コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

how to format value for a many2many field thru XML RPC

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
xmlrpcmany2manyperl
4 返信
29092 ビュー
アバター
Nicolas C

Hello,

Up to now I was able to search/read/create and write objects thru XML RPC (using perl script).

Until now I was only dealing with "simple" values like : string (name of a product) number (price) boolean (true/false) ...

But I need now to deal with "many2many" field and I don't know how to perform...

As seen within "XML RPC perl - OpenERP dev book example" h t t p : / / doc.openerp.com/v6.0/developer/6_22_XML-RPC_web_services/#perl-example I build the "object data" as a hash reference and it work fine for all "simple values".

For "many2many" I tried to use list of "target model id" in the following format within the "object data" hash :

['1', '2']
[['1', '2']]
[('1', '2')]

or directly using the native "array" from perl (ie: @array) But I get any error while writing the data (the write is correctly running for other fields like name) and .... so.. nothing happened for this many2many field :(

I'm currently dealing with "multi variant" product an the field I try to update is "dimension_type_ids" from model "product.template" on v6.1/ubuntu 12.04 using apps extra module "product_variant_multi".

Any idea/help is welcome (even with other language than perl) !!!

Have a nice day.

3
アバター
破棄
アバター
saad
最善の回答

When we are creating a many2many field we use this syntax:

'field_name':fields.many2many('related_model_name','relation_table_name','current_model_id','related_model_id', 'string' )

If we want manually fill this field, we should insert data in relation_table_name by executing this querie:

cr.execute('insert into relation_table_name (current_model_id, related_model_id) values(%s,%s)',(first_value,second_value))

OpenObject (OpenERP Framework) provide a list of tuples to use many2many fields in an easy way. Here is the list of tuple that are accepted, with the corresponding semantics

The dimension_type_ids field is a many2many relationship, and the (6, 0, Ids) means to replace any existing records (of product.variant.dimension.option) with those in Ids, because you're calling a create() method.

4
アバター
破棄
Nicolas C
著作者

Thank you very much !!!!!! Now I understand very much : how OpenERP framework internally work and... what I have to do ! I will test right now and let you know. Your link to the "list of tuple" is really great !!!!

アバター
Nicolas C
著作者 最善の回答

Hello,

After solving some issue on the Ubuntu side, I have now a "/var/log/openerp-server.log" file working again.

Launching OpenERP server with additional options "--debug --log-level=debug_rpc_answer" now provide me useful informations !!!

When performing "product.template" edition thru the web interface, I captured the following syntax :

'dimension_type_ids': [[6, False, [1, 2]]]

I fully know/understand what is the last part of the "value" => "[1, 2]". This is the list of "foreign IDs" from model "product.variant.dimension.option" I just assigned to my template from the Web interface. But I don't know at all what the begin "6, False" refer to... :(

Does anyone have a clue about this syntax ? I'm not familiar with python at all so maybe this is some particular python syntax ? Or an OpenERP "usual format" ?

Any advice will be nice, I keep searching on my side ;o)

Just FYI, when performing a "read" on the same object I only get :

'dimension_type_ids': [1, 2]

Have a nice day everybody.

@++ Nicolas


UPTADE based on S@@D awesome answer

As only one answer is allowed, I'll update my own response here based on S@@D answer.

For an people looking to use perl as XML RPC interface to OpenERP, here is a sample of template.product object data (ie: a perl hash ref):

$object_data = {
    'name' => 'this is my template',
    'uom_id' => '1',
    'uom_po_id' => '1',
    'procure_method' => 'make_to_order',
    'variant_model_name' => '[_o.option_id.code_]',
    'do_not_update_variant' => '1',
    'sale_ok' => '1',
    'dimension_type_ids' => '[[6, 0, [1, 2]]',
    'variant_model_name_separator' => '\'\'',
    'supply_method' => 'produce',
    'type' => 'product',
    'categ_id' => '24',
    'is_multi_variants' => '1'
};

Where :

'dimension_type_ids' => '[[6, 0, [1, 2]]',

Is an update of a "many2many" field.

Have a look to S@@D link about tuple syntax (sorry but I have not enough karma to add link in my own answer). At the bottom of the developer book documentation page, you will have the "write" explained with all kindly syntax for many2many, one2many, many2one (the simpler one ;) ).

Note: I was only aware of CRUD (create/read/update(ie write)/delete(ie unlink) capability of OpenERP XML RPC... I'll now have a look to others listed in the doc page ;)

Thank you again S@@D Have a nice day

@++ Nicolas

6
アバター
破棄
アバター
Luis Javier
最善の回答

Thank you Nicolas C, i was trying to add some records to a Many2many field in Python.

model_obj.write({'field': [[6, 0, ids]]})
0
アバター
破棄
ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
How to find out the table name for a many2many relation (Where is the many2many table name stored?) 解決済
orm xmlrpc many2many
アバター
アバター
アバター
アバター
アバター
4
10月 21
25228
Create product using XMLRPC - PHP, issue with public_categ_ids
php xmlrpc many2many
アバター
アバター
2
6月 16
11951
Is it possible to retrieve 2 fields of all entry within a model thru xml-rpc?
list xmlrpc perl
アバター
アバター
アバター
3
3月 15
10466
[closed] help with xmlrpc + many2many_tags
tags xmlrpc many2many
アバター
アバター
2
3月 15
5759
How can I do a xmlrpc-Search via a many2many-field (from account.invoice.line to account.tax)?
search xmlrpc many2many
アバター
0
3月 15
4057
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now