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 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

Not returning list view

Suscribirse

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

Se marcó esta pregunta
returnsodooodoo12
4 Respuestas
4748 Vistas
Avatar
Grf


I have this model

class RawMaterialReport(models.Model):
    _name = 'raw.material.report'
    _description = 'Raw Material Report'

    product_id = fields.Many2one(
        'product.product', string='Product',
        required=False,
    )

    @api.multi
    def open_raw_materials(self):
        mrp_productions = self._context.get('active_ids')
        mrp_production = 
        self.env['mrp.production'].browse(mrp_productions)
        raw_products = 
        mrp_production.mapped('move_raw_ids.product_id')
        for p in raw_products:
            self.create({'product_id': p.id})

        view_id = self.env.ref('trk.raw_material_report_tree').id
        view = {
            'name': _('Details'),
            'view_type': 'form',
            'view_mode': 'tree, form',
            'res_model': 'raw.material.report',
            'views': [(view_id, 'form')],
            'type': 'ir.actions.act_window',
            # 'res_id': self.id,
        }
        return view

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data>

    <record id="raw_material_report_tree" model="ir.ui.view">
        <field name="name">raw.material.report.tree</field>
        <field name="model">raw.material.report</field>
        <field name="priority">2</field>
        <field name="arch" type="xml">
            <tree string="Sales Orders" >
                <field name="product_id" />
            </tree>
        </field>
    </record>



     <record id="action_raw_material_report" 
            model="ir.actions.act_window">
            <field name="name">zzzzz</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">raw.material.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,kanban,form</field>
        </record>


        <record id="action_server_learn_skill" 
            model="ir.actions.server">
            <field name="name">test</field>
            <field name="type">ir.actions.server</field>
            <field name="model_id" ref="model_raw_material_report" />
            <field name="binding_model_id" 
            ref="mrp.model_mrp_production" />
            <field name="state">code</field>
            <field name="code">model.open_raw_materials()</field>
        </record>

        <menuitem id="menu_sale_order1"
            name="test"
            action="action_raw_material_report"
            parent="sale.sale_order_menu"
            sequence="2" />
    </data>
</openerp>

When I go to action and run my method everything goes good until that point where I try to return a view it just not redirecting me to my tree view. Nothing happens. But raw.material.report Records got created and I can check them if I go to my menu, it opens list view with them. So there is some kind of a problem with my return, can someone help on this? I actually tried to return an action like this

action = self.env.ref('trk.action_raw_material_report').read()[0]
return action

but get the same, it just not redirecting me to my tree view.


0
Avatar
Descartar
Avatar
Thayif kabir
Mejor respuesta

Hi,

 Try this one

 return {
        'name': _('Details'),
        'view_type': 'form',
        'view_mode': 'tree, form',
        'res_model': 'raw.material.report',
        'views': [(view_id_tree[0].id, 'tree'),(False,'form')],
        'type': 'ir.actions.act_window',
        # 'res_id': self.id,
        'target': 'current',
    } 
Issue occurs because you may be passing wrong id in views [(view_id,'form')] instead of [(view_id,'tree')]
0
Avatar
Descartar
Avatar
Grf
Autor Mejor respuesta


The problem was that in action_server_learn_skill

I needed

<field name="code">action = model.open_raw_materials()</field>

instead of

<field name="code">model.open_raw_materials()</field>

because the method is not returning anything to action.


0
Avatar
Descartar
Avatar
Dhaval Desai
Mejor respuesta

 Hello Grf.​

 Please try this:

 @api.multi
 def your_function_name(self):
    tree_view_id = self.env.ref('trk.raw_material_report_tree').id
    return {
        'name': _('Details'),
        'type': 'ir.actions.act_window',
        'res_model': 'raw.material.report',
        'view_type':'form',
        'view_mode': 'tree',
        'view_id': tree_view_id,
        'res_id': False,
        'context': False,
        'target':'new'
    }

 You can refer below link:

 \https://www.odoo.com/forum/help-1/question/how-to-return-a-tree-view-from-a-python-function-119786           

 Make sure it will helpful.


 Thank you.

0
Avatar
Descartar
Grf
Autor

same result, nothng happens

¿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
psycopg2.ProgrammingError: no existe la relación «_unknown» Please HELP!!!!
odoo odoo12
Avatar
Avatar
2
nov 25
280
Reverse Transfer - how to stop returning more than was delivered - Odoo.sh v16
returns odoo
Avatar
Avatar
1
dic 24
3704
How to track One2many field in Odoo12? Resuelto
odoo odoo12
Avatar
Avatar
Avatar
Avatar
3
nov 23
18475
Error: Couldn't load module web Resuelto
odoo odoo12
Avatar
Avatar
Avatar
3
nov 24
26569
How I get the current ID of a record ? Resuelto
odoo odoo12
Avatar
Avatar
1
abr 23
6964
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