From 8b6865ae6234e173e13790dd843c362b429b9bfb Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Mon, 25 Sep 2017 10:49:04 +0900 Subject: [PATCH] SimulationTool: Remove input/output perimeter definition. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per Jérome, who implemented the test, it was written to test the current state rather than testing the desired outcome. And it makes little sense to have (and test for) 100 being present in both debit and credit columns ("normal" lines), and 0 to be present in the stat line. Update test to check for a more consistent outcome. Acked-by: Jérome Perrin <jerome@nexedi.com> --- product/ERP5/Tool/SimulationTool.py | 11 ++--------- product/ERP5/tests/testAccountingReports.py | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py index 17d21de027..ebc26945e1 100644 --- a/product/ERP5/Tool/SimulationTool.py +++ b/product/ERP5/Tool/SimulationTool.py @@ -46,7 +46,7 @@ from Products.ERP5 import DeliverySolver from Products.ERP5 import TargetSolver from Products.PythonScripts.Utility import allow_class -from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery, SQLQuery +from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery from Shared.DC.ZRDB.Results import Results from Products.ERP5Type.Utils import mergeZRDBResults @@ -464,15 +464,8 @@ class SimulationTool(BaseTool): if simulation_query is not None: query_list.append(simulation_query) return ComplexQuery( - SQLQuery("%(query_table)s.node_uid <> %(query_table)s.mirror_node_uid " - "OR %(query_table)s.section_uid <> %(query_table)s.mirror_section_uid " - "OR %(query_table)s.mirror_node_uid IS NULL " - "OR %(query_table)s.mirror_section_uid IS NULL " - "OR %(query_table)s.payment_uid IS NOT NULL" % { - 'query_table': table, - }), + query_list, logical_operator='AND', - *query_list ) return simulation_query simulation_query = getSimulationQuery( diff --git a/product/ERP5/tests/testAccountingReports.py b/product/ERP5/tests/testAccountingReports.py index cad6738581..ad3c4e7a46 100644 --- a/product/ERP5/tests/testAccountingReports.py +++ b/product/ERP5/tests/testAccountingReports.py @@ -2148,7 +2148,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): credit_price=0,) self.assertTrue(line_list[-1].isStatLine()) - self.checkLineProperties(line_list[-1], debit_price=0, credit_price=0,) + self.checkLineProperties(line_list[-1], debit_price=100, credit_price=100) def testAccountStatementMultipleSection(self): -- 2.30.9