openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #05116
[Merge] lp:~camptocamp/openerp-product-attributes/7.0-fix-translate-view-lep into lp:openerp-product-attributes
Leonardo Pistone - camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/7.0-fix-translate-view-lep into lp:openerp-product-attributes.
Requested reviews:
Product Core Editors (product-core-editors)
Related bugs:
Bug #1294745 in OpenERP Product Attributes: "[6.1] [7.0] product_custom_attributes, production_lot_custom_attributes: open by attribute set crashes on launguages other than English and French"
https://bugs.launchpad.net/openerp-product-attributes/+bug/1294745
For more details, see:
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-fix-translate-view-lep/+merge/211792
--
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-fix-translate-view-lep/+merge/211792
Your team Product Core Editors is requested to review the proposed merge of lp:~camptocamp/openerp-product-attributes/7.0-fix-translate-view-lep into lp:openerp-product-attributes.
=== modified file 'product_custom_attributes/product.py'
--- product_custom_attributes/product.py 2013-09-30 11:55:27 +0000
+++ product_custom_attributes/product.py 2014-03-19 17:49:16 +0000
@@ -23,7 +23,7 @@
from openerp.osv import fields
from openerp.osv.osv import except_osv
from openerp.osv.orm import setup_modifiers
-from tools.translate import _
+from tools.translate import translate
from lxml import etree
class product_template(Model):
@@ -91,6 +91,13 @@
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None:
context = {}
+
+ def translate_view(source):
+ """Return a translation of type view of source."""
+ return translate(
+ cr, None, 'view', context.get('lang'), source
+ ) or source
+
result = super(product_product, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu)
if view_type == 'form' and context.get('attribute_group_ids'):
eview = etree.fromstring(result['arch'])
@@ -105,9 +112,14 @@
placeholder = eview.xpath("//separator[@string='attributes_placeholder']")[0]
placeholder.getparent().replace(placeholder, attributes_notebook)
elif context.get('open_product_by_attribute_set'):
- main_page = etree.Element('page', string=_('Custom Attributes'))
+ main_page = etree.Element(
+ 'page',
+ string=translate_view('Custom Attributes')
+ )
main_page.append(attributes_notebook)
- info_page = eview.xpath("//page[@string='%s']" % (_('Information'),))[0]
+ info_page = eview.xpath(
+ "//page[@string='%s']" % (translate_view('Information'),)
+ )[0]
info_page.addnext(main_page)
result['arch'] = etree.tostring(eview, pretty_print=True)
result = self._fix_size_bug(cr, uid, result, context=context)