Odoo-mobile / framework

Odoo Mobile Framework
https://play.google.com/store/apps/dev?id=8607973775002477408
Other
327 stars 374 forks source link

How to check 'user_has_groups' method in app #359

Closed naitikvithlani closed 6 years ago

naitikvithlani commented 6 years ago

Hello All,

I am trying to check user's group through the application.

The way i found is check 'res_groups_users_rel' and then check the 'res_groups' for checking the user's groups.

Is there any way to call predefined method 'user_has_groups' of odoo from the application ?

ghost commented 6 years ago

@naitikvithlani

If you're developing an offline app, you should prevent this online server calls. Add res.groups model in app and check access rights offline.

naitikvithlani commented 6 years ago

@KasimSCS I am developing app using jsonrpc(online)

ghost commented 6 years ago

@naitikvithlani

If you've already managed to use jsonrpc already. then check out OSyncAdapter.java and OSyncDataUtils.java.

for e.g. if you've created one record offline at android device then Odoo-mobile/framework is creating same record at server using OdooWrapper.java::callMethod function by passing model, method, and args value as parameter. Note that in odoo some methods are @api.model and some are @api.multi.

Use callMethod, get the error, trace the error. solve the error. That is the way.

naitikvithlani commented 6 years ago

@KasimSCS Thanks for your support, but i am not using any application which is provided by odoo.

I am developing my customised application using jsonrpc using volley as per my requirements, which is not based on [odoo-mobile/framework], so here i don't have any odoo classes.

So, i am stuck with check res.groups of login user.

ghost commented 6 years ago

@naitikvithlani

odoo has defined the route name call_kw. you can use call_kw for calling has_groups method of res.users model. has_group is @api.model so, you need to send string of whichever groups you want to check and that's it. :)

naitikvithlani commented 6 years ago

@KasimSCS Thanks

ghost commented 6 years ago

@naitikvithlani

You can close the issue if this works for you.

Thanks.

naitikvithlani commented 6 years ago

@KasimSCS I try to make as you suggested but not able to get groups details, It would be great if you can share some sample code to make it possible.

Thanks in advance.

ghost commented 6 years ago

screenshot from 2017-12-11 16-11-38

@naitikvithlani Have a look a screenshot. Thanks

naitikvithlani commented 6 years ago

@KasimSCS Is there any way to add group by clause in jsonrpc request (as above screenshot attached) ?

naitikvithlani commented 6 years ago

Hello @kasimscs, I am developing app using jsonrpc(online) app, anyone can help me for know the server configuration of odoo server for 1K users of this app.

I guess 20 core server with 32GB RAM will enough for this ?