Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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
4721 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.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
psycopg2.ProgrammingError: no existe la relación «_unknown» Please HELP!!!!
odoo odoo12
Avatar
Avatar
2
nov 25
258
Reverse Transfer - how to stop returning more than was delivered - Odoo.sh v16
returns odoo
Avatar
Avatar
1
dic 24
3685
How to track One2many field in Odoo12? Resuelto
odoo odoo12
Avatar
Avatar
Avatar
Avatar
3
nov 23
18458
Error: Couldn't load module web Resuelto
odoo odoo12
Avatar
Avatar
Avatar
3
nov 24
26551
How I get the current ID of a record ? Resuelto
odoo odoo12
Avatar
Avatar
1
abr 23
6936
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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