Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

What should the view inherit from?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
pythonxmlviewmany2one
5146 Vizualizări
Imagine profil
francois.ribemont

I am trying to do something really simple here. But I can't find anything in the docs, or on help.openerp.com

I added a field (which is a many2one relationship with another table) on a form. This created a dropdown menu where can either pick or create new values.

If you click on "Create and Edit", this will open a new window, where you have a field that you can fill in, and save. But the label for this field is "unknown". Someone explained to me that I need to create a view for this form.

So I did, I created this view, at first, I inherited from another form (the users' one), but it throwing me error, moaning about missing fields. My question is: What should I inherit from?

The process works without defining my own view for this, but whenever I pick an existing record, create a new one, the value doesn't appear, but instead I have the name of the table, and its identifier as a link to the record (that will open a new window if I recall correctly). Is there a way to do a lookup instead, and display the value?

Here the code:

counties_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="hubclub_counties_form">
            <field name="name">hubclub.counties.form</field>
            <field name="model">hubclub.counties</field>
            <field name="inherit_id" ref="base.view_users_form"/>
            <field name="arch" type="xml">
                <group>
                    <field name="county" />
                </group>
            </field>
        </record>
    </data>
</openerp>

extra-attributes.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="hubclub_res_users_form">
            <field name="name">res.users.form</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="base.view_users_form"/>
            <field name="arch" type="xml">
                <xpath expr="/form/sheet/notebook/page[2]" position="after">
                    <page string="Hubclub specific settings">
                        <group>
                            <field name="county_id" />
                        </group>
                    </page>
                </xpath>
            </field>
        </record>
    </data>
</openerp>

__openerp__.py

# -*- coding: utf-8 -*-

{
    'name': 'Hubclub module',
    'version': '1.0',
    'author': 'Openapp',
    'category': 'Tools',
    'depends': ['base', 'point_of_sale'],
    'data': ['extra-attributes.xml', 'counties_view.xml'],
    'demo': [],
    'installable': True,
}

hubclub_module.py

# -*- coding: utf-8 -*-

from openerp.osv import fields, osv


class hubclub_counties(osv.osv):
    _name = 'hubclub.counties'
    _columns = {
        'county': fields.text(),
    }
    _sql_constraints = [('county_uniq', 'unique(county)',
                         'Country already exists')]


# User
class res_users(osv.osv):
    _name = 'res.users'
    _inherit = 'res.users'
    _columns = {
        'county_id': fields.many2one('hubclub.counties', 'County'),
    }
    _defaults = {
    }


res_users()
hubclub_counties()
0
Imagine profil
Abandonează
Gopakumar N G

what is the error? also check that you have defined the model res_users inside hubclub_counties.

francois.ribemont
Autor

There is no error, just the behavior I described. Where can I find documentation on how to define res_users in hubclun_counties?

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Can you use the dot notation in XML attrs?
attrs xml view many2one
Imagine profil
Imagine profil
1
oct. 22
10520
openerp 7 .netsvc: Unable to use a closed cursor.
python xml many2one __openerp__.py
Imagine profil
0
mar. 15
7119
OpenERP 7 many2one with current month filter
filter python xml many2one
Imagine profil
Imagine profil
2
mar. 15
30234
How to hide view.xml fields group in Account module with attr
python xml
Imagine profil
Imagine profil
Imagine profil
2
dec. 23
13930
how to remove first empty element from fields.selection Rezolvat
python xml
Imagine profil
Imagine profil
Imagine profil
3
iul. 22
24348
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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