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

<filter string="Resident" domain="[]" context="{'group_by':'resident'}" options='{"terminology": {

                                    "string_true": "Resident",

                                    "string_false": "Non Resident"

                                }}'/>


resident is boolean Fields. so when i group by it, there should be 2 field appear that is 
True and Undefined so i wanna change that TRUE and Undefined to Resident and Non Resident.

อวตาร
ละทิ้ง

For customization of odoo modules read: https://learnopenerp.tumblr.com/

ผู้เขียน คำตอบที่ดีที่สุด

https://ibb.co/sb4mR8M ======> Link for the Photo

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

Hi, 
you can add a compute field that takes 'Resident' if boolean Is True and 'non resident' if False 
then in your pivot, you consider the new field, not the boolean. 

field1 = fields.Char(string='Resident', compute='compute_resident_char', store=True)
@api.multi @api.depends('resident') def compute_resident_char(self):     for rec in self:         if rec.resident:             rec.field1 = 'Resident'         else:             rec.field1 = 'Non resident'  

If you already have records in your DB, you would think to launch a xmlrpc call to recompute this new field for all records so it gets updated.

Upvote if this helps. If not, you can write back for further analysis. 

Regards.

อวตาร
ละทิ้ง
ผู้เขียน

it does'nt solve my problem

ผู้เขียน

but thanks for answering

That's how i solved the same problem that i had.

you're welcome.

ผู้เขียน

Well when i create that function i must change field name in Xml to Field1 right ?

Related Posts ตอบกลับ มุมมอง กิจกรรม
TypeError: 'bool' object is not callable แก้ไขแล้ว
2
ส.ค. 21
39289
7
ก.ค. 18
13261
1
เม.ย. 19
5365
3
ก.ค. 16
5845
3
ก.ย. 15
17253