Hi good day!,
I just want to as on how to assign/send/copy long text field value to another text field in odoo 10 by a xmlrpc webservice.
Thank you very much in advance!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi good day!,
I just want to as on how to assign/send/copy long text field value to another text field in odoo 10 by a xmlrpc webservice.
Thank you very much in advance!
- Firstly, you have to set up the connection to your odoo instance :
``
`
import xmlrpc.client
url = 'http://your-odoo-server'
db = 'your-database-name'
username = 'your-odoo-username'
password = 'your-odoo-password'
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
``
`
- Then, you can fetch the record IDs you want to copy, you can use 'search and read' to get it
``
`
model_name = 'your.odoo.model' # Replace with your actual Odoo model name
record_ids = [1, 2, 3] # Replace with the IDs of the records you want to update
``
`
- finally, you deal with these record IDs and proceed to the update,
``
`
for record_id in record_ids:
record = models.execute_kw(db, uid, password, model_name, 'read', [record_id], {'fields': ['field_to_copy', 'target_field']})
# Check if the source field has a value
if record[0]['field_to_copy']:
source_value = record[0]['field_to_copy']
# Update the target field with the source value
models.execute_kw(db, uid, password, model_name, 'write', [[record_id], {'target_field': source_value}])
``
`
*** Please note that if you are working with long text fields, the API response might not include the complete text in a single call. You may need to adjust your code to handle this situation based on your specific requirements.
*** I hope it can be helpful. Thx
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 6 24
|
1595 | ||
|
1
thg 4 23
|
1494 | ||
|
1
thg 3 23
|
2338 | ||
|
0
thg 12 22
|
1905 | ||
INSTALLING ODOO 10C ERROR
Đã xử lý
|
|
1
thg 10 21
|
3846 |