From 3e7d3c7ee4f8838e0a9c347eca016e746175a634 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 27 Apr 2015 11:56:54 +0200 Subject: [PATCH] [FIX] account: tax_amount can be null in database The `tax_amount` of move lines is by default set to `0.0`. Nevertheless, this default value is set by Odoo, not by postgresql. This is therefore likely that the `tax_amount` is set as null instead of 0.0, in database. Therefore, when getting this value directly with a SQL request, this is possible that `null` will be returned. Therefore, in this specific case, `res.get(record.id, 0.0` could return `False`, if the sum of `tax_amount` is `null`, and try to multiply a boolean with an integer is not possible: `_rec_get(rec) * rec.sign` opw-633903 --- addons/account/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index c1aca3ee8ec..149a1257b71 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1755,7 +1755,7 @@ class account_tax_code(osv.osv): res2 = {} for record in self.browse(cr, uid, ids, context=context): def _rec_get(record): - amount = res.get(record.id, 0.0) + amount = res.get(record.id) or 0.0 for rec in record.child_ids: amount += _rec_get(rec) * rec.sign return amount