payroll compute sheet error

Bug #693788 reported by TeMPO
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 3

Bug Description

latest trunk

Setup a database with demo data

Create a payroll slip for Quentin Paolino

Use "Compute Sheet " Button

you get the folllowing error

[2010-12-23 15:11:43,257][trunk66] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
  File "/home/tempo/openobject-server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/tempo/openobject-server/bin/osv/osv.py", line 196, in exec_workflow
    res = self.exec_workflow_cr(cr, uid, obj, method, *args)
  File "/home/tempo/openobject-server/bin/osv/osv.py", line 189, in exec_workflow_cr
    return wf_service.trg_validate(uid, obj, args[0], method, cr)
  File "/home/tempo/openobject-server/bin/workflow/wkf_service.py", line 80, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/home/tempo/openobject-server/bin/workflow/instance.py", line 48, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/home/tempo/openobject-server/bin/workflow/workitem.py", line 61, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/home/tempo/openobject-server/bin/workflow/workitem.py", line 174, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/home/tempo/openobject-server/bin/workflow/workitem.py", line 182, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/home/tempo/openobject-server/bin/workflow/workitem.py", line 41, in create
    process(cr, res, ident, stack=stack)
  File "/home/tempo/openobject-server/bin/workflow/workitem.py", line 53, in process
    result = _execute(cr, workitem, activity, ident, stack)
  File "/home/tempo/openobject-server/bin/workflow/workitem.py", line 107, in _execute
    wkf_expr.execute(cr, ident, workitem, activity)
  File "/home/tempo/openobject-server/bin/workflow/wkf_expr.py", line 68, in execute
    return _eval_expr(cr, ident, workitem, activity['action'])
  File "/home/tempo/openobject-server/bin/workflow/wkf_expr.py", line 58, in _eval_expr
    ret = eval(line, env, nocopy=True)
  File "/home/tempo/openobject-server/bin/tools/safe_eval.py", line 281, in safe_eval
    return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/tempo/openobject-server/bin/osv/orm.py", line 183, in <lambda>
    return lambda *args, **argv: attr(self._cr, self._uid, [self._id], *args, **argv)
  File "/home/tempo/openobject-addons/hr_payroll/hr_payroll.py", line 1184, in compute_sheet
    'name':'Salary Slip of %s for %s' % (slip.employee_id.name, ttyme.strftime('%B-%Y')),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

Related branches

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

The issue is due to the locale month name in French (décembre) which have an accent in the name.

Changed in openobject-addons:
status: New → Confirmed
Revision history for this message
Jamin Shah(OpenERP) (jamin-openerp) wrote :

Hello,

I have tested your scenario with updated code.

Steps:

1) Create a new database with demo data (French Language).
2) Create payroll slip for Quentin Paolino
3) Click on "Compute Sheet" button.

But I am not able to face any problem.

Would you please update code, check again and notify me?

Thanks.

Changed in openobject-addons:
status: Confirmed → Incomplete
Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

Hello Jas,

In which language is your OS locales ? This issue is not due to OpenERP locales, but to your OS locales.

In fact, strftime function, return the locale's full month name with the template %B and yet, my OpenERP locale is English but my OS locale is French. Python try to repalce %B by 'Décembre' and the error occurs.

Try to change your OS locales to French and check again.

I've link a branch and propose it to merging to fix this issue.

Revision history for this message
Jamin Shah(OpenERP) (jamin-openerp) wrote :

Hello Quentin,

Thanks for your reply.
I will check it with OS locale.

Thanks again!

Revision history for this message
xrg (xrg) wrote : Re: [Bug 693788] Re: payroll compute sheet error

On Friday 24 December 2010, you wrote:
> Hello Jas,
>
> In which language is your OS locales ? This issue is not due to OpenERP
> locales, but to your OS locales.
>
> In fact, strftime function, return the locale's full month name with the
> template %B and yet, my OpenERP locale is English but my OS locale is
> French. Python try to repalce %B by 'Décembre' and the error occurs.
>
> Try to change your OS locales to French and check again.
>
> I've link a branch and propose it to merging to fix this issue.

I guess the backtrace is self-explanatory.

But I would prefer that you use "tools.ustr(ttyme.strftime('%B-%Y'))", rather
than decode('utf-8'). Please don't assume any encodings, other languages may
have the same trouble but also the rare chance that they use an arbitrary
encoding.

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

Hello xrg,

I didn't know the tools.ustr() function. I will modify the code in my branch.

Revision history for this message
Quentin THEURET @Amaris (qtheuret) wrote :

The code has been updated in my branche.

Changed in openobject-addons:
status: Incomplete → Confirmed
Revision history for this message
xrg (xrg) wrote :

On Friday 24 December 2010, you wrote:
> The code has been updated in my branch.

Nice, thanks.

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello Quentin,

Its fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3.
Rev-id: <email address hidden>
Rev-no: 4635

Thanks for reporting and for your patch.

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

It will be merged soon with Addons3 branch.

Changed in openobject-addons:
milestone: none → 6.0-rc2
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.