Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Servicios para partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Get a functionnnal field on advanced research fields option , on the filter [v7]

Suscribirse

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

Se marcó esta pregunta
filterfieldsv7advanced_filterfunctional
2 Respuestas
6191 Vistas
Avatar
TEIMI Yassine

I added a functionnal field on stock.picking model, I want to have this field, on the list of fields to choose, when you try to filter on fields, using the openerp filter tool. How this can be possible ?

As it's for payed and delivered functionnal fields on sale.order, I want to put my field among the choosable fields on advanced research option, on the filter. 

Many thanks.

0
Avatar
Descartar
Avatar
Ivan
Mejor respuesta

This has been discussed numerous times albeit with different context: by default function fields are not stored in the database and cannot be used for filtering/domain/sorting unless if you implement fnct_search or set the store attribute to True.

0
Avatar
Descartar
TEIMI Yassine
Autor

I have already values computed for this functionnal field, when I add the store=True parameter, it raises error that the column of this functionnal field does not exist on database. Do I have to add store=True only when there is no values computed for this field ?

TEIMI Yassine
Autor

I'm inheriting with "orm.Model" should I do it with osv.osv so that the field can be stored on database ?

Ivan

orm.Model is just an alias for osv.osv. They are pointing to the same object/class. So, it is not the issue. I don't quite get what you mean by "Do I have to add store=True only when there is no values computed for this field ?". Also by "I have already values computed for this functionnal field, when I add the store=True parameter, it raises error that the column of this functionnal field does not exist on database.". Exact wording of error will help. If you previously already have a field with the same name, it may cause problem, though I'm not sure what it will be exactly.

Ivan

store=True is defined for a column/field. So, it will be applicable whether the function used to calculate the column/field return value or not. In fact they MUST return value, although the value can be NULL or 0.0

TEIMI Yassine
Autor

I mean that I created the functionnal field, without the store=True parameter, and i have data on this field, it means that on the view containing this field, i already created records. and when I add the store=True parameter, for the functionnal field "amount_bl" for example it raises error : ProgrammingError: column stock_picking.amount_bl does not exist LINE 1: ...stock_picking."num_bl",stock_picking."commercial",stock_pick...

Ivan

You need to upgrade the module first.

Avatar
TEIMI Yassine
Autor Mejor respuesta

@Ivan : To Explain more my situation : First of all, I created the functionnal field without the store parameter (i forgot), it's on stock.picking.out model, (stock_picking table). Then, users created "delivery orders", so this functionnal field has computed values. So, right now, when I add the store parameter, into the functionnal field "amount_bl" for example, it raises error : ProgrammingError: column stock_picking.amount_bl does not exist LINE 1: ...stock_picking."num_bl",stock_picking."commercial",stock_pick...

I wonder if that error comes from the fact that users have already created delivery orders, and does not find where to store it.? (a supposition).

                                                            EDITED ANWSER :

@Ivan : When updating the module an error raises : 

File "/opt/openerp/server/openerp/addons/add_bl_valcr/stock.py", line 23, in _amount_order so_record = self.pool.get('sale.order').browse(cr, uid, so_id, context=None) AttributeError: 'NoneType' object has no attribute 'browse'

It's related the function of the field, here is the code : 

class StockPickingOut(orm.Model):

    _inherit = 'stock.picking.out'
    _name = 'stock.picking.out'

    def _amount_order(self, cr, uid, ids, amount_bl, arg, context):

        res = {}
       
        for picking in self.browse(cr, uid, ids, context):

            res[picking.id] =  0.0
            origin = picking.origin
            cr.execute("SELECT ID FROM SALE_ORDER WHERE NAME='%s' AND ID IS NOT NULL" %(origin))
            so = cr.fetchone()
            if so:
                so_id = so[0]
                so_record = self.pool.get('sale.order').browse(cr, uid, so_id, context=None)
                amount = so_record.amount_total
             
                res[picking.id] = amount
        return res

I think it has a relation with the fact that old none stored values have been deleted. 

So what I did, it's ignoring this error, and updating the module, So now the functionnal field is empty.

Just to explain more what the function does, it just pull the amount of the sale order, and put it on the delivery order. I don't know now after putting store=True, it's not working properly (supposition).

I'm now working to improve the code of my functionnal field, I'll let you know of my results.

Many thanks Ivan.

 

 

 

0
Avatar
Descartar
Ivan

You need to upgrade the module first.

TEIMI Yassine
Autor

Yes it worked, but I lost all old none stored values for this field. How can I recompute these values again ?

TEIMI Yassine
Autor

@ivan : check my edited answer please.

Ivan

Remove the column from the table (or rename it to something else), the upgrade the module again.

TEIMI Yassine
Autor

In fact, that's what I did, I first renamed the column and add the store parameter as True, same result, The column is created on database, but with empty values for existing records. Secondly, I created other column, with the same function code, but of course renamed, (I passed the correct field_name parameter for the field's function). then, same result.

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How to use AND / OR operators in advanced filters? Resuelto
filter v7
Avatar
Avatar
Avatar
Avatar
3
abr 23
35320
Filter last year and last month Resuelto
filter v7
Avatar
Avatar
Avatar
3
ago 17
24680
How to filter numerical values?
filter v7
Avatar
Avatar
1
ene 16
11899
Date is less than 3 months
filter fields
Avatar
0
jul 15
4348
Why an advanced product search with condition "doesn't contain" doesn't display products with empty searched field?
filter v7
Avatar
0
mar 15
5518
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 empresariales de código abierto que cubre 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