Ir al contenido
Odoo Menú
  • Inicia 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
    • Artificial Intelligence
    • 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 propiedades
    • 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
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

Create python filter domain dinamically odoo14

Suscribirse

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

Se marcó esta pregunta
v14
2 Respuestas
1310 Vistas
Avatar
sfs, jonathankabre1@gmail.com

Hi, 
i want to fetch my table account.move.line depending on the value provided from the form.

so normally I have to do this:

"

domains = [(' partner_id ', '=', 'self.partener_id.id'), (' account_id ', '=', 'self.account_id.id'),]

 moves = self.env['account.move.line'].search(domains)

"

But now, having two (02) parameter in domain is not required, so i can have 0, or 1, 0r 2 parameter depending if i filled the imput form   partener_id and  account_id 


so this is what i tried:

"

 if rec. partner_id  .id != False:                

    domains += "('partner_id', '=', '" + str(rec. partner_id  .id) + "'),"           

 if rec. account_id .id != False:                

     domains   += "('account_id', '=', '" + str(rec. account_id .id) + "'),"                                         


moves = self.env['account.move.line'].search([domains])

"

but this return the following error: 

ValueError: Invalid leaf ('partner_id', '=', '8'),('account_id', '=', '2'),


How can i fix it?

 

0
Avatar
Descartar
Niyas Raphy (Walnut Software Solutions)

make sure that the fields are in the corresponding models.
also you can refer this: https://www.youtube.com/watch?v=dq5Vtj_pwuI

sfs, jonathankabre1@gmail.com
Autor
hi, my post displays: 

500: Internal Server Error

can you see what happened?

Le jeu. 30 déc. 2021 à 15:17, Léo Auvray <lau@2crsi.com> a écrit :

Une nouvelle question Create python filter domain dinamically odoo14 le Aide a été publiée. Cliquez ici pour accéder à la question :

Voir la question

Envoyé par Odoo S.A. utilisant Odoo.

Avatar
Jainesh Shah(Aktiv Software)
Mejor respuesta

This error is because you are concating the string and use it as domain,
As domains are must be a list of tuples or list of list

So you can make your domain like this.

domains = []

if rec.partner_id.id != False:
domains += [('partner_id', '=', rec.partner_id.id)]

if rec.account_id.id != False:
domains += [('account_id', '=', rec.account_id.id)]


Create python filter domain dinamically odoo14
https://www.odoo.com

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

0
Avatar
Descartar
Avatar
sfs, jonathankabre1@gmail.com
Autor Mejor respuesta

thanks but this not answer to my question.

the user have 2 field to filled: parameter_id and account_id.
if he field none of the 2 fields, my script 'ld look like :   moves = self.env['account.move.line'].search([])

if he field  parameter_id  only ->  moves = self.env['account.move.line'].search([ (' partner_id ', '=', 'self.partener_id.id') ])

if he field   account_id only ->  moves = self.env['account.move.line'].search([(' account_id ', '=', 'self.account_id.id')]) 

if he field  parameter_id and  account_id  ->  moves = self.env['account.move.line'].search([ (' account_id ', '=', 'self.account_id.id') ,(' account_id ', '=', 'self.account_id.id') ])


and then i use   'moves' for others treatements   

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
How to create Approval - V14
v14
Avatar
1
abr 26
1562
Attached PDF file is not formatted properly
v14
Avatar
Avatar
1
dic 25
1495
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
sept 25
4632
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
ago 25
1962
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
ago 25
4516
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 Svenska ภาษาไทย 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.

Sitio web hecho con

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