Review: Needs Fixing

Hi Sandy, thanks for picking this up.

I'm afraid that your solution does not work in every case. Calling _() on a 
variable does not really make sense as it will be a matter of coincidence if 
the translation can be found. You see, internally this call gets translated to

    pool.get('ir.translation')._get_source(cr, SUPERUSER_ID, None, 
('code','sql_constraint'), lang, source)

so it will only work if there happens to be an existing code or constraint 
translation with the name of the model. This is the case for Invoice, but not 
for Incoming Shipment for example.

I don't know of any easier way to get the model name in the user's language 
than a search+read on the ir.model pool.


-- 
https://code.launchpad.net/~savoirfairelinux-openerp/ocb-addons/7.0_mail_thread_translate_bug1262000/+merge/207992
Your team Savoir-faire Linux' OpenERP is subscribed to branch 
lp:~savoirfairelinux-openerp/ocb-addons/7.0_mail_thread_translate_bug1262000.

-- 
Mailing list: https://launchpad.net/~savoirfairelinux-openerp
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~savoirfairelinux-openerp
More help   : https://help.launchpad.net/ListHelp

Reply via email to