[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
This commit is contained in:
Denis Ledoux 2015-04-27 11:56:54 +02:00
parent e8ffc09b30
commit 3e7d3c7ee4
1 changed files with 1 additions and 1 deletions

View File

@ -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