Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Creating new view from a old view

Subscriure's

Get notified when there's activity on this post

This question has been flagged
viewres.partnerinherit
11 Respostes
14480 Vistes
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
Descartar
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
Best Answer

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
Descartar
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?

Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
inherit res.partner view
view res.partner inherit
Avatar
Avatar
1
de març 15
12030
How to inherit from view to add an element in it ?
view inherit
Avatar
Avatar
1
de març 15
9447
How to create another type of Invoice with other sequence?
view inherit
Avatar
0
de març 15
4873
Inherit a predefined view.
view inherit
Avatar
Avatar
1
de març 15
6483
How to add a field conditional to tree view of customer? Solved
treeview view res.partner hide inherit
Avatar
Avatar
Avatar
Avatar
Avatar
4
de des. 23
40173
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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