Skip to content

[14.0][MIG] document_url: Migration to 14.0 - #306

Merged
OCA-git-bot merged 17 commits into
OCA:14.0from
Tecnativa:14.0-mig-document_url
Nov 6, 2021
Merged

[14.0][MIG] document_url: Migration to 14.0#306
OCA-git-bot merged 17 commits into
OCA:14.0from
Tecnativa:14.0-mig-document_url

Conversation

@victoralmau

@victoralmau victoralmau commented Oct 13, 2021

Copy link
Copy Markdown
Member

Supersede from: #304

Migration to 14.0.

Extra changes:

  • Define the add attachment and add URL buttons on the same line.
  • Allow downloading of url type attachments by clicking on the icon or the name.
  • Define the name of the url type attachments as links (allows to open it in a new tab).
  • Hide the download button for url attachments.
  • Force to set mimetype to "application/link" for url attachments.
  • Displays a link icon for url attachments.

Please @Tardo and @pedrobaeza can you review it?

@Tecnativa TT30263

pedrobaeza and others added 16 commits September 1, 2021 13:48
[MIG] document_url

* bump version to 9.0.1.0.0 and make it installable
* Update JS structure
* Add css in order to be compliant with odoo style
* Add a README.rst and OCA conventions
* Improve selector
* add fr.po for fr translation
* open link with target='_blank'
OCA Transbot updated translations from Transifex
Without this patch, when you hover on the menu item, its background color does not change, and its cursor is a text one.

With this patch, the menu item styling matches those available in all surrounding menus.
Replace char © by word Copyright
Change format in usage description

[UPD] Update document_url.pot

[UPD] README.rst

Update translation files

Updated by Update PO files to match POT (msgmerge) hook in Weblate.
[UPD] README.rst

[UPD] Update document_url.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: knowledge-12.0/knowledge-12.0-document_url
Translate-URL: https://translation.odoo-community.org/projects/knowledge-12-0/knowledge-12-0-document_url/

[UPD] README.rst
Currently translated at 100.0% (14 of 14 strings)

Translation: knowledge-12.0/knowledge-12.0-document_url
Translate-URL: https://translation.odoo-community.org/projects/knowledge-12-0/knowledge-12-0-document_url/hr/
[UPD] Update document_url.pot

[UPD] README.rst

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: knowledge-13.0/knowledge-13.0-document_url
Translate-URL: https://translation.odoo-community.org/projects/knowledge-13-0/knowledge-13-0-document_url/
[MIG] document_url: Migration to 14.0
@pedrobaeza pedrobaeza added this to the 14.0 milestone Oct 13, 2021

@pedrobaeza pedrobaeza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Functional review:

  • The "Add URL" button link appears in a new line, taking more space, instead of appearing in the same line as previous versions.
  • Although it's not explicitly something of this module, the way URL attachments now behave seems odd: they appear as a regular attachment, but with a generic icon (non clickable), and the download button. Only clicking on such button leads to open the URL in the same tab, but it's not possible to do ctrl+click (or third-button click) to open in new tab. I think this module should add some changes to this behavior to have a special icon like in previous versions, and be totally clickable, opening the link in a new tab.

@pedrobaeza

Copy link
Copy Markdown
Member

This is better, thanks, but I'm still unable to open it in a new tab, and it's opened by default in the same tab. The download icon can be also hidden in this type of attachment. A last thing: about the icon, isn't a more suitable icon for the link?

@victoralmau
victoralmau force-pushed the 14.0-mig-document_url branch from 836cfb3 to 4bf2679 Compare October 14, 2021 08:54
@victoralmau

Copy link
Copy Markdown
Member Author

Some changes have been made.

There are other pending changes that would be quite difficult to make (it would require overwriting quite a bit of core code):

  • Change the icon of url type attachments (in v13 it was the same).
  • Change the icon and define it as a link (now an on-click is defined that does not allow it to be opened in a new tab).

