Commit 114a2fc2 authored by Jérome Perrin's avatar Jérome Perrin

Checks the destination section is an Organisation or a Person


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4777 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 03b134b8
......@@ -83,8 +83,8 @@ else: \n
valid_date = 0\n
# check the date is in an opened period\n
transaction_date = DateTime( transaction.getStopDate().year(),\n
transaction.getStopDate().month(),\n
transaction.getStopDate().day() ) # we don\'t care about hour:minutes\n
transaction.getStopDate().month(),\n
transaction.getStopDate().day() ) # we don\'t care about hour:minutes\n
for apd in context.portal_catalog(\n
portal_type = "Accounting Period", \n
simulation_state = "planned") : \n
......@@ -95,20 +95,22 @@ else: \n
error_message = "Date is not in an openned Accounting Period" \n
\n
# Get sections and a currency.\n
source_section = transaction.getSourceSection()\n
destination_section = transaction.getDestinationSection()\n
source_section = transaction.getSourceSection(portal_type = [\'Organisation\'])\n
destination_section = transaction.getDestinationSection(portal_type = [\'Organisation\', \'Person\'])\n
currency = transaction.getResource()\n
\n
if source_section in (None, \'\'):\n
error_message = \'source_section is not defined\'\n
error_message = \'Source Section is not defined\'\n
elif transaction.getPortalType() not in (\'Balance Transaction\', \'Accounting Transaction\'):\n
if destination_section in (None, \'\'):\n
error_message = \'destination_section is not defined\'\n
error_message = \'Destination Section is not defined\'\n
if transaction.getDestinationSection() not in (None, \'\'):\n
error_message = \'Destination Section is not an Organisation or a Person\'\n
elif currency in (None, \'\'):\n
error_message = \'currency is not defined\'\n
\n
if error_message != \'\':\n
raise ValidationFailed, \'Action impossible : \'+error_message\n
raise ValidationFailed, \'Action impossible : \' + error_message\n
]]></string> </value>
......@@ -116,42 +118,45 @@ if error_message != \'\':\n
<item>
<key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAEAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAQAAABIAAAAPAAAAQwAA
AHM9AgAAZAEAawAAbAEAfQIAAWQCAH0DAHQDAHwAAGQDAIMCAH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PgEAAABzAAAAAA==</string> </value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
......
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