mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
Add api decorator on create, write
on pingen ir.attachment. When multiple module redefine create, write it can lead to TypeError
This commit is contained in:
committed by
Akim Juillerat
parent
e3b2f67dec
commit
0b9574f3cc
@@ -6,7 +6,7 @@
|
|||||||
import requests
|
import requests
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from odoo import models, fields, _
|
from odoo import models, fields, _, api
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
@@ -66,12 +66,14 @@ class IrAttachment(models.Model):
|
|||||||
document.write({'state': 'canceled'})
|
document.write({'state': 'canceled'})
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
attachment = super(IrAttachment, self).create(vals)
|
attachment = super(IrAttachment, self).create(vals)
|
||||||
if 'send_to_pingen' in vals:
|
if 'send_to_pingen' in vals:
|
||||||
attachment._handle_pingen_document()
|
attachment._handle_pingen_document()
|
||||||
return attachment
|
return attachment
|
||||||
|
|
||||||
|
@api.multi
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
res = super(IrAttachment, self).write(vals)
|
res = super(IrAttachment, self).write(vals)
|
||||||
if 'send_to_pingen' in vals:
|
if 'send_to_pingen' in vals:
|
||||||
|
|||||||
Reference in New Issue
Block a user