Skip to Content
Menu
This question has been flagged
1 Reply
5271 Views

I'm trying to search through my invoices and what I want to search by is the equivalent of:

Invoices that are: 

  • on or after the self.start_date AND

  • on or before the self.end_date AND

  • type = out_invoice OR out_refund

I can't quite get the syntax right with the leafs.  I've tried various combinations such as:

self.env['account.invoice'].search([('date_invoice','>=',self.start_date),('date_invoice','<=',self.end_date),('type','=','out_invoice'),'|',('type','=','out_refund')])

What's the proper syntax here?

Avatar
Discard
Best Answer

Hi,

You can try this,


self.env['account.invoice'].search([('type','in',['out_invoice', 'out_refund']), '|', ('date_invoice','>=',self.start_date),('date_invoice','<=',self.end_date)])

Thanks

Avatar
Discard
Related Posts Replies Views Activity
0
Mar 15
4360
0
Jun 24
428
3
Oct 23
15418
3
Feb 23
5703
1
Jul 22
5415