Commit fecbcaf9 authored by Jérome Perrin's avatar Jérome Perrin

translate getExplanationText, fix url to point to /view


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5982 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 96f38f78
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
from Products.ZSQLCatalog.zsqlbrain import ZSQLBrain from Products.ZSQLCatalog.zsqlbrain import ZSQLBrain
from DateTime import DateTime from DateTime import DateTime
from ZTUtils import make_query from ZTUtils import make_query
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from zLOG import LOG from zLOG import LOG
class InventoryBrain(ZSQLBrain): class InventoryBrain(ZSQLBrain):
""" """
Global analysis (all variations and categories) Global analysis (all variations and categories)
...@@ -168,7 +168,7 @@ class InventoryListBrain(ZSQLBrain): ...@@ -168,7 +168,7 @@ class InventoryListBrain(ZSQLBrain):
if o is not None: if o is not None:
explanation = o.getExplanationValue() explanation = o.getExplanationValue()
if explanation is not None: if explanation is not None:
return '%s/%s' % (self.portal_url.getPortalObject().absolute_url(), return '%s/%s/view' % (self.portal_url.getPortalObject().absolute_url(),
explanation.getRelativeUrl()) explanation.getRelativeUrl())
else: else:
return '' return ''
...@@ -251,18 +251,28 @@ class InventoryListBrain(ZSQLBrain): ...@@ -251,18 +251,28 @@ class InventoryListBrain(ZSQLBrain):
def getExplanationText(self): def getExplanationText(self):
# Returns an explanation of the movement # Returns an explanation of the movement
o = self.getObject() o = self.getObject()
explanation_text = 'Unknow'
if o is not None: if o is not None:
N_ = lambda msg, **kw: o.Localizer.translate('ui', msg, **kw)
# Get the delivery/order # Get the delivery/order
delivery = o.getExplanationValue() delivery = o.getExplanationValue()
if delivery is not None: if delivery is not None:
explanation_text = "%s %s" % (delivery.getPortalType(), mapping = {
delivery.getTitleOrId()) 'delivery_portal_type' : delivery.getTranslatedPortalType(),
'delivery_title' : delivery.getTitleOrId()
}
causality = delivery.getCausalityValue() causality = delivery.getCausalityValue()
if causality is not None: if causality is not None:
explanation_text = "%s (%s %s)" % (explanation_text, mapping['causality_portal_type'] = \
causality.getPortalType(), causality.getTranslatedPortalType()
causality.getTitleOrId()) mapping['causality_title'] = causality.getTitleOrId()
return N_("${delivery_portal_type} ${delivery_title} "\
"(${causality_portal_type} ${causality_title})",
mapping = mapping )
else :
return N_("${delivery_portal_type} ${delivery_title}",
mapping = mapping )
else :
return N_('Unknown')
return explanation_text return explanation_text
class DeliveryListBrain(InventoryListBrain): class DeliveryListBrain(InventoryListBrain):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment