コンテンツへスキップ
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 do I remove fields from a view in a custom module?

購読

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

この質問にフラグが付けられました
viewinheritance
12 返信
36153 ビュー
アバター
Seth Boyd

I'm trying to modify a view from the CRM module from a custom module with no luck.  Currently, from the debugging interface, I can see that my inherited views are being created alongside the views they are meant to modify and end up being straight copies of the inherited view with no modifications.

Here is the view's code:

<!-- Phonecalls Form View -->
    <record model="ir.ui.view" id="crm_case_phone_form_view">
        <field name="name">CRM - Phone Call Form</field>
        <field name="model">crm.phonecall</field>
        <field name="type">form</field>
        <field name="inherited_id" ref="crm.crm_case_phone_form_view"/>
        <field name="arch" type="xml">
            <field name="partner_phone" position="replace"/>
            <field name="user_id" position="replace"/>
            <field name="duration" position="replace"/>
            <field name="partner_mobile" position="replace"/>
            <field name="priority" position="replace"/>
        </field>
    </record>

As you can see, I'm just tryting to remove a few fields, but after restarting openerp and updating my module nothing changes at all on the view.

 

EDIT:

Here are the four files that I have in my module.

__openerp__.py

{
    "name" : "Hotel CRM Customizations",
    "version" : "0.01",
    "category" : "Generic Modules/Hotel Management",
    "description": """
    Module to to customize the CRM module to be more useful for the hotel industry
    """,
    "depends" : ["crm"],
    "data": [
        "crm_phonecall_menu.xml",
        "crm_phonecall_view.xml",
    ],
    "auto_install": False,
    "installable": True
}

__init__.py is blank

crm_phonecall_menu.xml (this modification actually works)

<?xml version="1.0"?>
<openerp>
    <data>
        <!-- PHONE CALLS (menu)  -->
        <menuitem name="Call Log" id="crm.menu_crm_case_phone"
            groups="base.group_sale_salesman"
            parent="base.menu_base_partner" sequence="4" />
    </data>
</openerp>

crm_phonecall_view.xml

<?xml version="1.0"?>
<openerp>
    <data>

    <!-- Phonecalls Form View -->
    <record model="ir.ui.view" id="crm_case_phone_form_view_inherit">
        <field name="name">CRM - Phone Call Form</field>
        <field name="model">crm.phonecall</field>
        <field name="sequence">14</field>
        <field name="inherited_id" ref="crm.crm_case_phone_form_view"/>
        <field name="arch" type="xml">
            <field name="partner_phone" position="attributes">
                <attribute name="invisible">True</attribute>
            </field>
            <field name="user_id" position="attributes">
                <attribute name="invisible">True</attribute>
            </field>
            <field name="duration" position="replace"/>
            <field name="partner_mobile" position="replace"/>
            <field name="priority" position="replace"/>
        </field>
    </record>
    </data>
</openerp>

0
アバター
破棄
Mariusz Mizgier

Seems like some of the comment has been trimmed, so usage is .

Ludo - 21South

Ah, very well spotted on the inherit! On the position tag, it is a common way to do that. This is the equivalent of . You could also use Xpath, but the OpenERP built-in is much easier!

Seth Boyd
著作者

"inherited_id" was the problem. After changing it to "inherit_id" everything is working properly. Thank you so much for noticing that!

Seth Boyd
著作者

First, when you inherit a view, use field name="inherit_id" instead of inherited_id. Second, remove sequence from the xml view - you do not need that for inherited view, which deals with attributes. Third, i do not understand your position="replace" usage of fields like duration partner_mobile or priority - if you use replace, the schema is like

Seth Boyd
著作者

I tried to convert your, Mariusz's, comment to an answer, but it created it under my name for some reason. I've accepted your answer instead.

アバター
Mariusz Mizgier
最善の回答

Easiest way to do that is to use attributes for that. For example, if you want to hide partner_phone just type:

<field name="partner_phone" position="attributes">

<attribute name="invisible">True</attribute>

</field>

That way the field you want to dissapear will be hidden in the form view.

3
アバター
破棄
Seth Boyd
著作者

I updated my original post to include all of my file contents including your suggested change. Unfortunately, it's still not working yet, though.

アバター
Ludo - 21South
最善の回答

And you are 100% sure the view gets loaded? (as in: its in an installed module AND in the __openerp__.py "data" or "update_xml" list?)

If so, try to add the priority (or sequence?) field to your view. The syntax is something like <field name="sequence">15</field>. Give it a low number so it gets picked up last.

Also try to make the id of the xml record unique. I do not know if that matters, but I always tend to make it unique. Just add something like _inherit to the end of it.

[EDIT]

Try to enclose the view adjustments with the <data> tag, like so:

        <field name="arch" type="xml">

           <data>
                <field name="partner_phone" position="replace"/>
                <field name="user_id" position="replace"/>
                <field name="duration" position="replace"/>
                <field name="partner_mobile" position="replace"/>
                <field name="priority" position="replace"/>

            </data>
        </field>

