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

AttributeError: 'bool' object has no attribute 'get' openerp

By
evon_dun
on 9/12/13, 5:02 AM 3,988 views

Hi, i created few fields to my account.invoice, and i am trying to update these fields with a function. I get this error: AttributeError: 'bool' object has no attribute 'get' openerp. Please help its really very urgent, account_invoice.py", line 844, in button_reset_taxes. My fields:

'vat13_5':fields.float('13.5%',digits_compute=dp.get_precision('Account')),
'vat5':fields.float('5%',digits_compute=dp.get_precision('Account')),
'others':fields.float('Others',digits_compute=dp.get_precision('Account')),
'sales_vat13_5':fields.function(_tax_base_amount,

type= 'float',string = 'Sales 13.5%', digits_compute=dp.get_precision('Account'),method = True, store = True), 'sales_vat5':fields.function(_tax_base_amount, type= 'float',string = 'Sales 5%', digits_compute=dp.get_precision('Account'),method = True, store = True), 'sales_others':fields.function(_tax_base_amount, type= 'float',string = 'Sales Others', digits_compute=dp.get_precision('Account'),method = True, store = True),

the fields vat13_5, vat5, and others already have values in them.

the function which i am using :

> def
> _tax_base_amount(self,cr,uid,ids,name,args,context=None):
>     res = {}
>     tax_obj = self.pool.get('account.invoice.tax')
>     for invoice in self.browse(cr,uid,ids,context=context):
>        res[invoice.id] = {
>                          'sales_vat13_5':0.0,
>                          'sales_vat5':0.0,
>                             'sales_others':0.0,
>                        }
>         base1 = 0.0
>         base2 = 0.0
>         base3 = 0.0
>         name13_5 = 'Vat13.5%'
>         name13 = '13.5% - Vat13.5% E'
>         name5 = 'Vat  5 %'
>         name5E = '5% E - Vat 5% E'
>         namecst2 = 'CST 2% '
>         namecst2E = '2% - CST 2% E'
>         namevat2 = 'Vat 2% ( 3B )'
>         namevat2E = '2% - Vat 2% ( 3B ) E'
>         namecst5 = 'CST 5% Without form C '
>         namecst5E = '5%  - CST 5% Without Form C E'
>         namecst13_5 = 'CST 13.5% Without form C '
>         namecst13_5E = '13.5%  - CST 13.5% Without Form C E'
>         namecst= '5% - CST 13.5% Without Form C E '
>         if invoice.vat13_5:                
>             cr.execute('select base_amount from account_invoice_tax
> where invoice_id = %s and name in
> (%s,%s)',(invoice.id,name13_5,name13))
>             base1 = cr.fetchall()[0]
>             #raise osv.except_osv(_('Message'), _(base1))
>             res[invoice.id]['sales_vat13_5'] =
> base1
>         if invoice.vat5:        
>             cr.execute('select base_amount from account_invoice_tax
> where invoice_id = %s and name in
> (%s,%s)',(invoice.id,name5,name5E))
>             base2 = cr.fetchall()[0]
>             #raise osv.except_osv(_('Message'), _(base2))
>             res[invoice.id]['sales_vat5'] = base2
>         if invoice.others:
>             cr.execute('select base_amount from account_invoice_tax
> where invoice_id = %s and name in
> (%s,%s,%s,%s,%s,%s,%s,%s,%s)',(invoice.id,namecst2,namecst2E,namevat2,namevat2E,namecst5,namecst5E,namecst13_5,namecst13_5E,namecst))
>             taxes = cr.fetchall()               
>             for t in taxes:
>                 base3 += t[0]
>             #raise osv.except_osv(_('Message'), _(base3))
>             res[invoice.id]['sales_others'] =
> base3
>         cr.execute('update account_invoice set sales_vat13_5=%s,
> sales_vat5=%s, sales_others=%s where
> id=%s',(base1,base2,base3,invoice.id))
>     return True

Can you post the whole traceback of the error?

Andreas Brueckl
on 9/18/13, 11:58 AM

hey i got my error corrected i just changed it to return res and i am sorted. Thanks anyways.

evon_dun
on 9/19/13, 2:26 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: 9/12/13, 5:02 AM
Seen: 3988 times
Last updated: 3/16/15, 8:10 AM