Commit e585b05a authored by Jérome Perrin's avatar Jérome Perrin

Refactor the use of Accounting Period. Closing a period will new create a balance transaction.

Balance Transaction also changed, it now uses destination by default, because BalanceTransaction will in the near future be catalogued as inventories.
Accounting Period workflow was also simplified a lot.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15786 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e3e419fe
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/AccountingTransactionLine_view</string> </value> <value> <string>string:${object_url}/AccountingTransactionLine_viewDestination</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Comments</string> </value> <value> <string>Description</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Workflow_statusModify</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_comment</string>
<string>my_workflow_action</string>
<string>your_profit_and_loss_account</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingPeriod_viewDeliverWorkflowActionDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Base_viewWorkflowActionDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Validate Workflow Action</string> </value>
</item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>simulation_state</string> </value> <value> <string>my_workflow_action</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -217,23 +217,7 @@ ...@@ -217,23 +217,7 @@
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item>
<item>
<key> <string>editable_expression</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable_permission</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>editable_role</string> </key>
<value>
<list/>
</value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
...@@ -249,27 +233,19 @@ ...@@ -249,27 +233,19 @@
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>max_length</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>not_viewable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>read_only</string> </key>
<value> <int>1</int> </value>
</item>
<item> <item>
<key> <string>required</string> </key> <key> <string>required</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>State</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
...@@ -279,22 +255,6 @@ ...@@ -279,22 +255,6 @@
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>viewable_expression</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>viewable_permission</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>viewable_role</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>whitespace_preserve</string> </key> <key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -319,7 +279,7 @@ ...@@ -319,7 +279,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.portal_workflow.getInfoFor(here, \'simulation_state\')</string> </value> <value> <string>request/workflow_action | nothing</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -91,12 +91,12 @@ ...@@ -91,12 +91,12 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <value>
<list> <list>
<string>listbox_source_payment</string>
<string>listbox_resource</string> <string>listbox_resource</string>
<string>listbox_source</string> <string>listbox_source_section_title</string>
<string>listbox_source_debit</string> <string>listbox_destination</string>
<string>listbox_source_credit</string> <string>listbox_destination_credit</string>
<string>listbox_destination_section_title</string> <string>listbox_destination_debit</string>
<string>listbox_destination_payment</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -104,8 +104,10 @@ ...@@ -104,8 +104,10 @@
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>my_source_section</string> <string>my_destination_section</string>
<string>my_destination_reference</string>
<string>my_title</string> <string>my_title</string>
<string>my_resource</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -115,7 +117,8 @@ ...@@ -115,7 +117,8 @@
<list> <list>
<string>my_start_date</string> <string>my_start_date</string>
<string>my_description</string> <string>my_description</string>
<string>simulation_state</string> <string>my_translated_portal_type</string>
<string>my_translated_simulation_state_title</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -338,15 +338,15 @@ ...@@ -338,15 +338,15 @@
<string>ID</string> <string>ID</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source</string> <string>destination</string>
<string>Account</string> <string>Account</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_payment</string> <string>destination_payment</string>
<string>Bank Account</string> <string>Bank Account</string>
</tuple> </tuple>
<tuple> <tuple>
<string>getDestinationSectionTitle</string> <string>source_section_title</string>
<string>Third Party</string> <string>Third Party</string>
</tuple> </tuple>
<tuple> <tuple>
...@@ -354,11 +354,11 @@ ...@@ -354,11 +354,11 @@
<string>Currency</string> <string>Currency</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_debit</string> <string>destination_debit</string>
<string>Debit</string> <string>Debit</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_credit</string> <string>destination_credit</string>
<string>Credit</string> <string>Credit</string>
</tuple> </tuple>
</list> </list>
...@@ -405,11 +405,11 @@ ...@@ -405,11 +405,11 @@
<value> <value>
<list> <list>
<tuple> <tuple>
<string>source</string> <string>destination</string>
<string>Account</string> <string>Account</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_payment</string> <string>destination_payment</string>
<string>Bank Account</string> <string>Bank Account</string>
</tuple> </tuple>
<tuple> <tuple>
...@@ -417,11 +417,11 @@ ...@@ -417,11 +417,11 @@
<string>Currency</string> <string>Currency</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_debit</string> <string>destination_debit</string>
<string>Debit</string> <string>Debit</string>
</tuple> </tuple>
<tuple> <tuple>
<string>source_credit</string> <string>destination_credit</string>
<string>Credit</string> <string>Credit</string>
</tuple> </tuple>
</list> </list>
...@@ -454,12 +454,7 @@ ...@@ -454,12 +454,7 @@
<item> <item>
<key> <string>global_attributes</string> </key> <key> <string>global_attributes</string> </key>
<value> <value>
<list> <list/>
<tuple>
<string>source_section</string>
<string>source_section</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -468,7 +463,7 @@ ...@@ -468,7 +463,7 @@
</item> </item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>lines</string> </key>
<value> <int>20</int> </value> <value> <int>30</int> </value>
</item> </item>
<item> <item>
<key> <string>list_action</string> </key> <key> <string>list_action</string> </key>
...@@ -552,12 +547,23 @@ ...@@ -552,12 +547,23 @@
<item> <item>
<key> <string>stat_columns</string> </key> <key> <string>stat_columns</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>destination_debit</string>
<string>AccountingTransactionLine_statSourceCredit</string>
</tuple>
<tuple>
<string>destination_credit</string>
<string>AccountingTransactionLine_statSourceDebit</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>stat_method</string> </key> <key> <string>stat_method</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -610,4 +616,23 @@ ...@@ -610,4 +616,23 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.MethodField</string>
<string>Method</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>AccountingTransaction_getInvoiceTransactionLineList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>listbox_source</string> </value> <value> <string>listbox_destination</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>listbox_source</string> </value> <value> <string>Destination</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>listbox_source_debit</string> </value> <value> <string>listbox_destination_credit</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>listbox_source_debit</string> </value> <value> <string>Credit</string> </value>
</item> </item>
<item> <item>
<key> <string>whitespace_preserve</string> </key> <key> <string>whitespace_preserve</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>listbox_source_credit</string> </value> <value> <string>listbox_destination_debit</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>listbox_source_credit</string> </value> <value> <string>Debit</string> </value>
</item> </item>
<item> <item>
<key> <string>whitespace_preserve</string> </key> <key> <string>whitespace_preserve</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>listbox_source_payment</string> </value> <value> <string>listbox_destination_payment</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>listbox_source_payment</string> </value> <value> <string>Payment</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: cell.getObject().AccountingTransaction_getSourcePaymentItemList()</string> </value> <value> <string>python: cell.getObject().AccountingTransaction_getDestinationPaymentItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>listbox_resource</string> </value> <value> <string>Currency</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>listbox_destination_section_title</string> </value> <value> <string>listbox_source_section_title</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>listbox_destination_section_title</string> </value> <value> <string>Third Party</string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_source_section</string> </value> <value> <string>my_destination_section</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -71,48 +71,43 @@ ...@@ -71,48 +71,43 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n \n
closing_period = state_change[\'object\']\n closing_period = state_change[\'object\']\n
portal = closing_period.getPortalObject()\n portal = closing_period.getPortalObject()\n
N_ = portal.Base_translateString\n N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
valid_states = [\'planned\', \'confirmed\', \'delivered\']\n valid_state_list = [\'started\', \'stopped\', \'delivered\']\n
\n \n
start_date = closing_period.getStartDate()\n start_date = closing_period.getStartDate()\n
stop_date = closing_period.getStopDate()\n stop_date = closing_period.getStopDate()\n
\n \n
if start_date > stop_date :\n if start_date > stop_date:\n
raise ValidationFailed, N_("Start Date is After Stop Date")\n raise ValidationFailed, N_("Start Date is After Stop Date")\n
\n \n
period_list = closing_period.getParentValue().searchFolder(\n period_list = closing_period.getParentValue().searchFolder(\n
simulation_state = valid_states,\n simulation_state=valid_state_list,\n
sort_on = [(\'delivery.start_date\', \'asc\')],\n sort_on=[(\'delivery.start_date\', \'asc\')],\n
portal_type = \'Accounting Period\')\n portal_type=\'Accounting Period\')\n
\n \n
for period in period_list :\n for period in period_list:\n
period = period.getObject()\n period = period.getObject()\n
portal.log("AccountingPeriod_CheckDates", "id:%s start:%s stop:%s" % (\n if period.getSimulationState() in valid_state_list:\n
period.getId(),\n if start_date <= period.getStopDate():\n
period.getStartDate(),\n
period.getStopDate()))\n
if period.getSimulationState() in valid_states :\n
if start_date <= period.getStopDate() :\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
"${date} is already in an opened accounting period",\n "${date} is already in an opened accounting period",\n
mapping = {\'date\': period.Base_FormatDate(start_date)})\n mapping={\'date\': start_date})\n
\n \n
if len(period_list) > 1 :\n if len(period_list) > 1:\n
last_period = period_list[-1].getObject()\n last_period = period_list[-1].getObject()\n
if last_period.getId() == closing_period.getId() :\n if last_period.getId() == closing_period.getId():\n
last_period = period_list[-2].getObject()\n last_period = period_list[-2].getObject()\n
if (start_date - last_period.getStopDate()) > 1:\n if (start_date - last_period.getStopDate()) > 1:\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
"Last opened period ends on ${last_openned_date},"+\n "Last opened period ends on ${last_openned_date},"+\n
" this period starts on ${this_period_start_date}."+\n " this period starts on ${this_period_start_date}."+\n
" Accounting Periods must be consecutive.",\n " Accounting Periods must be consecutive.",\n
mapping = { \'last_openned_date\' :\n mapping = { \'last_openned_date\': last_period.getStopDate(),\n
period.Base_FormatDate(last_period.getStopDate()),\n \'this_period_start_date\': start_date } )\n
\'this_period_start_date\' :\n
period.Base_FormatDate(start_date) } )\n
]]></string> </value> ]]></string> </value>
...@@ -160,12 +155,14 @@ if len(period_list) > 1 :\n ...@@ -160,12 +155,14 @@ if len(period_list) > 1 :\n
<string>state_change</string> <string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string> <string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>closing_period</string> <string>closing_period</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>portal</string> <string>portal</string>
<string>N_</string> <string>N_</string>
<string>valid_states</string> <string>valid_state_list</string>
<string>start_date</string> <string>start_date</string>
<string>stop_date</string> <string>stop_date</string>
<string>period_list</string> <string>period_list</string>
...@@ -189,7 +186,7 @@ if len(period_list) > 1 :\n ...@@ -189,7 +186,7 @@ if len(period_list) > 1 :\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>AccountingPeriod_CheckDates</string> </value> <value> <string>checkDates</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -68,43 +68,41 @@ ...@@ -68,43 +68,41 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ZSQLCatalog.SQLCatalog import Query\n
from Products.ZSQLCatalog.SQLCatalog import ComplexQuery\n
\n \n
closing_period = state_change[\'object\']\n period = state_change[\'object\']\n
portal = closing_period.getPortalObject()\n portal = period.getPortalObject()\n
N_ = portal.Base_translateString\n N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
accounting_module = portal.accounting_module\n
valid_states = [\'cancelled\', \'stopped\']\n
\n \n
start_date = closing_period.getStartDate()\n
stop_date = closing_period.getStopDate()\n
\n \n
search_params = { \'delivery.start_date\' : \'>= %s\' % start_date,\n valid_simulation_state_list = [\'cancelled\', \'delivered\', \'delivered\']\n
\'delivery.stop_date\' : \'<= %s\' % stop_date,\n all_state_list = [x[1] for x in\n
\'simulation_state\' : \'stopped\' }\n portal.Base_getTranslatedWorkflowStateItemList(wf_id=\'accounting_workflow\')]\n
transaction_list = accounting_module.searchFolder( **search_params )\n invalid_simulation_state_list = [state for state in all_state_list\n
if state not in valid_simulation_state_list]\n
\n \n
comment=N_("Closing period ${period_title}",\n section_uid = period.getParentUid()\n
mapping={\'period_title\': unicode(closing_period.getTitle(), \'utf8\')})\n search_params = {\n
\'delivery.start_date\': dict(query=period.getStartDate(),\n
range=\'min\'),\n
\'delivery.stop_date\': dict(query=period.getStopDate(),\n
range=\'ngt\'),\n
\'simulation_state\': invalid_simulation_state_list,\n
\'portal_type\': portal.getPortalAccountingTransactionTypeList(),\n
\'query\': ComplexQuery(Query(source_section_uid=section_uid),\n
Query(destination_section_uid=section_uid),\n
operator=\'OR\')\n
}\n
\n \n
section_uid = closing_period.getParentValue().getUid()\n transaction_list = portal.portal_catalog.searchResults(**search_params)\n
for transaction in transaction_list :\n if transaction_list:\n
transaction = transaction.getObject()\n raise ValidationFailed, N_(\n
# FIXME: this approach is not compatible with categories as sections.\n "All Accounting Transactions for this organisation during the period have"\n
if transaction.getSourceSectionUid() == section_uid or \\\n " to be closed first")\n
transaction.getDestinationSectionUid() == section_uid :\n </string> </value>
transaction.activate().AccountingTransaction_closeByAccountingPeriod(\n
comment = comment, closing_period_path = closing_period.getPath() )\n
\n
# if a transaction validation fails, it puts the Closing Period object back to confirmed state\n
closing_period.activate( \n
after_method_id = [\'AccountingTransaction_closeByAccountingPeriod\']\n
).deliver()\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -149,23 +147,29 @@ closing_period.activate( \n ...@@ -149,23 +147,29 @@ closing_period.activate( \n
<string>state_change</string> <string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string> <string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>Products.ZSQLCatalog.SQLCatalog</string>
<string>Query</string>
<string>ComplexQuery</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>closing_period</string> <string>period</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>portal</string> <string>portal</string>
<string>N_</string> <string>N_</string>
<string>accounting_module</string> <string>valid_simulation_state_list</string>
<string>valid_states</string> <string>append</string>
<string>start_date</string> <string>$append0</string>
<string>stop_date</string> <string>_getiter_</string>
<string>x</string>
<string>all_state_list</string>
<string>state</string>
<string>invalid_simulation_state_list</string>
<string>section_uid</string>
<string>dict</string>
<string>search_params</string> <string>search_params</string>
<string>_apply_</string> <string>_apply_</string>
<string>transaction_list</string> <string>transaction_list</string>
<string>unicode</string>
<string>comment</string>
<string>section_uid</string>
<string>_getiter_</string>
<string>transaction</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -182,7 +186,7 @@ closing_period.activate( \n ...@@ -182,7 +186,7 @@ closing_period.activate( \n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>AccountingPeriod_DeliverTransactions</string> </value> <value> <string>checkTransactionsState</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -68,25 +68,17 @@ ...@@ -68,25 +68,17 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Deliver the transaction and \'notify\' the closing_period on failure."""\n <value> <string>"""Create a balance transaction\n
"""\n
from DateTime import DateTime\n
\n \n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n accounting_period = sci[\'object\']\n
N_ = context.Base_translateString\n portal = accounting_period.getPortalObject()\n
profit_and_loss_account = portal.portal_workflow.getInfoFor(\n
accounting_period, \'profit_and_loss_account\')\n
\n \n
try : \n accounting_period.AccountingPeriod_createBalanceTransaction(\n
context.portal_workflow.doActionFor( context,\n profit_and_loss_account=profit_and_loss_account)\n
\'deliver_action\', \n
skip_period_validation = 1,\n
comment=comment )\n
except ValidationFailed, message :\n
closing_period = context.getPortalObject().restrictedTraverse(closing_period_path)\n
if closing_period.getSimulationState() != \'confirmed\' :\n
closing_period.failClosing()\n
closing_period.portal_workflow.doActionFor( closing_period,\n
\'edit_action\', \n
comment=N_(\'unable to deliver ${transaction_path} : ${error_message}\',\n
mapping={\'transaction_path\':context.getPath(),\n
\'error_message\': unicode(str(message), \'utf8\') } ))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -101,9 +93,15 @@ except ValidationFailed, message :\n ...@@ -101,9 +93,15 @@ except ValidationFailed, message :\n
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>comment, closing_period_path, **kw</string> </value> <value> <string>sci</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -123,24 +121,19 @@ except ValidationFailed, message :\n ...@@ -123,24 +121,19 @@ except ValidationFailed, message :\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>2</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>comment</string> <string>sci</string>
<string>closing_period_path</string> <string>DateTime</string>
<string>kw</string> <string>_getitem_</string>
<string>Products.DCWorkflow.DCWorkflow</string> <string>accounting_period</string>
<string>ValidationFailed</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>portal</string>
<string>N_</string> <string>profit_and_loss_account</string>
<string>message</string>
<string>closing_period</string>
<string>unicode</string>
<string>str</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -157,7 +150,7 @@ except ValidationFailed, message :\n ...@@ -157,7 +150,7 @@ except ValidationFailed, message :\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>AccountingTransaction_closeByAccountingPeriod</string> </value> <value> <string>createBalanceTransaction</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string>The Accounting Period is cancelled, a new one should be defined.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
...@@ -42,6 +42,12 @@ ...@@ -42,6 +42,12 @@
<tuple/> <tuple/>
</value> </value>
</item> </item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
...@@ -77,9 +83,7 @@ ...@@ -77,9 +83,7 @@
<item> <item>
<key> <string>Modify portal content</string> </key> <key> <string>Modify portal content</string> </key>
<value> <value>
<tuple> <tuple/>
<string>Manager</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.States</string>
<string>StateDefinition</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Closing is the state used when the activity of delivering transaction happens.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>closing</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Closing</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>deliver</string>
<string>fail_closing</string>
</tuple>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string>The Accounting Period is closed.\r\n
\r\n
It is no longer possible to add accounting transactions in this period. A balance transaction has been created.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string>The Accounting Period is not openned yet.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
...@@ -42,11 +42,17 @@ ...@@ -42,11 +42,17 @@
<tuple> <tuple>
<string>cancel</string> <string>cancel</string>
<string>cancel_action</string> <string>cancel_action</string>
<string>plan</string> <string>start</string>
<string>plan_action</string> <string>start_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -18,13 +18,21 @@ ...@@ -18,13 +18,21 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string>The Accounting Period is openned.\r\n
\r\n
It is therefore possible to post accounting accounting transactions with dates during this period.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>planned</string> </value> <value> <string>started</string> </value>
</item> </item>
<item> <item>
<key> <string>permission_roles</string> </key> <key> <string>permission_roles</string> </key>
...@@ -34,14 +42,14 @@ ...@@ -34,14 +42,14 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Open</string> </value> <value> <string>Openned</string> </value>
</item> </item>
<item> <item>
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>confirm</string> <string>stop</string>
<string>confirm_action</string> <string>stop_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -78,7 +86,6 @@ ...@@ -78,7 +86,6 @@
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string> <string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Author</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
...@@ -97,9 +104,7 @@ ...@@ -97,9 +104,7 @@
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string> <string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Author</string>
<string>Manager</string> <string>Manager</string>
<string>Member</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -18,13 +18,20 @@ ...@@ -18,13 +18,20 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string>The Accounting Period is temporary closed, but can be openned back.\r\n
In this state it is not possible to post transactions during this period.</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>confirmed</string> </value> <value> <string>stopped</string> </value>
</item> </item>
<item> <item>
<key> <string>permission_roles</string> </key> <key> <string>permission_roles</string> </key>
...@@ -34,16 +41,16 @@ ...@@ -34,16 +41,16 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Temporally Closed Accounting Period</string> </value> <value> <string>Temporary Closed</string> </value>
</item> </item>
<item> <item>
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>close</string> <string>deliver</string>
<string>close_action</string> <string>deliver_action</string>
<string>plan</string> <string>restart_action</string>
<string>reopen_action</string> <string>start</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -80,7 +87,6 @@ ...@@ -80,7 +87,6 @@
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string> <string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Author</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
...@@ -99,9 +105,7 @@ ...@@ -99,9 +105,7 @@
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string> <string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Author</string>
<string>Manager</string> <string>Manager</string>
<string>Member</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
<value> <value>
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string>
<string>Owner</string> <string>Owner</string>
</tuple> </tuple>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Transitions</string>
<string>TransitionDefinition</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>AccountingPeriod_DeliverTransactions</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>close</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>closing</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string></string> </value> <value> <string>createBalanceTransaction</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>actbox_category</string> </key> <key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value> <value> <string>workflow</string> </value>
...@@ -28,25 +34,25 @@ ...@@ -28,25 +34,25 @@
</item> </item>
<item> <item>
<key> <string>actbox_url</string> </key> <key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=close_action</string> </value> <value> <string>%(content_url)s/AccountingPeriod_viewDeliverWorkflowActionDialog?workflow_action=deliver_action</string> </value>
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string>close</string> </value> <value> <string>deliver</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Closing accounting period is made in an activity. if it fails, the Accounting Period object remains in confirmed state, otherwise it goes to delivered state, depending on the result of passing workflow transitions.</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>guard</string> </key> <key> <string>guard</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <none/>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>close_action</string> </value> <value> <string>deliver_action</string> </value>
</item> </item>
<item> <item>
<key> <string>new_state_id</string> </key> <key> <string>new_state_id</string> </key>
...@@ -54,7 +60,7 @@ ...@@ -54,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <string></string> </value> <value> <string>checkTransactionsState</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -64,6 +70,12 @@ ...@@ -64,6 +70,12 @@
<key> <string>trigger_type</string> </key> <key> <string>trigger_type</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
</item> </item>
<item>
<key> <string>var_exprs</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
...@@ -71,8 +83,8 @@ ...@@ -71,8 +83,8 @@
<pickle> <pickle>
<tuple> <tuple>
<tuple> <tuple>
<string>Products.DCWorkflow.Guard</string> <string>Persistence</string>
<string>Guard</string> <string>PersistentMapping</string>
</tuple> </tuple>
<none/> <none/>
</tuple> </tuple>
...@@ -80,13 +92,36 @@ ...@@ -80,13 +92,36 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>roles</string> </key> <key> <string>_container</string> </key>
<value>
<dictionary>
<item>
<key> <string>profit_and_loss_account</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple> <tuple>
<string>Assignor</string> <tuple>
<string>Manager</string> <string>Products.CMFCore.Expression</string>
<string>Expression</string>
</tuple> </tuple>
</value> <none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>kwargs/profit_and_loss_account | nothing</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Transitions</string>
<string>TransitionDefinition</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>fail_closing</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>confirmed</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
</item> </item>
<item> <item>
<key> <string>actbox_url</string> </key> <key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=reopen_action</string> </value> <value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=restart_action</string> </value>
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string>plan</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>reopen_action</string> </value> <value> <string>restart_action</string> </value>
</item> </item>
<item> <item>
<key> <string>new_state_id</string> </key> <key> <string>new_state_id</string> </key>
<value> <string></string> </value> <value> <string>started</string> </value>
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
<value> <value>
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>confirm</string> </value> <value> <string>start</string> </value>
</item> </item>
<item> <item>
<key> <string>new_state_id</string> </key> <key> <string>new_state_id</string> </key>
<value> <string>confirmed</string> </value> <value> <string>started</string> </value>
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
......
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
</item> </item>
<item> <item>
<key> <string>actbox_url</string> </key> <key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=plan_action</string> </value> <value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=start_action</string> </value>
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string>plan</string> </value> <value> <string>start</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>plan_action</string> </value> <value> <string>start_action</string> </value>
</item> </item>
<item> <item>
<key> <string>new_state_id</string> </key> <key> <string>new_state_id</string> </key>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <string>AccountingPeriod_CheckDates</string> </value> <value> <string>checkDates</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
<value> <value>
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>plan</string> </value> <value> <string>stop</string> </value>
</item> </item>
<item> <item>
<key> <string>new_state_id</string> </key> <key> <string>new_state_id</string> </key>
<value> <string>planned</string> </value> <value> <string>stopped</string> </value>
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
......
...@@ -24,15 +24,15 @@ ...@@ -24,15 +24,15 @@
</item> </item>
<item> <item>
<key> <string>actbox_name</string> </key> <key> <string>actbox_name</string> </key>
<value> <string>Temporally Close Accounting Period</string> </value> <value> <string>Temporary Close Accounting Period</string> </value>
</item> </item>
<item> <item>
<key> <string>actbox_url</string> </key> <key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=confirm_action</string> </value> <value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=stop_action</string> </value>
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string>confirm</string> </value> <value> <string>stop</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>confirm_action</string> </value> <value> <string>stop_action</string> </value>
</item> </item>
<item> <item>
<key> <string>new_state_id</string> </key> <key> <string>new_state_id</string> </key>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <string>AccountingPeriod_CheckTransactionsState</string> </value> <value> <string>checkTransactionsState</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
<value> <value>
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -18,15 +18,21 @@ ...@@ -18,15 +18,21 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>default_expr</string> </key> <key> <string>default_expr</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <none/>
</value> </value>
</item> </item>
<item> <item>
<key> <string>default_value</string> </key> <key> <string>default_value</string> </key>
<value> <string>Associate</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -38,11 +44,11 @@ ...@@ -38,11 +44,11 @@
</item> </item>
<item> <item>
<key> <string>for_status</string> </key> <key> <string>for_status</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>zz</string> </value> <value> <string>profit_and_loss_account</string> </value>
</item> </item>
<item> <item>
<key> <string>info_guard</string> </key> <key> <string>info_guard</string> </key>
...@@ -52,26 +58,7 @@ ...@@ -52,26 +58,7 @@
</item> </item>
<item> <item>
<key> <string>update_always</string> </key> <key> <string>update_always</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.CMFCore.Expression</string>
<string>Expression</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:[\'Order Assignee\', \'Invoice Assignee\']</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -79,7 +79,7 @@ from Products.ERP5Type.Message import Message\n ...@@ -79,7 +79,7 @@ from Products.ERP5Type.Message import Message\n
transaction = state_change[\'object\']\n transaction = state_change[\'object\']\n
N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
\n \n
# do we have to check transaction is in openned periods ?\n # do we have to check transaction is in openned periods ? \n
skip_period_validation = state_change[\'kwargs\'].get(\n skip_period_validation = state_change[\'kwargs\'].get(\n
\'skip_period_validation\', 0)\n \'skip_period_validation\', 0)\n
transition = state_change[\'transition\']\n transition = state_change[\'transition\']\n
...@@ -94,36 +94,34 @@ check_destination = (transaction.getPortalType() in\n ...@@ -94,36 +94,34 @@ check_destination = (transaction.getPortalType() in\n
source_section = transaction.getSourceSectionValue(\n source_section = transaction.getSourceSectionValue(\n
portal_type=[\'Organisation\', \'Person\'])\n portal_type=[\'Organisation\', \'Person\'])\n
if source_section is None:\n if source_section is None:\n
raise ValidationFailed(\'Source Section is not Defined.\')\n raise ValidationFailed(N_(\'Source Section is not Defined.\'))\n
\n \n
destination_section = transaction.getDestinationSectionValue(\n destination_section = transaction.getDestinationSectionValue(\n
portal_type=[\'Organisation\', \'Person\'])\n portal_type=[\'Organisation\', \'Person\'])\n
# if it\'s not an invoice, then we can validate without destination\n # if it\'s not an invoice, then we can validate without destination\n
if destination_section is None and check_destination :\n if destination_section is None and check_destination :\n
raise ValidationFailed(\'Destination Section is not Defined.\')\n raise ValidationFailed(N_(\'Destination Section is not Defined.\'))\n
\n \n
currency = transaction.getResource(portal_type = \'Currency\')\n currency = transaction.getResource(portal_type = \'Currency\')\n
if not currency :\n if not currency :\n
raise ValidationFailed(\'Currency is not Defined.\')\n raise ValidationFailed(N_(\'Currency is not Defined.\'))\n
\n \n
# XXX manually default start date to stop date\n # XXX manually default start date to stop date\n
if not transaction.getStartDate() and transaction.getStopDate():\n if not transaction.getStartDate() and transaction.getStopDate():\n
transaction.setStartDate(transaction.getStopDate())\n transaction.setStartDate(transaction.getStopDate())\n
\n \n
if not transaction.getStartDate() :\n if not transaction.getStartDate() :\n
raise ValidationFailed(\'Date is not Defined\')\n raise ValidationFailed(N_(\'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
# check the date is in an opened period\n # check the date is in an opened period\n
transaction_date = DateTime( transaction.getStartDate().year(),\n transaction_date = transaction.getStartDate().earliestTime()\n
transaction.getStartDate().month(),\n \n
transaction.getStartDate().day(),\n
# we don\'t care about hour:minutes\n
)\n
openned_accounting_period_list = source_section.searchFolder(\n openned_accounting_period_list = source_section.searchFolder(\n
portal_type = "Accounting Period",\n portal_type="Accounting Period",\n
simulation_state = "planned")\n # planned is for b/w compatibility\n
simulation_state=("planned", \'started\'))\n
if len(openned_accounting_period_list) == 0 :\n if len(openned_accounting_period_list) == 0 :\n
# if the entity doesn\'t have any accounting period, we can\n # if the entity doesn\'t have any accounting period, we can\n
# consider that they do not want to use accounting periods or\n # consider that they do not want to use accounting periods or\n
...@@ -134,19 +132,15 @@ else:\n ...@@ -134,19 +132,15 @@ else:\n
if apd.getStartDate().Date() <= transaction_date.Date() <= apd.getStopDate().Date():\n if apd.getStartDate().Date() <= transaction_date.Date() <= apd.getStopDate().Date():\n
valid_date = True\n valid_date = True\n
if not valid_date :\n if not valid_date :\n
raise ValidationFailed("Date is not in an openned Accounting Period "\n raise ValidationFailed(N_("Date is not in an opened 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
if check_destination :\n if check_destination :\n
valid_date = False\n valid_date = False\n
transaction_date = DateTime( transaction.getStopDate().year(),\n transaction_date = transaction.getStopDate().earliestTime()\n
transaction.getStopDate().month(),\n
transaction.getStopDate().day(),\n
# we don\'t care about hour:minutes\n
)\n
openned_accounting_period_list = destination_section.searchFolder(\n openned_accounting_period_list = destination_section.searchFolder(\n
portal_type = "Accounting Period",\n portal_type = "Accounting Period",\n
simulation_state = "planned")\n simulation_state = (\'planned\', \'started\'))\n
if len(openned_accounting_period_list) == 0:\n if len(openned_accounting_period_list) == 0:\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
...@@ -154,8 +148,8 @@ else:\n ...@@ -154,8 +148,8 @@ else:\n
if apd.getStartDate().Date() <= transaction_date.Date() <= apd.getStopDate().Date():\n if apd.getStartDate().Date() <= transaction_date.Date() <= apd.getStopDate().Date():\n
valid_date = True\n valid_date = True\n
if not valid_date :\n if not valid_date :\n
raise ValidationFailed("Date is not in an openned Accounting Period "\n raise ValidationFailed(N_("Date is not in an opened Accounting Period "\n
"for destination section")\n "for destination section"))\n
]]></string> </value> ]]></string> </value>
...@@ -236,7 +230,6 @@ else:\n ...@@ -236,7 +230,6 @@ else:\n
<string>currency</string> <string>currency</string>
<string>False</string> <string>False</string>
<string>valid_date</string> <string>valid_date</string>
<string>DateTime</string>
<string>transaction_date</string> <string>transaction_date</string>
<string>openned_accounting_period_list</string> <string>openned_accounting_period_list</string>
<string>len</string> <string>len</string>
......
380 386
\ 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