Odoo Help

Welcome!

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.

0

YEAR COMPUTATION

By
louie
on 1/25/15, 7:46 PM 492 views

IS IT POSSIBLE TO TO SUBTRACT THE YEAR. IF SO WHAT CODE IM GOING TO USE. DO I NEED TO USE THE FIELDS.DATE OR FIELDS THAT INTEGER? TAKE NOTE I NEED ONLY TO SUBTRACT THE YEARNOW - YEAREFFECT. YEAR EFFECT IS FIELDS TO BE INPUT.

1
louie
On 2/1/15, 11:56 PM

hi baiju, actually im newbie for the openerp. kindly provide the sample code? because i dont have idea what code im gonna input. anyway. here's the output that i want to see.     yearnow-yeareffect. EX. 2015-2000. the yeareffect that is field to be input. thanks advance.

1

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 1/25/15, 11:20 PM

Hi Louie,

You can do that in many ways. I can give you a simple way. In this you have to choose your YEAREFFECT field as integer(in format "yyyy", ie '2015')

in code its like:-

'yeareffect' : fields.integer('Year Effect'),

Then at calculation part you can use like this:-

yearnow = int(time.strftime("%Y"))

then you have get the value in yeareffect field

diff =  value_yeareffect - yearnow

For this you have to import time

This is a simple way, You can do it in many other ways, for that you have mention more details about your requirement, This is from what i understood form your brief description. please let me know if this solves the problem.

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

1 follower(s)

Stats

Asked: 1/25/15, 7:46 PM
Seen: 492 times
Last updated: 3/28/15, 3:13 AM