Odoo Aide


4 Answers
Juan Vicente Pascual
11/05/2016 06:56

try this,

invoices = self.env['account.invoice'].search([('type', 'in', ['in_invoice', 'in_refund']),

                                                                           ('state', 'in', ['open', 'paid']),

                                                                           ('create_date', '>=', self.start_date),

                                                                           ('create_date', '<=', self.end_date)])

1 Commentaires
Yenthe Van Ginneken
11/05/2016 09:49

This works perfectly, thanks Juan! I actually didn't knew I didn't even need the '&' operators.

Fekete Mihai
11/05/2016 09:49

Hi Yenthe, by default Odoo uses AND operator, so if you are not using OR operator, you should not add the operators in front, but if are doing, first operator is for last 2 conditions and so on, here you have 2 operators and 4 conditions...at 4 conditions you should have 3 operators...

Yenthe Van Ginneken
11/05/2016 09:50

I've converted your comment to an answer since the reason why is also very important. I didn't even know by default '&' was enforced for multiple domains like this. +1

Fekete Mihai
11/05/2016 23:09

Yenthe, here is an old topiuc describing more the search operators, please see https://www.odoo.com/forum/help-1/question/full-list-of-search-operators-46716

Poser une question
Keep Informed
1 Abonné(e)s
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now