Community mailing list archives

community@mail.odoo.com

Server Actions / Formula

by
Dave Ellison
- 04/22/2016 11:07:15
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