[('id', 'in', parent.product_id_domain)]
how can add a condition to this domain as it has to execute only when parent.picking_type_code =='outgoing'
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi Sruti,
So the domain conditions are simple to understand and write. Like `[('id', 'in', parent.product_id_domain)]`
just means if id is found in parent.product_id_domain.
To add more filtering (conditions) simply append the tuple to condition array.
Means, your final condition will be `[( 'id' , 'in' , parent.product_id_domain ), (parent.picking_type_code, '=' , 'outgoing')]`
Multiple conditions:
You can do it as follows,
`
# Check the condition and apply the appropriate domain
if parent_id.picking_type_code == 'outgoing':
domain = [('id', 'in', parent.product_id_domain)]
elif parent_id.picking_type_code == 'incoming':
domain = [('id', 'in', product_id)]
# Search for records using the constructed domain
records = self.env['table.name'].search(domain)`
Hey , Can you please answer this
Can we have multiple conditions like
if parent_id.picking_type_code', '==', 'outgoing execute
('id', 'in', parent.product_id_domain)
else parent_id.picking_type_code == incoming another domain ('id', 'in', product_id)
Hey Nisarga,
Yes, it is doable.
You can do it as follows,
# Check the condition and apply the appropriate domain
if parent_id.picking_type_code == 'outgoing':
domain = [('id', 'in', parent.product_id_domain)]
elif parent_id.picking_type_code == 'incoming':
domain = [('id', 'in', product_id)]
# Search for records using the constructed domain
records = self.env['table.name'].search(domain)
Thanks Jenish M and Chandan , If you know how can we add multiple as like Nisarga commented , Please comment it
updated my answer.
Can we have multiple conditions like
if parent_id.picking_type_code', '==', 'outgoing execute
('id', 'in', parent.product_id_domain)
else parent_id.picking_type_code == incoming another domain ('id', 'in', product_id)
Hey Nisarga,
Yes, it is doable.
You can do it as follows,
# Check the condition and apply the appropriate domain
if parent_id.picking_type_code == 'outgoing':
domain = [('id', 'in', parent.product_id_domain)]
elif parent_id.picking_type_code == 'incoming':
domain = [('id', 'in', product_id)]
# Search for records using the constructed domain
records = self.env['table.name'].search(domain)
if this answers your question, please upvote (PS: I am new here with no Karma points)
You can add your conditions seperated by comma(,)
For example,
[('id', 'in', parent.product_id_domain), ('parent_id.picking_type_code', '==', 'outgoing']
Can we have multiple conditions like
if parent_id.picking_type_code', '==', 'outgoing execute
('id', 'in', parent.product_id_domain)
else parent_id.picking_type_code == incoming another domain ('id', 'in', product_id)
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
3
thg 5 24
|
5835 | ||
|
1
thg 1 24
|
1814 | ||
|
1
thg 11 23
|
1866 | ||
|
1
thg 11 23
|
6 | ||
|
1
thg 10 23
|
1999 |