跳至内容
菜单
此问题已终结
1 回复
1570 查看

Hello, imagine that I have a list of products and I want to show the products that have been created today in a daily email.

Would be possible to show this list of products dynamically in the email taking into acocunt a date filter?

Like the image, URL, name, etc

Thanks!

形象
丢弃
最佳答案

Yes, it is possible to dynamically show a list of products created today in a daily email, including details like the image, URL, name, etc. To achieve this, you can follow these general steps:

  1. Create a scheduled action: Set up a scheduled action in Odoo to run daily and trigger the email generation process.

  2. Define a method to fetch products: Write a method in your Odoo model to retrieve the products created today based on a date filter. You can use the fields.Datetime.now() function to get the current date and time. Here's an example:

from datetime import datetime, timedelta

class Product(models.Model):
_name = 'product.product'

def get_products_created_today(self):
today = datetime.now().date()
products = self.search([('create_date', '>=', str(today)), ('create_date', ' return products

形象
丢弃
相关帖文 回复 查看 活动
2
7月 24
2320
1
5月 24
2749
0
12月 15
3527
0
6月 25
7081
3
8月 24
20019