Merge lp:~openerp-dev/openobject-server/trunk-website_html_field_translation-pga into lp:openobject-server

Proposed by Thibault Delavallée (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/trunk-website_html_field_translation-pga
Merge into: lp:openobject-server
Diff against target: 34 lines (+15/-2)
1 file modified
openerp/addons/base/ir/ir_qweb.py (+15/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/trunk-website_html_field_translation-pga
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+216703@code.launchpad.net

Description of the change

TO UDPATE

To post a comment you must log in.

Unmerged revisions

5185. By Parth Gajjar(Open ERP)

merged with trunk

5184. By Parth Gajjar(Open ERP)

merged with trunk

5183. By Parth Gajjar(Open ERP)

[IMP] translated from translation term if field type is html

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/addons/base/ir/ir_qweb.py'
--- openerp/addons/base/ir/ir_qweb.py 2014-04-16 08:54:07 +0000
+++ openerp/addons/base/ir/ir_qweb.py 2014-04-22 12:17:41 +0000
@@ -479,6 +479,13 @@
479 ('data-oe-expression', t_att['field']),479 ('data-oe-expression', t_att['field']),
480 ]480 ]
481481
482 def translate_html(self, cr, uid, trans_name, res_id, value, context=None):
483 if context.get('lang'):
484 for trans in self.pool['ir.translation'].search_read(cr, uid, [('name', '=', trans_name),('res_id', '=', res_id),('lang', '=', context.get('lang'))],['source','value']):
485 if trans['value']:
486 value = value.replace(trans['source'], trans['value'])
487 return value
488
482 def value_to_html(self, cr, uid, value, column, options=None, context=None):489 def value_to_html(self, cr, uid, value, column, options=None, context=None):
483 """ Converts a single value to its HTML version/output490 """ Converts a single value to its HTML version/output
484 """491 """
@@ -489,8 +496,14 @@
489 """ Converts the specified field of the browse_record ``record`` to496 """ Converts the specified field of the browse_record ``record`` to
490 HTML497 HTML
491 """498 """
492 return self.value_to_html(499 if column._type == 'html':
493 cr, uid, record[field_name], column, options=options, context=context)500 trans_name = ('%s,%s')%(record._table_name,field_name)
501 value = self.translate_html(cr, uid, trans_name, record.id, record[field_name],context)
502 return self.value_to_html(
503 cr, uid, value, column, options=options, context=context)
504 else:
505 return self.value_to_html(
506 cr, uid, record[field_name], column, options=options, context=context)
494507
495 def to_html(self, cr, uid, field_name, record, options,508 def to_html(self, cr, uid, field_name, record, options,
496 source_element, t_att, g_att, qweb_context, context=None):509 source_element, t_att, g_att, qweb_context, context=None):