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

Why this action menu voice appears only in the sale order view?

Suscribirse

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

Se marcó esta pregunta
actiontreeviewodoo11
1 Responder
5201 Vistas
Avatar
Daniele Morelli

I am using odoo11, and i am working on the following code, that adds a menu item in the "action" dropdown for sale orders, in order for the user to confirm multiple sale orders at once:


Python:

class SaleOrderConfirmWizard(models.TransientModel):
    _name = "sale.order.confirm.wizard"
    _description = "Wizard - Sale Order Confirm"

    @api.multi
    def confirm_sale_orders(self):
        self.ensure_one()
        active_ids = self._context.get('active_ids')
        orders = self.env['sale.order'].browse(active_ids)
        for order in orders:
            print(order.id)
            if order.state in ['draft', 'sent']:
                order.action_confirm()
 

XML:

    <record id="view_confirm_sale_order" model="ir.ui.view">
        <field name="model">sale.order.confirm.wizard</field>
        <field name="arch" type="xml">
            <form string="Confirm Sale Orders">
                <footer>
                    <button name="confirm_sale_orders" string="Confirm" type="object" class="oe_highlight"/>
                    or
                    <button string="Cancel" class="oe_link" special="cancel" />
                </footer>
            </form>
        </field>
    </record>

    <record id="action_confirm_sale_order" model="ir.actions.act_window">
        <field name="name">Confirm Sale Orders</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">sale.order.confirm.wizard</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="view_confirm_sale_order" />
        <field name="target">new</field>
        <field name="multi">True</field>
    </record>

    <act_window id="confirm_sale_order"
        name="Confirm Sale Orders"
        src_model="sale.order"
        res_model="sale.order.confirm.wizard"
        view_type="form"
        view_mode="form"
        key2="client_action_multi"
        target="new"/>

Now, I may be blind, but I can't see anywhere the reference to the treeview (which is "sale.view_order_tree" if im not wrong) this stuff should appear in.

I wanted something similar for the "quotation" treeview, and i thought i had to change some view reference (quotations are still instances of "sale.order" model, so i guess i have to change nothing on the model side)...

But, as strange as it sounds, i cannot find in this code any reference to the sale order treeview to change. I am probably missing something very evident, so please forgive this pretty dumb question.

Thank you in advance


EDIT:

I can't really explain why, but now i can see the new menu item even in the quotation page (maybe i didn't refresh properly the page?). In any case, i'd like to know if its normal that there is no explicit reference to the view?

0
Avatar
Descartar
Avatar
Pablo Guerra
Mejor respuesta

Didn't get why you added 2 act windows.

For your purpose, ie to confirm together multiple sale records, the action button should only appear only in the tree view, and not in the form view.

So after you defined the view (id="view_confirm_sale_order")
you'll need to define just one act window

something like

<act_window id="action_confirm_multiple_orders"
            name="Confirm Multiple orders"
            key2="client_action_multi"
            view_mode="form"
            multi="True"
            target="new"
            src_model="sale.order"
            res_model="sale.order.confirm.wizard"
        />


Instead of 2 act windows.

Please accept and Upvote, if useful.

1
Avatar
Descartar
Daniele Morelli
Autor

Thank you for your kind answer... I must admit that i based my code on stuff i found online. Probably the original author was interested in making the menu voice appear in both kind of views...

Cheers

¿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
Select multiple rows and perform one action - Odoo 11 Resuelto
treeview odoo11
Avatar
Avatar
Avatar
2
may 21
20178
How to call ir.actions.client in a thread?
action odoo11
Avatar
0
ago 19
4698
Can i populate data from O2M lines on button type action in another form O2M lines??
action button odoo11
Avatar
Avatar
1
jun 20
3296
Automated action for all models
action automated odoo11
Avatar
0
feb 19
3590
Error while trying to display a model's tree view Resuelto
action treeview act_window
Avatar
Avatar
1
feb 19
8163
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