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

Hi everyone,


I am struggling with creating AND condition on account.invoice model for o2m invoice_line_ids  field (relation to account.invoice.line model). I need to filter invoices having invoice line with Product=Downpayment and quantity=1 at the same time. With using domain filter in XML search view (see code below) it does not work because it takes in account all lines in order to satisfy the defined condition within one invoice.  Using Odoo v12.0.


<xpath expr="//search/filter[@name='myinvoices']" position="before">

   <filter name="Downpayments" domain="[('invoice_line_ids.product_id.name', '=', 'Downpayment'), ('invoice_line_ids.quantity', '=', 1)]"/>

</xpath>


Many thanks for your help


Best regards,

Marek


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

Hello Jainesh,

&amp is used by default therefore without specification, it has the same effect.

Regards,

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

can you try

<filter name="Downpayments" domain="[('invoice_line_ids.sale_line_ids.is_downpayment', '!=', False)]"/> 

 there is no issue with domain AND or OR condition feel free to add more domain as needed




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

Hello Marek,

You need to replace below code in your xpath:

<filter name="Downpayments" domain="['&amp;',('invoice_line_ids.product_id.name', '=', 'Down payment'), ('invoice_line_ids.quantity', '=', 1)]"/>

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 22
3347
3
thg 8 23
2844
0
thg 1 18
5257
3
thg 3 25
2689
0
thg 6 24
1469