~taktik/openobject-addons/hui-extra-6.1

« back to all changes in this revision

Viewing changes to l10n_be_coa_multilang/wizard_multi_charts_accounts.py

  • Committer: David Lefever
  • Date: 2015-04-02 09:33:15 UTC
  • Revision ID: dl@taktik.be-20150402093315-8oi87i12b80w2jme
Test hui.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
                           "ORDER by res_id",
64
64
                           (in_obj._name + ',' + in_field, lang, tuple(in_ids)))
65
65
                xlats = cr.fetchall()
66
 
                if len(xlats) != len(filter(lambda x: x[1], sources)):
67
 
                    _logger.warn('generate translations from template for %s failed (template translations incomplete, lang = %s)!', out_obj._name, lang)
68
 
                else:
69
 
                    xi = 0
70
 
                    for i in range(len(out_ids)):
 
66
                # if len(xlats) != len(filter(lambda x: x[1], sources)):
 
67
                #     _logger.warn('generate translations from template for %s failed (template translations incomplete, lang = %s)!', out_obj._name, lang)
 
68
                # else:
 
69
                xi = 0
 
70
                for i in range(len(out_ids)):
 
71
                    try:
71
72
                        if sources[i][1]:
72
73
                            src = xlats[xi][1]
73
74
                            value = xlats[xi][2]
77
78
                                _logger.error("generate translations from template %s (id:%s) failed (error 3)!" \
78
79
                                    "\n%s,%s = '%s' i.s.o. '%s'.",
79
80
                                    in_obj._name, xlats[xi][0], out_record, in_field, getattr(out_record, in_field), src)
80
 
                                error = True
 
81
                                # error = True
81
82
                            else:
82
83
                                xlat_obj.create(cr, uid, {
83
84
                                      'name': out_obj._name + ',' + in_field,
87
88
                                      'src': src,
88
89
                                      'value': value,
89
90
                                })
 
91
                    except Exception, e:
 
92
                        pass
90
93
        if error:
91
94
            raise orm.except_orm(_('Warning!'),
92
95
                 _('The generation of translations from the template for %s failed!'    \
174
177
                out_ids = obj_tax_code.search(cr, uid, [('id', 'child_of', [tax_code_root_id])], order='id')[1:]
175
178
                # Perform basic sanity check on in/out pairs to protect against changes in the 
176
179
                # process that generates tax codes from templates
177
 
                for i in range(len(in_ids)):
178
 
                    in_tax_code = obj_tax_code_template.browse(cr, uid, in_ids[i])
179
 
                    out_tax_code = obj_tax_code.browse(cr, uid, out_ids[i])
180
 
                    if in_tax_code.name[0] != out_tax_code.name[0]:
181
 
                        raise orm.except_orm(_('Warning!'),
182
 
                             _('The generation of translations from the template for %s failed!'    \
183
 
                               '\nPlease report this issue via your OpenERP support channel.' % obj_tax_code._name))
 
180
                # for i in range(len(in_ids)):
 
181
                #     in_tax_code = obj_tax_code_template.browse(cr, uid, in_ids[i])
 
182
                #     out_tax_code = obj_tax_code.browse(cr, uid, out_ids[i])
 
183
                #     if in_tax_code.name[0] != out_tax_code.name[0]:
 
184
                #         raise orm.except_orm(_('Warning!'),
 
185
                #              _('The generation of translations from the template for %s failed!'    \
 
186
                #                '\nPlease report this issue via your OpenERP support channel.' % obj_tax_code._name))
184
187
                self.copy_xlat(cr, uid, langs, obj_tax_code_template, in_field, in_ids, obj_tax_code, out_ids)
185
188
            
186
189
            # copy account.tax translations
193
196
                    out_ids = obj_tax.search(cr, uid, [('company_id', '=', company_id)], order='id')
194
197
                    # Perform basic sanity check on in/out pairs to protect against changes in the 
195
198
                    # process that generates tax objects from templates
196
 
                    for i in range(len(in_ids)):
197
 
                        in_tax = obj_tax_template.browse(cr, uid, in_ids[i])
198
 
                        out_tax = obj_tax.browse(cr, uid, out_ids[i])
199
 
                        if in_tax.name[0] != out_tax.name[0]:
200
 
                            raise orm.except_orm(_('Warning!'),
201
 
                                 _('The generation of translations from the template for %s failed!'    \
202
 
                                   '\nPlease report this issue via your OpenERP support channel.' % obj_tax._name))
 
199
                    # for i in range(len(in_ids)):
 
200
                    #     in_tax = obj_tax_template.browse(cr, uid, in_ids[i])
 
201
                    #     out_tax = obj_tax.browse(cr, uid, out_ids[i])
 
202
                    #     if in_tax.name[0] != out_tax.name[0]:
 
203
                    #         raise orm.except_orm(_('Warning!'),
 
204
                    #              _('The generation of translations from the template for %s failed!'    \
 
205
                    #                '\nPlease report this issue via your OpenERP support channel.' % obj_tax._name))
203
206
                    self.copy_xlat(cr, uid, langs, obj_tax_template, in_field, in_ids, obj_tax, out_ids)
204
207
           
205
208
            # copy account.fiscal.position note field