diff --git a/slick_reporting/generator.py b/slick_reporting/generator.py index 5546cbb..6e03c1f 100644 --- a/slick_reporting/generator.py +++ b/slick_reporting/generator.py @@ -827,7 +827,9 @@ def get_crosstab_parsed_columns(self): "ref": magic_field_class, "id": id, "model": self.crosstab_model, - "is_remainder": counter == ids_length, + "is_remainder": counter == ids_length + if self.crosstab_compute_remainder + else False, "source": "magic_field" if magic_field_class else "", "is_summable": magic_field_class.is_summable, } diff --git a/tests/tests.py b/tests/tests.py index 8900348..b688f9c 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -302,6 +302,16 @@ def test_productclientsalesmatrix(self): self.assertEqual(data[0]["__total__CT%s" % self.client2.pk], 600) self.assertEqual(data[0]["__total__CT----"], 900) + def test_productclientsalesmatrix_no_remainder(self): + report = report_generators.ProductClientSalesMatrix( + crosstab_ids=[self.client1.pk, self.client2.pk], + crosstab_compute_remainder=False, + ) + data = report.get_report_data() + self.assertEqual(data[0]["__total__CT%s" % self.client1.pk], 300) + self.assertEqual(data[0]["__total__CT%s" % self.client2.pk], 600) + # self.assertEqual(data[0]["__total__CT----"], 900) + def test_show_empty_records(self): report = report_generators.ClientTotalBalance() data = report.get_report_data()