Я пытаюсь обновить Item.QtyOnHand
с помощью IPP .NET SDK для QuickBooks v3.0. я выбрал
Я отслеживаю количество этого товара в наличии
флажок для продуктов, которые я хочу обновить. Но я всегда получаю сообщение об ошибке:
Detail=Business Validation Error: требуется учетная запись стоимости проданных товаров, если вы отслеживаете количество запасов для этого продукта.
Как обновить количество в наличии? Мой код:
var oauthValidator = new OAuthRequestValidator(RestProfile.OAuthAccessToken, RestProfile.OAuthAccessTokenSecret, this.ConsumerProfile.ConsumerKey, this.ConsumerProfile.ConsumerSecret);
var serviceContext = new ServiceContext(this.RestProfile.AppToken, this.RestProfile.CompanyId, IntuitServicesType.QBO, oauthValidator);
var dataService = new DataService( serviceContext );
var queryService = new QueryService<Item>( serviceContext );
var items = queryService.Where(x=>x.Type == ItemTypeEnum.Inventory).ToList();
var batch = dataService.CreateNewBatch();
foreach( var item in items )
{
batch.Add(new Item()
{
Name = item.Name,
Id = item.Id,
QtyOnHand = item.QtyOnHand+1,
QtyOnHandSpecified = true
}, item.Id, OperationEnum.update);
}
batch.Execute();
я всегда получаю эту ошибку:
{
"BatchItemResponse" : [{
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "20"
}, {
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "23"
}, {
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "21"
}, {
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "22"
}
],
"time" : "2014-10-09T12:42:48.715-07:00"
}