Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Clone a view with its modifications (extend res.partner)

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
viewsviewinheritanceres.partnerprogrammingcloneinheri
7579 Weergaven
Avatar
Javier Matos Odut

Hello,

I am a developer and I have created some modules for OpenERP v7 that we use in our company. I have a difficult problem that I want to solve and that's why I am willing someone to share some knowledge with me.

I have a module that extends res.partner to add many fields that we need for our customers. The problem with this is that there are many entities or models that depend on res.parther (res.user for instance). When I add fields to res.partner and extend the form view, then views or models that depend on res.partner are also modified, even when they have nothing to do with customers. This is ugly, because providers and users get those new fields, and I don't want that to happen.

A second approach was to use _inherits in order to control an inner partner, but also add the fields that I want:

_name = 'mycompany.customer'
_inherits = {
    'res.partner': 'partner_id',
}
_columns = {
    ...
}

This approach is cleaner. Now my customers have the basic information in res.partner, but I also add extra fields in my mycompany.customer model. The bad thing is that I have to write my own views from the scratch. What I do for this is to copy res.partner views and extend them. The worst part of this is that when an additional module changes res.partner view, then the view for my customer is not modified, so I have to copy the modifications that this module does into my own code.

What is the best way to do what I want? I just want new fields to be added to a customer, but not to a provider nor a user. I thought about adding a "clone" feature to OpenERP to clone views and its modifications. This way I will be able to clone res.partner views and make some changes to include customer fields.

1
Avatar
Annuleer
Leonardo Donelli

Can't you just extend the form view normally (as you did initially) and make the fields invisible when the partner is not a customer?

Javier Matos Odut
Auteur

Thank you Leonardo, that is a good idea. How can I know when the partner is a customer? Can I just use domain with customer = 1? What I was trying now is to redefine the fields_view_get function, that is supposed to create a view dynamically. I will check your suggestion first, which seems to be easier. Thank you so much :)

Javier Matos Odut
Auteur

Done, thank you so much Leonardo :)

Leonardo Donelli

Yes you can use [('customer', '=', 1)] assuming you correctly flagged customers. Personally, I would add a tab in the res_partner form view notebook (called 'Customer info'), with all the customers-only fields, and show that only when partner is a customer.

Javier Matos Odut
Auteur

That is exactly what I had. There where also some minor changes that I made outside that customer notebook, but they were also hidden successfully. Thank you so much again, I was looking for an "Star Wars hiper-complex solution" doing meta programming to extend cloned views (with fields_view_get) but your proposal is just the easiest and most correct way to do it. Thank you again :)

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
attribute error in inherited view?
view inheritance res.partner
Avatar
Avatar
Avatar
2
mrt. 15
9710
I want to use res_partner view to another menu action with fields (not all) in res_partner
views inheritance res.partner odoo
Avatar
Avatar
1
nov. 21
3996
inherited form does not display correctly?
view inheritance res.partner look
Avatar
Avatar
Avatar
3
okt. 20
6663
view inherit from res.partner appears all one page with no styling or formatting
view inheritance res.partner appearance
Avatar
Avatar
1
mrt. 15
7459
custom_function is not a valid action on... Opgelost
views view inheritance buttons odoo
Avatar
Avatar
1
nov. 22
7993
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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