Commit 69183210 authored by Jérome Perrin's avatar Jérome Perrin

AccountingTransaction_createReversalTransaction:

  use correct portal_type when creating lines.
  sort line so that debit is usually before credit
  also copy resource on movement if it differs from the delivery
  


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13023 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 42dfc64d
...@@ -110,16 +110,17 @@ if context.getStopDate() != context.getStartDate():\n ...@@ -110,16 +110,17 @@ if context.getStopDate() != context.getStartDate():\n
if context.getProperty(\'payment_mode\'):\n if context.getProperty(\'payment_mode\'):\n
reversal.setProperty(\'payment_mode\', context.getProperty(\'payment_mode\'))\n reversal.setProperty(\'payment_mode\', context.getProperty(\'payment_mode\'))\n
\n \n
line_list = context.getMovementList(\n line_list = context.AccountingTransaction_getInvoiceTransactionLineList(\n
portal_type=context.getPortalAccountingMovementTypeList())\n portal_type=context.getPortalAccountingMovementTypeList())\n
line_list.reverse()\n
\n
# guess portal_type to create lines\n # guess portal_type to create lines\n
if line_list:\n if line_list:\n
line_portal_type = line_list[0].getPortalType()\n line_portal_type = line_list[0].getPortalType()\n
\n \n
for line in line_list:\n for line in line_list:\n
new_line = reversal.newContent( portal_type=\'Accounting Transaction Line\', )\n new_line = reversal.newContent( portal_type=line_portal_type )\n
new_line.edit(\n new_line.edit(\n
id=line.getId(),\n
source=line.getSource(portal_type=\'Account\'),\n source=line.getSource(portal_type=\'Account\'),\n
destination=line.getDestination(portal_type=\'Account\'),\n destination=line.getDestination(portal_type=\'Account\'),\n
quantity= - line.getQuantity(),\n quantity= - line.getQuantity(),\n
...@@ -129,7 +130,7 @@ for line in line_list:\n ...@@ -129,7 +130,7 @@ for line in line_list:\n
\n \n
# copy some values if they are defined explicitly on line\n # copy some values if they are defined explicitly on line\n
for prop in [ \'source_section\', \'destination_section\',\n for prop in [ \'source_section\', \'destination_section\',\n
\'source_payment\', \'destination_payment\', ]:\n \'source_payment\', \'destination_payment\', \'resource\' ]:\n
if line.getProperty(prop) != context.getProperty(prop):\n if line.getProperty(prop) != context.getProperty(prop):\n
new_line.setProperty(prop, line.getProperty(prop))\n new_line.setProperty(prop, line.getProperty(prop))\n
\n \n
......
191 192
\ 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