تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3518 أدوات العرض
try:
from xmlrpc import client as xmlrpclib
except ImportError:
import xmlrpclib


url = <insert server URL>
db = <insert database name>
username = 'admin'
password = <insert password for your admin user (default: admin)>
common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url))
print(common.version())

#calling methods
models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url))
uid = common.login(db, username, password)
print(uid)
result = models.execute(db, uid, password, 'res.partner', 'search_read', [['id', '=', 1]])
number_of_customers = models.execute(db, uid, password, 'res.partner', 'search_count', [])
#checking access rights
print(models.execute_kw(db, uid, password, 'sale.order', 'check_access_rights', ['read'], {'raise_exception': False}))
#list records
print(models.execute_kw(db, uid, password, 'sale.order', 'search', [[['partner_id.name', '=', 'Gemini Furniture']]]))
#
# print(models.execute_kw(db, uid, password, 'res.partner', 'search',[[['is_company', '=', True], ['customer', '=', True]]]))

print('Number of customers: ' + str(number_of_customers))
print('result: ' + str(result[0].get('name')))
OUTPUT:
{'server_serie': '13.0', 'server_version_info': [13, 0, 0, 'final', 0, 'e'], 'server_version': '13.0+e', 'protocol_version': 1}
2
True
[30, 28, 33, 32, 31, 29, 16, 14, 13, 12, 10, 8, 7, 4, 27, 26, 25, 24, 23, 22, 21, 9, 15, 11, 17, 34, 35, 18, 36]
Number of customers: 36
result: YourCompany
الصورة الرمزية
إهمال
أفضل إجابة

Not sure what your asking? Everything seems to be working fine from the terminal outputs 


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 24
4436
2
مايو 22
10100
2
أكتوبر 20
5347
0
مارس 20
20071
0
مارس 15
3214