Commit 40426c0d authored by Jérome Perrin's avatar Jérome Perrin

item: use brain attributes in Item_getTrackingList

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