Commit c0792f01 authored by Łukasz Nowak's avatar Łukasz Nowak

- move functionality of selecting invoice transactions by Trade Model Rule's Simulation Movements


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27849 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c20e7c5a
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</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>_body</string> </key>
<value> <string>#\n
# This method is used by the invoice_transaction_builder\n
# delivery builder to select the Invoice Transaction \n
# in which creating new Invoice Transaction Lines.\n
#\n
\n
deliveries_keys = {}\n
for movement in movement_list:\n
ar = movement.getParentValue()\n
line = None\n
\n
# case of tax movement \n
if ar.getSpecialiseValue().getPortalType() == \'Tax Rule\':\n
for other_rule in ar.getParentValue().contentValues():\n
if other_rule == ar:\n
continue\n
for sm in other_rule.contentValues():\n
line = sm.getDeliveryValue()\n
\n
# case of trade model movement\n
if ar.getParentValue().getParentValue().getSpecialiseValue().getPortalType() == \'Trade Model Rule\':\n
tm_related_movement = ar.getParentValue().getParentValue().getParentValue()\n
line = tm_related_movement.getDeliveryValue()\n
\n
# in case of invoice rule (ie. starting from Invoice)\n
if line is None:\n
line = ar.getParentValue().getOrderValue()\n
\n
# in case of invoicing rule (ie. starting from Order)\n
if line is None:\n
line = movement.getParentValue().getParentValue().getDeliveryValue()\n
\n
deliveries_keys[line.getExplanationValue()] = 1\n
\n
return filter(lambda x : x is not None, deliveries_keys.keys())\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>movement_list, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>movement_list</string>
<string>kw</string>
<string>deliveries_keys</string>
<string>_getiter_</string>
<string>movement</string>
<string>_getattr_</string>
<string>ar</string>
<string>None</string>
<string>line</string>
<string>other_rule</string>
<string>sm</string>
<string>tm_related_movement</string>
<string>_write_</string>
<string>filter</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>InvoiceTransaction_selectDelivery</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
196 197
\ No newline at end of file \ No newline at end of file
...@@ -71,6 +71,10 @@ for movement in movement_list:\n ...@@ -71,6 +71,10 @@ for movement in movement_list:\n
continue\n continue\n
for sm in other_rule.contentValues():\n for sm in other_rule.contentValues():\n
line = sm.getDeliveryValue()\n line = sm.getDeliveryValue()\n
\n
# case of trade model movement\n
if ar.getParentValue().getParentValue().getSpecialiseValue().getPortalType() == \'Trade Model Rule\':\n
line = ar.getParentValue().getParentValue().getParentValue().getDeliveryValue()\n
\n \n
# in case of invoice rule (ie. starting from Invoice)\n # in case of invoice rule (ie. starting from Invoice)\n
if line is None:\n if line is None:\n
......
248 249
\ No newline at end of file \ No newline at end of file
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