在域计算字段中指定时间段(odoo 10)

Specify time period in domain computed field (odoo 10)

如何在计算字段的域中指定日期:

for record in self:
last_confirmed_order = self.env['sale.order'].search(
    [('partner_id', '=', record.name),('date_order','>=',time.strftime('%Y-%m-%d'))],
    order='date_order desc',
    limit=1000
)
sum = 0
for x in last_confirmed_order:
  sum = sum + x.amount_total
  record['x_last_order_sum'] = sum

报错

感谢我将代码调整为

的建议
for record in self:
    today=time.strftime('%Y-%m-%d')
    last_confirmed_order = self.env['sale.order'].search(
    [('partner_id', '=', record.name),('date_order','=',today)],
    order='date_order desc',
    limit=1000
)
record['x_last_order'] = last_confirmed_order.date_order

for x in last_confirmed_order:
 sum = sum + x.amount_total
 record['x_last_order_sum'] = sum

我没有收到任何错误,但该值保持为零。虽然我今天确实有那个客户的订单。我是否必须将 date_order 转换为与 Y M D 相同的格式?

域过滤器运算符是问题所在

尝试使用“>=”代替“>=”