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

[15.0][MIG] mail_drop_target #881

Merged
merged 24 commits into from
Jan 24, 2024
Merged

Conversation

JasminSForgeFlow
Copy link
Contributor

@JasminSForgeFlow JasminSForgeFlow commented Apr 4, 2022

Standard Migration

Adapt Odoo's out-of-box dropzone functionality, and remove the dependency of web_drop_target.

@ForgeFlow

@oca-clabot
Copy link

Hey @JasminSForgeFlow, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: https://odoo-community.org/page/cla
Here is a list of the users:

Appreciation of efforts,
OCA CLAbot

@JasminSForgeFlow JasminSForgeFlow force-pushed the 15.0-mig-mail_drop_target branch 2 times, most recently from 03edf08 to 7462b29 Compare April 4, 2022 09:17
@rafaelbn
Copy link
Member

rafaelbn commented Apr 7, 2022

/ocabot migration mail_drop_target

@OCA-git-bot OCA-git-bot added this to the 15.0 milestone Apr 7, 2022
@OCA-git-bot OCA-git-bot mentioned this pull request Apr 7, 2022
36 tasks
@etobella
Copy link
Member

etobella commented May 3, 2022

Why do you want to remove the dependency on web_drop_target? Code was easier if it was dependent IMO

@etobella
Copy link
Member

etobella commented May 3, 2022

I understand you change, so, don't need to keep the dependancy.
However, it is failing un runbot
image

@etobella
Copy link
Member

etobella commented May 3, 2022

With eml it works fine, but it fails when using msg (taken it from the test files)

@ygol
Copy link
Contributor

ygol commented May 19, 2022

I think there's a dependency missing (ReferenceError: base64js is not defined):
the library "base64js" that was previously loaded from "web_drop_target".
After adding it to further test:

I tried loading several different msg messages and could get some of them working (plain text email). but most often I get the following error:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/home/odoo/src/odoo/odoo/http.py", line 687, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/http.py", line 348, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 916, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 535, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1347, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1339, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 460, in call_kw
    result = _call_kw_model(method, model, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 433, in _call_kw_model
    result = method(recs, *args, **kwargs)
  File "/home/odoo/src/user/mail_drop_target/models/mail_thread.py", line 90, in message_process_msg
    message_email = self.env["ir.mail_server"].build_email(
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_mail_server.py", line 422, in build_email
    for (fname, fcontent, mime) in attachments:
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: not enough values to unpack (expected 3, got 2)

Also got from a different messages:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/home/odoo/src/odoo/odoo/http.py", line 687, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/http.py", line 348, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 916, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 535, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1347, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1339, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 460, in call_kw
    result = _call_kw_model(method, model, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 433, in _call_kw_model
    result = method(recs, *args, **kwargs)
  File "/home/odoo/src/user/mail_drop_target/models/mail_thread.py", line 90, in message_process_msg
    message_email = self.env["ir.mail_server"].build_email(
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_mail_server.py", line 395, in build_email
    msg['Message-Id'] = message_id
  File "/usr/lib/python3.8/email/message.py", line 409, in __setitem__
    self._headers.append(self.policy.header_store_parse(name, val))
  File "/usr/lib/python3.8/email/policy.py", line 146, in header_store_parse
    raise ValueError("Header values may not contain linefeed "
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: Header values may not contain linefeed or carriage return characters

and also

Traceback (most recent call last):
  File "/home/odoo/.local/lib/python3.8/site-packages/extract_msg/msg.py", line 55, in __init__
    super().__init__(path)
  File "/usr/lib/python3/dist-packages/olefile/olefile.py", line 1075, in __init__
    self.open(filename, write_mode=write_mode)
  File "/usr/lib/python3/dist-packages/olefile/olefile.py", line 1192, in open
    self._raise_defect(DEFECT_FATAL, "not an OLE2 structured storage file")
  File "/usr/lib/python3/dist-packages/olefile/olefile.py", line 1105, in _raise_defect
    raise exception_type(message)
OSError: not an OLE2 structured storage file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/home/odoo/src/odoo/odoo/http.py", line 687, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/http.py", line 348, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 916, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 535, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1347, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1339, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 460, in call_kw
    result = _call_kw_model(method, model, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 433, in _call_kw_model
    result = method(recs, *args, **kwargs)
  File "/home/odoo/src/user/mail_drop_target/models/mail_thread.py", line 84, in message_process_msg
    message_msg = Message(b64decode(message))
  File "/home/odoo/.local/lib/python3.8/site-packages/extract_msg/message.py", line 26, in __init__
    super().__init__(path, prefix, attachmentClass, filename, delayAttachments, overrideEncoding, attachmentErrorBehavior, recipientSeparator)
  File "/home/odoo/.local/lib/python3.8/site-packages/extract_msg/message_base.py", line 54, in __init__
    super().__init__(path, prefix, attachmentClass, filename, overrideEncoding, attachmentErrorBehavior)
  File "/home/odoo/.local/lib/python3.8/site-packages/extract_msg/msg.py", line 59, in __init__
    raise InvalidFileFormatError(e)
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
extract_msg.exceptions.InvalidFileFormatError: not an OLE2 structured storage file

@LoisRForgeFlow
Copy link
Contributor

Rebased and fixed conflict.

@github-actions
Copy link

github-actions bot commented Feb 5, 2023

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 5, 2023
@github-actions github-actions bot closed this Mar 12, 2023
@etobella etobella reopened this Aug 1, 2023
@nguyenminhchien
Copy link

Hello @JasminSForgeFlow @LoisRForgeFlow , i just created this PR to import base64js library. Please review.
Thanks,

@nguyenminhchien
Copy link

@ygol i don't face those errors you had, please share your test files.

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 3, 2023
@LoisRForgeFlow
Copy link
Contributor

LoisRForgeFlow commented Sep 21, 2023

Hello @JasminSForgeFlow @LoisRForgeFlow , i just created this PR to import base64js library. Please review. Thanks,

@nguyenminhchien thanks! your commit has been included here.

However, now a test from a different module is failing. I have tried to reproduce the error in my local with both mail_drop_target and mail_composer_cc_bcc installed, but all ran good in my case. Can you try to reproduce in your side?

@nguyenminhchien
Copy link

However, now a test from a different module is failing. I have tried to reproduce the error in my local with both mail_drop_target and mail_composer_cc_bcc installed, but all ran good in my case. Can you try to reproduce in your side?

@LoisRForgeFlow Pull the latest Odoo codebase, the test will be failed. Here is from my local
image

Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jan 21, 2024
Copy link
Member

@JordiBForgeFlow JordiBForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Works as expected

@JordiBForgeFlow
Copy link
Member

@JoanSForgeFlow @LoisRForgeFlow Can you review?

Copy link

@ElmerGForgeFlow ElmerGForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The file detection mechanism has been improved, now adeptly managing PDFs and other file formats through the inclusion of the condition else if (drop_file.name.endsWith(".eml")).
  • Introducing a reference (this._fileUploaderRef) for the file uploader enhances the structure of the code and facilitates more straightforward access to the uploader component.

It works.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@JordiBForgeFlow
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Sorry @JordiBForgeFlow you are not allowed to merge.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

Copy link
Contributor

@LoisRForgeFlow LoisRForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional test 👍

@etobella
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 15.0-ocabot-merge-pr-881-by-etobella-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 5e3a263 into OCA:15.0 Jan 24, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 233f1b8. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved merged 🎉 needs review ready to merge stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.