使用ODOO

时间:2016-06-08 09:29:41

标签: openerp odoo-9

计划程序应生成报告并将其保存在ir.attachments中,即PDF报告应存储在ir.attachment表中,然后需要将该报告作为附件发送。

1)如何在ir.attachment表中存储报告(PDF)

在ODOO 9中

到目前为止,我试过了:

@api.model
def _redmine_mail(self):

    ir_model_data = self.env['ir.model.data']
    try:
        template_id = ir_model_data.get_object_reference('pms', 'email_template_edi_timesheet')[1]
        print template_id
    except ValueError:
        template_id = False
    try:
        compose_form_id = ir_model_data.get_object_reference('mail', 'email_compose_message_wizard_form')[1]
    except ValueError:
        compose_form_id = False
    ctx = dict()
    ctx.update({
        'default_model': 'redmine.timesheet',
        'default_res_id': 1,
        'default_use_template': bool(template_id),
        'default_template_id': template_id,
        'default_composition_mode': 'comment',
        'mark_so_as_sent': True
    })

    return {
        'type': 'ir.actions.act_window',
        'view_type': 'form',
        'view_mode': 'form',
        'res_model': 'mail.compose.message',
        'views': [(compose_form_id, 'form')],
        'view_id': compose_form_id,
        'target': 'new',
        'context': ctx,
    }

_redmine_mail通过Scheduler触发。

1)如何生成报告并将其存储在ir.attachents中? 2)无需打开电子邮件向导,邮件应直接发送附带报告。

先谢谢

0 个答案:

没有答案