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

Developing a new popup in stock_picking, basic doubts about how to generate the popup

Suscribirse

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

Se marcó esta pregunta
stock_pickingpopuppopupwindowodooV8
1 Responder
9088 Vistas
Avatar
E.M.

I am trying to develop a new popup for stock_picking which will display the move.lines and allow user to select them and print a custom report with selected ones.

As a first try I want to generate the popup with just a couple of fields of the stock.picking.


- Do I have to use models.Transient or models.Model?

- Do I have to give it a different _name="label.picking" or just extend "stock.picking" and use it?

- Do I have to use view_id field in the button controller?


This is the model:


# -*- coding: utf-8 -*-
from openerp import models, fields
class LabelPicking(models.TransientModel):
_name = "label.picking"
_inherit = "stock.picking"
def view_tree_print_dispatch_items(self):
return {
'type': 'ir.actions.act_window',
'name': 'view_tree_print_dispatch_items',
'view_type': 'tree',
'view_mode': 'tree',
'res_model': 'label.picking',
'target': 'new',
}


And this is the XML:

<?xml version="1.0" encoding="utf-8" ?>
<openerp>
<data>
<record model="ir.ui.view" id="stock.view_picking_form_item_labels">
<field name="name">stock.picking.form.item_labels</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='state']" position="before">
<button name="view_tree_print_dispatch_items" string="Imprimir Items" type="object"/>
</xpath>
</field>
</record>

<record id="view_tree_print_dispatch_items" model="ir.ui.view">
<field name="name">Labels Dispatch Items Tree</field>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>-
<field name="origin"/>-
</tree>
</field>
</record>

</data>
</openerp>
 
2
Avatar
Descartar
Avatar
Jose M. González
Mejor respuesta

Hi, 

this example may help, in my case i use popup to update other model and return the original view. (this popup is launched from button)

#modelo temporal para popup.

class refuse_leave(osv.osv_memory):

_name = "refuse.leave"

_description = "Reason that order is not delivered"

_columns = {

'refusal_explanation': fields.text('Refusal explanation', required=True),

'return_reasons_type': fields.many2one('delivery.return.reasons.type','Return type', required=True),

}

     

     #botón de guardar la información introducida en el popup

def refuse_leave(self,cr, uid, ids, context=None):

data = self.read(cr,uid,ids)[0] 

return_reason = data['refusal_explanation']

return_type = data['return_reasons_type'][0]

if return_reason == "" or( len(return_reason)< 5):

raise osv.except_osv(_('Error'), _('Motivo no válido'))

else:

delivery_route_line_obj = self.pool.get('delivery.route.line')

record_id = context.get('delivery_line_id')

tipo_incidencia = context.get('tipo_entrega')     

[ operaciones que tenga que realizar ]

return True

refuse_leave()


<!-- xml con el modelo del popup --> <?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<record id="view_refuse_leave" model="ir.ui.view">

<field name="name">Leave Refuse</field>

<field name="model">refuse.leave</field>

<field name="arch" type="xml">

<form string="Refuse_Leave"> <!-- position="attributes"-->

<separator string="Información de recepción de pedido" />

<attribute name="string"> Seleccione el motivo por el cual el pedido no se entregó correctamente del siguiente desplegable:<br></br></attribute>

<!-- <div style="float:left; widht:30%;">

<field name="return_reasons_type" />

</div> -->

<group colspan="0" col="0">

<div><b>Razones</b> </div><newline />

<field name="return_reasons_type" nolabel="1" />

<field name="refusal_explanation" nolabel="1" placeholder="Indique el motivo por el que no se pudo entregar es pedido..." />

<small>

<b>Información</b><br></br>

Es obligatorio que indique algún texto de por qué este pedido no fue entregado correctamente.

</small>

</group>

<footer>

<button string="Guardar motivo" class="oe_highlight" type="object" name="refuse_leave" />

<button string="Salir" special="cancel" /> <!-- class="oe_link" -->

</footer>

</form>

</field>

</record>

<record id="action_view_refuse_leave" model="ir.actions.act_window">

<field name="name">Leave Refuse</field>

<field name="type">ir.actions.act_window</field>

<field name="res_model">refuse.leave</field>

<field name="view_type">form</field>

<field name="view_mode">form</field>

<field name="target">new</field>

</record>

</data>

</openerp>

<!-- xml que lanzará el popup -->

...

<button name="action_received_with_exception" string="Received with exception"

type="object" states="delivered" />



#python desde donde lanza la acción del botón

def action_received_with_exception (self, cr, uid, ids, context=None):

context.update({

'tipo_entrega' : 'ok_con_incidencias',

'delivery_line_id': ids[0],

})

try:

return {

'name': 'Causas de devolución de pedido',

'view_type': 'form',

"view_mode": 'form',

'res_model': 'refuse.leave',

'type': 'ir.actions.act_window',

'target': 'new',

'flags': {'action_buttons': False},

'context': context,

}

except ValueError:

raise osv.except_osv(_('Error'))

1
Avatar
Descartar
E.M.
Autor

It helps, now I am trying a transient model which inherits from stock_picking, how do you move a given ID (or parameter) from stock_picking to the popup model/form when you click the button?

Jose M. González

with that question I have also fought x-D with this code: [code] context.update({ 'tipo_entrega' : 'ok_con_incidencias', 'delivery_line_id': value that you want, }) [/code] you can pass the info in the context to popup because you add param 'context': context ( see -> #python desde donde lanza la acción del botón). And you obtain the pass value in this line: record_id = context.get('delivery_line_id') ( see -> #modelo temporal para popup.). May the Force be with you !!!

¿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
Press a button and display a form in a popup, how? Resuelto
qweb popup popupwindow odooV8
Avatar
Avatar
Avatar
2
dic 23
39134
Popup Form, do i need to create a new model? Resuelto
models popup popupwindow odooV8
Avatar
Avatar
1
feb 16
8771
Odoo pop up
time popup popupwindow
Avatar
0
abr 24
2549
Can't validate stock.picking with product on multi-location
stock_picking validateerror odooV8
Avatar
0
sept 19
71
Launch popup to select a certain type of product in the sale.order.line view
sale.order.line popup popupwindow
Avatar
0
may 24
4347
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