[Erp5-report] r18866 - in /erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workf...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 25 18:41:33 CET 2008


Author: jerome
Date: Fri Jan 25 18:41:33 2008
New Revision: 18866

URL: http://svn.erp5.org?rev=18866&view=rev
Log:
Improve accounting workflow:
* Balance Transaction no longuer have a different path, they are only created and validated by the system anyway
* States manages Delete Object permission correctly
* remove obsolete script to check budget
* add a new intermediate state, "started" for use when you want to modify an "stopped" transaction (which is no longer editable directly)

Removed:
    erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBalanceTransaction.xml
    erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBudget.xml
    erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml

Removed: erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBalanceTransaction.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBalanceTransaction.xml?rev=18865&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBalanceTransaction.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBalanceTransaction.xml (removed)
@@ -1,187 +1,0 @@
-<?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 Products.DCWorkflow.DCWorkflow import ValidationFailed\n
-\n
-error_message = \'\'\n
-\n
-# Balance Transaction.\n
-transaction = state_change[\'object\']\n
-module = transaction.getParentValue()\n
-\n
-# Get sections and a currency.\n
-source_section = transaction.getSourceSection()\n
-\n
-if source_section in (None, \'\'):\n
-  error_message = \'source_section is not defined\'\n
-else:\n
-  for t in module.contentValues(filter={\'portal_type\':\'Balance Transaction\'}):\n
-    if t.getSimulationState() == \'delivered\':\n
-      error_message = \'another balance transaction is already defined\'\n
-      break\n
-  else:\n
-    dict = {}\n
-    for line in transaction.contentValues(filter={\'portal_type\':\'Balance Transaction Line\'}):\n
-      key_list = (line.getSource(), line.getDestinationSection(), line.getSourcePayment())\n
-      if key_list in dict:\n
-        error_message = \'More than one lines are defined for the account %s, the third party %s and the bank account %s\' % key_list\n
-        break\n
-      dict[key_list] = 1\n
-\n
-  \n
-if error_message != \'\':\n
-  raise ValidationFailed, \'Action impossible : \'+error_message\n
-\n
-# if it\'s ok, validate the lines\n
-container.validateTransactionLines(state_change)\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>_params</string> </key>
-            <value> <string>state_change</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>1</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>state_change</string>
-                            <string>Products.DCWorkflow.DCWorkflow</string>
-                            <string>ValidationFailed</string>
-                            <string>error_message</string>
-                            <string>_getitem_</string>
-                            <string>transaction</string>
-                            <string>_getattr_</string>
-                            <string>module</string>
-                            <string>source_section</string>
-                            <string>None</string>
-                            <string>_getiter_</string>
-                            <string>t</string>
-                            <string>dict</string>
-                            <string>line</string>
-                            <string>key_list</string>
-                            <string>_write_</string>
-                            <string>container</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>validateBalanceTransaction</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>

Removed: erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBudget.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBudget.xml?rev=18865&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBudget.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateBudget.xml (removed)
@@ -1,246 +1,0 @@
-<?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 encoding="cdata"><![CDATA[
-
-from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
-""" This scripts validate that this transaction fits in the defined budget. It requires erp5_budget.\n
-"""\n
-transaction = state_change[\'object\']\n
-portal = state_change.getPortal()\n
-\n
-# checks if there is enough budget before validating this transaction\n
-AccountingTransaction_viewAccountingTransactionLineList = transaction.contentValues(\n
-                    filter={\'portal_type\': (\'Accounting Transaction Line\', \n
-                                            \'Sale Invoice Transaction Line\', \n
-                                            \'Pay Sheet Transaction Line\',\n
-                                            \'Purchase Invoice Transaction Line\' )})\n
-\n
-# delete all objects which are mapped values (predicates) in the budget module\n
-id_list = []\n
-for objects in portal.budget_module.objectValues():\n
-  if objects.getPortalType() == \'Mapped Value\':\n
-    id_list.append(objects.getId())\n
-portal.budget_module.manage_delObjects(id_list)\n
-\n
-# Create predicates (mapped values) from budget cells\n
-for objects in portal.budget_module.objectValues():\n
-  if objects.getPortalType() == \'Budget\':\n
-    for obj_line in objects.objectValues():\n
-      if obj_line.getPortalType() == \'Budget Line\':\n
-        for obj in obj_line.objectValues():\n
-          financial_section = obj.getMembershipCriterionCategoryList()[0]\n
-          function = obj.getMembershipCriterionCategoryList()[1]\n
-          group = obj.getMembershipCriterionCategoryList()[2]\n
-          budget = obj.getQuantity() + obj.getCurrentInventory() - obj.getConsumedBudget()\n
-          budget_module = obj.getPortalObject().budget_module\n
-          predicate = budget_module.newContent(portal_type=\'Mapped Value\')\n
-          predicate.setMembershipCriterionBaseCategoryList([\'financial_section\',\'function\',\'group\'])\n
-          predicate.setMembershipCriterionCategoryList([financial_section,function,group])\n
-          predicate.setCriterionPropertyList([\'quantity\',\'stop_date\'])\n
-          predicate.setCriterion(\'quantity\',max=budget)\n
-          predicate.setCriterion(\'stop_date\',min=obj.getStartDate(),max=obj.getStopDate())\n
-          predicate.immediateReindexObject()\n
-\n
-for line in AccountingTransaction_viewAccountingTransactionLineList:\n
-  if line.getSource() and line.getSourceDebit()>0 and line.getPortalType() != "Sale Invoice Transaction Line":\n
-    new_id = \'atl\' + str(line.getId())\n
-    financial_section = line.getSourceValue().getFinancialSectionValue().getCategoryRelativeUrl(base=0)\n
-    function_category = line.getParent().getSourceFunction()\n
-    function = portal.portal_categories.getCategoryValue(function_category).getCategoryRelativeUrl(base=0)\n
-    group = line.getParent().getSourceSectionValue().getGroup() \n
-    quantity = -line.getQuantity()\n
-    temp_obj = line.asContext(\n
-                id                    = new_id\n
-               , title                = line.getTitle()\n
-               , start_date           = line.getStartDate()\n
-               , stop_date            = line.getStopDate()\n
-               , quantity             = quantity\n
-               , financial_section    = financial_section\n
-               , function             = function\n
-               , group                = group\n
-               )\n
-\n
-    temp_obj.setFinancialSection(financial_section)\n
-    temp_obj.setFunction(function)\n
-    temp_obj.setGroup(group)\n
-    temp_obj.setQuantity(quantity)\n
-    enough_budget = 0\n
-    for objects in portal.budget_module.objectValues():\n
-      if objects.getPortalType() == \'Mapped Value\': \n
-         res = objects.test(temp_obj)\n
-         if res: \n
-            enough_budget = 1   \n
-    if not enough_budget :\n
-      error_message = \'Insuficient or Undefined Budget for the Transaction Source Account\'\n
-      raise ValidationFailed, \'Impossible Action: \'+error_message\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>_params</string> </key>
-            <value> <string>state_change</string> </value>
-        </item>
-        <item>
-            <key> <string>_proxy_roles</string> </key>
-            <value>
-              <tuple/>
-            </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>1</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>state_change</string>
-                            <string>Products.DCWorkflow.DCWorkflow</string>
-                            <string>ValidationFailed</string>
-                            <string>_getitem_</string>
-                            <string>transaction</string>
-                            <string>_getattr_</string>
-                            <string>portal</string>
-                            <string>AccountingTransaction_viewAccountingTransactionLineList</string>
-                            <string>id_list</string>
-                            <string>_getiter_</string>
-                            <string>objects</string>
-                            <string>obj_line</string>
-                            <string>obj</string>
-                            <string>financial_section</string>
-                            <string>function</string>
-                            <string>group</string>
-                            <string>budget</string>
-                            <string>budget_module</string>
-                            <string>predicate</string>
-                            <string>line</string>
-                            <string>str</string>
-                            <string>new_id</string>
-                            <string>function_category</string>
-                            <string>quantity</string>
-                            <string>temp_obj</string>
-                            <string>enough_budget</string>
-                            <string>res</string>
-                            <string>error_message</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>validateBudget</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>

Removed: erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml?rev=18865&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml (removed)
@@ -1,119 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
-        <tuple/>
-      </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>Define Account Balance</string> </value>
-        </item>
-        <item>
-            <key> <string>actbox_url</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=balance_action&button_title=Define+Account+Balance
-
-]]></string> </value>
-        </item>
-        <item>
-            <key> <string>after_script_name</string> </key>
-            <value> <string>setReferences</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>This user actions should only be used to set up the balanche of all accounts when a company migrates to ERP5 from another ERP</string> </value>
-        </item>
-        <item>
-            <key> <string>guard</string> </key>
-            <value>
-              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>balance_action</string> </value>
-        </item>
-        <item>
-            <key> <string>new_state_id</string> </key>
-            <value> <string>delivered</string> </value>
-        </item>
-        <item>
-            <key> <string>script_name</string> </key>
-            <value> <string>validateBalanceTransaction</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string>Define Account Balance</string> </value>
-        </item>
-        <item>
-            <key> <string>trigger_type</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <tuple>
-          <string>Products.DCWorkflow.Guard</string>
-          <string>Guard</string>
-        </tuple>
-        <none/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>expr</string> </key>
-            <value>
-              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
-            </value>
-        </item>
-        <item>
-            <key> <string>roles</string> </key>
-            <value>
-              <tuple>
-                <string>Assignor</string>
-              </tuple>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <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: here.getPortalType() == \'Balance Transaction\'</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>




More information about the Erp5-report mailing list