DTA wizard crash with l10n_ch

Bug #345324 reported by manganese
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

With version 5.0 when I click "Make payment" for generate dta file.

generate this error.

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 231, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 74, in __call__
    return getattr(self, method)(*params)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 552, in execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 532, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py", line 178, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py", line 74, in execute_cr
    action_res = action(self, cr, uid, data, context)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/l10n_ch/wizard/dta_wizard.py", line 574, in _create_dta
    dta_line = record_type(v).generate()
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/l10n_ch/wizard/dta_wizard.py", line 81, in __init__
    and tr(global_context_dict[i])
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/l10n_ch/wizard/dta_wizard.py", line 66, in tr
    s= s.decode('utf-8')
  File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 14: ordinal not in range(128)

I guess tr(s) on line 65 into file dta_wizard.py raise exception, because the string s is already in unicode type.

I made a small change into tr(s) method for detect the kind of string.

def tr(s):
        if type(s) != type(u'0'):
                s = s.decode('utf-8')

        for k in TRANS:
                s = s.replace(k[0],k[1])
        try:
                res= s.encode('ascii','replace')
        except:
                res = s
        return res

And now it's work.

Related branches

Changed in openobject-addons:
assignee: nobody → jvo-openerp
Revision history for this message
Luc Maurer @ Camptocamp (lmaurer-c2c) wrote :

As it concern l10n-ch module, Camptocamp will correct it.

Regards

LUc

Changed in openobject-addons:
assignee: jvo-openerp → nbessi-c2c
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Sorry.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Camptocamp has made a branch that fix the l10n_ch following problems (lp:~c2c/openobject-addons/5.0_l10n_ch_maintenance) :
 Wizard DTA generation encoding error (thanks for the contributions)
 Old BVR references are now supported
 Temporary solution for the non functional expr tag in the RML
 Temporary solution for the missing ocrb file (I know its is dirty but it copy the file in tmp if it does not exist)
 (we are waiting on Tiny for these two bugs)

Improvements:
 Adding fields on the res.partner.bank view that will allows you to choose what to print on BVR
 We also integrated all the changes made by Tiny for the translation of error messages, we take our time when merging in order to have the optimum solution

Known bug still pending :
 DTA in foreign currencies

Nicolas

Changed in openobject-addons:
status: Incomplete → Fix Released
Changed in openobject-addons:
status: Fix Released → Fix Committed
Revision history for this message
Husen Daudi (husendaudi) wrote :

Merged with 5.0_l10n_ch_maintenance branch.
2446 <email address hidden>

Thanks to Nicolas Bessi

Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.