Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
9131 Widoki

There is a standard method

 def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False)

I'm calling a super on it and passing a domain like this

[('end_date', '>=', '2019-05-01'), ('end_date', '<=', '2019-05-30'), ('employee', 'in', [49]), ('state', 'in', ['done'])]

and it works.

but when I try to append

domain.append(('&'))
domain.append(('state', 'in', ['progress']))

I get

File "/home/www/workspace/openerp-7.0-20140804-231303/openerp/osv/expression.py", line 201, in normalize_domain
    assert expected == 0, 'This domain is syntactically not correct: %s' % (domain)
AssertionError: This domain is syntactically not correct: [('end_date', '>=', '2019-05-01'), ('end_date', '<=', '2019-05-30'), ('employee', 'in', [49]), ('state', 'in', ['done']), '&', ('state', 'in', ['progress'])]

basically, need to filter all records by dates and in state 'done' and on top of that all records in state 'progress'.

Awatar
Odrzuć
Najlepsza odpowiedź

Hello

by default in odoo domain search with the & condition, so you don't need to add '&' into the domain

then you add ('state', 'in', ['done']), '&', ('state', 'in', ['progress'])

this above condition you have to write like ('state', 'in', ['done', 'progress']).

so your whole domain is like

[('end_date', '>=', '2019-05-01'), ('end_date', '<=', '2019-05-30'), 
('employee', 'in', [49]), ('state', 'in', ['done', 'progress'])]

Try like this, i hope this will helps you.

Awatar
Odrzuć
Autor

Actually, this worked thank you, but I don't get all the records. the problem is that records that in 'progress' state doesn't have end_date, can I bypass this somehow?

Powiązane posty Odpowiedzi Widoki Czynność
1
sie 15
4222
1
mar 15
5492
1
kwi 20
2823
2
sty 24
16170
1
lip 15
4451