I want to send daily manufacturing orders details to the manager via email. I had tried to acheive this by using email templates, it only generating report for only one manufacturing. Any good approach for this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
I have acheived it by attaching custom report consisting of all MOs with the email template
if matching_reports:
report = ir_actions_report.browse(cr, uid, matching_reports[0])
report_service = 'report.' + report.report_name
service = netsvc.LocalService(report_service)
(result, format) = service.create(cr, uid, mrp_ids, {'model': self._name}, context=context)
# eval_context = {'time': time, 'object': self.pool.get('mrp.production')}
if not report.attachment: # or not eval(report.attachment, eval_context)
file_name = "dailyreport" #re.sub(r'[^a-zA-Z0-9_-]', '_', 'dailyreport')
file_name += ".pdf"
attachment_id = attachment_obj.create(cr, uid,
{
'name': file_name,
'datas': result,
'datas_fname': file_name,
# 'res_model': 'email.template',
# 'res_id': email.id,
'type': 'binary'
}, context=context)
email_obj.write(cr, uid, template_id, {'email_from': email.email_from,
'email_to': email.email_to,
'subject': email.subject,
'body_html':email.body_html,
'email_recipients': email.email_recipients,
'attachment_ids' : [(6,0, [attachment_id])],
})
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 3 15
|
8508 | ||
Place image in body of report
Đã xử lý
|
|
3
thg 3 15
|
5266 | |
|
0
thg 3 15
|
3762 | ||
|
1
thg 11 24
|
1625 | ||
|
0
thg 8 24
|
1641 |