我的模型有一个选择字段,如下所示
task_type = fields.Selection([
('product', 'Product'),
('document', 'Document'),
('issue', 'Issue'),
('child','Child'),
('other','Other')],
'Task Type', copy=False,
help="Let user choose the type of each task:\n"
"- Product :\n"
" Development of new system, apps, report, ...\n"
"- Document : \n"
" The deliverable is a document, presentation, invoice, sales, slides, ...\n"
"- Issue : \n"
" There is an issue or task to solve related to other task\n"
"- Child : \n"
" Used for children task\n"
"- Other \n" )
我的问题是如何在.py文件中以编程方式更改此选择的选定值?。
我试过这样但是没有用。
task_type = "child"
答案 0 :(得分:0)
如果要更新该记录,请使用写入方法,如
Partner.write([partner.id], {'name': "MyCompany"})
此处合作伙伴是res.partner模型的对象。