summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/_deprecated
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/_deprecated')
-rw-r--r--addons/web/static/src/js/_deprecated/data.js100
-rw-r--r--addons/web/static/src/js/_deprecated/data_model.js81
-rw-r--r--addons/web/static/src/js/_deprecated/model.js60
3 files changed, 98 insertions, 143 deletions
diff --git a/addons/web/static/src/js/_deprecated/data.js b/addons/web/static/src/js/_deprecated/data.js
index f6a58367903..3c95ababc3a 100644
--- a/addons/web/static/src/js/_deprecated/data.js
+++ b/addons/web/static/src/js/_deprecated/data.js
@@ -5,7 +5,6 @@ var Class = require('web.Class');
var Context = require('web.Context');
var concurrency = require('web.concurrency');
var mixins = require('web.mixins');
-var Model = require('web.Model');
var session = require('web.session');
var translation = require('web.translation');
var pyeval = require('web.pyeval');
@@ -792,7 +791,7 @@ function build_domain(record, domain) {
return new CompoundDomain(domain).set_eval_context(eval_context);
}
-return {
+var data = {
Query: Query,
DataSet: DataSet,
DataSetStatic: DataSetStatic,
@@ -803,4 +802,101 @@ return {
build_domain: build_domain,
};
+
+var Model = Class.extend({
+ /**
+ new openerp.web.Model(name[, context[, domain]])
+
+ @constructs instance.web.Model
+ @extends instance.web.Class
+
+ @param {String} name name of the OpenERP model this object is bound to
+ @param {Object} [context]
+ @param {Array} [domain]
+ */
+ init: function(name, context, domain) {
+ this.name = name;
+ this._context = context || {};
+ this._domain = domain || [];
+ },
+ /**
+ * @deprecated does not allow to specify kwargs, directly use call() instead
+ */
+ get_func: function (method_name) {
+ var self = this;
+ return function () {
+ return self.call(method_name, _.toArray(arguments));
+ };
+ },
+ /**
+ * Fetches a Query instance bound to this model, for searching
+ *
+ * @param {Array<String>} [fields] fields to ultimately fetch during the search
+ * @returns {instance.web.Query}
+ */
+ query: function (fields) {
+ return new data.Query(this, fields);
+ },
+ /**
+ * Fetches the model's domain, combined with the provided domain if any
+ *
+ * @param {Array} [domain] to combine with the model's internal domain
+ * @returns {instance.web.CompoundDomain} The model's internal domain, or the AND-ed union of the model's internal domain and the provided domain
+ */
+ domain: function (domain) {
+ if (!domain) { return this._domain; }
+ return new data.CompoundDomain(this._domain, domain);
+ },
+ /**
+ * Fetches the combination of the user's context and the domain context,
+ * combined with the provided context if any
+ *
+ * @param {Object} [context] to combine with the model's internal context
+ * @returns {web.Context} The union of the user's context and the model's internal context, as well as the provided context if any. In that order.
+ */
+ context: function (context) {
+ return new Context(session.user_context, this._context, context || {});
+ },
+ /**
+ * Call a method (over RPC) on the bound OpenERP model.
+ *
+ * @param {String} method name of the method to call
+ * @param {Array} [args] positional arguments
+ * @param {Object} [kwargs] keyword arguments
+ * @param {Object} [options] additional options for the rpc() method
+ * @returns {jQuery.Deferred<>} call result
+ */
+ call: function (method, args, kwargs, options) {
+ args = args || [];
+ kwargs = kwargs || {};
+ if (!_.isArray(args)) {
+ // call(method, kwargs)
+ kwargs = args;
+ args = [];
+ }
+ pyeval.ensure_evaluated(args, kwargs);
+ var call_kw = '/web/dataset/call_kw/' + this.name + '/' + method;
+ return session.rpc(call_kw, {
+ model: this.name,
+ method: method,
+ args: args,
+ kwargs: kwargs
+ }, options);
+ },
+ call_button: function (method, args) {
+ pyeval.ensure_evaluated(args, {});
+ return session.rpc('/web/dataset/call_button', {
+ model: this.name,
+ method: method,
+ // Should not be necessary anymore. Integrate remote in this?
+ domain_id: null,
+ context_id: args.length - 1,
+ args: args || []
+ });
+ },
+});
+
+
+return data;
+
});
diff --git a/addons/web/static/src/js/_deprecated/data_model.js b/addons/web/static/src/js/_deprecated/data_model.js
deleted file mode 100644
index 3bae06a3f4c..00000000000
--- a/addons/web/static/src/js/_deprecated/data_model.js
+++ /dev/null
@@ -1,81 +0,0 @@
-odoo.define('web.DataModel', function (require) {
-"use strict";
-
-var Context = require('web.Context');
-var data = require('web.data');
-var Model = require('web.Model');
-var pyeval = require('web.pyeval');
-var session = require('web.session');
-
-Model.include({
- /**
- * Fetches a Query instance bound to this model, for searching
- *
- * @param {Array<String>} [fields] fields to ultimately fetch during the search
- * @returns {instance.web.Query}
- */
- query: function (fields) {
- return new data.Query(this, fields);
- },
- /**
- * Fetches the model's domain, combined with the provided domain if any
- *
- * @param {Array} [domain] to combine with the model's internal domain
- * @returns {instance.web.CompoundDomain} The model's internal domain, or the AND-ed union of the model's internal domain and the provided domain
- */
- domain: function (domain) {
- if (!domain) { return this._domain; }
- return new data.CompoundDomain(this._domain, domain);
- },
- /**
- * Fetches the combination of the user's context and the domain context,
- * combined with the provided context if any
- *
- * @param {Object} [context] to combine with the model's internal context
- * @returns {web.Context} The union of the user's context and the model's internal context, as well as the provided context if any. In that order.
- */
- context: function (context) {
- return new Context(session.user_context, this._context, context || {});
- },
- /**
- * Call a method (over RPC) on the bound OpenERP model.
- *
- * @param {String} method name of the method to call
- * @param {Array} [args] positional arguments
- * @param {Object} [kwargs] keyword arguments
- * @param {Object} [options] additional options for the rpc() method
- * @returns {jQuery.Deferred<>} call result
- */
- call: function (method, args, kwargs, options) {
- args = args || [];
- kwargs = kwargs || {};
- if (!_.isArray(args)) {
- // call(method, kwargs)
- kwargs = args;
- args = [];
- }
- pyeval.ensure_evaluated(args, kwargs);
- var call_kw = '/web/dataset/call_kw/' + this.name + '/' + method;
- return session.rpc(call_kw, {
- model: this.name,
- method: method,
- args: args,
- kwargs: kwargs
- }, options);
- },
- call_button: function (method, args) {
- pyeval.ensure_evaluated(args, {});
- return session.rpc('/web/dataset/call_button', {
- model: this.name,
- method: method,
- // Should not be necessary anymore. Integrate remote in this?
- domain_id: null,
- context_id: args.length - 1,
- args: args || []
- });
- },
-
-});
-
-return Model;
-});
diff --git a/addons/web/static/src/js/_deprecated/model.js b/addons/web/static/src/js/_deprecated/model.js
deleted file mode 100644
index 377ff1a1757..00000000000
--- a/addons/web/static/src/js/_deprecated/model.js
+++ /dev/null
@@ -1,60 +0,0 @@
-odoo.define('web.Model', function (require) {
-"use strict";
-
-var Class = require('web.Class');
-var session = require('web.session');
-
-var Model = Class.extend({
- /**
- new openerp.web.Model(name[, context[, domain]])
-
- @constructs instance.web.Model
- @extends instance.web.Class
-
- @param {String} name name of the OpenERP model this object is bound to
- @param {Object} [context]
- @param {Array} [domain]
- */
- init: function(name, context, domain) {
- this.name = name;
- this._context = context || {};
- this._domain = domain || [];
- },
- /**
- * @deprecated does not allow to specify kwargs, directly use call() instead
- */
- get_func: function (method_name) {
- var self = this;
- return function () {
- return self.call(method_name, _.toArray(arguments));
- };
- },
- /**
- * Call a method (over RPC) on the bound OpenERP model.
- *
- * @param {String} method name of the method to call
- * @param {Array} [args] positional arguments
- * @param {Object} [kwargs] keyword arguments
- * @param {Object} [options] additional options for the rpc() method
- * @returns {jQuery.Deferred<>} call result
- */
- call: function (method, args, kwargs, options) {
- args = args || [];
- kwargs = kwargs || {};
- if (!_.isArray(args)) {
- // call(method, kwargs)
- kwargs = args;
- args = [];
- }
- var call_kw = '/web/dataset/call_kw/' + this.name + '/' + method;
- return session.rpc(call_kw, {
- model: this.name,
- method: method,
- args: args,
- kwargs: kwargs
- }, options);
- },
-});
-
-return Model;
-});