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

Creating new view from a old view

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
viewres.partnerinherit
11 Respostas
14481 Visualizações
Avatar
Lawrence

I have to create a view from the view "view_partner_tree"(base.res_partner) without touching the original. In the view that I create, I have to add some function field (not stored). I managed to create a new module displaying the view "view_partner_tree" on a different page. Would really kind of any of you to maybe guide me a bit through it or to give me a link that might help. (I have read anything google could find me with (inheritance, view)

_description = 'Aged Partner Balance'   
def _get_not_due(self, cr, uid, ids, name, arg, context):
    res = {}
    return res

_name = 'aged.partner.balance'
_columns = {
    'not_due': fields.function(_get_not_due, type='char', string="Not Due")       
    }   


    <record id="view_partner_tree" model="ir.ui.view">
        <field name="name">res.partner.tree</field>
        <field name="model">res.partner</field>
        <field eval="8" name="priority"/>
        <field name="arch" type="xml">
            <tree string="Contacts">
                <field name="name"/>
                <field name="function" invisible="1"/>
                <field name="phone"/>
                <field name="email"/>
                <field name="user_id" invisible="1" />
                <field name="is_company" invisible="1"/>
                <field name="country" invisible="1"/>
                <field name="country_id" invisible="1"/>
                <field name="parent_id" invisible="1"/>
            </tree>
        </field>
    </record>
   <record id="view_res_partner_filter" model="ir.ui.view">
        <field name="name">res.partner.select</field>
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <search string="Search Partner">
               <field name="name"
                   filter_domain="['|','|',('name','ilike',self),('parent_id','ilike',self),('ref','=',self)]"/>
               <filter help="My Partners" icon="terp-personal+" domain="[('user_id','=',uid)]"/>
               <separator/>
               <filter string="Persons" name="type_person" icon="terp-personal" domain="[('is_company','=',0)]"/>
               <filter string="Companies" name="type_company" icon="terp-partner" domain="[('is_company','=',1)]"/>
               <separator/>
               <filter string="Customers" name="customer" icon="terp-personal" domain="[('customer','=',1)]" help="Customer Partners"/>
               <separator/>
               <filter string="Suppliers" name="supplier" icon="terp-personal" domain="[('supplier','=',1)]" help="Supplier Partners"/>
               <field name="category_id" string="Tag" filter_domain="[('category_id','ilike', self)]"/>
               <field name="user_id"/>
               <field name="parent_id" filter_domain="[('parent_id','child_of',[self])]"/>
               <group expand="0" string="Group By...">
                   <filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by' : 'user_id'}" />
                   <filter string="Company" context="{'group_by': 'parent_id'}"/>
               </group>
           </search>
        </field>
    </record>


    <record id="action_partner_form" model="ir.actions.act_window">
        <field name="name">Aged Partner Balance</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">res.partner</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree</field>
        <field name="context">{"search_default_customer":1}</field>
        <field name="search_view_id" ref="view_res_partner_filter"/>
    </record>

    <record id="action_partner_tree_view1" model="ir.actions.act_window.view">
        <field name="sequence" eval="1"/>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="view_partner_tree2"/>
        <field name="act_window_id" ref="action_partner_form"/>
    </record>


    <menuitem id="menu_partner_form" parent="base.menu_sales" action="action_partner_form" sequence="1"/>
</data>

</openerp>

1
Avatar
Cancelar
Bonnet Denis

What do you want to say about "different pages" : in a new menu or a new tab in form view?

Lawrence
Autor

in a new menu

Sehrish

You just need to inherit original view

Avatar
Bonnet Denis
Melhor resposta

This is an example I make to a perso module:

<record id="view_task_form2_inherit" model="ir.ui.view">
    <field name="name">project.task.form.inherit</field>
    <field name="model">project.task</field>
    <field name="inherit_id" ref="project.view_task_form2"/>
    <field name="arch" type="xml">
        <field name="work_ids" groups="project.group_tasks_work_on_tasks" position="replace">
            <field name="work_ids" groups="project.group_tasks_work_on_tasks">
                <tree string="Task Work" editable="top">
                    <field name="id" invisible='1'/>
                    <field name="name" on_change="onchange_name(name,id)"/>
                    <field name="date" on_change="onchange_date(date,id)"/>
                    <field name="hours" widget="float_time" sum="Spent Hours" on_change="onchange_hours(hours,id)"/>
                    <field name="user_id" on_change="onchange_user_id(user_id,id)"/>
                </tree>
            </field>
        </field>
    </field>
</record>

Here the documentation about inheritance in Views in V6.1(Work with v7.0 too)

When you create a new menu, you associate this to a act_window and this act_window have to be associate to your custom view. If you need some more explication I can give it.

1
Avatar
Cancelar
Lawrence
Autor

I have done something similar aswell. But now I want to create a new module that would looks like the page "Customers" but with like 7 more functions fields. (I read that doc a while ago, but thanks).

Bonnet Denis

Inherit from "Customers" view, add some function fields and call your new view In your module.

Lawrence
Autor

I thought that doing so would just add the new fields in the old "customers" view and wouldnt create a different view. I think I have a idea tho. Im going to try this right away. Anything i should put in the .py?

Lawrence
Autor

When I do that I get a error which says that it can't find the function field that i added in the model : "res.partner", but when i put mine "aged.partner.balance" it says that it cant render the view with this model

Lawrence
Autor

Can't find field 'not_due' in the following view parts composing the view of object model 'res.partner': Can't render view aged_partner_balance.view_partner_tree for model: aged.partner.balance

Bonnet Denis

Do you have restart the server and update your module? see http://help.openerp.com/question/1118/how-can-i-reload-source-code-without-restarting-the-openerp-server/

Lawrence
Autor

yes :S do you want me to show you my .py and xml?

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
inherit res.partner view
view res.partner inherit
Avatar
Avatar
1
mar. 15
12030
How to inherit from view to add an element in it ?
view inherit
Avatar
Avatar
1
mar. 15
9448
How to create another type of Invoice with other sequence?
view inherit
Avatar
0
mar. 15
4874
Inherit a predefined view.
view inherit
Avatar
Avatar
1
mar. 15
6483
How to add a field conditional to tree view of customer? Resolvido
treeview view res.partner hide inherit
Avatar
Avatar
Avatar
Avatar
Avatar
4
dez. 23
40174
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