Commit 1cd6b9fe authored by Jérome Perrin's avatar Jérome Perrin

Fixed the fact that IventoryBrain.getExplanationText cannot find the

explanation for "Virtual" Inventory movements. 



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7570 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0b203cf5
...@@ -62,7 +62,8 @@ class Inventory(Delivery): ...@@ -62,7 +62,8 @@ class Inventory(Delivery):
security.declarePublic('alternateReindexObject') security.declarePublic('alternateReindexObject')
def alternateReindexObject(self, **kw): def alternateReindexObject(self, **kw):
"""This method is called when an inventory object is included in a group of catalogged objects. """This method is called when an inventory object is included in a
group of catalogged objects.
""" """
return self.immediateReindexObject(**kw) return self.immediateReindexObject(**kw)
......
...@@ -162,10 +162,15 @@ class InventoryListBrain(ZSQLBrain): ...@@ -162,10 +162,15 @@ class InventoryListBrain(ZSQLBrain):
def getListItemUrl(self, cname_id, selection_index, selection_name): def getListItemUrl(self, cname_id, selection_index, selection_name):
# XXX FIXME can catch to many exceptions # XXX FIXME can catch to many exceptions
try: try:
if cname_id in ('getExplanationText','getExplanation', ): if cname_id in ('getExplanationText', 'getExplanation', ):
o = self.getObject() o = self.getObject()
if o is not None: if o is not None:
explanation = o.getExplanationValue() if not getattr(o, 'isDelivery', 0):
explanation = o.getExplanationValue()
else:
# Additional inventory movements are catalogged in stock table
# with the inventory's uid. Then they are their own explanation.
explanation = o
if explanation is not None: if explanation is not None:
return '%s/%s/view' % ( return '%s/%s/view' % (
self.portal_url.getPortalObject().absolute_url(), self.portal_url.getPortalObject().absolute_url(),
...@@ -238,7 +243,12 @@ class InventoryListBrain(ZSQLBrain): ...@@ -238,7 +243,12 @@ class InventoryListBrain(ZSQLBrain):
if o is not None: if o is not None:
N_ = lambda msg, **kw: o.Localizer.translate('ui', msg, **kw) N_ = lambda msg, **kw: o.Localizer.translate('ui', msg, **kw)
# Get the delivery/order # Get the delivery/order
delivery = o.getExplanationValue() if not getattr(o, 'isDelivery', 0):
delivery = o.getExplanationValue()
else:
# Additional inventory movements are catalogged in stock table
# with the inventory's uid. Then they are their own explanation.
delivery = o
if delivery is not None: if delivery is not None:
mapping = { mapping = {
'delivery_portal_type' : delivery.getTranslatedPortalType(), 'delivery_portal_type' : delivery.getTranslatedPortalType(),
......
This diff is collapsed.
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