Commit 11d7cac7 authored by Jérome Perrin's avatar Jérome Perrin

style cleanup

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25379 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ba824034
...@@ -54,45 +54,32 @@ ...@@ -54,45 +54,32 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>#\n <value> <string>#\n
# this script is called on the Sale Invoice Transaction\n # this script is called on the Invoice Transaction\n
# after the sale_invoice_transaction_builder delivery builder\n # after the invoice_transaction_builder delivery builder\n
# created Sale Invoice Transaction Line\n # created accounting lines in the invoice\n
# \n # \n
from Products.ERP5Type.Log import log\n
LOG = lambda msg:log(\n
"SaleInvoiceTransaction_postTransactionLineGeneration", msg)\n
\n
sale_invoice = context\n
\n \n
# Accounting specific: \n # Accounting specific: \n
# if every lines have the same resource, then copy the resource \n # if every lines have the same resource, then copy the resource \n
# on the Transaction and delete resource on the lines.\n # on the Transaction and delete resource on the lines.\n
# TODO: this is a Property Assignment Movement Group\n
\n \n
accounting_line_portal_type = (\n accounting_line_portal_type = context.getPortalAccountingMovementTypeList()\n
"Sale Invoice Transaction Line",\n
"Purchase Invoice Transaction Line",\n
"Accounting Transaction Line")\n
\n
resources_keys = {}\n resources_keys = {}\n
\n for line in context.contentValues(portal_type=accounting_line_portal_type):\n
for line in sale_invoice.objectValues() :\n
if line.getPortalType() not in accounting_line_portal_type :\n
continue\n
else : \n
resources_keys[line.getResource()] = 1\n resources_keys[line.getResource()] = 1\n
\n \n
if len(resources_keys.keys()) == 1 :\n if len(resources_keys.keys()) == 1 :\n
# set the resource on the transaction\n # set the resource on the transaction\n
sale_invoice.setResource(resources_keys.keys()[0])\n context.setResource(resources_keys.keys()[0])\n
# and delete on the invoice lines, so that if the user\n # and delete on the invoice lines, so that if the user\n
# changes the ressource on the transaction, it also change on \n # changes the ressource on the transaction, it also change on \n
# the lines. \n # the lines. \n
for line in sale_invoice.objectValues() :\n for line in context.contentValues(portal_type=accounting_line_portal_type):\n
if line.getPortalType() in accounting_line_portal_type :\n
line.setResource(None)\n line.setResource(None)\n
assert(line.getResource() == sale_invoice.getResource())\n assert(line.getResource() == sale_invoice.getResource())\n
else :\n else :\n
raise ValueError, "%s doesn(t have only one resource %s" % (\n raise ValueError, "%s doesn\'t have only one resource %s" % (\n
sale_invoice.getPath(), resources_keys.keys())\n sale_invoice.getPath(), resources_keys.keys())\n
\n \n
# round debit / credit on created transaction.\n # round debit / credit on created transaction.\n
...@@ -134,20 +121,17 @@ context.AccountingTransaction_roundDebitCredit()\n ...@@ -134,20 +121,17 @@ context.AccountingTransaction_roundDebitCredit()\n
<value> <value>
<tuple> <tuple>
<string>kw</string> <string>kw</string>
<string>Products.ERP5Type.Log</string> <string>_getattr_</string>
<string>log</string>
<string>LOG</string>
<string>context</string> <string>context</string>
<string>sale_invoice</string>
<string>accounting_line_portal_type</string> <string>accounting_line_portal_type</string>
<string>resources_keys</string> <string>resources_keys</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>_getattr_</string>
<string>line</string> <string>line</string>
<string>_write_</string> <string>_write_</string>
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>None</string> <string>None</string>
<string>sale_invoice</string>
<string>AssertionError</string> <string>AssertionError</string>
<string>ValueError</string> <string>ValueError</string>
</tuple> </tuple>
......
192 193
\ 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