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
    • eLearning
    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 taberna
    • 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
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • 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
    Browse all Industries
  • 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
    • Services for 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

[SOLVED] OpenERP 7: Tree view - Order by date of creation and not by name

Suscribirse

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

Se marcó esta pregunta
treeviewopenerp7
9 Respuestas
13623 Vistas
Avatar
Selverine

Hi all,


I would like to know if it is possible, to order the customers by creation date and not by name.

I would like to do it on the "Tree View" in the sale part.

For OpenERP 8 , I can  override the python default order in the tree view

<tree default_order='create_date'> 

</tree>

But it doesn't work for OpenERP 7. 

Are they another possibility?


Someone has an idea please?


Thank you,


Selverine

0
Avatar
Descartar
Avatar
Temur
Mejor respuesta

in v7 try to add create_date field to the corresponding model:

_columns = {
    'create_date': fields.datetime('Create Date'),
    ...
}
_order = "create_date" # To order using create_date

you have not to manage 'create_date' field in any way, it'll be managed automatically. just add it.

then update module and try again. hope it'll help.

2
Avatar
Descartar
Selverine
Autor

Hi Temur, Thank you for your answer. However, even with this, my Tree order automatically by name and not by create_date. So after I can manually order it with the view interface but I would like automatically by create_date and not by name. Btw why it is automatically by name? Thank you, Selverine

Temur

additionally to add 'create_date', use _order in a model, as suggested @Ray:

_order = "create_date"
then it'll be ordered automatically.
also it may be good idea to add readonly=True to create_date field, as it's special field and users do not have to edit it, it's managed by server.
Selverine
Autor

Hi Temur. It is still not working...it is still ordering by name. Maybe in another part some function override my order no?

Temur

Hi Selverine. yes, that's possible if you're adding changes in a original code, then it may be overriden by module inheriting from module you're changing code in. You should do the stuff (add "create_date" and "_order") in your own custom module, NOT in a base code of Odoo modules(in general it's a bed idea to change anything in original code of base modules). Inherit corresponding model in the custom module and to stuff there, then add model's original module to dependency list of your module ("depends" - in __openerp__.py) and your module will override behavior of original model. if you find that it's overriden in another module, then add that module to "depends" list to overcome it's definitions.

Avatar
Ray Carnes
Mejor respuesta

The way to define the sort order of a model in Python is with:

_order = "first_field, optional_second_field"

If there is no order specified, the default is ID.

Check the documentation at https://www.odoo.com/documentation/8.0/reference/orm.html


1
Avatar
Descartar
Selverine
Autor

Hi Ray. Thank you for your help. I did this inside my class class res_partner(osv.osv, format_address) ( res_partner.py inside the folder /base/res). However it is still not working and it ordered by name and not my create_date. Maybe somewhere a class override my order no? Thank you. Selverine

Ray Carnes

Selverine, you should not be changing code Odoo code (in the base/res folder). You should make your own module. You can see which modules could be changing the defaults for res.partner by looking in Settings --> Technical --> Database Structure --> Models. Open the res.partner module and look at the 'In Modules' field - this shows you a list of all modules that are contributing to the definition of the model, and that could be changing the default sort order.

Avatar
Selverine
Autor Mejor respuesta

It is working :-).

Thank you both for your help.

So it was this. One module override the order.

After override it by a new class directly in the sale module it is working perfectly.


Thank you!!

0
Avatar
Descartar
¿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
openerp7 - Return tree view from class with no new fields
treeview openerp7 return
Avatar
0
jun 18
3171
How to Align Left [float, integer] Fields in Tree View in Odoo
treeview
Avatar
Avatar
Avatar
Avatar
3
abr 25
5958
How to change column width in tree view one2many,many2many Resuelto
treeview
Avatar
Avatar
Avatar
Avatar
Avatar
5
nov 23
44409
Create dynamic tree view Resuelto
treeview
Avatar
Avatar
Avatar
3
sept 23
10345
How to put two fields under same column in tree view
treeview
Avatar
Avatar
1
sept 22
4597
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 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 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