Methods need context as an argument in order to get the exceptions/warnings translated.

Bug #432504 reported by Albert Cervera i Areny - http://www.NaN-tic.com
28
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

Some warning/exception messages are not translated in account module due to missing context in the appropiate functions.

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

The attached diff should fix some of those issues in the whole account module.

description: updated
summary: - Untranslated messages in invoices
+ Untranslated messages in account module due to missing context
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote : Re: Untranslated messages in account module due to missing context

Hello Albert,

Sorry to say, but context is not responsible here for the python code Message translations.

Its their entries in .po files, which makes them translated on pop up windows.

Thank you.

Changed in openobject-addons:
status: New → Invalid
Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

I insist. If there's no context, translations in .po files are useless. 'context' IS necessary for translation in python code. Take a look at the "class _" in tools/translate.py or otherwise, please speak to somebody that knows how this works.

Changed in openobject-addons:
status: Invalid → New
Changed in openobject-addons:
status: New → Confirmed
summary: - Untranslated messages in account module due to missing context
+ Methods need context as an argument in order to get the
+ exceptions/warnings translated.
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Albert,

This is really a crucial one.

Thank you for reporting.I would like to request you to apply the attached patch which comes out as the general solution.

Its not feasible that we add context as an argument to each method.Because it may happen that any module would have overridden the parent / super class method.

Kindly notify us.

Thank you.

affects: openobject-addons → openobject-server
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Jay, that being said, even if 5.0 is fucked up, may be we can still fix coming 5.2 this is the unique time window we have to break the API.

BTW, I already proposed something to Tiny Belgium team (Quentin and Christophe) to allow breaking the API while tracking the changes in bzr. I still need to get in touch with Fabien about my proposal and then we can safely fix 5.2, I'll let you all know about that.

Thank you all for your efforts.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Raphael,

Its really not a good idea to add context to all the methods(sung and unsung).

This patch would serve the purpose of translations of the strings raised by the methods.

Thank you.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : Re: [Bug 432504] Re: Methods need context as an argument in order to get the exceptions/warnings translated.

All right, possible. I didn't thought about this concrete issue I should
say, it was more a general remark about the opportunity to break the API if
we really need it for 5.2.
Thank you for your analysis.

On Fri, Nov 13, 2009 at 11:55 AM, Jay (Open ERP) <email address hidden> wrote:

> Hello Raphael,
>
> Its really not a good idea to add context to all the methods(sung and
> unsung).
>
> This patch would serve the purpose of translations of the strings raised
> by the methods.
>
> Thank you.
>
> --
> Methods need context as an argument in order to get the exceptions/warnings
> translated.
> https://bugs.launchpad.net/bugs/432504
> You received this bug notification because you are subscribed to
> OpenObject Server.
>
> Status in OpenObject Server: Confirmed
>
> Bug description:
> Some warning/exception messages are not translated in account module due to
> missing context in the appropiate functions.
>

Revision history for this message
Numérigraphe (numerigraphe) wrote :

As suggested by Jay I'm marking bug 544204 a duplicate of this issue.
I too think the issue of passing the context correctly should be addressed throughout the whole code base.

> Its really not a good idea to add context to all the methods(sung and unsung).
It's even worse, isn't it: it must not not only be in every method defined, but also every method call !
I'm not too keen on this either, but do we have other options? I would be delighted if the framework can make it easier.

Lionel

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

I'm closing this bug as the code locations indicated in the patch have indeed been patched now or refactored. You can try with the latest trunk. BTW the issue with having the client pass the context to every on_change call is handled in a separate bug.
Thanks for reporting, Albert!

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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