Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
39288 Представления

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)

Аватар
Отменить
Лучший ответ

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

you can change the variable name and it will work.

Аватар
Отменить
Лучший ответ

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)
Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
окт. 15
3894
2
апр. 19
10148
3
сент. 15
10721
2
сент. 16
7465
3
июл. 16
5845