Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6744 มุมมอง

I'm developing a module to extend Invoice (Odoo 11). I have added a binary field into the Invoice model, and I want to be able to send this binary via mail.

Sending an e-mail directly and attaching a binary is simple, but I want to open the composer wizard with the binary as an attachment. Currently, the "Send by e-mail" button opens the composer with Odoo's default PDF report; I want to add another file in that view.

อวตาร
ละทิ้ง

Did you manage to fix this?

คำตอบที่ดีที่สุด

You can do this. You need to override the "action_invoice_sent" method and create ir.attachment record by passing the value of you binary field and then pass the attachment_id default to attachment_ids field of the composer.

@api.multi
def action_invoice_sent(self):
res = super(Invoice, self).action_invoice_sent()
ctx = res.get('context')
# create ir.attachment record using your binary field
ctx.update({'default_attachment_ids': [attachment_id]})
return res


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to track One2many field in Odoo12? แก้ไขแล้ว
3
พ.ย. 23
17269
Error: Couldn't load module web แก้ไขแล้ว
3
พ.ย. 24
24832
How I get the current ID of a record ? แก้ไขแล้ว
1
เม.ย. 23
6049
1
พ.ย. 22
3913
1
ต.ค. 22
868