Commit b14e660d authored by Yusei Tahara's avatar Yusei Tahara

[erp5_advanced_trade] You can use variations with lines and without movement cells.

parent e8bf1284
<hidden_content_type_list>
<portal_type id="Internal Order Line">
<item>Internal Order Cell</item>
</portal_type>
<portal_type id="Internal Packing List Line">
<item>Internal Packing List Cell</item>
</portal_type>
<portal_type id="Inventory Line">
<item>Inventory Cell</item>
</portal_type>
<portal_type id="Purchase Order Line">
<item>Purchase Order Cell</item>
</portal_type>
<portal_type id="Purchase Packing List Line">
<item>Purchase Packing List Cell</item>
</portal_type>
<portal_type id="Returned Purchase Packing List Line">
<item>Returned Purchase Packing List Cell</item>
</portal_type>
<portal_type id="Returned Sale Packing List Line">
<item>Returned Sale Packing List Cell</item>
</portal_type>
<portal_type id="Sale Order Line">
<item>Sale Order Cell</item>
</portal_type>
<portal_type id="Sale Packing List Line">
<item>Sale Packing List Cell</item>
</portal_type>
</hidden_content_type_list>
\ No newline at end of file
<workflow_chain>
<chain>
<type>Internal Order Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Internal Packing List Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Inventory Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Purchase Order Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Purchase Packing List Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Returned Purchase Packing List Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Returned Sale Packing List Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Sale Order Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
<chain>
<type>Sale Packing List Line</type>
<workflow>-trade_matrix_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>20.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_advanced_trade</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# Define a dictionary where we store the subfields to display.
sub_field_dict = {}
split_depth = 1
# Try to assign each item to a sub field.
for item in item_list:
# Get value of the item
item_value = item[int(not is_right_display)]
# Hash key from item_value
item_split = item_value.split('/')
item_key = '/'.join(item_split[:split_depth])
base_category = item_split[0]
# Create a new subfield if necessary
if not sub_field_dict.has_key(item_key):
# Create property dict (key are field parameters)
sub_field_property_dict = default_sub_field_property_dict.copy()
sub_field_property_dict['key'] = item_key
sub_field_property_dict['title'] = context.portal_categories[base_category].getTitle()
sub_field_property_dict['required'] = 0
sub_field_property_dict['field_type'] = 'ListField'
sub_field_property_dict['size'] = 1
sub_field_property_dict['item_list'] = [('', '')]
sub_field_property_dict['value'] = None
sub_field_dict[item_key] = sub_field_property_dict
# Put the value in the correct sub field.
sub_field_dict[item_key]['item_list'].append(item)
if item_value in value_list and sub_field_property_dict['value'] is None:
sub_field_dict[item_key]['value'] = item_value
# Return the list of subfield configuration.
return sub_field_dict.values()
<?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>item_list, value_list, default_sub_field_property_dict={}, is_right_display=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getMultiListFieldPropertyDictListForAdvancedTrade</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
return 'Base_getMultiListFieldPropertyDictListForAdvancedTrade'
<?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_getHashScriptIdForParallelListField</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""This script is used to know if quantity can be edited by user.
* If this is not a movement (line containing lines or cell), user
cannot edit this line which is just a container, but no actual movement.
* If items are used, quantity is set by the item quantity.
"""
if not context.isMovement():
return False
return not (context.getResource() and context.getResourceValue().getAggregatedPortalTypeList())
<?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_isQuantityEditable</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
return context.isMovement()
<?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_isQuantityEnabled</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2019-7-18 Yusei Tahara
Initial commit
\ No newline at end of file
Nexedi
\ No newline at end of file
erp5_trade
\ No newline at end of file
Use variations with movment lines. You don't need movement cells. It makes more sense for many industries.
\ No newline at end of file
GPL
\ No newline at end of file
yusei
\ No newline at end of file
1
\ No newline at end of file
Internal Order Line | Internal Order Cell
Internal Packing List Line | Internal Packing List Cell
Inventory Line | Inventory Cell
Purchase Order Line | Purchase Order Cell
Purchase Packing List Line | Purchase Packing List Cell
Returned Purchase Packing List Line | Returned Purchase Packing List Cell
Returned Sale Packing List Line | Returned Sale Packing List Cell
Sale Order Line | Sale Order Cell
Sale Packing List Line | Sale Packing List Cell
\ No newline at end of file
Internal Order Line | -trade_matrix_workflow
Internal Packing List Line | -trade_matrix_workflow
Inventory Line | -trade_matrix_workflow
Purchase Order Line | -trade_matrix_workflow
Purchase Packing List Line | -trade_matrix_workflow
Returned Purchase Packing List Line | -trade_matrix_workflow
Returned Sale Packing List Line | -trade_matrix_workflow
Sale Order Line | -trade_matrix_workflow
Sale Packing List Line | -trade_matrix_workflow
\ No newline at end of file
erp5_advanced_trade
\ No newline at end of file
erp5_advanced_trade
\ No newline at end of file
1.0
\ No newline at end of file
......@@ -131,7 +131,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.isMovement() and not here.getVariationCategoryList()</string> </value>
<value> <string>python: here.Movement_isQuantityEnabled()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -14,7 +14,6 @@
<string>enabled</string>
<string>hash_script_id</string>
<string>items</string>
<string>size</string>
<string>title</string>
</list>
</value>
......@@ -77,17 +76,15 @@
</item>
<item>
<key> <string>hash_script_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
......@@ -130,10 +127,6 @@
<list/>
</value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
......@@ -162,6 +155,19 @@
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Movement_getHashScriptIdForParallelListField()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
......
return 'Base_getMultiListFieldPropertyDictList'
<?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_getHashScriptIdForParallelListField</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
return context.isMovement() and not context.getVariationCategoryList()
<?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_isQuantityEnabled</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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