From f1a71e2a3ff99715836856b7b81ed1ab885ffef6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 20 Sep 2007 15:05:58 +0000
Subject: [PATCH] Don't create line if no quantity and no total_price

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16515 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../AccountingPeriod_createBalanceTransaction.xml        | 9 +++++++++
 bt5/erp5_accounting/bt/revision                          | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml
index c7bc1df52f..70b6ba2b5a 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_createBalanceTransaction.xml
@@ -142,6 +142,9 @@ for inventory in getInventoryList(\n
   total_price = roundCurrency(inventory.total_price or 0, section_currency)\n
   quantity = roundCurrency(inventory.total_quantity or 0,\n
                            inventory.resource_relative_url)\n
+  \n
+  if not total_price and not quantity:\n
+    continue\n
 \n
   if inventory.resource_uid != section_currency_uid:\n
     if inventory.node_relative_url == profit_and_loss_account:\n
@@ -179,6 +182,9 @@ for inventory in getInventoryList(\n
   total_price = roundCurrency(inventory.total_price or 0, section_currency)\n
   quantity = roundCurrency(inventory.total_quantity or 0,\n
                            inventory.resource_relative_url)\n
+  \n
+  if not total_price and not quantity:\n
+    continue\n
   profit_and_loss_quantity += total_price\n
 \n
   if inventory.resource_uid != section_currency_uid:\n
@@ -210,6 +216,9 @@ for inventory in getInventoryList(\n
   total_price = roundCurrency(inventory.total_price or 0, section_currency)\n
   quantity = roundCurrency(inventory.total_quantity or 0,\n
                            inventory.resource_relative_url)\n
+  \n
+  if not total_price and not quantity:\n
+    continue\n
   profit_and_loss_quantity += total_price\n
 \n
   if inventory.resource_uid != section_currency_uid:\n
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 511fa83dfa..be6652a2ab 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-414
\ No newline at end of file
+415
\ No newline at end of file
-- 
2.30.9