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
    • e-learning
    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
    • Conocimientos
    • 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 pub
    • 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
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • 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
    Explorar todos los sectores
  • 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
    • Servicios para 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

Open a View in Pop Up in a one to many relationship

Suscribirse

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

Se marcó esta pregunta
viewpopupcustom_module
1 Responder
7749 Vistas
Avatar
Cyrus Waithaka

Hi good people.

I am creating an addon to add a questionnaire to the partners view. I want this to be done under a "Questionnaire" tab that I have added to the partners view.

I have created the questionnaire model as follows

class customer_questionnaire(osv.osv):

  _name = "customer.questionnaire"

_columns = {
    #'partner': fields.many2one('res.partner', 'Partner', ondelete='cascade', select=1),
    'name': fields.char('Name', size=15, required=True), #several fields

I then extend Partners object as follows to add a questionnaire field:

class Partner(osv.osv):
    '''Partner'''
    _inherit = 'res.partner'
    _columns = {
    'questionnaire': fields.one2many('customer.questionnaire', 'partner', 'Confidential Questionnaire', help="Click to view/edit user's confidential questionnaire."),
    }

Here is the view that is adding the tab under customers page and a questionnaire field with a tree:

<page string='Questionnaire'>
                        <separator string="Customer Questionnaire" colspan="4" />
                        <field name="questionnaire" nolabel="1" colspan="4" readonly="1">
                            <tree string="Questionnaires">
                                <field name="work_hours" />
                                <field name="commute" />
                            </tree>
                            <form string="Questionnaires">
                                <field name="work_hours" />
                                <field name="commute" />
                            </form>
                        </field>
                    </page>

This still doesnt open the questionnaire view in pop up. I suppose I am missing something. What am I doing wrong? Can someone please outline the steps that I need to follow to open the questionnaire when I click on a row in the tab. Like how the contacts tab under company customers is made.

Thank you

 

2
Avatar
Descartar
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Mejor respuesta

Hello Cyrus,

There are several mistakes which you need to correct.
1. You have to uncomment partner many2one field in customer.questionnaire object.
2. I don't see any fields named "work_hours" and "commute". Instead of them, you have to define "name" field in xml (or create appropriate field in py under customer.questionnaire object)
3. You have to remove readonly attribute from xml.

Corrected code:

Corrected code:

class customer_questionnaire(osv.osv):
    _name = "customer.questionnaire"
    _columns = {
        'partner': fields.many2one('res.partner', 'Partner', ondelete='cascade', select=1),
        'name': fields.char('Name', size=15, required=True), #several fields
    }

<page string='Questionnaire'>
    <separator string="Customer Questionnaire" colspan="4"/>
    <field name="questionnaire" nolabel="1" colspan="4">
        <tree string="Questionnaires">
            <field name="name"/>
        </tree>
        <form string="Questionnaires">
            <field name="name" />
        </form>
    </field>
</page>

2
Avatar
Descartar
Cyrus Waithaka
Autor

Hi Sudhir, Thank you for your answer. Sorry, I did not paste the entire code. But I have tried your suggestions with no luck. Is the pop up created automatically once I add the relationship field on the view or am I required to define a function that creates the pop up? Here is the entire xml https://www.dropbox.com/s/1vs55p0r18hxzbk/customer_questionaire.xml?dl=0 and then my .py file https://www.dropbox.com/s/9it6dr1drhfqxv9/customer_questionaire.py?dl=0

Sudhir Arya (ERP Harbor Consulting Services)

Yes, system creates pop by default. You just have to define o2m field in xml.

Cyrus Waithaka
Autor

It's creating the tab and the tree view fine but clicking on the field/rows does not generate the pop up. I have shared a link to download my code. please check it out from this link https://www.dropbox.com/sh/ius9524594pk7l6/AAC5P9UCP1ePmhWmhbjkP9cLa?dl=0 Thank you in advance

Cyrus Waithaka
Autor

It works now. An add item button is automatically added if you do the relationships properly. The readonly attribute was the issue. I however do not have enough points to vote your answer. Thank you anyway Sudhir :-)

¿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
How to return a popup when click in validate of account.invoice? Resuelto
wizard view popup return
Avatar
Avatar
2
mar 15
10644
How to make pop ups after actions? Resuelto
popup
Avatar
Avatar
Avatar
2
jul 25
9797
Odoo10: how to set the tree (list) view as default view for Customers and Products in Sales module Resuelto
view
Avatar
Avatar
Avatar
Avatar
4
ene 24
24547
Attrs attribute Resuelto
view
Avatar
Avatar
2
ene 24
3385
Translate pop up in Odoo 14
popup
Avatar
0
nov 23
2119
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