Commit 481c9d45 authored by Jérome Perrin's avatar Jérome Perrin

item: use brain attributes in Item_getTrackingList

no need to do catalog here
parent 39f3b002
from Products.ERP5Type.Document import newTempBase
portal = context.getPortalObject()
catalog = portal.portal_catalog.getResultValue
if current:
method = portal.portal_simulation.getCurrentTrackingList
else:
method = portal.portal_simulation.getTrackingList
uid = context.getUid()
history_list = []
for res in method(aggregate_uid=uid, **kw):
history_list = []
for brain in method(aggregate_uid=context.getUid(), **kw):
history = newTempBase(context, str(len(history_list)))
explanation = catalog(uid=res.delivery_uid)
node_value = catalog(uid=res.node_uid)
section_value = catalog(uid=res.section_uid)
resource_value = catalog(uid=res.resource_uid)
explanation = brain.getExplanationValue()
date = brain.getDate()
history.edit(
#uid = catalog(uid=res.uid).getTitle(),
date=res.getDate(),
node_title=node_value is not None and node_value.getTitle() or None,
date=date,
node_title=brain.node_title,
source_title=explanation.getSourceTitle(),
section_title=section_value is not None and section_value.getTitle() or None,
resource_title=resource_value is not None and resource_value.getTitle() or None,
section_title=brain.section_title,
resource_title=brain.resource_title,
explanation=explanation.getTitle(),
translated_portal_type = explanation.getTranslatedPortalType(),
quantity = explanation.getQuantity(),
translated_portal_type=explanation.getTranslatedPortalType(),
quantity=explanation.getQuantity(),
url=explanation.absolute_url(),
item_quantity = context.getQuantity(at_date=res.getDate()),
variation_category_item_list = [x[0] for x in explanation.getVariationCategoryItemList()],
item_quantity=context.getQuantity(at_date=date),
variation_category_item_list=[x[0] for x in explanation.getVariationCategoryItemList()],
simulation_state=explanation.getTranslatedSimulationStateTitle(),
)
history_list.append(history)
return history_list
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