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

Hi Guys,

Can you tell me the best way(code) to create a datepicker in Odoo Website, which is compatible across all popular browser and mobile browsers?

Moreover, the datapicker must set the dateformat from Language of Odoo Configuration.

ie. Go to Settings > Languages > Date Format

Whatever format is inputted here, it must appear on the date field.

Odoo Version - v11 Community


Thanks in advance.


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

Hi Burhan,

 Create the datepicker as below code.

<input id="birth_date" type="text" name="birth_date" class="form-control o_website_form_input o_website_form_date"/>

Hope it will work.

Thanks.



Ảnh đại diện
Huỷ bỏ

Not working

Câu trả lời hay nhất

Burhan,

You can use input type  date in your form.

Example Code . click to see the demo.

<form>
  Birthday:
  <input type="date" name="bday">
</form>


Thanks & Regards

iWesabe




Ảnh đại diện
Huỷ bỏ
Tác giả

Hello Shameem babu,

Thank you for your reply. I am aware about the type='date'. But it is not compatible with browsers like IE.

Moreover, How can I get the date format in this datepicker from Odoo configuration?

Câu trả lời hay nhất

i think simply creating a fields.Date() do the thing.

eg:

class yourclass(models.Model):
    _name = 'module.name'
    date = fields.Date(string='Date')


Ảnh đại diện
Huỷ bỏ
Tác giả

Hello Muhammed,

The above code which you suggested is for creating a new Date field in Odoo backend.

My question is regarding creating a datepicker in Odoo Website.

Thank You for your efforts.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 19
8774
1
thg 10 18
6275
0
thg 7 16
6082
0
thg 8 21
3158
1
thg 7 20
16003