@pedrobaeza

Copy link
Copy Markdown
Member

Then what are the changes you have made? Are you going to handle the rest? At least we need to do ctrl+click for opening in new tab.

@victoralmau

Copy link
Copy Markdown
Member Author

Then what are the changes you have made? Are you going to handle the rest? At least we need to do ctrl+click for opening in new tab.

Sorry, I have not mentioned the changes (if they are in the commit).
The changes that are already made are the following:

  • Hide the download button in url type attachments.
  • Define the name of the attachment as a link, this allows to open it in a new tab with Ctrl + Click.

@pedrobaeza

Copy link
Copy Markdown
Member

This is better, thanks, although the other features are very desired. Isn't possible to add to the link (<a> tag?) the attribute target="new" for having the new tab thing? Another thing is that the target should be the URL, not the controller path that is later resolved to the link.

@victoralmau

Copy link
Copy Markdown
Member Author

Some more clarifications regarding the previous comment::

I think one possibility would be to suggest some changes to Odoo to help with this, what do you think?

@victoralmau
victoralmau force-pushed the 14.0-mig-document_url branch from 4bf2679 to 480f502 Compare October 14, 2021 15:43
@pedrobaeza

Copy link
Copy Markdown
Member

Odoo is not going to change anything about this, as URLs are not allowed anywhere in the UI. Aren't you able to intercept the mimetype compute method for putting a special one, and provide the mimetype icon here in this module instead on the main one?

@victoralmau
victoralmau force-pushed the 14.0-mig-document_url branch from 480f502 to edfe496 Compare October 15, 2021 14:05
@victoralmau

Copy link
Copy Markdown
Member Author

I have added all the extra changes to the PR description to clarify all of them.

@pedrobaeza

Copy link
Copy Markdown
Member

Great, we are advancing a lot, but now you have hidden too much, as for PDFs, the download button nor the extension is shown (after refreshing one time the tab):

On this PR:
Selección_051

On runbot:

Selección_050

@victoralmau
victoralmau force-pushed the 14.0-mig-document_url branch from edfe496 to 68143d1 Compare October 15, 2021 15:44
@pedrobaeza

Copy link
Copy Markdown
Member

Now the download button has appeared again for links.

Define the add attachment and add URL buttons on the same line.
Allow downloading of url type attachments by clicking on the icon or the name.
Define the name of the url type attachments as links (allows to open it in a new tab).
Hide the download button for url attachments.
Force to set mimetype to "application/link" for url attachments.
Displays a link icon for url attachments.
TT30263
@victoralmau
victoralmau force-pushed the 14.0-mig-document_url branch from 68143d1 to 0669b94 Compare October 18, 2021 06:05
@victoralmau

Copy link
Copy Markdown
Member Author

Now the download button has appeared again for links.

Sorry for the absurd confusion, it's already changed.
adjuntos

@pedrobaeza pedrobaeza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now it's working as desired.

@pedrobaeza
pedrobaeza requested a review from Tardo October 18, 2021 11:55

@Tardo Tardo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍 Only code review.

The mimetype for attachments of type url seems not to be relevant. The field is calculated when you write/create and on the other hand the mimetype 'application/link' doesn't seem to be valid (https://www.iana.org/assignments/media-types/media-types.xhtml). So if you really want to force a mimetype... it might be more convenient to use application/octet-stream

@pedrobaeza

Copy link
Copy Markdown
Member

Let's move on for now:

/ocabot merge nobump

I think the mimetype helps for displaying such icon.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-306-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Oct 21, 2021
Signed-off-by pedrobaeza
@CasVissers-360ERP

Copy link
Copy Markdown

@pedrobaeza Merge seems stalled?

@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-306-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit 72656e5 into OCA:14.0 Nov 6, 2021
@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

@yajo
yajo deleted the 14.0-mig-document_url branch November 8, 2021 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.