Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gisce/ws_transactions
WebServices Transactions for OpenObject
https://github.com/gisce/ws_transactions
hacktoberfest openerp python xmlrpc xmlrpc-transactions
Last synced: about 2 months ago
JSON representation
WebServices Transactions for OpenObject
- Host: GitHub
- URL: https://github.com/gisce/ws_transactions
- Owner: gisce
- License: gpl-3.0
- Created: 2011-04-27T14:23:35.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2023-10-26T13:33:41.000Z (about 1 year ago)
- Last Synced: 2024-04-13T16:09:57.596Z (9 months ago)
- Topics: hacktoberfest, openerp, python, xmlrpc, xmlrpc-transactions
- Language: Python
- Homepage: http://code.gisce.net/ws_transactions
- Size: 37.1 KB
- Stars: 2
- Watchers: 22
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XML-RPC WebService Transactions for OpenERP
This allows us to add another service endpoint `ws_transaction` to work with Transactions at XML-RPC level
## Examples
**Comit**
```python
DBNAME = 'test_ws_transactions'
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/ws_transaction')
tid = sock.begin(DBNAME, uid, password)
print("Opening transaction %s..." % tid)
partner1 = sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'read', [1],
['name'])
print("Print before write", partner1[0])
sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'write', [1],
{'name': '%s mod' % partner1[0]['name']})
partner1 = sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'read', [1],
['name'])
print("Print after write", partner1[0])
print("Commit!")
sock.commit(DBNAME, uid, PASS, tid)
partner1 = sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'read', [1],
['name'])
print("Print after commit", partner1[0])
print("Clossing...")
sock.close(DBNAME, uid, PASS, tid)
```**Rollback**
```python
DBNAME = 'test_ws_transactions'
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/ws_transaction')
tid = sock.begin(DBNAME, uid, password)
print("Opening transaction %s..." % tid)
partner1 = sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'read', [1],
['name'])
print("Print before write", partner1[0])
sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'write', [1],
{'name': '%s mod' % partner1[0]['name']})
partner1 = sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'read', [1],
['name'])
print("Print after write", partner1[0])
print("Rollback!")
sock.rollback(DBNAME, uid, PASS, tid)
partner1 = sock.execute(DBNAME, uid, PASS, tid, 'res.partner', 'read', [1],
['name'])
print("Print after rollback", partner1[0])
print("Clossing...")
sock.close(DBNAME, uid, PASS, tid)
```