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

domain="[('deprecated', '=', False)] meaning?

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

Here, domain="[('deprecated', '=', False)] means it will display only those records for which deprecated(field name) is false(field value).

Generally Domain is used to filter data based on conditions.

You can get reference from here : https://www.odoo.com/documentation/10.0/reference/orm.html#domains

อวตาร
ละทิ้ง

Thanks Jainesh

It helps me :)

คำตอบที่ดีที่สุด

There are two types of domain in odoo, the first one is inline domain and the other is functional domain. The purpose of both domain is to filter records in many2one fields.

Inline Domain

department_id= fields.Many2one('department.model','Department',domain="[('academic_department','=',True)]")

Above code means i want to show only those department which are academic.

Functional Domain

def semester_domain(self):
      #do some logic for getting ids    
return [('id','in',[your ids goes here])]
department_id = fields.Many2one('department.model','Department',domain=semester_domain)

Hope I helped you. For scratch and business development in Odoo visit: https://goo.gl/8HgnCF

Thanks

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

thks for the reply, I know what you said but what I want is jainesh answer. Only on domain="[('deprecated', '=', False)]

คำตอบที่ดีที่สุด

Filter  objects which field depreciated(may be boolean) contain False value

อวตาร
ละทิ้ง