Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
8468 Lượt xem

Hi I'm using odoo 10 community and I have a question regarding the search bar:


When I'm searching a specific variation in my inventory and I'm using the search bar, odoo automatically add attribute search with an "OR" opérator. is it possible to search several attributes with an "AND" operator. I don't want to use a custom filter since it would be very long to make a search.



thanks



thanks for your help!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

hello you can point your resarch to a function called in your  model and test it with boolean field

there is an example

check_maladie_convertie=fields.Boolean(string="Holiday_maladie_Type_to_convert", compute='_check_maladie_type')

    @api.multi

    def _check_maladie_type(self):

  holidays=self.env['hr.holidays'].search([("employee_id",'=', self.employee_id.id)])

  holidays_maladie=self.env['hr.holidays'].search([("employee_id",'=',self.employee_id.id),

    ('type', '=', 'remove'),

    ('HolidayStatus_name','=','maladie'),

    ('state','=','validate')])

  for holiday in holidays_maladie:

   holiday.check_maladie_convertie =True

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

See https://www.odoo.com/apps/modules/10.0/web_search_with_and/

Use AND conditions on omnibar search

When searching for records on same field Odoo joins multiple queries with OR. For example:

  • Perform a search for customer "John" on field Name
  • Odoo displays customers containing "John"
  • Search for "Smith" on same field Name
  • Odoo displays customers containing "John" OR "Smith"

With this module installed you can press Shift key before searching for "Smith" and Odoo finds customers containing "John" AND "Smith"


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 23
6519
2
thg 11 22
6914
1
thg 6 22
3378
0
thg 9 21
3016
4
thg 8 20
7826