Skip to content

Commit

Permalink
Remove unnecessary init
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Nechyporenko committed Jul 20, 2023
1 parent 848f270 commit 8df6bf8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions crnd_web_field_domain/static/src/js/basic_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ odoo.define('crnd_web_field_domain.field_domain', function (require) {

BasicModel.include({

init: function () {
this.assembleDomains = pyUtils.assembleDomains;
this._super.apply(this, arguments);
},

_getDomain: function (element, options) {
if (!options || !options.fieldName) {
return this._super.apply(this, arguments);
Expand All @@ -26,20 +21,20 @@ odoo.define('crnd_web_field_domain.field_domain', function (require) {
if (options && options.fieldName && domain_field) {
if (element._domains[options.fieldName]) {
var origin_domain = element._domains[options.fieldName].length !== 0 ? element._domains[options.fieldName] : "[]";
var assembled_domain = this.assembleDomains([origin_domain, domain_field_value], "AND");
var assembled_domain = pyUtils.assembleDomains([origin_domain, domain_field_value], "AND");
return Domain.prototype.stringToArray(assembled_domain, this._getEvalContext(element, true));
}
var viewType = options.viewType || element.viewType;
var fieldInfo = element.fieldsInfo[viewType][options.fieldName];
if (fieldInfo && fieldInfo.domain) {
var origin_domain = fieldInfo.domain.length !== 0 ? fieldInfo.domain : "[]";
var assembled_domain = this.assembleDomains([origin_domain, domain_field_value], "AND");
var assembled_domain = pyUtils.assembleDomains([origin_domain, domain_field_value], "AND");
return Domain.prototype.stringToArray(assembled_domain, this._getEvalContext(element, true));
}
var fieldParams = element.fields[options.fieldName];
if (fieldParams.domain) {
var origin_domain = fieldParams.domain.length !== 0 ? fieldParams.domain : "[]";
var assembled_domain = this.assembleDomains([origin_domain, domain_field_value], "AND");
var assembled_domain = pyUtils.assembleDomains([origin_domain, domain_field_value], "AND");
return Domain.prototype.stringToArray(assembled_domain, this._getEvalContext(element, true));
}
return this._super.apply(this, arguments);
Expand Down

0 comments on commit 8df6bf8

Please sign in to comment.