-
-
Save martintamare/8f9f2fa7f5dbb1519158b652a9c75287 to your computer and use it in GitHub Desktop.
Account.move read error
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
#!/usr/bin/env python | |
# -*-coding:utf-8 -* | |
import xmlrpc.client | |
from alkivi.config import ConfigManager | |
from xmlrpc.client import Fault, ProtocolError | |
import time | |
config = ConfigManager("odoo") | |
endpoint = config.get("default", "endpoint") | |
url = config.get(endpoint, "url") | |
port = config.get(endpoint, "port") | |
protocol = config.get(endpoint, "protocol") | |
version = config.get(endpoint, "version") | |
user = config.get(endpoint, "user") | |
password = config.get(endpoint, "password") | |
db = config.get(endpoint, "db") | |
url = f"https://{url}" | |
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url)) | |
print(common.version()) | |
uid = common.authenticate(db, user, password, {}) | |
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url)) | |
fields = models.execute_kw(db, uid, password, 'account.move', 'fields_get', [], {}) | |
# Testing field one by one | |
for field, field_data in fields.items(): | |
stop = False | |
while not stop: | |
try: | |
data = models.execute_kw(db, uid, password, 'account.move', 'read', [[49928]], {'fields': [field]}) | |
print(f"{field} OK") | |
stop = True | |
except Fault as e: | |
print(f"Error on {field=} {e}") | |
stop = True | |
except ProtocolError as e: | |
time.sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment