تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
6416 أدوات العرض

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


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
نوفمبر 23
16783
3
نوفمبر 24
24037
1
أبريل 23
5715
1
نوفمبر 22
3612
1
أكتوبر 22
868