OdooRPC is the latest python codes to access the Odoo. It is a better and easier to used version of XML-RPC. Read this XML-RPC if you are interested.
There are 2 version of OdooRPC, 'Client' version is to run on the local PC (eg, from PyCharm) and 'Server' version is to run it on the server.
XML-RPC Use Cases
1) Mobile app development to access to Odoo, such as react-native and flutter development.
2) Migrate master data and transactional data from the Ms Excel to the Odoo, especially validation and customization are involved.
3) Mass update Odoo records to fix the data issue in the Odoo.
The following is the OdooRPC client sample code to mass update the duplicate customer record.
from odoo_rpc_client import Client
client = Client('IP address', 'database', 'username', 'password')
partner_obj = client['res.partner']
partner_ids = partner_obj.search_records([('customer', '=', True)], order="name", limit=3871)
previous_name = ''
previous_ref = ''
for rec in partner_ids:
if previous_name:
if previous_name == rec.name and previous_ref == rec.ref:
partner = partner_obj.browse(rec.id)
partner.write(
{'customer': False, })
previous_name = rec.name
previous_ref = rec.ref
Bình luận