Odoo Help


Create Lead using java API based on Assignee

on 1/18/15, 7:40 PM 1,478 views


I want to ensure that lead is assigned to the correct team to deal with it

I am able to create the lead using this code

FilterCollection contactfilter1=new FilterCollection();

//contactfilter1.add("hr_department_id","=","hr_department_id"); System.out.println("odoo search object"); RowCollection leadCount1 = partnerAd.searchAndReadObject(contactfilter1, new String[]{"name","email_from","hr_department_id","partner_id","parent_id"}); System.out.println(leadCount1.size()); for (Row row : leadCount1){ System.out.println("Row ID: " + row.getID()); System.out.println("Name:" + row.get("name")); System.out.println("Email:" + row.get("email_from")); System.out.println("HR:" + row.get("hr_department_id")); System.out.println("PartenerId"+row.get("partner_id")); System.out.println("parentId"+row.get("1")); } Row leadrow=leadCount1.get(0); leadrow.put("name", "BizRuntime"); Object team=null; Object [] hrId=null; for(Row row:leadCount1){ System.out.println(row.get("name")); System.out.println(row.get("email")); hrId = (Object []) row.get("hr_department_id"); if (hrId == null){ System.out.println("hr_department_id: Null"); System.out.println("hr_department_id: Null"); } else{ System.out.println("hr_department_id: " + hrId[0]); // If nou need more info, you need to create an ObjectAdapter to read } team=row.get("1"); } System.out.println("*********for department************"); Row newPartner = partnerAd.getNewRow(new String[]{"name", "email_from","hr_department_id","partner_id"}); newPartner.put("name", "zebra"); newPartner.put("email_from", "zebra@gmail.com"); newPartner.put("partner_id","1"); newPartner.put("hr_department_id",team); partnerAd.createObject(newPartner); boolean success=partnerAd.writeObject(newPartner, true); if(success){ System.out.println("record created"); } System.out.println("New Row ID: " + newPartner.getID());

So it sucessfully created a Lead but Default assign to Team As Admin

so,can you explain me how i will achieve this to create lead based on Assignee


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/18/15, 7:40 PM
Seen: 1478 times
Last updated: 3/16/15, 8:10 AM