-
-
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 883243c
Showing
4 changed files
with
27 additions
and
40 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
52 changes: 21 additions & 31 deletions
52
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,27 @@ | ||
/** @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(event) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
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(); | ||
}, | ||
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