Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

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

Odoberať

Get notified when there's activity on this post

This question has been flagged
treeviewopenerp7
9 Replies
13634 Zobrazenia
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
Zrušiť
Avatar
Temur
Best Answer

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
Zrušiť
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
Best Answer

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
Zrušiť
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 Best Answer

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
Zrušiť
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
openerp7 - Return tree view from class with no new fields
treeview openerp7 return
Avatar
0
jún 18
3184
How to Align Left [float, integer] Fields in Tree View in Odoo
treeview
Avatar
Avatar
Avatar
Avatar
3
apr 25
5964
How to change column width in tree view one2many,many2many Solved
treeview
Avatar
Avatar
Avatar
Avatar
Avatar
5
nov 23
44415
Create dynamic tree view Solved
treeview
Avatar
Avatar
Avatar
3
sep 23
10348
How to put two fields under same column in tree view
treeview
Avatar
Avatar
1
sep 22
4602
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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