Commit 9d44c79b authored by Jérome Perrin's avatar Jérome Perrin

When setting source|destination reference, assign 1 for the first reference, not 0.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15273 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eb8a4d94
...@@ -68,8 +68,7 @@ ...@@ -68,8 +68,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># Purchase Invoice Transaction or Sale Invoice Transaction.\n <value> <string>transaction = state_change[\'object\']\n
transaction = state_change[\'object\']\n
\n \n
# Get sections.\n # Get sections.\n
source_section = transaction.getSourceSection()\n source_section = transaction.getSourceSection()\n
...@@ -77,19 +76,22 @@ destination_section = transaction.getDestinationSection()\n ...@@ -77,19 +76,22 @@ destination_section = transaction.getDestinationSection()\n
\n \n
# Invoice Reference is automatically filled only for Sale Invoice Transaction.\n # Invoice Reference is automatically filled only for Sale Invoice Transaction.\n
if transaction.getPortalType() == \'Sale Invoice Transaction\':\n if transaction.getPortalType() == \'Sale Invoice Transaction\':\n
if transaction.getReference() in (None, \'\'):\n if not transaction.getReference():\n
invoice_id_group = (\'accounting\', \'invoice\', source_section)\n invoice_id_group = (\'accounting\', \'invoice\', source_section)\n
invoice_reference = transaction.generateNewId(id_group = invoice_id_group)\n invoice_reference = transaction.generateNewId(id_group=invoice_id_group,\n
default=1)\n
transaction.setReference(invoice_reference)\n transaction.setReference(invoice_reference)\n
\n \n
# Generate new values for Source Reference and Destination Reference.\n # Generate new values for Source Reference and Destination Reference.\n
if transaction.getSourceReference() in (None, \'\'):\n if not transaction.getSourceReference():\n
source_id_group = (\'accounting\', \'section\', source_section)\n source_id_group = (\'accounting\', \'section\', source_section)\n
source_reference = transaction.generateNewId(id_group = source_id_group)\n source_reference = transaction.generateNewId(id_group=source_id_group,\n
default=1)\n
transaction.setSourceReference(source_reference)\n transaction.setSourceReference(source_reference)\n
if transaction.getDestinationReference() in (None, \'\'):\n if not transaction.getDestinationReference():\n
destination_id_group = (\'accounting\', \'section\', destination_section)\n destination_id_group = (\'accounting\', \'section\', destination_section)\n
destination_reference = transaction.generateNewId(id_group = destination_id_group)\n destination_reference = transaction.generateNewId(\n
id_group=destination_id_group, default=1)\n
transaction.setDestinationReference(destination_reference)\n transaction.setDestinationReference(destination_reference)\n
</string> </value> </string> </value>
</item> </item>
...@@ -145,7 +147,6 @@ if transaction.getDestinationReference() in (None, \'\'):\n ...@@ -145,7 +147,6 @@ if transaction.getDestinationReference() in (None, \'\'):\n
<string>_getattr_</string> <string>_getattr_</string>
<string>source_section</string> <string>source_section</string>
<string>destination_section</string> <string>destination_section</string>
<string>None</string>
<string>invoice_id_group</string> <string>invoice_id_group</string>
<string>invoice_reference</string> <string>invoice_reference</string>
<string>source_id_group</string> <string>source_id_group</string>
......
364 365
\ 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