Hello, I am writing a tool to import leads into our openerp instance.
The XMLRPC examples are very good, however I'm having trouble figuring out how to set the many2many_tags we need to tag the new lead with "New Lead".
xmlsock_common = xmlrpclib.ServerProxy(openerp_xmlrpcpath_common)
openerp_uid = xmlsock_common.login(
openerp_dbname, openerp_username, openerp_password)
xmlsock_object = xmlrpclib.ServerProxy(openerp_xmlrpcpath_object)
name = '%s %s' % (wrapnone(message.pop("FirstName")),
wrapnone(message.pop("LastName")))
company = wrapnone(message.pop("Company"))
title = "%s - %s - %s" % (company, name, wrapnone(message.pop("FormName", "unknownform")))
#company name - contact name - FormName"
lead = {
'name': title,
'partner_name': company,
'contact_name': name, # Contact Name
'email_from': wrapnone(message.pop("EMail")),
#'city': 'Santa Clara', # City
'type': 'lead',
'priority': '3',
'description': notes,
'phone': wrapnone(message.pop("Phone")),
#'categ_ids': new_lead_ids,
}
xmlsock_object.execute(openerp_dbname, openerp_uid,
openerp_password, 'crm.lead', 'create', lead)
The "field" I'm trying to set is:
Field: categ_ids Object: crm.leads Type: many2many Widget: many2many_tags Context: {'object_name': 'crm.lead'} Domain: [('object_id.model','=','crm.lead')] Relation: crm.case.categHow can I look up "New Lead" in the "tags" table and set it on the new lead please? Are there any examples using xmlrpc to fetch/set many2many2_tags I can use? thank you, -Alfred