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
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
1
Odpowiedz
407
Widoki
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
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
lip 25
|
289 | ||
|
2
lip 25
|
636 | ||
|
1
lip 25
|
437 | ||
|
2
lip 25
|
436 | ||
|
3
cze 25
|
1098 |