-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] dms_attachment_link: Migration to 17.0
TT50055
- Loading branch information
1 parent
5bb5f5c
commit 49bed24
Showing
3 changed files
with
32 additions
and
39 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
58 changes: 27 additions & 31 deletions
58
dms_attachment_link/static/src/js/dms_attachment_link.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 |
---|---|---|
@@ -1,37 +1,33 @@ | ||
/** @odoo-module **/ | ||
|
||
import {registerPatch} from "@mail/model/model_core"; | ||
import {Chatter} from "@mail/core/web/chatter"; | ||
import {patch} from "@web/core/utils/patch"; | ||
|
||
registerPatch({ | ||
name: "AttachmentBoxView", | ||
recordMethods: { | ||
_onAddDmsFile() { | ||
this.env.services.action.doAction( | ||
"dms_attachment_link.action_dms_file_wizard_selector_dms_attachment_link", | ||
{ | ||
additionalContext: { | ||
active_id: this.chatter.thread.id, | ||
active_ids: [this.chatter.thread.id], | ||
active_model: this.chatter.threadModel, | ||
}, | ||
onClose: this._onAddedDmsFile.bind(this), | ||
} | ||
); | ||
}, | ||
_onAddedDmsFile() { | ||
this.chatter.refresh(); | ||
}, | ||
patch(Chatter.prototype, { | ||
_onAddDmsFile() { | ||
this.action.doAction( | ||
"dms_attachment_link.action_dms_file_wizard_selector_dms_attachment_link", | ||
{ | ||
additionalContext: { | ||
active_id: this.state.thread.id, | ||
active_ids: [this.state.thread.id], | ||
active_model: this.state.thread.model, | ||
}, | ||
onClose: async () => { | ||
await this._onAddedDmsFile(); | ||
}, | ||
} | ||
); | ||
}, | ||
}); | ||
|
||
registerPatch({ | ||
name: "Chatter", | ||
recordMethods: { | ||
/** | ||
* Handles click on the attach button. | ||
*/ | ||
async onClickButtonAddAttachments() { | ||
await this.onClickButtonToggleAttachments(); | ||
}, | ||
onClickAddAttachments(ev) { | ||
ev.stopPropagation(); | ||
this.state.isAttachmentBoxOpened = !this.state.isAttachmentBoxOpened; | ||
if (this.state.isAttachmentBoxOpened) { | ||
this.rootRef.el.scrollTop = 0; | ||
this.state.thread.scrollTop = "bottom"; | ||
} | ||
}, | ||
async _onAddedDmsFile() { | ||
this.reloadParentView(); | ||
}, | ||
}); |
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