Odoo Help

Welcome!

This community 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.

-1

(Still the same, no change) I added a boolean field in my search view as group by. But when i grouped the boolean field, its search name shows as true. How can i change true to my field name?

By
rosey
on 12/31/14, 5:46 AM 1,400 views

 

I added a boolean field in my search view. When i grouped it, instead of the field name it shows true. I want remove the true showing in the filter view. I added string="field label" and name="field label" both are not working.

Then i listed and take search view, still shows wrongly.

Please suggest a method to search perfectly a boolean field.

How can i solve this?

For Eg:

'temporary_employees' : fields.boolean('Temporary Employees'),

 

<group string="Temporary Employees">
                        <filter string="Temporary Employees" icon="terp-gtk-select-all" domain="['&amp;',('temporary_employees',  '=', True)]" context="{'group_by':'temporary_employees'}"/>
                    </group>

When i take group by of the above field, search name shows as True/false instead of  Temporary Employees.

When we give filter string="Temporary Employees", group by name will shows the corresponding string name,right?But for boolean field it showing true/false in kanban view and in tree view showing checkbox. How can i get the dting in the group by?

 

 

Hello Rosery, what do you want to do exactly ? Are you willing to make a similar filter as the 'customer' 'supplier' in Partners search view ? If not, could you post some example of what you want to do ?Regards

Bruno PLANCHER
on 1/7/15, 6:01 AM

Please check the updated question

rosey
on 1/8/15, 11:37 PM
3
Nishant Jogi
On 1/5/15, 8:47 AM

Hello Rosey,

You can resolve your problem with read_group, you use following example for reference.

Example:

def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False,lazy=True):
        ret_val = super(res_partner, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby,lazy=lazy)
        for rt in ret_val:
            if rt.has_key('customer'):
                if rt.get('customer', False):
                    rt['customer'] = 'Customer'
                else:
                    rt['customer'] = 'Not Customer'
        return ret_val

Here, customer is boolean field, when we group by boolean field it will display value means True or False but you can change the value of Display by using read_group method.

Thanks.

But it doesnt change the value. Still the same.

rosey
on 1/6/15, 6:04 AM

Where you want to change? This will replace true with 'Customer' on group title.

Nishant Jogi
on 1/6/15, 12:07 PM

I want to change in my custom module.

rosey
on 1/7/15, 5:04 AM

I checked the code, but still the same in interface. But while debugging i get rt['customer'] = 'Customer'. not displaying in interface

rosey
on 1/7/15, 5:06 AM

rt['customer'] here customer means the Boolean field name. = 'Customer' means the string which you want to display.

Nishant Jogi
on 1/7/15, 11:10 AM

i gave my boolean field, when i printed the value,it is displaying in the debugging portion. But in interface still the same. True / False

rosey
on 1/8/15, 3:31 AM
-1

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 12/31/14, 6:39 AM

So, let me get this straight. You created a boolean (true or false) and you want to group your results by this value. Then when you select the "group-by" it shows to unfoldable results, namely "true" and "false"? Is this correct?

If so, I can't think of any alternative way to do this. The value is going to be either true or false, there is no in between.

I know that. Can change true or false name occuring in the filter result by any attribute? I want to dispaly field name there in the filter view. Is it possible?

rosey
on 12/31/14, 7:06 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 12/31/14, 5:46 AM
Seen: 1400 times
Last updated: 3/16/15, 8:10 AM