Commit 11cb562e authored by Jérome Perrin's avatar Jérome Perrin

manually default start date to stop date; make sure resource is a Currency;...

manually default start date to stop date; make sure resource is a Currency; compare date as DateTime objects again


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6178 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83b843c8
...@@ -108,12 +108,16 @@ if destination_section is not None and \\\n ...@@ -108,12 +108,16 @@ if destination_section is not None and \\\n
if destination_section is None and check_destination :\n if destination_section is None and check_destination :\n
raiseError(\'Destination Section is not Defined.\')\n raiseError(\'Destination Section is not Defined.\')\n
\n \n
currency = transaction.getResource()\n currency = transaction.getResource(portal_type = \'Currency\')\n
if not currency :\n if not currency :\n
raiseError(\'Currency is not Defined.\')\n raiseError(\'Currency is not Defined.\')\n
\n \n
if transaction.getStartDate() in (None, \'\') :\n # XXX manually default start date to stop date\n
raiseError(\'date is not Defined\')\n if not transaction.getStartDate() and transaction.getStopDate():\n
transaction.setStartDate(transaction.getStopDate())\n
\n
if not transaction.getStartDate() :\n
raiseError(\'Date is not Defined\')\n
else:\n else:\n
if not skip_period_validation :\n if not skip_period_validation :\n
valid_date = False\n valid_date = False\n
...@@ -133,10 +137,9 @@ else:\n ...@@ -133,10 +137,9 @@ else:\n
valid_date = True\n valid_date = True\n
for apd in openned_accounting_period_list:\n for apd in openned_accounting_period_list:\n
apd = apd.getObject()\n apd = apd.getObject()\n
# Compare date, not datetime\n if apd.getStartDate() <= transaction_date <= apd.getStopDate():\n
if apd.getStartDate().strftime("%Y/%m/%d") <= transaction_date.strftime("%Y/%m/%d") <= apd.getStopDate().strftime("%Y/%m/%d"):\n
valid_date = True\n valid_date = True\n
if not valid_date:\n if not valid_date :\n
raiseError("Date is not in an openned Accounting Period "\n raiseError("Date is not in an openned Accounting Period "\n
"for source section")\n "for source section")\n
# do the same for destination section \n # do the same for destination section \n
...@@ -154,8 +157,7 @@ else:\n ...@@ -154,8 +157,7 @@ else:\n
valid_date = True\n valid_date = True\n
for apd in openned_accounting_period_list:\n for apd in openned_accounting_period_list:\n
apd = apd.getObject()\n apd = apd.getObject()\n
# Compare date, not datetime\n if apd.getStartDate() <= transaction_date <= apd.getStopDate():\n
if apd.getStartDate().strftime("%Y/%m/%d") <= transaction_date.strftime("%Y/%m/%d") <= apd.getStopDate().strftime("%Y/%m/%d"):\n
valid_date = True\n valid_date = True\n
if not valid_date :\n if not valid_date :\n
raiseError("Date is not in an openned Accounting Period "+\n raiseError("Date is not in an openned Accounting Period "+\n
......
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