Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

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

Subscriure's

Get notified when there's activity on this post

This question has been flagged
dateodoo8.0v14
1 Respondre
9700 Vistes
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
Descartar
Avatar
Bole
Best Answer

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
Descartar
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!

Registrar-se
Related Posts Respostes Vistes Activitat
customize date filter odoo 14
filter date v14
Avatar
Avatar
1
de jul. 22
4112
How to change first day of the week Solved
date listview v14
Avatar
1
de des. 20
8404
Filter as a date
filter date filtering v14
Avatar
Avatar
1
de jul. 23
3771
odoo server not starting after amazon rds postgres upgrade Solved
rds odoo8.0 odooV8_database v14
Avatar
Avatar
Avatar
3
d’ag. 21
4989
Invoice date same as sales order date
invoice date odoo.sh v14
Avatar
Avatar
1
de jul. 21
3560
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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