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

field.function in tree view

購読

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

この質問にフラグが付けられました
v6
2 返信
14359 ビュー
アバター
Tajjajt

hi !

I have in my new module a functional field, whene i put it in my tree view i can't open my view.

here the action code :

    <record id="my_module_normal_action" model="ir.actions.act_window">
    <field name="name">My module</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">mymodule</field>
<field name="domain">[('my_field','=',True)]</field>
    <field name="view_type">form</field>
    <field name="view_id" ref="my_module_tree_view"/>
    <field name="search_view_id" ref="my_module_search_form_view"/>
</record>

my code xml :

<record id="my_module_tree_view" model="ir.ui.view">
            <field name="name">my.module.tree</field>
            <field name="model">mymodule</field>
            <field name="type">tree</field>
            <field eval="7" name="priority"/>
            <field name="arch" type="xml">
                <tree string="my module">
                   <field name="my_string"/>
            <field name="my_field"/>
                </tree>
            </field>
        </record>

in my python code :

  'my_field': fields.function(_get_concatenate_values, method=True, string='Reference', type='char'),

this is the function's code :

def _get_concatenate_values(self, cr, uid, ids, field_name, arg, context=None):
            records=self.browse(cr,uid,ids)
            result={}
            for r in records:
                if(r.field1 and r.field2):
                    result[r.id]= str(r.field1.name)+'.'+ str(r.field2.name)
                return result

"my_field"'s value is the concatenation of the two fields :field1 and field2

thanks for your reply.

0
アバター
破棄
Andreas Brueckl

What version of OpenERP are you using? Your field is called 'code' but you use 'my_string' and 'my_module' in the view?

Tajjajt
著作者

I use V6.0.2 , my feild's name is 'my_field', 'my_sring' is an other field in my module. so I rectify the python code : 'my_field': fields.function(_get_concatenate_values, method=True, string='Reference', type='char'),

アバター
Lucio
最善の回答

In the definition of the action, you need to add:

<field name="view_mode">tree,form</field>

or

<field name="view_mode">form,tree</field>

depending in the order you want the views to be accessed.

(Or maybe just <field name="view_mode">tree</field> if you do not have a form view.)

I think the problem is in your domain statement in the definition of the action!

<field name="domain">[('my_field','=',True)]</field>

I think you are trying to say that it is not empty, but this restriction is satisfied only if the field has the boolean value True. Change it to:

 <field name="domain">[('my_field','&lt;&gt',False)]</field>

This means that is different to False that, I think, is more acccurate.

Hope it helps!

2
アバター
破棄
Tajjajt
著作者

It dosnt work !!

here a picture of my problem:

[URL=http://www.imagup.com/data/1176824638.html][IMG]http://data.imagup.com/12/1176824638.png[/IMG][/URL]

I have 3 rows but invisible, when I delete the line <field name="my_field"/> from the tree code it works and I have my liste

Tajjajt
著作者

link to the picture : http://www.imagup.com/data/1176824638.html

Lucio

Without the 'my_field' field it works just fine? What's the message error you are getting?

Tajjajt
著作者

yes without 'my_fiels' it works fine, i have no msg error, i can't see my data?

Tajjajt
著作者

any help !!

Lucio

I updated my answer, maybe that is the problem! I do not see any other possibility of change!

Andreas Brueckl

Please update your question with the code of "_get_concatenate_values"

Lucio

Did it work?

Tajjajt
著作者

no !! I have the same problem.

Tajjajt
著作者

I updated my question

アバター
Tony Gu
最善の回答

You defined a domain in act_window based on the function field 'my_field', while you didn't define a "fnct_search" search method for that function field.

Update: Another option would be to add store=True to the function field.

0
アバター
破棄
Lucio

As far as I know, store=True will be used for the value of the field to be stored in the database. But, is this necessary to just show it in a tree view and filter the domain? I think it is not, but then again, I am not sure

Andreas Brueckl

For the domain filter only, the store flag is not required. Only if you want to use in the SearchView.

Lucio

Yes, in that case, I see what you are saying! Thanks!

Tajjajt
著作者

I added "store=True" to my function field but during the installation of the module I get this error :

=================
Traceback (most recent call last):
  File "netsvc.pyo", line 489, in dispatch
  File "service\web_services.pyo", line 599, in dispatch
  File "osv\osv.pyo", line 122, in wrapper
  File "osv\osv.pyo", line 176, in execute
  File "osv\osv.pyo", line 167, in execute_cr
  File "C:\Program Files\OpenERP 6.0\Server\addons\base\module\wizard\base_module_upgrade.py", line 98, in upgrade_module
  File "pooler.pyo", line 60, in restart_pool
Tajjajt
著作者
  File "pooler.pyo", line 39, in get_db_and_pool
  File "addons\__init__.pyo", line 883, in load_modules
  File "addons\__init__.pyo", line 719, in load_module_graph
  File "addons\__init__.pyo", line 414, in init_module_objects
  File "osv\orm.pyo", line 2651, in _auto_init
  File "osv\orm.pyo", line 378, in get_pg_type
TypeError: int argument required
=============
Tajjajt
著作者

can you help me plz ?!

joshuajan
def _get_concatenate_values(self, cr, uid, ids, field_name, arg, context=None):
    records=self.browse(cr,uid,ids)
    result={}
    for r in records:
        if(r.field1 and r.field2):
            result[r.id]= str(r.field1.name)+'.'+ str(r.field2.name)
        #return result
    return result

I think there is a problem of you return value.

Tajjajt
著作者

can anyone help me plz!

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

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

登録
関連投稿 返信 ビュー 活動
How to reset default values for a specific user? 解決済
v6
アバター
アバター
1
12月 17
14316
how to get url of current page 解決済
v6
アバター
アバター
アバター
2
12月 23
23448
How to find all the customer invoices that were paid after the due date?
v6
アバター
アバター
1
3月 15
6891
Limiting access Controls to Allocation requests in Holidays
v6
アバター
1
3月 15
4775
JasperReports won't evaluate null nor 0
v6
アバター
0
3月 15
4477
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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