[FIX] account_edi: fix access to edi documents attachment
Following odoo/odoo@44a4cdb, account.edi.document `attachment_id` now is restricted, so force getting it's value as superuser. X-original-commit: b805e90457ef57868b9742b622465ea823b05af2 Part-of: odoo/odoo#111839
This commit is contained in:
@@ -277,6 +277,10 @@ class AccountEdiDocument(models.Model):
|
||||
}
|
||||
"""
|
||||
self.ensure_one()
|
||||
if not self.attachment_id:
|
||||
attachment_sudo = self.sudo().attachment_id
|
||||
if not attachment_sudo:
|
||||
return {}
|
||||
return {'attachment_ids': self.attachment_id.ids}
|
||||
if not (attachment_sudo.res_model and attachment_sudo.res_id):
|
||||
# do not return system attachment not linked to a record
|
||||
return {}
|
||||
return {'attachment_ids': attachment_sudo.ids}
|
||||
|
||||
@@ -395,7 +395,7 @@ class AccountMove(models.Model):
|
||||
return self.edi_document_ids.filtered(lambda d: d.edi_format_id == edi_format)
|
||||
|
||||
def _get_edi_attachment(self, edi_format):
|
||||
return self._get_edi_document(edi_format).attachment_id
|
||||
return self._get_edi_document(edi_format).sudo().attachment_id
|
||||
|
||||
####################################################
|
||||
# Import Electronic Document
|
||||
|
||||
Reference in New Issue
Block a user