Odoo Help

Welcome!

This community 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.

0

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

By
Anne-Sylvie Burri
on 11/11/13, 5:57 AM 1,451 views

Hello,

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')
    }
account_invoice()

but it returns me this erreure:

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

Someone has an idea?

THX

what do you want to do exactly ?

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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