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

Hello,

I want to add a date-filter inside the page "Printers", to filter the records with a from-to picker:


< record id="product_product_template_only_form_view_ext" model="ir.ui.view"> 

< field name="name">product.product_template_only_form_view.ext < /field>

< field name="model">product.template < /field>

< field name="inherit_id" ref="product.product_template_only_form_view" /> 

< field name="arch" type="xml"> 

< xpath expr = "//page[@name='notes']" position="after"> 

< page string="Printers"> 

< field name="print_data"> 

< tree> 

< field name="date"/> 

< field name="name"/>  

< /tree>
< /field> 

< /page> 

< /xpath> 

< /field> 

< /record>

I did some research and found this filter:

< filter string="Today" domain="[('date', '>=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date', '<=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>


But I don't know where to add it.


Thank you


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

Hi,
Instead of the form view you have to inherit the search view to add the filter.
You can go to developer mode and open the developer tools, go to ‘Edit Searchview’ to get the external id of the search view. You refer the similar search view of other models by following the same step and see how to filters are already given there to get an idea of where to place the code segment.

For example this is an inherited view for ‘ sale.view_sales_order_filter’

https://ibb.co/Byw8pTQ

Regards

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

Hello, thanks for your answer, there is no 'searchview' in product.product_template_only_form_view I can inherit from...

ผู้เขียน

Also there is no ‘Edit Searchview’ in the dev tools...

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 24
2643
1
มิ.ย. 24
5115
1
ต.ค. 23
10813
1
ต.ค. 23
98
413 Request Entity Too Large แก้ไขแล้ว
1
ส.ค. 23
2193