[Erp5-report] r34121 jerome - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_s...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 25 17:23:07 CET 2010


Author: jerome
Date: Thu Mar 25 17:23:05 2010
New Revision: 34121

URL: http://svn.erp5.org?rev=34121&view=rev
Log:
make it possible to extend account_type/expense and account_type/income

Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.xml?rev=34121&r1=34120&r2=34121&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.xml [utf8] Thu Mar 25 17:23:05 2010
@@ -166,7 +166,7 @@
 \n
 ### profit & loss accounts {{{\n
 for node in getInventoryList(\n
-                node_category_strict_membership=profit_and_loss_account_type,\n
+                node_category=profit_and_loss_account_type,\n
                 from_date=max(period_start_date, from_date),\n
                 group_by_node=1,\n
                 omit_output=1,\n
@@ -182,7 +182,7 @@
   total_debit += round(total_price, precision)\n
 \n
 for node in getInventoryList(\n
-                node_category_strict_membership=profit_and_loss_account_type,\n
+                node_category=profit_and_loss_account_type,\n
                 from_date=max(period_start_date, from_date),\n
                 group_by_node=1,\n
                 omit_input=1,\n
@@ -387,7 +387,7 @@
 \n
 ### profit & loss accounts {{{\n
 for node in getInventoryList(\n
-                node_category_strict_membership=profit_and_loss_account_type,\n
+                node_category=profit_and_loss_account_type,\n
                 omit_output=1,\n
                 from_date=min(period_start_date,\n
                               initial_balance_date),\n
@@ -403,7 +403,7 @@
                     \'initial_debit_balance\', 0) + total_price\n
 \n
 for node in getInventoryList(\n
-                node_category_strict_membership=profit_and_loss_account_type,\n
+                node_category=profit_and_loss_account_type,\n
                 omit_input=1,\n
                 from_date=min(period_start_date,\n
                               initial_balance_date),\n

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml?rev=34121&r1=34120&r2=34121&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml [utf8] Thu Mar 25 17:23:05 2010
@@ -258,7 +258,7 @@
 \n
 # profit & loss -> same, but from date limited to the current period\n
 for inventory in portal.portal_simulation.getInventoryList(\n
-                            node_category_strict_membership=profit_and_loss_account_type,\n
+                            node_category=profit_and_loss_account_type,\n
                             portal_type=portal.getPortalAccountingMovementTypeList(),\n
                             from_date=max(from_date, period_start_date),\n
                             at_date=at_date,\n

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml?rev=34121&r1=34120&r2=34121&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml [utf8] Thu Mar 25 17:23:05 2010
@@ -113,7 +113,8 @@
         \'account_type/asset/receivable\',\n
         \'account_type/liability/payable\'):\n
       group_by_mirror_section_node_category_list.append(node_category_url)\n
-    elif node_category_url in (\'account_type/income\', \'account_type/expense\'):\n
+    elif node_category.isMemberOf(\'account_type/income\') or \\\n
+         node_category.isMemberOf(\'account_type/expense\'):\n
       profit_and_loss_node_category_list.append(node_category_url)\n
     else:\n
       group_by_node_node_category_list.append(node_category_url)\n

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml?rev=34121&r1=34120&r2=34121&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml [utf8] Thu Mar 25 17:23:05 2010
@@ -92,15 +92,18 @@
 new_result  = []\n
 net_balance = 0.0\n
 \n
-node_account_type = None\n
+# accounts from PL have a balance calculated differently\n
+is_pl_account = False\n
 if params.get(\'node_uid\'):\n
   if context.getUid() == params[\'node_uid\']:\n
-    node_account_type = context.getAccountTypeId()\n
+    is_pl_account = context.isMemberOf(\'account_type/expense\')\\\n
+                 or context.isMemberOf(\'account_type/income\')\n
   else:\n
     node = portal.portal_catalog.getObject(params[\'node_uid\'])\n
-    node_account_type = node.getAccountTypeId()\n
-\n
-if from_date or node_account_type in (\'expense\', \'income\'):\n
+    is_pl_account = node.isMemberOf(\'account_type/expense\')\\\n
+                 or node.isMemberOf(\'account_type/income\')\n
+\n
+if from_date or is_pl_account:\n
   period_start_date = None\n
   # Create a new parameter list to get the previous balance\n
   get_inventory_kw = params.copy()\n
@@ -109,7 +112,7 @@
   get_inventory_kw.pop(\'at_date\', None)\n
 \n
   if params.has_key(\'period_start_date\'):\n
-    if node_account_type in (\'expense\', \'income\'):\n
+    if is_pl_account:\n
       # if we have on an expense / income account, only take into account\n
       # movements from the current period.\n
       period_start_date = params[\'period_start_date\']\n
@@ -126,13 +129,12 @@
         from_date = period_start_date\n
 \n
   # Get previous debit and credit\n
-  if from_date == period_start_date and \\\n
-                      node_account_type in (\'expense\', \'income\'):\n
+  if from_date == period_start_date and is_pl_account:\n
     previous_total_debit = previous_total_credit = 0\n
   else:\n
     getInventoryAssetPrice = portal.portal_simulation.getInventoryAssetPrice\n
     # first to the balance at the period start date\n
-    if node_account_type in (\'expense\', \'income\'):\n
+    if is_pl_account:\n
       period_openning_balance = 0\n
     else:\n
       period_openning_balance = getInventoryAssetPrice(\n
@@ -268,7 +270,8 @@
                             <string>_write_</string>
                             <string>new_result</string>
                             <string>net_balance</string>
-                            <string>node_account_type</string>
+                            <string>False</string>
+                            <string>is_pl_account</string>
                             <string>node</string>
                             <string>period_start_date</string>
                             <string>get_inventory_kw</string>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml?rev=34121&r1=34120&r2=34121&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml [utf8] Thu Mar 25 17:23:05 2010
@@ -93,7 +93,8 @@
     node = context\n
   else:\n
     node = portal.portal_catalog.getObject(params[\'node_uid\'])\n
-  if node.getAccountTypeId() in (\'expense\', \'income\'):\n
+  if node.isMemberOf(\'account_type/expense\') or\\\n
+        node.isMemberOf(\'account_type/income\'):\n
     # For expense or income accounts, we only take into account transactions\n
     # from the beginning of the period.\n
     params[\'from_date\'] = params[\'period_start_date\']\n

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=34121&r1=34120&r2=34121&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] Thu Mar 25 17:23:05 2010
@@ -1,1 +1,1 @@
-1148
+1150




More information about the Erp5-report mailing list