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

I was wondering if it was possible to be able to save a report to chatter when it is printed from a python method.

For some detail, at the moment my report is saved to the attachments

<report id="quote_report"
        name="quotes.quote_report_template"
        model="quote.quote"
        string="Quote Report"
        report_type="qweb-pdf"
        attachment="('Quotation - %s' % (object.name))"
        print_report_name="'Quotation - %s' % (object.name)"/>

I am currently printing my report via:

def print_quotation(self):
    [some code]
    return self.env.ref('quotes.quote_report').report_action(self) ​   ​    ​   ​     ​   ​    ​   ​     ​   ​    ​   ​     ​   ​    ​   ​
อวตาร
ละทิ้ง

Hi,

In this example, let's assume you have some files added to field `attachs` in your current model and after clicking on bouton Attach, they are added to the chatter. ( enabling chatter in your current model).

attachs = fields.Many2many('ir.attachment', string="Attachments", required=True)

@api.multi

def attachment_chatter(self):

subject = u"Attachment"

body = u"You will find attached the proof of payment document"

self.message_post(body,

subject=subject,

attachment_ids=[x.id for x in self.attachs])

For more options, you can /addons/mail/models/mail_thread.py

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 19
3561
1
มี.ค. 16
11796
0
เม.ย. 21
3260
1
ม.ค. 21
3018
Report page / header height แก้ไขแล้ว
2
ก.ย. 20
6245