Commit 302b40ee authored by Sebastien Robin's avatar Sebastien Robin

- automatically define start date and stop date on currency exchange line in...

- automatically define start date and stop date on currency exchange line in order to make it available for the full day.
- allow some document to not be closed when we close the counter date
- the accounting date make all operations after the date working

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15162 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fd12be27
...@@ -65,7 +65,9 @@ ...@@ -65,7 +65,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># Raise ValidationFailed if the accounting date is not opened for the given date and the given site\n <value> <string encoding="cdata"><![CDATA[
# Raise ValidationFailed if the accounting date is not opened for the given date and the given site\n
\n \n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
...@@ -91,10 +93,13 @@ if site is None:\n ...@@ -91,10 +93,13 @@ if site is None:\n
#context.log(\'Baobab_checkAccountingDateOpen\', \'get site for vault %s\' %(site))\n #context.log(\'Baobab_checkAccountingDateOpen\', \'get site for vault %s\' %(site))\n
site = context.Baobab_getVaultSite(site)\n site = context.Baobab_getVaultSite(site)\n
\n \n
if context.portal_catalog.countResults(portal_type=\'Accounting Date\', start_date=str(date), site_id=site.getId(), simulation_state="opened")[0][0] == 0:\n if 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
msg = Message(domain = "ui", message="Transaction not in the good counter date")\n raise Exception, 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, src__=1)\n
msg = Message(domain = "ui", message="Transaction not in the good accounting date")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -163,7 +168,7 @@ if context.portal_catalog.countResults(portal_type=\'Accounting Date\', start_da ...@@ -163,7 +168,7 @@ if context.portal_catalog.countResults(portal_type=\'Accounting Date\', start_da
<string>site_list</string> <string>site_list</string>
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>str</string> <string>Exception</string>
<string>msg</string> <string>msg</string>
</tuple> </tuple>
</value> </value>
......
...@@ -91,6 +91,7 @@ if site_uid is not None:\n ...@@ -91,6 +91,7 @@ if site_uid is not None:\n
(simulation_state == \'finished\' and \'siege\' in here.getSource(\'\'))\n (simulation_state == \'finished\' and \'siege\' in here.getSource(\'\'))\n
)\n )\n
)\n )\n
or (portal_type == \'Monetary Destruction\' and simulation_state == \'ordered\')\n
):\n ):\n
append(document)\n append(document)\n
\n \n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n
\n
current_date_string = DateTime().strftime(\'%Y-%m-%d\')\n
start_date = DateTime(\'%s 00:00\' % current_date_string)\n
stop_date = DateTime(\'%s 23:59\' % current_date_string)\n
context.setStartDate(start_date)\n
context.setStopDate(stop_date)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>DateTime</string>
<string>_getattr_</string>
<string>current_date_string</string>
<string>start_date</string>
<string>stop_date</string>
<string>context</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CurrencyExchangeLine_init</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
308 310
\ 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