<?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>_body</string> </key>
            <value> <string>#\n
#  this script is called on the Invoice Transaction\n
# after the invoice_transaction_builder delivery builder\n
# created accounting lines in the invoice\n
# \n
\n
# Accounting specific: \n
#  if every lines have the same resource, then copy the resource \n
# on the Transaction and delete resource on the lines.\n
# TODO: this is a Property Assignment Movement Group\n
\n
accounting_line_portal_type = context.getPortalAccountingMovementTypeList()\n
resources_keys = {}\n
for line in context.contentValues(portal_type=accounting_line_portal_type):\n
  resources_keys[line.getResource()] = 1\n
\n
if len(resources_keys.keys()) == 1 :\n
  # set the resource on the transaction\n
  context.setResource(resources_keys.keys()[0])\n
  # and delete on the invoice lines, so that if the user\n
  # changes the ressource on the transaction, it also change on \n
  # the lines. \n
  for line in context.contentValues(portal_type=accounting_line_portal_type):\n
    line.setResource(None)\n
    assert(line.getResource() == context.getResource())\n
else :\n
  raise ValueError, "%s doesn\'t have only one resource %s" % (\n
              context.getPath(), resources_keys.keys())\n
\n
# round debit / credit on created transaction.\n
context.AccountingTransaction_roundDebitCredit()\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>related_simulation_movement_path_list=None, **kw</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>VifibInvoiceTransaction_postTransactionLineGeneration</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
