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

Where exactly is the date format filled from for a language?

Odebírat

Get notified when there's activity on this post

This question has been flagged
dateodoo8.0v14
1 Odpovědět
9699 Zobrazení
Avatar
Yenthe Van Ginneken (Mainframe Monkey)

Hi guys

I've been looking at languages and the date formats / time formats.
If I look in the code I can see the language being fetched from the settings of your Ubuntu machine from the file misc.py under /openerp/tools/misc.py
I've modified the locales file for en_US under /usr/share/i18n/locales/en_US and the same for nl_NL like this:

en_US:
% Appropriate date representation (%x)
%       "%d/%m/%Y"
d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"

nl_NL:
d_fmt   "<U0025><U0064><U002D><U0025><U006D><U002D><U0025><U0079>"

Yet my date format when creating a new Odoo db is still wrong. I will get %m/%d/%Y for en_US and %d-%m-%Y for nl_NL..


Can anybody tell me where exactly I should set the date format for a specific format? I've been trying some things for hours but nothing succeeds.
NOTE: I'm not talking about modifying the date format manually under settings > Languages but I'm talking about setting the dateformat without accessing the languages menu, so by code.

With kind regards
Yenthe

 

0
Avatar
Zrušit
Avatar
Bole
Nejlepší odpověď

Settings -> Languages

number, date, time and simmilar formats are defined there.. 
hope it helps : )
 

to do it by code... define some base module and put yml file in (and in __openerp__.py just like any test yml)
( modify yml to your needs) :

-
  I force the installation of Croatian language
-
  !python {model: base.language.install}: |
    lang_ids = self.pool.get('res.lang').search(cr, uid, [('code', '=', 'hr_HR')], limit=1, context=context)
    if not lang_ids:
      wizard_id = self.create(cr, uid, {'lang': 'hr_HR'}, context)
      self.lang_install(cr, uid, [wizard_id], context)
-
  I make Croatian as default language if installed
-
  !python {model: res.lang}: |
    if self.search(cr, uid, [('code', '=', 'hr_HR')], limit=1):
      value_obj = self.pool.get('ir.values')
      ids = value_obj.search(cr, uid, [
        ('name', '=', 'lang'),
        ('key', '=', 'default'),
        ('model', '=', 'res.partner'),
      ], limit=1, context=context)
      vals = {
        'name': 'lang',
        'key': 'default',
        'key2': False,
        'model': 'res.partner',
        'object': False,
        'value_unpickle': 'hr_HR',
      }
      if ids:
        value_obj.write(cr, uid, ids, vals, context)
      else:
        value_obj.create(cr, uid, vals, context)
-
  I correct all formats for Croatian language
-
  !python {model: res.lang}: |
    lang_ids = self.search(cr, uid, [('code', '=', 'hr_HR')], limit=1)
    if lang_ids:
      self.write(cr, uid, lang_ids, {
        'grouping': '[3,0]',
        'decimal_point': ',',
        'thousands_sep': '.',
        'name': 'Croatian / Hrvatski',
        'date_format': '%d.%m.%Y',
        'time_format': '%H:%M:%S',
      }, context)

 

 hope this helps ;)

1
Avatar
Zrušit
Yenthe Van Ginneken (Mainframe Monkey)
Autor

Hi Bole that is exactly what I want to surpass. I want this date format to be filled in correctly automaticly. Every language installed should by default have the date format d%/m%/Y%, or atleast for the Dutch / Nederlands language.

Yenthe Van Ginneken (Mainframe Monkey)
Autor

I've added a note for this in my post as this might have not been clear enough, sorry about that.

Bole

here , adited my previous answer according to your needs ;) hope this helps

Yenthe Van Ginneken (Mainframe Monkey)
Autor

@Bole alright this looks very interesting! What is the best (already existing) module to place this extra file in? And I can only add in the last part from !python {model: res.lang}: | right?

Bole

