Odoo Help

1

how to dispaly only year

By
Maniganda
on 5/15/13, 12:12 PM 3,356 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

Maniganda
on 5/16/13, 5:12 AM
1
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

Maniganda
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
0

Hello,

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

import datetime

from tools import DEFAULT_SERVER_DATETIME_FORMAT

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

Thank You, Serpent Consulting Services Pvt. Ltd.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

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