تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4950 أدوات العرض

Hello all,

I'm using a lot xmlrpclib in python to generate automatically a lot of stuff in my openerp.

I have now a problem with the expenses, HR expenses.

In the database, it is in hr.expense.expense.

and when I do a search like that :

#Config for API
openErpUser = 'User'
openErpPassword = 'password'
openErpBase = 'openerpbase' 
openErpCommon = 'localhost:8069/xmlrpc/common' #the xmlrpc common URL
openErpObject = 'localhost:8069/xmlrpc/object' #the xmlrpc object URL

#Connect to API
sock_common = xmlrpclib.ServerProxy (openErpCommon)
uid = sock_common.login(openErpBase, openErpUser, openErpPassword)
sock = xmlrpclib.ServerProxy(openErpObject)

#Search all the expenses that have been done after January 1st 2013
searchArgs = [('date', '>', '2013-01-01'),]
expenseIds = sock.execute(openErpBase, uid, openErpPassword, 'hr.expense.expense', 'search', searchArgs)

And the expenseIds is empty (and I have at least 10 exepenses done after this date).

When I do this with invoices, it works perfectly, but, whith these expenses. So far, I'm stuck :/

Who can help me ?

الصورة الرمزية
إهمال

Where can I get the API list of all the objects like hr.expense.expense?

الكاتب

What I do is to look at the tables names in the database and I replace the _ by a dot and that's it !

الكاتب أفضل إجابة

I've found the problem.

It is because the user I was using to connect with the script didn't have the access rights in Configuration-->Users-->Users-->HR. You have to put him as a manager instead of an employee (as it was by default).

Hope it will help other people

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 15
4896
2
سبتمبر 20
5871
1
نوفمبر 19
6778
2
مارس 15
17977
1
مارس 15
11595