Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How do I remove fields from a view in a custom module?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
viewinheritance
12 Răspunsuri
36164 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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
Autor

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

Seth Boyd
Autor

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
Autor

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.

Imagine profil
Mariusz Mizgier
Cel mai bun răspuns

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
Imagine profil
Abandonează
Seth Boyd
Autor

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

Imagine profil
Ludo - 21South
Cel mai bun răspuns

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
Imagine profil
Abandonează
Seth Boyd
Autor

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

Imagine profil
Eduardo de Miguel
Cel mai bun răspuns

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

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

</field>
0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
View inheritance Rezolvat
view inheritance
Imagine profil
Imagine profil
1
mar. 20
4332
Weird error "Expression cannot be located in parent view" in view inheritance Rezolvat
view inheritance
Imagine profil
Imagine profil
1
iul. 16
7888
Problem with inheritance of a view. Rezolvat
view inheritance
Imagine profil
Imagine profil
1
mar. 15
8685
Is "search + use arch" the right way to derive a form ?
view inheritance
Imagine profil
0
mar. 15
4559
view inheritance in openerp
view inheritance
Imagine profil
Imagine profil
1
mar. 15
4329
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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