From 1a603bd2bd9649bd78eceae2285eae0aaa3dd47b Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 16 Nov 2011 11:13:59 +0100 Subject: [PATCH] [FIX] account_analytic_analysis: don't return floats or empty strings for date fields (from function fields) when intending False bzr revid: xmo@openerp.com-20111116101359-z48vvxxpmkrynxyt --- .../account_analytic_analysis.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 8ebb75244a1..d46a24fc277 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -61,7 +61,7 @@ class account_analytic_account(osv.osv): res[id][f] = [int(id * 1000000 + int(x[0])) for x in result] elif f == 'last_worked_invoiced_date': for id in ids: - res[id][f] = 0.0 + res[id][f] = False if parent_ids: cr.execute("SELECT account_analytic_line.account_id, MAX(date) \ FROM account_analytic_line \ @@ -74,8 +74,8 @@ class account_analytic_account(osv.osv): res[account_id][f] = sum for account in accounts: for child in account.child_ids: - if res[account.id].get(f, '') < res.get(child.id, {}).get(f, ''): - res[account.id][f] = res.get(child.id, {}).get(f, '') + if res[account.id][f] < res.get(child.id, {}).get(f): + res[account.id][f] = res.get(child.id, {}).get(f, False) elif f == 'ca_to_invoice': for id in ids: res[id][f] = 0.0 @@ -123,7 +123,7 @@ class account_analytic_account(osv.osv): res[id][f] = round(res.get(id, {}).get(f, 0.0), dp) + round(res2.get(id, 0.0), 2) elif f == 'last_invoice_date': for id in ids: - res[id][f] = '' + res[id][f] = False if parent_ids: cr.execute ("SELECT account_analytic_line.account_id, \ DATE(MAX(account_invoice.date_invoice)) \ @@ -137,11 +137,11 @@ class account_analytic_account(osv.osv): res[account_id][f] = lid for account in accounts: for child in account.child_ids: - if res[account.id][f] < res.get(child.id, {}).get(f, ''): - res[account.id][f] = res.get(child.id, {}).get(f, '') + if res[account.id][f] < res.get(child.id, {}).get(f): + res[account.id][f] = res.get(child.id, {}).get(f, False) elif f == 'last_worked_date': for id in ids: - res[id][f] = '' + res[id][f] = False if parent_ids: cr.execute("SELECT account_analytic_line.account_id, MAX(date) \ FROM account_analytic_line \ @@ -154,8 +154,8 @@ class account_analytic_account(osv.osv): res[account_id][f] = lwd for account in accounts: for child in account.child_ids: - if res[account.id][f] < res.get(child.id, {}).get(f, ''): - res[account.id][f] = res.get(child.id, {}).get(f, '') + if res[account.id][f] < res.get(child.id, {}).get(f): + res[account.id][f] = res.get(child.id, {}).get(f, False) elif f == 'hours_qtt_non_invoiced': for id in ids: res[id][f] = 0.0