I need to hide the secondes from a fields.Datetime in a form view. What is the best way to do this?
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
- Dự án
- MRP
Câu hỏi này đã bị gắn cờ
I do that not only for particular forms, but generally for each database and language by specifying the corresponding time format under "Settings/Languages".
Fine :)
Hi Pieter Paulussen,
You add a class to your date time filed and write a script. Then include maxlength property to the date to remove from right side.
For example
<script type="text/javascript">
$('.your_date_field').css({"color": "red", "border": "2px solid red"});//TO TEST
// CODE WHEN READ ONLY
//CODE WHEN EDIT
</script>
<field name="date" class="your_date_field"/>
Isn't the javascript supposed to be put after the field definition?
Also I think that when you want to extend the javascript, it's best to extend the full date-time widget rather than just changing the css.
Javascript near the field definition is not supposed :)
My code works, I tested
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 6 25
|
1817 | ||
|
|
3
thg 2 25
|
5410 | ||
|
|
1
thg 7 23
|
4645 | ||
|
|
4
thg 12 22
|
10405 | ||
|
|
2
thg 4 21
|
4377 |
Try by creating new widget for datetime, i don't know more
Refer:
1) odoo-9.0c-20160806/openerp/addons/web/static/src/xml/base.xml
2) https://www.odoo.com/documentation/9.0/howtos/web.html#read-write-field
Yeah I'm more looking to an option like in qweb: t-field-option='{"hide_seconds":"True"}'