openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #05308
[Merge] lp:~camptocamp/openerp-product-attributes/6.1-fix-translate-view-lep into lp:openerp-product-attributes/6.1
Leonardo Pistone - camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/6.1-fix-translate-view-lep into lp:openerp-product-attributes/6.1.
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/6.1-fix-translate-view-lep/+merge/211798
--
https://code.launchpad.net/~camptocamp/openerp-product-attributes/6.1-fix-translate-view-lep/+merge/211798
Your team OpenERP Community is subscribed to branch lp:openerp-product-attributes/6.1.
=== modified file 'production_lot_custom_attributes/lot.py'
--- production_lot_custom_attributes/lot.py 2014-01-31 17:39:49 +0000
+++ production_lot_custom_attributes/lot.py 2014-03-19 18:03:02 +0000
@@ -24,7 +24,7 @@
"""Production lot customization: custom attributes."""
from openerp.osv import fields, osv
-from tools.translate import _
+from tools.translate import translate, _
from lxml import etree
import re
import itertools
@@ -217,6 +217,13 @@
"""
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
+
attr_pool = self.pool.get('attribute.attribute')
result = super(stock_production_lot, self).fields_view_get(
cr, uid, view_id, view_type, context, toolbar=toolbar,
@@ -250,11 +257,11 @@
# in this case, we know the attribute set beforehand, and we
# add the attributes to the current view
main_page = etree.Element(
- 'page', string=_('Custom Attributes')
+ 'page', string=translate_view('Custom Attributes')
)
main_page.append(attributes_notebook)
info_page = eview.xpath(
- "//page[@string='%s']" % (_('Stock Moves'),)
+ "//page[@string='%s']" % (translate_view('Stock Moves'),)
)[0]
info_page.addnext(main_page)
result['arch'] = etree.tostring(eview, pretty_print=True)
Follow ups