Skip to Content
Menu
This question has been flagged
2 Replies
2728 Views

Hi,

I'm trying to send data from Salesforce.com to my Odoo instance via the external API. As Salesforce does not have XMLRPC support, I plan to send directly encoded in XML to the endpoint. I've managed to figure out how to format most of my CRUD and login and search commands, but I am currently stuck on Many2Many field commands. From reading the documentation here (https://www.odoo.com/documentation/11.0/reference/orm.html#odoo.models.Model.write) it seems I need to send a triplet / tuple to the endpoint, but I can't figure out how to properly format it. 

I've tried a simple delete operation on a record per below, but an array doesn't seem to work. I also tried using a struct but that doesn't seem to work (unless I botched the formatting):

			<member>
				<name>product_ids</name>
				<value>
					<array>
						<data>
							<value><int>5</int></value>
							<value><string>0</string></value>
							<value><string>0</string></value>
						</data>
					</array>
				</value>
			</member>

above is after the XML blocks for param1 - database, param2 - uid, param3 - password, param4 - model, param5 - command (in this case, 'write'), and param 6 - record id
Avatar
Discard

have you checked the webserivce doc

https://www.odoo.com/documentation/11.0/webservices/odoo.html

You will have full example

Author Best Answer

My response to my own question looks like didn't go through.

I've referenced the webservice doc many times and am familiar with it, but it doesn't cover raw XML syntax, which is very not helpful in my case. To improve in the future, I would suggest that Odoo also document the XML syntax of the various commands. 

For anybody else with this issue in the future, after experimenting in Postman, I've found that the correct way format for this is an array of arrays (with the outer array being the list of commands on the member, and the inner array being the triplet) as such:

<member>
				<name>product_ids</name>
				<value>
					<array>
						<data>
                                                    <array><data> <value><int>5</int></value> <value><string>0</string></value> <value><string>0</string></value>
                                                    </data></array> </data> </array> </value> </member>
Avatar
Discard