Created
February 27, 2024 19:25
-
-
Save randall-vx/4fb7959e216d42f6d6f384be62c511ad to your computer and use it in GitHub Desktop.
partner_vat_unique XMLRPC python code to test PR #1675
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For this example we would be using the native xmlrpc python library. | |
import xmlrpc.client | |
import json | |
import ssl | |
ssl._create_default_https_context = ssl._create_unverified_context | |
# CONFIGURATION | |
# These parameters should be configurable in the external system. | |
url = 'http://oca-partner-contact-16-0-pr1675-a32c38a00de6.runboat.odoo-community.org' | |
db = 'bb5d175dc-7755-4b01-9dea-a79b3ec67cc0' | |
username = 'admin' | |
password = 'admin' | |
# This is to test the connection with odoo server. | |
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url)) | |
output = common.version() | |
print(str("Version: "), output) | |
# This call tests the credentials and returns the user ID for the next calls. | |
uid = common.authenticate(db, username, password, {}) | |
print(str("User ID: "), uid) | |
# Initialize the models endpoint. | |
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url)) | |
id = models.execute_kw(db, uid, password, 'res.partner', 'create', [{'middlename': "Betzolina", 'lastname': "Dascola", 'lastname2': "Veroni", 'firstname': "Albertini", 'vat': "113520809"}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment