Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Custom fields update/read/write via XMLRPC?

By
Thomas Klosinsky
on 4/11/15, 4:41 PM 833 views

Hey,

I've been trying to update custom fields via XMLRPC but couldn't get it working so far.
Is there anything I need to add to XMLRPC-module or so to get those also to be accessible???

Any help appreciated!

EDIT:

public function Erp_product_update($pro_array, $userId, $client ) {

$msg2 = new xmlrpcmsg('execute');

$msg2->addParam(new xmlrpcval(Mage::getStoreConfig('magerpsync/magerpsync/dbname'), "string"));

$msg2->addParam(new xmlrpcval($userId, "int"));

$msg2->addParam(new xmlrpcval(Mage::getStoreConfig('magerpsync/magerpsync/pwd'), "string"));

$msg2->addParam(new xmlrpcval("magento.product", "string"));

$msg2->addParam(new xmlrpcval("create_product", "string"));

$msg2->addParam(new xmlrpcval($pro_array, "struct"));

$resp = $client->send($msg2);

}



$pro_array = array(

'name'=>new xmlrpcval($name, "string"),

'description'=>new xmlrpcval($desc, "string"),

'description_sale'=>new xmlrpcval($srt_desc, "string"),

'list_price'=>new xmlrpcval($onepro->getPrice(), "string"),

'standard_price'=>new xmlrpcval($product->getCost(), "string"),

'taxes_id'=>$tax1,

'supplier_taxes_id'=>$tax2,

'type'=>new xmlrpcval($type, "string"),

'categ_ids'=>new xmlrpcval($erp_categ_ids, "array"),

'default_code'=>new xmlrpcval($sku, "string"),

'weight_net'=>new xmlrpcval($onepro->getWeight(), "double"),

'product_id'=>new xmlrpcval($pro_id, "int"),

'method'=>new xmlrpcval('write', "string")

);

$this->Erp_product_update($pro_array, $userId, $client);


this works...

but when I add a field like this which before has the right string in the variable:


'x_manufacturer'=>new xmlrpcval($manufacturer, "string"),


then it's not working for this field in Odoo...

XMLRPC doesn't care if a field is custom or not, the call works the exact same way. What does your XMLRPC request look like? It's much more likely that the XMLRPC call isn't accurate.

Brett Lehrer
on 4/16/15, 10:40 PM

Well... that would be very weird, because all the other fields in the array are transmitted fine... this would be the array: $pro_array = array( 'name'=>new xmlrpcval($name, "string"), 'description'=>new xmlrpcval($desc, "string"), 'description_sale'=>new xmlrpcval($srt_desc, "string"), 'list_price'=>new xmlrpcval($product->getPrice(), "string"), 'type'=>new xmlrpcval($type, "string"), 'categ_ids'=>new xmlrpcval($erp_categ_ids, "array"), 'default_code'=>new xmlrpcval($sku, "string"), 'weight_net'=>new xmlrpcval($product->getWeight(), "double"), 'mage_id'=>new xmlrpcval($product->getId(), "int"), 'method'=>new xmlrpcval('create', "string") 'x_manufacturer'=>new xmlrpcval($product->getAttributeText('manufacturer'), "string"), ); $this->Erp_product_update($pro_array, $userId, $client); and public function Erp_product_update($pro_array, $userId, $client ) { $msg2 = new xmlrpcmsg('execute'); $msg2->addParam(new xmlrpcval(Mage::getStoreConfig('magerpsync/magerpsync/dbname'), "string")); $msg2->addParam(new xmlrpcval($userId, "int")); $msg2->addParam(new xmlrpcval(Mage::getStoreConfig('magerpsync/magerpsync/pwd'), "string")); $msg2->addParam(new xmlrpcval("magento.product", "string")); $msg2->addParam(new xmlrpcval("create_product", "string")); $msg2->addParam(new xmlrpcval($pro_array, "struct")); $resp = $client->send($msg2); maybe it has something to do with decoding the XML Data within the xmlrpc library??? How can I check what's Odoo getting at XMLRPC interface?

Thomas Klosinsky
on 4/17/15, 9:17 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/11/15, 4:41 PM
Seen: 833 times
Last updated: 4/17/15, 9:20 AM