From c473ea612765b65d639fab65226cea20eb9fbcfe Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 3 Nov 2009 20:16:10 +0000
Subject: [PATCH] display total balance, debit and credit correctly in
 Project_viewAccountingTransactionList.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30265 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Project_getAccountingTransactionList.xml  |   1 -
 .../erp5_project/Project_statBalance.xml      | 132 +++++++++++++++++
 .../erp5_project/Project_statCredit.xml       | 134 ++++++++++++++++++
 .../erp5_project/Project_statDebit.xml        | 133 +++++++++++++++++
 .../listbox.xml                               |   6 +-
 bt5/erp5_project/bt/revision                  |   2 +-
 6 files changed, 403 insertions(+), 5 deletions(-)
 create mode 100644 bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statBalance.xml
 create mode 100644 bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statCredit.xml
 create mode 100644 bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statDebit.xml

diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getAccountingTransactionList.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getAccountingTransactionList.xml
index cf8df4a88a..50616987f3 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getAccountingTransactionList.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_getAccountingTransactionList.xml
@@ -60,7 +60,6 @@ kw[\'node_category_strict_membership\'] = [\'account_type/expense\',\n
                                          \'account_type/income\',\n
                                          \'account_type/asset/receivable\',\n
                                          \'account_type/liability/payable\']\n
-\n
 return context.Node_getAccountingTransactionList(**kw)\n
 </string> </value>
         </item>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statBalance.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statBalance.xml
new file mode 100644
index 0000000000..bd92d17bf4
--- /dev/null
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statBalance.xml
@@ -0,0 +1,132 @@
+<?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>Script_magic</string> </key>
+            <value> <int>3</int> </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>"""Total balance of all accounting transactions related to the project.\n
+"""\n
+kw[\'project_uid\'] = context.getUid()\n
+kw[\'node_category_strict_membership\'] = [\'account_type/expense\',\n
+                                         \'account_type/income\',\n
+                                         \'account_type/asset/receivable\',\n
+                                         \'account_type/liability/payable\']\n
+return context.Node_statAccountingBalance(**kw)\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>**kw</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>kw</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>_write_</string>
+                            <string>_apply_</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>Project_statBalance</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statCredit.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statCredit.xml
new file mode 100644
index 0000000000..ce191c3e9e
--- /dev/null
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statCredit.xml
@@ -0,0 +1,134 @@
+<?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>Script_magic</string> </key>
+            <value> <int>3</int> </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>"""Total credit of all accounting transactions related to the project.\n
+"""\n
+kw[\'project_uid\'] = context.getUid()\n
+kw[\'omit_input\'] = 1\n
+kw[\'node_category_strict_membership\'] = [\'account_type/expense\',\n
+                                         \'account_type/income\',\n
+                                         \'account_type/asset/receivable\',\n
+                                         \'account_type/liability/payable\']\n
+# here, or 0 is to prevent displaying "- 0"\n
+return - context.Node_statAccountingBalance(**kw) or 0\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>**kw</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>kw</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>_write_</string>
+                            <string>_apply_</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>Project_statCredit</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statDebit.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statDebit.xml
new file mode 100644
index 0000000000..8e1992dd34
--- /dev/null
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_statDebit.xml
@@ -0,0 +1,133 @@
+<?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>Script_magic</string> </key>
+            <value> <int>3</int> </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>"""Total debit of all accounting transactions related to the project.\n
+"""\n
+kw[\'project_uid\'] = context.getUid()\n
+kw[\'omit_output\'] = 1\n
+kw[\'node_category_strict_membership\'] = [\'account_type/expense\',\n
+                                         \'account_type/income\',\n
+                                         \'account_type/asset/receivable\',\n
+                                         \'account_type/liability/payable\']\n
+return context.Node_statAccountingBalance(**kw)\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>**kw</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>kw</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>_write_</string>
+                            <string>_apply_</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>Project_statDebit</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_viewAccountingTransactionList/listbox.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_viewAccountingTransactionList/listbox.xml
index 1dd650a25e..de29d5f8f8 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_viewAccountingTransactionList/listbox.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_viewAccountingTransactionList/listbox.xml
@@ -323,15 +323,15 @@
                       <list>
                         <tuple>
                           <string>debit</string>
-                          <string>Entity_statDebit</string>
+                          <string>Project_statDebit</string>
                         </tuple>
                         <tuple>
                           <string>credit</string>
-                          <string>Entity_statCredit</string>
+                          <string>Project_statCredit</string>
                         </tuple>
                         <tuple>
                           <string>total_price</string>
-                          <string>Entity_statBalance</string>
+                          <string>Project_statBalance</string>
                         </tuple>
                       </list>
                     </value>
diff --git a/bt5/erp5_project/bt/revision b/bt5/erp5_project/bt/revision
index 3873f56298..e8f7ef6cfa 100644
--- a/bt5/erp5_project/bt/revision
+++ b/bt5/erp5_project/bt/revision
@@ -1 +1 @@
-706
\ No newline at end of file
+707
\ No newline at end of file
-- 
2.30.9