Skip to content

Commit

Permalink
[MIG] web_action_conditionable: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
traitrantrobz committed Sep 11, 2024
1 parent bd8069b commit 57b0d77
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions web_action_conditionable/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Contributors
- `Trobz <https://trobz.com>`__:

- Nguyễn Minh Chiến <[email protected]>
- Tran Thanh Trai <[email protected]>

Other credits
-------------
Expand Down
2 changes: 1 addition & 1 deletion web_action_conditionable/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "web_action_conditionable",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"depends": ["base", "web"],
"data": [],
"author": "Cristian Salamea,Odoo Community Association (OCA)",
Expand Down
1 change: 1 addition & 0 deletions web_action_conditionable/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

- [Trobz](https://trobz.com):
- Nguyễn Minh Chiến \<<[email protected]>\>
- Tran Thanh Trai \<<[email protected]>\>
1 change: 1 addition & 0 deletions web_action_conditionable/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Jasper Jumelet &lt;<a class="reference external" href="mailto:jasper.jumelet&#64;codeforward.nl">jasper.jumelet&#64;codeforward.nl</a>&gt;</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
<li>Nguyễn Minh Chiến &lt;<a class="reference external" href="mailto:chien&#64;trobz.com">chien&#64;trobz.com</a>&gt;</li>
<li>Tran Thanh Trai &lt;<a class="reference external" href="mailto:traitt&#64;trobz.com">traitt&#64;trobz.com</a>&gt;</li>
</ul>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
/** @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", {
patch(X2ManyField.prototype, {
get rendererProps() {
this.updateActiveActions();
return this._super(...arguments);
return super.rendererProps;
},
updateActiveActions() {
if (this.viewMode === "list" && this.activeActions.type === "one2many") {
if (
this.props.viewMode === "list" &&
this.activeActions.type === "one2many" &&
!this.props.readonly
) {
const self = this;
const parser = new XMLParser();
const archInfo = this.activeField.views[this.viewMode];
const xmlDoc = parser.parseXML(archInfo.__rawArch);
const archInfo = this.activeField.views[this.props.viewMode];
const xmlDoc = archInfo.xmlDoc;
["create", "delete"].forEach(function (item) {
if (self.activeActions[item] && _.has(xmlDoc.attributes, item)) {
if (item in self.activeActions && xmlDoc.hasAttribute(item)) {
const expr = xmlDoc.getAttribute(item);
try {
self.activeActions[item] = evaluateExpr(
Expand Down

0 comments on commit 57b0d77

Please sign in to comment.