Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

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

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

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

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
viewinheritance
12 Respostas
36175 Visualizações
Avatar
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
Avatar
Cancelar
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.

Avatar
Mariusz Mizgier
Melhor resposta

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
Avatar
Cancelar
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.

Avatar
Ludo - 21South
Melhor resposta

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
Avatar
Cancelar
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

Avatar
Eduardo de Miguel
Melhor resposta

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

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

</field>
0
Avatar
Cancelar
Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
View inheritance Resolvido
view inheritance
Avatar
Avatar
1
mar. 20
4341
Weird error "Expression cannot be located in parent view" in view inheritance Resolvido
view inheritance
Avatar
Avatar
1
jul. 16
7894
Problem with inheritance of a view. Resolvido
view inheritance
Avatar
Avatar
1
mar. 15
8695
Is "search + use arch" the right way to derive a form ?
view inheritance
Avatar
0
mar. 15
4564
view inheritance in openerp
view inheritance
Avatar
Avatar
1
mar. 15
4336
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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