コンテンツへスキップ
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
このフォーラムについて
ヘルプ

Changing one2many widget to many2many causes error on creation, many2many on 2 models seems to not relate them (all web UI)

購読

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

この質問にフラグが付けられました
1 返信
4651 ビュー
アバター
Roberto Cocchiararo

Hi

First of all, I would like to clarify that I am working with the web interface and not "programing" an instalable module, since I know programing basics, but no python.

My objective is to add functionality to the fleet management module.
I created 2 additional models, "events" and "fleet insurance" (the built in contracts can be used for other objectives, but the actual insurance is managed differently, only 2 companies are used and this allows keeping the vehicles up to date easier).

One is for listing events (name, date, description). Each event can have "x" number of vehicles participating (each vehicle can participate in any number of events, and this is a log).

The other is for registering insurance contracts (number, expiration and company). Each contract can have "y" vehicles associated (but one vehicle can have only 1 fleet insurance contract active).

I then need to extend the fleet.vehicle model, adding a list of all the events where it has participated, and the information of the current insurance contract (it can have only one).

My issues start here.

I first tried using many2many fields. This allowed me to pick vehicles in the events/fleet insurance, or events/fleet insurance from the vehicle form, but changing one entity has no effect on the other.

I then tried with one2many in the vehicles, many2one in events/fleet insurance. Now I could pick correctly from the vehicles, but could only have one on the other models (and it was a selection showing just one field, not all the info). Also, from the events/fleet insurance, the "add new" opened the vehicle creatin form, instead of listing the existing ones.

Finally I went with many2one in vehicles, one2many on the other side. This time the problem was inverted.
Then u tried setting the widget on both ends to "many2many", which seemed to be the answer. Too bad now I can't create new vehicles or events/fleet insurance because I get an " unhashable: list" error.

I tries also having many2many on one end, one2many on the other. Similar error when creating.

Can you helpe fix my issue or instruct on the correct way of achieving my objective, using only the web interface of course?

The XML code i ended up with (with some variations, like read only for the fleet insurance on the vehicle form view) was:

Fleet insurance form view:
<?xml version="1.0"?>
<form>
<group string="Seguro">
<field name="x_compania"/>
<field name="x_numeropoliza"/>
<field name="x_fechavencimiento"/>
</group>
<group string="Asegurados">
<field name="x_vehiculos" nolabel="1" widget="many2many"/>
</group>
</form>

Events form view:
<?xml version="1.0"?>
<form>
<group string="Evento">
<field name="x_nombreevento"/>
<field name="x_fechaevento"/>
</group>
<group string="Descripción">
<field nolabel="1" name="x_descripcion" placeholder="Escriba aquí información del evento"/>
</group>
<group string="Participantes">
<field name="x_vehiculos" nolabel="1" widget="many2many"/>
</group>
</form>

Vehicle form view addition (i tried with and without notebook, but with notebook it looked better):

<notebook>
<page string="Seguro de Flota" attrs="{'invisible': [('x_aseguradoflota','=',False)]}">
<group>
<field name="x_seguroflota" nolabel="1" widget="many2many" readonly="1"/>
</group>
</page>
<page string="Eventos" attrs="{'invisible': [('model_id','=',False)]}">
<group>
<field name="x_eventos" nolabel="1" widget="many2many"/>
</group>
</page>
</notebook>

 

0
アバター
破棄
アバター
Roberto Cocchiararo
著作者 最善の回答

I have been doing more experiments, and i believe now that what i tried was not supported, and that is the reason it failed in the first place :P

In any case, now i have:

Events (one2many) > Vehicles (many2many)

Fleet insurance (one2many) > Vehicles (many2one)

Doing it this way, i can have every vehicle participate in any number of events, and modifying one list, does the same on the other. Only downside is i had to change the form view for the events so that the vehicle list is "readonly", because the "one2many" list widget tries to create a new vehicle instead of picking existing ones.

At the same time, each vehicle can have only one fleet insurance active at any moment, which is good. My only issue is that since i am using just the web interface, and these are all custom models/fields, it seems like only "luck" decides what field is displayed in "vehicles" for the "many2one" field relating to "fleet insurance". This time, it was the policy number (more or less usefull), but i had another case where the "user that created the record" was displayed, which was not good at all.

Can i manage this in any way when i am not defining the model/field in python code? If i where, i could set the "_rec_name" of each custom "many2one" field i needed to display the 2 or 3 fields from the "fleet insurance" model in the "vehicle" form view.

 

 

 

0
アバター
破棄
ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

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

登録
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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