Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Creating new view from a old view

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
viewres.partnerinherit
11 Réponses
14409 Vues
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
Ignorer
Bonnet Denis

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

Lawrence
Auteur

in a new menu

Sehrish

You just need to inherit original view

Avatar
Bonnet Denis
Meilleure réponse

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
Ignorer
Lawrence
Auteur

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
Auteur

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
Auteur

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
Auteur

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
Auteur

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

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
inherit res.partner view
view res.partner inherit
Avatar
Avatar
1
mars 15
12014
How to inherit from view to add an element in it ?
view inherit
Avatar
Avatar
1
mars 15
9423
How to create another type of Invoice with other sequence?
view inherit
Avatar
0
mars 15
4855
Inherit a predefined view.
view inherit
Avatar
Avatar
1
mars 15
6464
How to add a field conditional to tree view of customer? Résolu
treeview view res.partner hide inherit
Avatar
Avatar
Avatar
Avatar
Avatar
4
déc. 23
40114
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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