Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set timezone? #8

Open
sebalix opened this issue Oct 3, 2017 · 9 comments
Open

How to set timezone? #8

sebalix opened this issue Oct 3, 2017 · 9 comments

Comments

@sebalix
Copy link
Collaborator

sebalix commented Oct 3, 2017

From @mrgaolei on February 14, 2017 10:39

I add that line:

odoo.env.context['tz'] = 'Asia/Shanghai'

But any datetime responses also UTC.

Copied from original issue: osiell/odoorpc#42

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

From @dfang on February 22, 2017 6:54

odoo.env.user.tz = 'Asia/Shanghai'

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

You say that responses are UTC, what kind of RPC calls do you do?

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

From @mrgaolei on February 22, 2017 8:27

@dfang thanks but response also UTC.

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

From @mrgaolei on February 22, 2017 8:31

@sebalix I'm using odoorpc library and jsonrpc.
I say response are UTC because some record in database the are "2017-2-1 0:00:00", but when I set tz='Asia/Shanghai' it also "2017-2-1 0:00:00"

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

I mean, do you use odoo.env[MODEL].method(...) calls or odoo.execute(....)? The context is sent to the server only with the first one.

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

From @mrgaolei on February 22, 2017 10:6

@sebalix
In Database sale.order has a row, id=1, date_order='2017-2-1 0:00:00'.

import odoorpc
odoo=odoorpc.ODOO()
odoo.login('odoo_v9', 'admin', 'password')
odoo.env.context['tz']='Asia/Shanghai'
S=odoo.env['sale.order']
S.browse(1)

response:

{
"xxxx": "xxxx",
"date_order": "2017-02-01 00:00:00"
}

But in Odoo web UI, it OK, shown as 2017-2-1 8:00:00.

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

Thanks for the example, I will try to figure out what is happening here.

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

From @mrgaolei on March 17, 2017 9:8

@sebalix Can it be fixable?

@sebalix
Copy link
Collaborator Author

sebalix commented Oct 3, 2017

I don't check yet. If you have time to do this, you could check the JSON value returned in your web browser when you navigate on the Odoo UI. If the raw value is not converted this means that it is the web client which convert it, not the server. This will help to do the right fix.

rigo1985 added a commit to rigo1985/odoorpc that referenced this issue Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant