Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


how to dispaly only year

on 5/15/13, 12:12 PM 2,388 views

I am creating the function field to return date and time and i need to display only year in the field how to achieve this ?

Instead of this you can use account.fiscalyear.

Sudhir Arya (SA)
on 5/16/13, 5:01 AM

i need to fetch current year and increment the year by 1 and need to dispaly both current and incremented year in selection field

on 5/16/13, 5:12 AM

Vasiliy Birukov

--Vasiliy Birukov--
| 6 6 8
Russian Federation
--Vasiliy Birukov--

Help develop and implement any project on base Odoo.

Vasiliy Birukov
On 5/16/13, 2:58 AM

You can extract Year from your datetime string like:

year = time.strftime('%Y',time.strptime(datetime, "%Y"))

And return it in other functional field as string.

how to make this as selection field

on 5/16/13, 3:29 AM

For the selection field check your functional field type="selection" and define their range of year.

Serpent Consulting Services Pvt. Ltd.
on 5/16/13, 4:52 AM

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 5/16/13, 4:28 AM


If You want to return only year from your datetime field then do like this:

import datetime


year = datetime.datetime.strptime(your_date, DEFAULT_SERVER_DATETIME_FORMAT).strftime("%Y")

Thank You, Serpent Consulting Services Pvt. Ltd.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 5/15/13, 12:12 PM
Seen: 2388 times
Last updated: 3/16/15, 8:10 AM