Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

What should the view inherit from?

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
pythonxmlviewmany2one
5163 Vistas
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
Descartar
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?

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Can you use the dot notation in XML attrs?
attrs xml view many2one
Avatar
Avatar
1
oct 22
10527
openerp 7 .netsvc: Unable to use a closed cursor.
python xml many2one __openerp__.py
Avatar
0
mar 15
7127
OpenERP 7 many2one with current month filter
filter python xml many2one
Avatar
Avatar
2
mar 15
30240
How to hide view.xml fields group in Account module with attr
python xml
Avatar
Avatar
Avatar
2
dic 23
13940
how to remove first empty element from fields.selection Resuelto
python xml
Avatar
Avatar
Avatar
3
jul 22
24353
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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