Odoo Help


help error function AttributeError: 'float' object has no attribute 'get'

Anne-Sylvie Burri
on 11/11/13, 5:57 AM 2,334 views


I try to add this feature:

class account_invoice(osv.osv):
    _inherit = 'account.invoice'

     # Pour chaque iid dans Invoice_IDS

    def _amount_weight(self, cr, uid, ids, name, args, context=None):
        invoice_ids = self.pool.get('account.invoice').search(cr, uid, [])

        total_weight = 0
        for iid in invoice_ids:
            line_ids = self.pool.get('account.invoice.line').search(cr, uid, [('id', '=', iid)], offset=0, limit=None, order=None, context=None, count=False)

            for lid in line_ids:
                i_line = self.pool.get('account.invoice.line').browse(cr, uid, iid, context=context)
                i_weight = i_line.weight
                total_weight = total_weight + i_weight
        return total_weight

    _columns = {
        'weight_tot_test': fields.function(_amount_weight, type='char', string='Poids Total')

but it returns me this erreure:

AttributeError: 'float' object has no attribute 'get'

Someone has an idea?


what do you want to do exactly ?

Cyril Gaspard (GEM)
on 11/14/13, 9:50 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 11/11/13, 5:57 AM
Seen: 2334 times
Last updated: 3/16/15, 8:10 AM