From 9bb5a24639ab26d33c3a852a036df7acb5487ccb Mon Sep 17 00:00:00 2001 From: saz-OpenERP Date: Mon, 11 Oct 2010 19:04:38 +0530 Subject: [PATCH] [IMP]Improves the details of summary report of pos module bzr revid: azaz.201186@gmail.com-20101011133438-lffkuu5g5amr6v7t --- .../report/pos_details_summary.py | 27 ++++++++++--------- .../report/pos_details_summary.rml | 14 +++------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/addons/point_of_sale/report/pos_details_summary.py b/addons/point_of_sale/report/pos_details_summary.py index 8745e7c637f..8b040426aa4 100644 --- a/addons/point_of_sale/report/pos_details_summary.py +++ b/addons/point_of_sale/report/pos_details_summary.py @@ -69,27 +69,28 @@ class pos_details_summary(report_sxw.rml_parse): objects, 0.0 ) - def _get_payments(self, objects, ignore_gift=False): - gift_journal_id = None - if ignore_gift: - config_journal_ids = self.pool.get("pos.config.journal").search(self.cr, self.uid, [('code', '=', 'GIFT')]) - if len(config_journal_ids): - config_journal = self.pool.get("pos.config.journal").browse(self.cr, self.uid, config_journal_ids, {})[0] - gift_journal_id = config_journal.journal_id.id + def _get_payments(self, objects): +# gift_journal_id = None +# if ignore_gift: +# config_journal_ids = self.pool.get("pos.config.journal").search(self.cr, self.uid, [('code', '=', 'GIFT')]) +# if len(config_journal_ids): +# config_journal = self.pool.get("pos.config.journal").browse(self.cr, self.uid, config_journal_ids, {})[0] +# gift_journal_id = config_journal.journal_id.id result = {} for obj in objects: - for payment in obj.payments: - if gift_journal_id and gift_journal_id == payment.journal_id.id: - continue - result[payment.journal_id.name] = result.get(payment.journal_id.name, 0.0) + payment.amount + for statement in obj.statement_ids: + if statement.journal_id: + result[statement.journal_id] = result.get(statement.journal_id, 0.0) + statement.amount + + print "===================================",result.items() return result def _paid_total(self, objects): - return sum(self._get_payments(objects, True).values(), 0.0) + return sum(self._get_payments(objects).values(), 0.0) def _total_of_the_day(self, objects): - total_paid = sum(self._get_payments(objects, True).values(), 0.0) + total_paid = self._paid_total(objects) total_invoiced = self._sum_invoice(objects) return total_paid - total_invoiced diff --git a/addons/point_of_sale/report/pos_details_summary.rml b/addons/point_of_sale/report/pos_details_summary.rml index b4c0e51c249..0cb07d3415b 100644 --- a/addons/point_of_sale/report/pos_details_summary.rml +++ b/addons/point_of_sale/report/pos_details_summary.rml @@ -218,17 +218,14 @@ [[ p[0] ]] - [[ p[1] ]] + [[ p[1] ]] [[company.currency_id.symbol]] - + - - - @@ -249,17 +246,14 @@ [[ t[0] ]] - [[ '%.2f' % (t[1],) ]] + [[ '%.2f' % (t[1],) ]] [[company.currency_id.symbol]] - + - - -