【发布时间】:2018-12-31 11:43:57
【问题描述】:
我在hr.holidays 模型上添加了one2many 下面的模型。
当我尝试保存记录时,它显示 IO ERROR:
我把 chmod -R 777 给了 odoo 根文件夹。但是没用。
注意:它在本地机器上工作正常,问题只在服务器上。
*.py
class LeaveAttachments(models.Model):
_name = "leave.attachment"
leave_request_id = fields.Many2one('hr.holidays', 'Leave request')
name = fields.Char('Description')
file = fields.Binary('Attachments',compute='get_file',inverse='set_file')
file_name = fields.Char('File name')
note = fields.Char('Notes')
@api.one
def set_file(self):
open(self.get_file_name(), 'w').write(self.file.decode('base64'))
@api.one
def get_file(self):
file = False
try:
file = open(self.get_file_name(), 'r').read().encode('base64')
except:
pass
self.file = file
我该如何解决这个问题?
编辑:
`ls la /odoo/ 的输出
【问题讨论】:
-
这还不够,您还必须完全更改文件夹的所有者才能确定
-
如果你不知道怎么做?把 cmd 的截图结果:
ls -la -
@khelilimiliana,我用输出更新了我的问题。
-
chown -R :odoo odoo -
@khelilimiliana,我尝试了你的解决方案,但同样的错误。