Skip to Content
Menu
This question has been flagged
2 Replies
2257 Views

Hi all,

in my custom employe module I had a m2m structure:

    class hr_employe_custom_model(models.Model):
        _inherit = 'hr.employee'
 
     qualification = fields.Many2many(comodel_name='hr.qualification')
 
which is

    class Qualification(models.Model):
        _name = "hr.qualification"
       _order = "qual_type"

        name = fields.Char()
        date_begin = fields.Date()
        date_duedate = fields.Date()
        qual_type = fields.Many2one("hr.qualification_category")
 
 
    class qualification_category(models.Model):
        _name = "hr.qualification_category"

        name = fields.Char()
 
 
1. I intend to filter qualification m2m based on a specific qual_type string. However, 
domain="[('qual_type', 'ilike', 'B3')]"> 
actually doesn't apply at all?

2. Is there any way to  add date_begin / date_duedate / qual_type as selectable field in a Custom Filter?

Regards,

Matthias

Avatar
Discard
Best Answer

You can use an onchange method with return a domain,  so you can custom any condition in the method.

——————————————————————————————————————————

sorry for misunderstand your question before. as I know, there is no way use both "<" and ">" in on condition. I have a idea, don't know if it's useful. 
You can try split the input data with a special symbol, such as ",". Then rewrite the name_search method, if attach the ",", you do some thing.

Hope it is useful!

Avatar
Discard
Author Best Answer

Hi Yuhui,

thanks for that. However, this way is working for applying a domain in the view.

What about applying any field of the m2m relation as selectable field for a Custom Filter in the Search View?

Regards,

Matthias

Avatar
Discard