[FIX] web: Display archive action if active in view
Since ee5e972, "Achive" and "Unarchive" actions are
automatically displayed in the actions dropdown
if the record has an `active` field.
The "Archive" action is shown if `active=True`, and
"Unarchive" otherwise.
However, if the record has the `active` field but
it's not in the view, the form controller think
`active=False` because `undefined` is falsy.
Therefore, the "Unarchive" action is always shown.
If `active` is not in the view, neither "Archive" nor
"Unarchive" should be shown.
closes odoo/odoo#36551
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
committed by
Yannick Tivisse
parent
55a4910b2e
commit
50d2f188f8
@@ -186,7 +186,7 @@ var FormController = BasicController.extend({
|
||||
var self = this;
|
||||
if (this.hasSidebar) {
|
||||
var otherItems = [];
|
||||
if (this.archiveEnabled) {
|
||||
if (this.archiveEnabled && this.initialState.data.active !== undefined) {
|
||||
var classname = "o_sidebar_item_archive" + (this.initialState.data.active ? "" : " o_hidden")
|
||||
otherItems.push({
|
||||
label: _t("Archive"),
|
||||
|
||||
Reference in New Issue
Block a user