Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to define the thousands separator BY CUSTOM MODULE?

By
Estudios, Procesos y Sistemas
on 5/4/15, 9:43 AM 620 views

Hi

Someone know how to change thousands separator in specific language by custom module in Odoo 8.0? 

0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 5/25/15, 8:34 AM

Modifying thusands separator belongs to language settings... So to do it within custom module you need to put desired data in csv, xml or yml file and load that file during module instalation... .

I prefer yml file for this pourpuse....here is an example for 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': 'Hrvatski',
        'date_format': '%d.%m.%Y',
        'time_format': '%H:%M:%S', }, context)


Just copy/paste/modify  in some_file.yml,
and include that file in your data section of __openerp__.py of your custom module...

0

I know how to change in the admin panel...


But, how to configure this changes on new module, for update automatically? 

-1
Tomasz Leppich
On 5/5/15, 6:01 PM

You don't need a custom module for it. You have it by default in Odoo. Go to Settings > Translations > Languages

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/4/15, 9:43 AM
Seen: 620 times
Last updated: 5/25/15, 8:35 AM