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

How to use two specific views (tree and form view) when using ir.actions.act_window

Suscribirse

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

Se marcó esta pregunta
formtreeir.actions.act
2 Respuestas
8780 Vistas
Avatar
Javier

Hello everybody,


I am trying to call account.invoice_tree and account.invoice_form views as tree and form views respectively from another view. The behaviour I would like to have is that all related invoices (to a lead record, for which I defined a button  to get them) be shown, first  in a list (using account.invoice_tree view),  and then after one of the invoices is clicked, I want the invoice displayed in account.invoice_form view). I attempted to get tha behavior by using the views field inside the ir.actions.act_window record as shown below, but it does'n work (ie the app always shows invoice_supplier_form . Can anybody provide guidance on it.


Thanks a lot in advance. I apreciate your response.


Javier



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

<field name="name">Sale Invoices</field>

<field name="res_model">account.invoice</field>

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

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

<field name="views">[[%(account.invoice_tree)d, "tree"], [%(account.invoice_form)d, "form"]</field>

 <field name="domain">[('lead_id', '=', lead_id), '|', ('type', '=', 'out_invoice'), ('type', '=', 'out_refund')]</field>

<field name="context">{'default_lead_id': lead_id}</field>

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

</record>

<button class="oe_stat_button" type="action" name="%(action_invoice_receivable_attach)d"

context="{'lead_id': active_id}" icon="fa-clipboard">

<field string="Sale Invoices" name="invoice_receivable_count" widget="statinfo" options="{'label_field': 'INVOICE_RECEIVABLE'}"/>

</button>


---------******-------


class crmLead(models.Model):

_inherit = 'crm.lead'

def _invoice_receivable_count(self):

invoices = 0

for invoice in self.invoices:

if 'out_invoice' == invoice.type or 'out_refund' == invoice.type:

invoices += 1

self.invoice_receivable_count = invoices

0
Avatar
Descartar
Avatar
Axel Mendoza
Mejor respuesta

Hi @Javier

There are two ways of doing that, assuming that you have a field invoices in the crm.lead and that you wanna display the invoices for the lead partner(you could change it to match your concept).

1- You could use the invoice search filters in conjunction with the button context to show the list view filtered by default with the partner of the lead. 

<button class="oe_stat_button" type="action" name="%(action_invoice_receivable_attach)d" context="{'search_default_partner_id': partner_id}" icon="fa-clipboard">

<field string="Sale Invoices" name="invoice_receivable_count" widget="statinfo" options="{'label_field': 'INVOICE_RECEIVABLE'}"/>

</button>

2- The other way involve changing the button type to "object" and in the method action for the button return the invoice action with a domain that filter all the invoice results

0
Avatar
Descartar
Avatar
Javier
Autor Mejor respuesta

Thank you Axel. I appreciate your response.


Regards.

0
Avatar
Descartar
¿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
Tree not showing "Add an item"
form tree
Avatar
Avatar
Avatar
Avatar
3
may 20
8372
One model, two forms and trees, how to set this up?
developement form tree
Avatar
Avatar
Avatar
3
abr 24
2726
Make a boolean field editable in a tree view with the possibility of open a form view when clicking on a row ?? Resuelto
editable form tree
Avatar
Avatar
2
nov 18
14146
how to use tree in form view
form view tree
Avatar
Avatar
1
mar 15
8905
can i use hierarchical chart in form view
form view tree
Avatar
0
mar 15
4859
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