I am doing work on ODOO iOS application.
I am creating Customer using res.partner
model and with create
method.
Customer is creating successfully without any error, but the tags field that I have selected during creation is not getting generated.
I have used below code for creating customer:
NSArray *inputParameter = [NSArray arrayWithObjects:[userDic objectForKey:@"database"],[userDic objectForKey:@"userId"],[userDic objectForKey:@"password"],@"res.partner",@"create",customerDictionary,nil];
// Show progress hud on main thread
[[OpenERPGlobal appDelegate] showProgressHUD:@"Please wait" withView:self.view];
// Depending on Id's read records
WebService *service = [[WebService alloc] init];
[service fetchDataWIthURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/xmlrpc/object",[userDic objectForKey:@"hostUrl"]]] withMethodName:ExecuteFunctionName withParameter:inputParameter withResult:^(id result,NSError *error)
{
[[OpenERPGlobal appDelegate] hideProgressHUD];
if([result isKindOfClass:[NSNumber class]])
{
[OpenERPGlobal showMessage:@"Customer created successfully." delegate:self tag:10 cancelButtonTitle:@"Ok" otherButtonTitles:nil];
}
}
And the input parameter for above call is as below:
{
"category_id" = (
17,
10,
9,
13
);
city = California;
email = "sample@gmail.com";
fax = "";
function = "";
"is_company" = 0;
mobile = "";
name = "123 Sample Customer";
phone = "";
street = "Street address";
website = "http://www.sample.com";
}
In above input parameter category_id
is my key for tags.
Does anybody has faced this kind of issue?
In res_partner object category_id has many2many relationship. So you need to add using [6, 0, [ids]]
Try this values:
{
"category_id" = [(6, 0, [17, 10, 9, 13])],
city = California;
email = "sample@gmail.com";
fax = "";
function = "";
"is_company" = 0;
mobile = "";
name = "123 Sample Customer";
phone = "";
street = "Street address";
website = "http://www.sample.com";
}