Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/12.0' into 13.0-oh-forward-port-…
Browse files Browse the repository at this point in the history
…from-12.0-x-xe4c
  • Loading branch information
Oleksandr Nechyporenko committed Nov 9, 2023
2 parents 8be04a2 + 3f65f9b commit 0840850
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crnd_web_field_domain/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'support': '[email protected]',
'website': 'https://crnd.pro',
'license': 'LGPL-3',
'version': '13.0.0.4.0',
'version': '13.0.0.5.0',
'depends': [
'web',
],
Expand Down
14 changes: 10 additions & 4 deletions crnd_web_field_domain/static/src/js/basic_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,28 @@ odoo.define('crnd_web_field_domain.field_domain', function (require) {
var domain_field = element_options ? element_options.domain_field : undefined;
var domain_field_value = domain_field && element._changes && element._changes[domain_field] ? element._changes[domain_field] : element.data[domain_field] || "[]";

if (options && options.fieldName && domain_field) {
if (options.fieldName && domain_field) {
if (element._domains[options.fieldName]) {
var origin_domain = element._domains[options.fieldName].length !== 0 ? element._domains[options.fieldName] : "[]";
var field_domain = element._domains[options.fieldName];
var is_field_domain_string = typeof field_domain === "string";
var origin_domain = field_domain.length !== 0 && is_field_domain_string ? field_domain : "[]";
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 field_domain = fieldInfo.domain;
var is_field_domain_string = typeof field_domain === "string";
var origin_domain = field_domain.length !== 0 && is_field_domain_string ? field_domain : "[]";
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 field_domain = fieldParams.domain;
var is_field_domain_string = typeof field_domain === "string";
var origin_domain = field_domain.length !== 0 && is_field_domain_string ? field_domain : "[]";
var assembled_domain = pyUtils.assembleDomains([origin_domain, domain_field_value], "AND");
return Domain.prototype.stringToArray(assembled_domain, this._getEvalContext(element, true));
}
Expand Down

0 comments on commit 0840850

Please sign in to comment.