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 @@
<item>
<key> <string>_body</string> </key>
<value> <string>#\n
# this script is called on the Sale Invoice Transaction\n
# after the sale_invoice_transaction_builder delivery builder\n
# created Sale Invoice Transaction Line\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
from Products.ERP5Type.Log import log\n
LOG = lambda msg:log(\n
"SaleInvoiceTransaction_postTransactionLineGeneration", msg)\n
\n
sale_invoice = context\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 = (\n
"Sale Invoice Transaction Line",\n
"Purchase Invoice Transaction Line",\n
"Accounting Transaction Line")\n
\n
accounting_line_portal_type = context.getPortalAccountingMovementTypeList()\n
resources_keys = {}\n
\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
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
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
# changes the ressource on the transaction, it also change on \n
# the lines. \n
for line in sale_invoice.objectValues() :\n
if line.getPortalType() in accounting_line_portal_type :\n
line.setResource(None)\n
assert(line.getResource() == sale_invoice.getResource())\n
for line in context.contentValues(portal_type=accounting_line_portal_type):\n
line.setResource(None)\n
assert(line.getResource() == sale_invoice.getResource())\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
\n
# round debit / credit on created transaction.\n
......@@ -134,20 +121,17 @@ context.AccountingTransaction_roundDebitCredit()\n
<value>
<tuple>
<string>kw</string>
<string>Products.ERP5Type.Log</string>
<string>log</string>
<string>LOG</string>
<string>_getattr_</string>
<string>context</string>
<string>sale_invoice</string>
<string>accounting_line_portal_type</string>
<string>resources_keys</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>line</string>
<string>_write_</string>
<string>len</string>
<string>_getitem_</string>
<string>None</string>
<string>sale_invoice</string>
<string>AssertionError</string>
<string>ValueError</string>
</tuple>
......
192
\ No newline at end of file
193
\ 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