[Erp5-report] r15269 - in /erp5/trunk/bt5/erp5_banking_core: SkinTemplateItem/portal_skins/...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jul 20 16:29:36 CEST 2007
Author: seb
Date: Fri Jul 20 16:29:35 2007
New Revision: 15269
URL: http://svn.erp5.org?rev=15269&view=rev
Log:
Include considered accounting date in the error message.
Simplify control flow.
Merge MySQL requests to always use only one instead of 2 in worst case.
Modified:
erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkAccountingDateOpen.xml
erp5/trunk/bt5/erp5_banking_core/bt/revision
Modified: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkAccountingDateOpen.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkAccountingDateOpen.xml?rev=15269&r1=15268&r2=15269&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkAccountingDateOpen.xml (original)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkAccountingDateOpen.xml Fri Jul 20 16:29:35 2007
@@ -96,17 +96,14 @@
# get only the office, not need of vault\n
#context.log(\'Baobab_checkAccountingDateOpen\', \'get site for vault %s\' %(site))\n
site = context.Baobab_getVaultSite(site)\n
-error = False\n
-if context.portal_catalog.countResults(portal_type=\'Accounting Date\', site_id=site.getId(), simulation_state="opened", limit=1)[0][0] == 0:\n
- # If there is no opened accounting date, consider today as an openned accounting day.\n
- if DateTime(date) < DateTime(DateTime().Date()):\n
- error = True\n
-elif context.portal_catalog.countResults(portal_type=\'Accounting Date\', start_date={\'query\':\'<=%s\' % (date, ), \'type\': \'date\', \'format\': \'%Y/%m/%d\'}, site_id=site.getId(), simulation_state="opened", limit=1)[0][0] == 0:\n
- # If an accounting date is openned but posterior to checked date, verification fails.\n
- error= True\n
-\n
-if error:\n
- msg = Message(domain = "ui", message="Transaction not in the good accounting date")\n
+accounting_date_list = context.portal_catalog(portal_type=\'Accounting Date\', site_id=site.getId(), simulation_state="opened", sort_on=[("start_date", "DESC")], limit=1)\n
+if len(accounting_date_list) == 0:\n
+ opened_accounting_date = DateTime(DateTime().Date())\n
+else:\n
+ opened_accounting_date = accounting_date_list[0].getStartDate()\n
+\n
+if DateTime(date) < opened_accounting_date:\n
+ msg = Message(domain = "ui", message="Transaction date incompatible with opened accounting date ${accounting_date}.", mapping={\'accounting_date\': opened_accounting_date})\n
raise ValidationFailed, (msg,)\n
\n
return "ok"\n
@@ -182,9 +179,8 @@
<string>site_list</string>
<string>len</string>
<string>_getitem_</string>
- <string>False</string>
- <string>error</string>
- <string>True</string>
+ <string>accounting_date_list</string>
+ <string>opened_accounting_date</string>
<string>msg</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_banking_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/bt/revision?rev=15269&r1=15268&r2=15269&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/bt/revision (original)
+++ erp5/trunk/bt5/erp5_banking_core/bt/revision Fri Jul 20 16:29:35 2007
@@ -1,1 +1,1 @@
-315
+320
More information about the Erp5-report
mailing list