Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

What should the view inherit from?

Odebírat

Get notified when there's activity on this post

This question has been flagged
pythonxmlviewmany2one
5147 Zobrazení
Avatar
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
Avatar
Zrušit
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!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Can you use the dot notation in XML attrs?
attrs xml view many2one
Avatar
Avatar
1
říj 22
10520
openerp 7 .netsvc: Unable to use a closed cursor.
python xml many2one __openerp__.py
Avatar
0
bře 15
7120
OpenERP 7 many2one with current month filter
filter python xml many2one
Avatar
Avatar
2
bře 15
30234
How to hide view.xml fields group in Account module with attr
python xml
Avatar
Avatar
Avatar
2
pro 23
13932
how to remove first empty element from fields.selection Vyřešeno
python xml
Avatar
Avatar
Avatar
3
čvc 22
24349
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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