Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX]dms: The method for uploading a file did not work when the folder was empty. #396

Merged
merged 1 commit into from
Apr 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions dms/static/src/js/views/dms_file_upload.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,18 @@ export const FileUpload = {
async onUpload(attachments) {
const self = this;
const attachmentIds = attachments.map((a) => a.id);
const ctx = this.props.context;
const ctx = Object.assign(
{},
this.actionService.currentController.props.context,
this.props.context
);
const controllerID = this.actionService.currentController.jsId;

if (!attachmentIds.length) {
this.notification.add(_t("An error occurred during the upload"));
return;
}

// Search the correct directory_id value according to the domain
ctx.default_directory_id = false;
if (this.props.domain) {
for (const domain_item of this.props.domain) {
if (domain_item.length === 3) {
Expand All @@ -122,7 +124,7 @@ export const FileUpload = {
}
}

if (ctx.default_directory_id === false) {
if (!ctx.default_directory_id) {
self.actionService.restore(controllerID);
return self.notification.add(
this.env._t("You must select a directory first"),
Expand Down