diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-12-27 10:55:04 +0200 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-12-27 10:55:04 +0200 |
| commit | aedda16fb934091e979f6d30d4e78625fbceeef6 (patch) | |
| tree | a690d3af171eef58be5f62922ec3aa1e1636109a | |
| parent | cdd21ff45a9c40a7e764a18a4260b871332b1b64 (diff) | |
point_of_sale: tolerate empty receipts in reports, pass the tests
bzr revid: p_christ@hol.gr-20101227085504-er2n08ppgga9qpcg
| -rw-r--r-- | addons/point_of_sale/report/pos_receipt_with_remboursment.py | 9 | ||||
| -rw-r--r-- | addons/point_of_sale/report/pos_receipt_without_remboursment.py | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/addons/point_of_sale/report/pos_receipt_with_remboursment.py b/addons/point_of_sale/report/pos_receipt_with_remboursment.py index 9b3dc529646..c600a9e2754 100644 --- a/addons/point_of_sale/report/pos_receipt_with_remboursment.py +++ b/addons/point_of_sale/report/pos_receipt_with_remboursment.py @@ -63,14 +63,19 @@ class order(report_sxw.rml_parse): WHERE absl.pos_statement_id = %d"""%(order_id.id) self.cr.execute(sql) res = self.cr.fetchone() - lst.append(res[0]) + if not res: + return ['', 0.0] + lst.append(res[0]) # todo: improve sql2 = """ select sum(absl.amount) as amt from account_bank_statement as abs LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id LEFT JOIN account_journal as aj ON aj.id = abs.journal_id where aj.name = '%s' """%(res[0]) self.cr.execute(sql2) res1 = self.cr.fetchone() - lst.append(res1[0]) + if res1: + lst.append(res1[0]) + else: + lst.append(0.0) return lst report_sxw.report_sxw('report.pos.receipt.with.remboursment', 'pos.order', 'addons/point_of_sale/report/pos_receipt_with_remboursment.rml', parser=order, header=False) diff --git a/addons/point_of_sale/report/pos_receipt_without_remboursment.py b/addons/point_of_sale/report/pos_receipt_without_remboursment.py index 72d227fbd52..d2fe0f1d542 100644 --- a/addons/point_of_sale/report/pos_receipt_without_remboursment.py +++ b/addons/point_of_sale/report/pos_receipt_without_remboursment.py @@ -63,14 +63,19 @@ class order(report_sxw.rml_parse): WHERE absl.pos_statement_id = %d"""%(order_id.id) self.cr.execute(sql) res = self.cr.fetchone() - lst.append(res[0]) + if not res: + return ['', 0.0] + lst.append(res[0]) # todo: improve sql2 = """ select sum(absl.amount) as amt from account_bank_statement as abs LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id LEFT JOIN account_journal as aj ON aj.id = abs.journal_id where aj.name = '%s' """%(res[0]) self.cr.execute(sql2) res1 = self.cr.fetchone() - lst.append(res1[0]) + if res1: + lst.append(res1[0]) + else: + lst.append(0.0) return lst report_sxw.report_sxw('report.pos.receipt.without.remboursment', 'pos.order', 'addons/point_of_sale/report/pos_receipt_without_remboursment.rml', parser=order, header=False) |
