Como envio un email automaticamente a varios usuarios de las ventas diarias u otro reporte ??
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
1
Balas
213
Tampilan
Hi,
By using the automated scheduled action, we can send the email at a particular interval of time. To achieve this, refer to the following
* https://www.cybrosys.com/blog/how-to-configure-automated-actions-in-odoo-18
* https://www.cybrosys.com/blog/how-to-configure-scheduled-actions-in-odoo-18
Try the following.
today = fields.Date.today()
start = datetime.combine(today, datetime.min.time())
end = datetime.combine(today, datetime.max.time())
# Get today's confirmed sales
orders = env['sale.order'].search([
('date_order', '>=', start),
('date_order', '<=', end),
('state', 'in', ['sale', 'done'])
])
total_sales = sum(orders.mapped('amount_total'))
order_count = len(orders)
# Prepare email content
subject = f"Daily Sales Report: {today.strftime('%Y-%m-%d')}"
body = f"""
Dear Team,<br/><br/>
Here is the sales summary for {today.strftime('%Y-%m-%d')}:<br/>
- Total Orders: {order_count}<br/>
- Total Sales: ${total_sales:.2f}<br/><br/>
Regards,<br/>
Odoo
"""
# Target recipients: user emails
user_emails = env['res.users'].search([('groups_id.name', '=', 'Sales')]).mapped('partner_id.email')
# Send emails
mail = env['mail.mail']
for email in user_emails:
if email:
mail.create({
'subject': subject,
'email_to': email,
'body_html': body,
}).send()
Hope it helps
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
1
Jul 25
|
425 | ||
|
1
Jul 25
|
188 | ||
|
2
Jul 25
|
259 | ||
|
3
Jun 25
|
920 | ||
|
0
Jun 25
|
188 |