mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-22 12:06:57 -06:00
[FIX] Avoid write trigger
This commit is contained in:
parent
cae6f3a9e1
commit
eb46f3a2a7
@ -63,7 +63,12 @@ class Attachment(orm.Model):
|
||||
logger.debug(
|
||||
'Found file type %s for attachment with id %s',
|
||||
file_type, attachment.id)
|
||||
attachment.write({'file_type': file_type})
|
||||
# Use SQL, not ORM, to prevent write triggers which are harmful
|
||||
# in 6.1 on attachments of which the model or the record no longer
|
||||
# exists
|
||||
cr.execute(
|
||||
"UPDATE ir_attachment SET file_type = %s WHERE id = %s",
|
||||
(file_type, attachment_id))
|
||||
return True
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
|
Loading…
Reference in New Issue
Block a user