gpt4 book ai didi

ios - 在odoo中创建客户(res.partner)时如何添加标签(Category_id)?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:00:36 29 4
gpt4 key购买 nike

我正在开发 ODOO iOS 应用程序。我正在使用 res.partner 模型和 create 方法创建 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];
}
}

上述调用的入参如下:

{
"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";
}

在上面的输入参数中,category_id 是我的标签键。

有人遇到过这种问题吗?

最佳答案

res_partner 中,对象 category_id 具有多对多关系。所以你需要添加 using [6, 0, [ids]]

试试这个值:

{
"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";
}

For more details of Many2one, One2many and Many2many field

关于ios - 在odoo中创建客户(res.partner)时如何添加标签(Category_id)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29643834/

29 4 0