you can put it in any module that you install on database... i ususaly put it in custom account_template module (because i rarely use standard localization modules l10n_xx) or any other module... and yes, you can modifiy yml file to your needs, the firt part is just to make 100% sure i have desired lang installed before i make any modifications

Yenthe Van Ginneken (Mainframe Monkey)
Autor

Okay I get the concept but not 100% how to do it. So I can create a new module with scaffold and then simply add one file (languages.yml for example) in the folder, add it to the __openerp__.py file and done? How would this ever be triggered on installation of a language for example then? :s

Bole

yml files are usefull, just grep/search for yml files in standard addons and look for examples... it can execute tests, but also it can execute python code during instalation of module... it is not trigered on instalation of languge... that comes later... but what you can do is use standard english lang for basic instalation, and then trigger instalation of desired languages troug module ( copy paste entire code) and do it for avery language you want installed and set acording to your needs : ) ....

Bole

additional note: I use this on v7, haven't test it on v8, also.. can't actualy debug yml file.... it is only interpreter for some actions... so you need to get the concept and try until it works as wanted ;)

Bole

note2: to find out other yml options check: openerp.tools.yaml_tag.py & openerp.tools.yaml_import.py

Yenthe Van Ginneken (Mainframe Monkey)
Autor

I've added your dateformat block under the module l10n_be in the already existing file account_chart_template.yml but I get errors.. raise YamlImportException("Can not process YAML block: %s" % node) Any ideas Bole? Would you want to share this custom module of you by the way? This concept is very interesting!

Bole

yml idea fo4r languages is copied from here: https://github.com/apollet/smile_openerp_addons_7.0/tree/master/smile_base chek that module...

Yenthe Van Ginneken (Mainframe Monkey)
Autor

Awesome! This is simply amazing. Strange that it isn't documented anywhere. Thanks Bole, accepted & upvoted.

Bole

(beer) :)

Bole

Huh... just found another interesting usage for yml files.... in v8.. check stock module... stock_data.yml ....

OdooBot
Hmmm interesting! Those yml have quite some options so it seems and nobody uses them.
By the way, your idea of just writing on the id and setting to true is working perfect. (from Linkedin)

Thanks
Yenthe

2015-01-07 17:22 GMT+01:00 Bole <bole-dajmi5-com@mail.odoo.com>:

Huh... just found another interesting usage for yml files.... in v8.. check stock module... stock_data.yml ....

--
Bole
Sent by Odoo S.A. using Odoo about Forum Post False

Bole

well.. in v7 i noticed yml files beeing used mostly for tests.. in v8 the more i look the more usage i notice... it is indeed very usefull tool, because you can execute some py methods during instalation of modules, meaning you can decide what to install , what data to import based on current database setup... i see this as wery fleksible tool..

OdooBot
Hey Bole

Yeah indeed it is a very flexible and handy way to add/modify some stuff.
I'm already using it to install languages, change formats, change automated actions etc..

Thank you for pointing this out to me, this is a gem to automate stuff.

With kind regards
Yenthe

2015-01-08 9:50 GMT+01:00 Bole <bole-dajmi5-com@mail.odoo.com>:

well.. in v7 i noticed yml files beeing used mostly for tests.. in v8 the more i look the more usage i notice... it is indeed very usefull tool, because you can execute some py methods during instalation of modules, meaning you can decide what to install , what data to import based on current database setup... i see this as wery fleksible tool..

--
Bole
Sent by Odoo S.A. using Odoo about Forum Post False

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
Related Posts Odpovědi Zobrazení Aktivita
customize date filter odoo 14
filter date v14
Avatar
Avatar
1
čvc 22
4111
How to change first day of the week Vyřešeno
date listview v14
Avatar
1
pro 20
8402
Filter as a date
filter date filtering v14
Avatar
Avatar
1
čvc 23
3771
odoo server not starting after amazon rds postgres upgrade Vyřešeno
rds odoo8.0 odooV8_database v14
Avatar
Avatar
Avatar
3
srp 21
4988
Invoice date same as sales order date
invoice date odoo.sh v14
Avatar
Avatar
1
čvc 21
3558
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