Commit 02692a36 authored by Łukasz Nowak's avatar Łukasz Nowak

erp5_trade: Extract logic for further reuse

Movement_isAggregateItemListEnabled allows to define, if given movement
is a candidate for aggregation, so extract this part into
Movement_isAggregateCandidate.
parent 212bc99d
if context.getResource() and context.getResourceValue().getAggregatedPortalTypeList()\
and context.isMovement()\
and (('Cell' in context.getPortalType()) or not context.getVariationCategoryList()):
return True
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Movement_isAggregateCandidate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -4,9 +4,7 @@ for Base_viewTradeFieldLibrary/my_view_mode_aggregate_title_list.enable
# If the resource accepts items, and the context is a movements (ie. not a line
# already containing cells or line that has variations but not cells yet)
if context.getResource() and context.getResourceValue().getAggregatedPortalTypeList()\
and context.isMovement()\
and (('Cell' in context.getPortalType()) or not context.getVariationCategoryList()):
if context.Movement_isAggregateCandidate():
return True
# If the movement already has an aggregate, display it.
......
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