我在classA上编写了一个字段(a),它会自动获取另一个classB中另一个字段(b)的内容
在更新我自己的模块开发后,我尝试在tryton上填写表格,然后我尝试保存表格.
但是出现了错误
Traceback (most recent call last):
File "/trytond/wsgi.py", line 104, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 48, in rpc
request, database_name, *request.rpc_params)
File "/trytond/wsgi.py", line 72, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 131, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 197, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/model/modelsql.py", line 832, in read
getter_results = field.get(ids, cls, field_list, values=result)
File "/trytond/model/fields/function.py", line 106, in get
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/function.py", line 106, in <genexpr>
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/function.py", line 101, in call
return dict((r.id, method(r, name)) for r in records)
File "/trytond/model/fields/function.py", line 101, in <genexpr>
return dict((r.id, method(r, name)) for r in records)
File "/trytond/modules/module_designing/design.py", line 15702, in On_change_design
('Description', '=', self.id),
ValueError: not enough values to unpack (expected 1, got 0)
,错误中提到的方法是这样的:(这个方法我在B类的字段(b)上使用它来调用另一个A类的另一个字段(a))
def On_change_design(self,Name):
Design = Pool().get('design.classA')
design, = Design.search([
('classB', '=', self.id),
])
return design.id
field(b) = fields.Function(fields.Many2One('design.classA', 'test'), 'On_change_design')
将包含字段(a)的字段(b)
这就是我对字段(a)的编码方式:
field(a) = fields.Function(fields.Char('area '),'on_change_parameters')
任何帮助将不胜感激,我想知道出了什么问题以及我应该做什么。
或者任何人都可以帮助我并告诉我如何编写方法onchange
以使字段(b)自动从另一个类(a)中获取另一个字段(a)的内容