Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
6182 Ansichten

i want remove repetition from my select box .my code is def _sel_func(self, cr, uid,context=None): cr.execute("select distinct on(caller) id,caller FROM calldata1 order by caller") result = cr.fetchall() lst = [] for r in result: dct = {} dct['id'] = r[o] dct['name'] = r[1] lst.append(dct) res_ids = [(r['id'], r['name']) for r in lst] return res_ids

_columns = { 'date_start': fields.date('Date Start', required=True), 'date_end': fields.date('Date End', required=True), 'caller_id':fields.many2one( 'calldata1', 'Caller', selection=_sel_func, ) } but it shows all the data in select box and shows error " ValidateError

The value "7172" for the field "calldata_print_report_wiz.caller_id" is not in the selection " when selecting this and clicking print. How to show only the data from query in select box .Any one please help?

Avatar
Verwerfen
Beste Antwort

Try to add a field 'name' to the object you display through many2one

Avatar
Verwerfen
Autor

adding name field corrected the issue

Autor

How can io get distict value for this name filed?

Autor

i want remove repetition from my select box .my code is def _sel_func(self, cr, uid,context=None): cr.execute("select distinct on(caller) id,caller FROM calldata1 order by caller") result = cr.fetchall() lst = [] for r in result: dct = {} dct['id'] = r[o] dct['name'] = r[1] lst.append(dct) res_ids = [(r['id'], r['name']) for r in lst] return res_ids

_columns = { 'date_start': fields.date('Date Start', required=True), 'date_end': fields.date('Date End', required=True), 'caller_id':fields.

Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Okt. 20
3228
1
Aug. 17
3685
0
März 15
3046
1
Sept. 23
1693
1
Juli 19
6754