Community mailing list archives

community@mail.odoo.com

Re: Server Actions / Formula

by
Graeme Gellatly
- 04/22/2016 16:30:10
Strptime, basically the opposite of strftime. Look it up, is part of standard library. Or else move your closing bracket for gmtime.

On Sat, 23 Apr 2016 3:19 AM Dave Ellison <dave.e@time-tele.com> wrote:
Hi,

I have a server action writing back to the server, based on an automated 
action. On one of the destinations, I am trying to work out a formula 
that gives me another field from the same object, plus X amount of days. 
Then write back that to another field.

I can work out a formula that gives me current date, plus a number of 
days. But I have tried various ways to integrate the object date field, 
but it seems I am not sure how it to convert the date to an integer.

"time.strftime('%Y-%m-%d %H:%M:%S',time.gmtime(time.time()+3600*24*30))"

This gives me current date, but the below I am trying to specify the 
date plus the days I want:

"time.strftime('%Y-%m-%d 
%H:%M:%S',time.gmtime(object.x_invoice_date+3600*24*30))"

Which gives me the error "cannot concatenate 'str' and 'int' objects". 
So ok, this means the x_invoice_date is giving me a string I presume. 
But is there any function I can use in the Server Actions formula, that 
will allow me to convert the returned field to an integer? Or have I 
gone completely wrong?

Thanks
Dave

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe