ir_lang.yml 1.77 KB
Newer Older
François C. committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
-
  I force the installation of French language
-
  !python {model: base.language.install}: |
    lang_ids = self.pool.get('res.lang').search(cr, uid, [('code', '=', 'fr_FR')], limit=1, context=context)
    if not lang_ids:
      wizard_id = self.create(cr, uid, {'lang': 'fr_FR'}, context)
      self.lang_install(cr, uid, [wizard_id], context)
-
  I make French as default language if installed
-
  !python {model: res.lang}: |
    if self.search(cr, uid, [('code', '=', 'fr_FR')], 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',
        'value_unpickle': 'fr_FR',
      }
      if ids:
        value_obj.write(cr, uid, ids, vals, context)
      else:
        value_obj.create(cr, uid, vals, context)
-
  I correct date and time format for French language
-
  !python {model: res.lang}: |
    lang_ids = self.search(cr, uid, [('code', '=', 'fr_FR')], limit=1)
    if lang_ids:
      self.write(cr, uid, lang_ids, {
        'date_format': '%d/%m/%Y',
        'time_format': '%H:%M:%S',
        'grouping': '[3, 3, 3, 3, 3]',
        'decimal_point': ',',
        'thousands_sep': ' ',
      }, context)
-
  I correct date and time format for English language
-
  !python {model: res.lang}: |
    lang_ids = self.search(cr, uid, [('code', '=', 'en_US')], limit=1)
    if lang_ids:
      self.write(cr, uid, lang_ids, {
        'date_format': '%m/%d/%Y',
        'time_format': '%H:%M:%S',
        'grouping': '[3, 3, 3, 3, 3]',
        'decimal_point': '.',
        'thousands_sep': ',',
      }, context)