-
-
Notifications
You must be signed in to change notification settings - Fork 176
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 16.0
Co-authored-by: DemchukM
- Loading branch information
1 parent
491460d
commit 395f435
Showing
6 changed files
with
42 additions
and
42 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
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
56 changes: 29 additions & 27 deletions
56
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,35 +1,37 @@ | ||
/** @odoo-module **/ | ||
|
||
import {AttachmentBox} from "@mail/components/attachment_box/attachment_box"; | ||
import {patch} from "web.utils"; | ||
import {registerPatch} from "@mail/model/model_core"; | ||
|
||
patch( | ||
AttachmentBox.prototype, | ||
"dms_attachment_link/static/src/js/dms_attachment_link.js", | ||
{ | ||
registerPatch({ | ||
name: "AttachmentBoxView", | ||
recordMethods: { | ||
_onAddDmsFile() { | ||
this.env.bus.trigger("do-action", { | ||
action: "dms_attachment_link.action_dms_file_wizard_selector_dms_attachment_link", | ||
options: { | ||
additional_context: { | ||
active_id: this.messaging.models["mail.chatter"].get( | ||
this.props.chatterLocalId | ||
).threadId, | ||
active_ids: [ | ||
this.messaging.models["mail.chatter"].get( | ||
this.props.chatterLocalId | ||
).threadId, | ||
], | ||
active_model: this.messaging.models["mail.chatter"].get( | ||
this.props.chatterLocalId | ||
).threadModel, | ||
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, | ||
}, | ||
on_close: this._onAddedDmsFile.bind(this), | ||
}, | ||
}); | ||
onClose: this._onAddedDmsFile.bind(this), | ||
} | ||
); | ||
}, | ||
_onAddedDmsFile() { | ||
this.trigger("reload"); | ||
this.chatter.refresh(); | ||
}, | ||
} | ||
); | ||
}, | ||
}); | ||
|
||
registerPatch({ | ||
name: "Chatter", | ||
recordMethods: { | ||
/** | ||
* Handles click on the attach button. | ||
*/ | ||
async onClickButtonAddAttachments() { | ||
await this.onClickButtonToggleAttachments(); | ||
}, | ||
}, | ||
}); |
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