本文介绍了什么是attachment=True odoo 13的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义模块,其中包含此字段

I created a custom module in which I have this field

record_file = fields.Binary(string='file', attachment=True, help='Upload the file')

据我所知 attachment=True 应该将我的图像或 pdf 保存到 ir.attachment 但在那里看不到任何内容

from what I understand attachment=True should save my images or pdfs to ir.attachment but am not seeing any there

我做错了什么

推荐答案

你没有做错,ir.attachment 记录在 res_field 的值时被隐藏(一个字符字段)被设置.

You are not doing something wrong, ir.attachment records are hidden when the value of res_field (a Char field) is set.

当您上传文件并保存时,会创建一个附件,并且将 res_field 的值设置为 record_file,使其在 Attachments.

When you upload the file and save, an attachment is created and the value of the res_field is set to record_file which makes it invisible under Attachments.

您可以检查方法 _searchread_group 被覆盖以在域中添加 res_field=False(如果不存在).

You can check that the methods _search and read_group was overridden to add res_field=False in the domain if not present.

请注意,attachment 参数的默认值为 True,因此您无需使用attachment=True.

Note that the default value for the attachment parameter is True so you do not need to useattachment=True.

这篇关于什么是attachment=True odoo 13的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 09:44