Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Odoo接受1到2个位置参数,但给出了3个_Python_Odoo 10 - Fatal编程技术网

Python Odoo接受1到2个位置参数,但给出了3个

Python Odoo接受1到2个位置参数,但给出了3个,python,odoo-10,Python,Odoo 10,我对Odoo和Python非常陌生,我正在创建一个模块,我将其中一个模块定义为: class Tag(models.Model): _name = 'todo.task.tag' name = fields.Char('Name', 40) 但是,当我安装模块时,它会显示以下错误: File "/mnt/extra-addons/todo_ui/models/models.py", line 65, in Tag name = fields.Char('Name', 4

我对Odoo和Python非常陌生,我正在创建一个模块,我将其中一个模块定义为:

class Tag(models.Model):
    _name = 'todo.task.tag'
    name = fields.Char('Name', 40)
但是,当我安装模块时,它会显示以下错误:

File "/mnt/extra-addons/todo_ui/models/models.py", line 65, in Tag
    name = fields.Char('Name', 40)
TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

似乎您正在尝试设置字段Char size,您需要使用size named参数指定它

name = fields.Char('Name', size=40)