mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-20 05:31:59 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
/** @odoo-module **/
|
||||
import {X2ManyField} from "@web/views/fields/x2many/x2many_field";
|
||||
import {XMLParser} from "@web/core/utils/xml";
|
||||
import {evaluateExpr} from "@web/core/py_js/py";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
|
||||
patch(X2ManyField.prototype, "web_action_conditionable_FieldOne2Many", {
|
||||
get rendererProps() {
|
||||
this.updateActiveActions();
|
||||
return this._super(...arguments);
|
||||
},
|
||||
updateActiveActions() {
|
||||
if (this.viewMode === "list" && this.activeActions.type === "one2many") {
|
||||
const self = this;
|
||||
const parser = new XMLParser();
|
||||
const archInfo = this.activeField.views[this.viewMode];
|
||||
const xmlDoc = parser.parseXML(archInfo.__rawArch);
|
||||
["create", "delete"].forEach(function (item) {
|
||||
if (self.activeActions[item] && _.has(xmlDoc.attributes, item)) {
|
||||
const expr = xmlDoc.getAttribute(item);
|
||||
try {
|
||||
self.activeActions[item] = evaluateExpr(
|
||||
expr,
|
||||
self.props.record.data
|
||||
);
|
||||
} catch (ignored) {
|
||||
console.log(
|
||||
"[web_action_conditionable] unrecognized expr '" +
|
||||
expr +
|
||||
"', ignoring"
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue