Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How could I overwrite only _model in a class?

Odebírat

Get notified when there's activity on this post

This question has been flagged
1 Odpovědět
3820 Zobrazení
Avatar
Pascal Tremblay

Hello all!

We want to change the default sort order in this view. Actually, thoses lines are sorted by name.

In the file ../openerp/addons/base/ir/ir_sequence_view.py, We have changed :

class ir_sequence(openerp.osv.osv.osv):

    _name = 'ir.sequence'
    _order = 'name'

for :

class ir_sequence(openerp.osv.osv.osv):

    _name = 'ir.sequence'
    _order = 'company_id'

and it works. the sequences are well sorted by company_id in our ir_sequence view :

But now, how could we overwrite ONLY this line ( _order = 'company_id') of the ir_sequence class? Do we have to override all the class?

We already have this in our custom module py file :

class not sure (openerp.osv.osv.osv):

    _name = 'not sure...'
    _order = 'company_id'
    _inherit = 'not sure....'
   

Could you help to complete? THANKS

0
Avatar
Zrušit
Emipro Technologies Pvt. Ltd.

Not getting clearly. You are talking about which line? Can you guide more?

Emipro Technologies Pvt. Ltd.

Do you want to change the "_order", by inheriting?

Pascal Tremblay
Autor

Yes, i'm searching the SHORTEST override that I could have. My goal is only to change the default order of the view.

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Nejlepší odpověď

Hello Pascal Tremblay,

I guess you want to inherit the class and want to override _order.

You can override or add anything by inheriting the object. Following is the sysntax:

class xyz_xyz(osv.osv):
    _inherit = 'xyz.xyz'
    _order = 'field_name'

In the example xyz.xyz (ir.sequence in your case) is the object name which you want to inherit and can change the sorting by changing the field in _order by default its ascending order. If you want sorting in descending order just write desc after field name in _order. 

_order = 'field_name desc'

If you want sorting based on more than one field write more fields' name and separate them by comma.

_order = 'field_name1 desc, field_name2 desc'

You can refer inheritance in details in documents: Inheritance in Odoo, Inheritance in V7 

4
Avatar
Zrušit
Pascal Tremblay
Autor

It was EXACTLY what I needed. Thanks a lot misters!

Pascal Tremblay
Autor

Still a question. How could I sort (with _order) but INVERSED??? You know when we click two times on a column header to sort it.

Pascal Tremblay
Autor

It's here : https://www.odoo.com/fr_FR/forum/help-1/question/how-to-change-the-order-of-partner-list-14100?sort=latest

Sudhir Arya (ERP Harbor Consulting Services)

See my updated answer.

Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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