Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
39177 Visualizzazioni

i have been creating a model, which includes a boolean fields and i call it in the view.

i have been thinking that it would be a database problem, so i re-installed the module,

and it still keep getting out!

upon saving the form this error occur:

TypeError: 'bool' object is not callable

my code is like this:

garage = fields.Boolean(string="Garage", default=False)
modified = fields.Boolean(string="Modified", default=False)
special_offer = fields.Boolean(string="Special Offer", default=False)
hidden = fields.Boolean(string="Hidden", default=False)

Avatar
Abbandona
Risposta migliore

the problem here in the variable name itself  "modified". because it was reserved

you can change the variable name and it will work.

Avatar
Abbandona
Risposta migliore

Hello Basem,


Yes, there are Reserved keywords in Odoo/Python.

  • new, true,  modified,  none,  break,  continue

So if you use such keywords in declaring fields/variables, Odoo (mostly after v13 I believe) will throw error like : 

TypeError: 'bool' object is not callable
Instead use : 
custom_modified = fields.Boolean(string="Modified", default=False)
Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
ott 15
3786
2
apr 19
10067
3
set 15
10597
2
set 16
7408
3
lug 16
5752