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 ...@@ -83,8 +83,8 @@ else: \n
valid_date = 0\n valid_date = 0\n
# check the date is in an opened period\n # check the date is in an opened period\n
transaction_date = DateTime( transaction.getStopDate().year(),\n transaction_date = DateTime( transaction.getStopDate().year(),\n
transaction.getStopDate().month(),\n transaction.getStopDate().month(),\n
transaction.getStopDate().day() ) # we don\'t care about hour:minutes\n transaction.getStopDate().day() ) # we don\'t care about hour:minutes\n
for apd in context.portal_catalog(\n for apd in context.portal_catalog(\n
portal_type = "Accounting Period", \n portal_type = "Accounting Period", \n
simulation_state = "planned") : \n simulation_state = "planned") : \n
...@@ -95,20 +95,22 @@ else: \n ...@@ -95,20 +95,22 @@ else: \n
error_message = "Date is not in an openned Accounting Period" \n error_message = "Date is not in an openned Accounting Period" \n
\n \n
# Get sections and a currency.\n # Get sections and a currency.\n
source_section = transaction.getSourceSection()\n source_section = transaction.getSourceSection(portal_type = [\'Organisation\'])\n
destination_section = transaction.getDestinationSection()\n destination_section = transaction.getDestinationSection(portal_type = [\'Organisation\', \'Person\'])\n
currency = transaction.getResource()\n currency = transaction.getResource()\n
\n \n
if source_section in (None, \'\'):\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 elif transaction.getPortalType() not in (\'Balance Transaction\', \'Accounting Transaction\'):\n
if destination_section in (None, \'\'):\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 elif currency in (None, \'\'):\n
error_message = \'currency is not defined\'\n error_message = \'currency is not defined\'\n
\n \n
if error_message != \'\':\n if error_message != \'\':\n
raise ValidationFailed, \'Action impossible : \'+error_message\n raise ValidationFailed, \'Action impossible : \' + error_message\n
]]></string> </value> ]]></string> </value>
...@@ -116,42 +118,45 @@ if error_message != \'\':\n ...@@ -116,42 +118,45 @@ if error_message != \'\':\n
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAEAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAQAAABIAAAAPAAAAQwAA <value> <string encoding="base64">YwAAAAAAAAAAAQAAAEAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAQAAABIAAAAPAAAAQwAA
AHM9AgAAZAEAawAAbAEAfQIAAWQCAH0DAHQDAHwAAGQDAIMCAH0FAHQGAHQDAHwAAGQEAIMCAGQF AHN7AgAAZAEAawAAbAEAfQIAAWQCAH0DAHQDAHwAAGQDAIMCAH0FAHQGAHQDAHwAAGQEAIMCAGQF
AIMCAGQGAGQHAIMCAH0HAHQGAHwFAGQIAIMCAIMAAHQIAGQCAGYCAGoGAG8KAAFkCQB9AwBuAAEB AIMCAGQGAGQHAIMCAH0HAHQGAHwFAGQIAIMCAIMAAHQIAGQCAGYCAGoGAG8KAAFkCQB9AwBuAAEB
fAcADG/3AAFkBwB9CQB0CgB0BgB0BgB8BQBkCACDAgCDAABkCgCDAgCDAAB0BgB0BgB8BQBkCACD fAcADG/3AAFkBwB9CQB0CgB0BgB0BgB8BQBkCACDAgCDAABkCgCDAgCDAAB0BgB0BgB8BQBkCACD
AgCDAABkCwCDAgCDAAB0BgB0BgB8BQBkCACDAgCDAABkDACDAgCDAACDAwB9CwB4fgB0DAB0BgB0 AgCDAABkCwCDAgCDAAB0BgB0BgB8BQBkCACDAgCDAABkDACDAgCDAACDAwB9CwB4fgB0DAB0BgB0
DQBkDQCDAgBkDgBkDwBkEABkEQCDAAKDAQBEXVgAfQ4Ad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b25zBAAAAE5vbmVzCgAAAHZh
cmlwdCAoUHl0aG9uKXMTAAAAdmFsaWRhdGVUcmFuc2FjdGlvbgEAAABzOgAAAA0CBgMPASECHwEK bGlkX2RhdGVzCAAAAERhdGVUaW1lcxAAAAB0cmFuc2FjdGlvbl9kYXRlcwkAAABfZ2V0aXRlcl9z
AggBBgIkARsBGwElAAYDEgE2AQ4BCAEOAxIBEgESAhMBCgEfARMBCgETAQ4CDQEoAQAAAHMTAAAA BwAAAGNvbnRleHRzAwAAAGFwZHMOAAAAc291cmNlX3NlY3Rpb25zEwAAAGRlc3RpbmF0aW9uX3Nl
dmFsaWRhdGVUcmFuc2FjdGlvbigBAAAAcxMAAAB2YWxpZGF0ZVRyYW5zYWN0aW9uKAAAAAAoAAAA Y3Rpb25zCAAAAGN1cnJlbmN5KAAAAAAoAAAAAHMPAAAAU2NyaXB0IChQeXRob24pcxMAAAB2YWxp
AHMPAAAAU2NyaXB0IChQeXRob24pcwgAAAA8bW9kdWxlPgEAAABzAAAAAA==</string> </value> ZGF0ZVRyYW5zYWN0aW9uAQAAAHM+AAAADQIGAw8BIQIfAQoCCAEGAiQBGwEbASUABgMSATYBDgEI
AQ4DGwEeARICEwEKAR8BEwEGAR8BDgETAQ4CDQEoAQAAAHMTAAAAdmFsaWRhdGVUcmFuc2FjdGlv
bigBAAAAcxMAAAB2YWxpZGF0ZVRyYW5zYWN0aW9uKAAAAAAoAAAAAHMPAAAAU2NyaXB0IChQeXRo
b24pcwgAAAA8bW9kdWxlPgEAAABzAAAAAA==</string> </value>
</item> </item>
<item> <item>
<key> <string>_dav_writelocks</string> </key> <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