Other than that I would not see why this would not work. I'm unfortunately not in the position to test it currently.

1
アバター
破棄
Seth Boyd
著作者

I've edited my original post to include the contents of all four files in the module. Also, I tried your suggested changes, but nothing has worked so far. The module is installed, and the view id changed in the debugging interface when I made it unique, so it is getting some of the file updates.

Ludo - 21South

I've edited my original answer. If that fails then I don't know what would be wrong. Assuming you did not make any typo's in the XML names. Can you check the database to verify the view itself is actually loaded?

OdooBot
The view is actually loaded, but it doesn't have an inherited_id for some reason.  It's weird when I preview my view from the debugging interface my changes aren't showing up there either.  Perhaps it is using my view changes, but my view changes aren't formatted properly so their not having their intended effect.


Here is the row for the created view:
"933";"crm.phonecall";
"data";
"<?xml version="1.0"?>
<data>
                <field name="partner_phone" position="attributes">
                    <attribute name="invisible">True</attribute>
                </field>
                <field name="user_id" position="attributes">
                    <attribute name="invisible">True</attribute>
                </field>
                <field name="duration" position="replace"/>
                <field name="partner_mobile" position="replace"/>
                <field name="priority" position="replace"/>
            </data>
        ";
"";
16;1;
"2014-08-01 13:43:59.672517";
"2014-08-01 14:28:33.136775";
1;
; <-- This should be the inherited_id
"CRM - Phone Call Form"

Here is the row for the view I'm trying to inherit from:
"928";
"crm.phonecall";
"form";
"<?xml version="1.0"?>
<form string="Phone Call" version="7.0">
                <header>
                    <button name="case_close" string="Call Done" type="object" class="oe_highlight" states="open,pending"/>
                    <button name="case_reset" string="Reset to Todo" type="object" states="cancel"/>
                    <button name="case_cancel" string="Cancel Call" type="object" states="draft,open,pending"/>
                    <field name="state" widget="statusbar" nolabel="1" statusbar_visible="open,done"/>
                </header>
                <sheet string="Phone Call">
                    <div class="oe_right">
                        <button string="Convert to Opportunity" type="object" name="action_button_convert2opportunity" attrs="{'invisible':[ '|', ('opportunity_id','!=',False), ('state', 'not in', ('open', 'done'))]}"/>
                        <button string="Schedule Other Call" name="505" type="action"/>
                        <button string="Schedule a Meeting" name="action_make_meeting" type="object"/>
                    </div>
                    <div class="oe_title">
                        <div class="oe_edit_only">
                            <label for="name"/>
                        </div>
                        <h1><field name="name" required="1"/></h1>
                        <div class="oe_edit_only">
                            <label for="partner_phone" string="Phone"/>
                        </div>
                        <h2><field name="partner_phone"/></h2>
                    </div>

                    <group col="4">
                        <field name="date"/>
                        <field name="user_id"/>
                        <field name="duration" widget="float_time"/>
                        <field name="section_id" colspan="1" widget="selection"/>
                        <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
                        <field name="email_from" invisible="1"/> <!--not needed because of the chatter, thus invisible, but must be in the view as it's returned by onchange_partner_id()-->
                        <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
                        <field name="partner_mobile"/>
                        <field name="priority"/>
                        <field name="opportunity_id" on_change="on_change_opportunity(opportunity_id)"/>
                    </group>
                    <field name="description" placeholder="Description..."/>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
            </form>
        ";
"";
16;
1;
"2014-07-27 16:22:20.594678";
"2014-07-27 16:22:20.594678";
1;
;
"CRM - Phone Call Form"

Thanks for your help,
Seth


On Fri, Aug 1, 2014 at 8:22 AM, Ludo - Neobis <ludo@neobis.nl> wrote:

I've edited my original answer. If that fails then I don't know what would be wrong. Assuming you did not make any typo's in the XML names. Can you check the database to verify the view itself is actually loaded?

--
Ludo - Neobis Sent by OpenERP S.A. using Odoo. Access your messages and documents in Odoo

アバター
Eduardo de Miguel
最善の回答

You should use "replace", but leaving a blank space inside

<field name="partner_phone" position="replace">

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

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

登録
関連投稿 返信 ビュー 活動
View inheritance 解決済
view inheritance
アバター
アバター
1
3月 20
4328
Weird error "Expression cannot be located in parent view" in view inheritance 解決済
view inheritance
アバター
アバター
1
7月 16
7883
Problem with inheritance of a view. 解決済
view inheritance
アバター
アバター
1
3月 15
8680
Is "search + use arch" the right way to derive a form ?
view inheritance
アバター
0
3月 15
4557
view inheritance in openerp
view inheritance
アバター
アバター
1
3月 15
4324
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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