Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6959 มุมมอง

Hi everyone,


I am using a fields.selection:


'typeseller': fields.selection((('d','Direct'), ('ca','Communication agencies'),('r','Reseller')),'Type of seller',required=True),


I want to create a group_by filter for this field:


<filter string="Type seller" context="{'group_by': 'typeseller'}"/>


However, on my view, it does the group by by showing the "key" (so here d, ca and r) instead of the value ( Direct, Communication agencies or Reseller) and it is pretty ugly.


Is it possible to group by the value instead of the key?


Many thanks,


Selverine


PS: I am using an OpenERP 7

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Add the field typeseller in the tree view and it should show value instead of key.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Dear Selverine,


I think there are not direct way to do that, But you can do another Selection Field like this:

 

'new_typeseller': fields.selection((('d','d'), ('ca','ca'),('r','r')),'Type of seller',required=True),


and then make Onchange Methd like this:
def onchange_typeseller(self,cr,uid,ids,typeseller=False,context=None):

     return {'value':{'new_typeseller':typeseller}}

Then call it on xml and make group by the new field:

<filter string="Type seller" context="{'group_by': 'new_typeseller'}"/>

you can make the new field invisible from the form view and add it to tree view.

I hope I helped you...

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ค. 24
1626
1
พ.ย. 21
2544
1
ก.ค. 21
2640
0
เม.ย. 16
4148
1
พ.ค. 15
3860