forked from OCA/web
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] web_tree_many2one_clickable: Migration to 16.0
[MIG] web_tree_many2one_clickable: Migration to 16.0 [MIG] web_tree_many2one_clickable: Migration to 16.0 [MIG] web_tree_many2one_clickable: Migration to 16.0
- Loading branch information
Showing
7 changed files
with
74 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
* Artem Kostyuk <[email protected]> | ||
* Anand Kansagra <[email protected]> | ||
* Alexandre Díaz <[email protected]> | ||
* Dennis Sluijk <[email protected]> |
33 changes: 33 additions & 0 deletions
33
web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** @odoo-module */ | ||
/* Copyright 2013 Therp BV (<http://therp.nl>). | ||
* Copyright 2015 Pedro M. Baeza <[email protected]> | ||
* Copyright 2016 Antonio Espinosa <[email protected]> | ||
* Copyright 2017 Sodexis <[email protected]> | ||
* Copyright 2018 Camptocamp SA | ||
* Copyright 2019 Alexandre Díaz <[email protected]> | ||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ | ||
|
||
import {ListRenderer} from "@web/views/list/list_renderer"; | ||
import {Component} from "@odoo/owl"; | ||
import {useService} from "@web/core/utils/hooks"; | ||
|
||
export class TreeMany2oneClickableButton extends Component { | ||
setup() { | ||
this.actionService = useService("action"); | ||
} | ||
|
||
async onClick(ev) { | ||
ev.stopPropagation(); | ||
return this.actionService.doAction({ | ||
type: "ir.actions.act_window", | ||
res_model: this.props.field.relation, | ||
res_id: this.props.value[0], | ||
views: [[false, "form"]], | ||
target: "target", | ||
additionalContext: this.props.context || {}, | ||
}); | ||
} | ||
} | ||
TreeMany2oneClickableButton.template = "web_tree_many2one_clickable.Button"; | ||
|
||
Object.assign(ListRenderer.components, {TreeMany2oneClickableButton}); |
10 changes: 10 additions & 0 deletions
10
web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
td.o_list_many2one { | ||
button.web_tree_many2one_clickable { | ||
margin-left: 0.5em; | ||
visibility: hidden; | ||
} | ||
|
||
&:hover button.web_tree_many2one_clickable { | ||
visibility: visible; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
web_tree_many2one_clickable/static/src/components/many2one_button/many2one_button.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates> | ||
<t t-name="web_tree_many2one_clickable.Button" owl="1"> | ||
<button | ||
class="btn btn-sm btn-secondary fa fa-arrow-right web_tree_many2one_clickable" | ||
t-on-click="onClick" | ||
> | ||
</button> | ||
</t> | ||
|
||
<t t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension"> | ||
<xpath expr="//Field" position="after"> | ||
<TreeMany2oneClickableButton | ||
record="record" | ||
field="record.fields[column.name]" | ||
value="record.data[column.name]" | ||
t-if="record.fields[column.name].type == 'many2one' and record.data[column.name] and canUseFormatter(column, record) and !props.archInfo.fieldNodes[column.name].options.no_open" | ||
/> | ||
</xpath> | ||
</t> | ||
</templates> |
10 changes: 0 additions & 10 deletions
10
web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss
This file was deleted.
Oops, something went wrong.
68 changes: 0 additions & 68 deletions
68
web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js
This file was deleted.
Oops, something went wrong.