From 3af321fa59afc0d37335b6f785f295737e1e039c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 3 Oct 2012 14:41:36 +0530 Subject: [PATCH] find wrong vouchers --- patches/october_2012/find_wrong_voucher.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/patches/october_2012/find_wrong_voucher.py b/patches/october_2012/find_wrong_voucher.py index 8acc278dae6..ed9ce9c644b 100644 --- a/patches/october_2012/find_wrong_voucher.py +++ b/patches/october_2012/find_wrong_voucher.py @@ -1,9 +1,15 @@ def execute(): import webnotes vouchers = webnotes.conn.sql(""" - select parent, parenttype, modified from `tabPurchase Taxes and Charges` + select parent, parenttype, modified, sum(tax_amount) as tax from `tabPurchase Taxes and Charges` where modified >= '2012-07-12' - and category = 'Valuation' and tax_amount != 0 + and category in ('Total', 'Valuation and Total') and parenttype != 'Purchase Taxes and Charges Master' + group by parenttype, parent """) - print vouchers \ No newline at end of file + + for d in vouchers: + total_tax = webnotes.conn.sql("""select tax_amount from `tab%s` where name = %s""" % + (d[1], '%s'), d[0]) + if flt(total_tax[0][0]) != flt(d[3]): + print d \ No newline at end of file