Retail:Developers Guide/Backbone Models and Collections
Contents |
Introduction
Openbravo Web POS uses Backbone.Model and Backbone.Collection to work with data. This article provides an overview of the models and collections.
Models
By convention Openbravo Web POS provides the models as part of OB.Model
object:
-
OB.Model.BusinessPartner
-
OB.Model.DocumentSequence
-
OB.Model.Order
-
OB.Model.OrderLine
-
OB.Model.PaymentLine
-
OB.Model.Product
-
OB.Model.ProductPrice
-
OB.Model.TaxRate
-
OB.Model.Terminal
Collections
The available collections are part of the OB.Collection
:
-
OB.Collection.BusinessPartnerList
-
OB.Collection.DocumentSequenceList
-
OB.Collection.OrderLineList
-
OB.Collection.OrderList
-
OB.Collection.PaymentLineList
-
OB.Collection.ProductCategoryList
-
OB.Collection.ProductList
-
OB.Collection.ProductPriceList
-
OB.Collection.TaxRateList
Examples
Code snippets that uses OB.Dal
and one of the listed model/collection
Search for pending orders:
OB.Dal.find(OB.Model.Order, { hasbeenpaid: 'N' }, function(pendingOrderList, me) { // success }, function(tx, error) { // error }, this);
Searching business partners:
/* rest of the code */ var criteria = {}; if (filter && filter !== '') { // filter is a parameter of the function criteria._identifier = { operator: OB.Dal.CONTAINS, value: filter }; } OB.Dal.find(OB.Model.BusinessPartner, criteria, successCallbackBPs, errorCallback); // success and error callbacks are previously defined
Back to Concepts