Repository navigation
[20.0][MIG] document_url: Migration to version 20.0 - #668
adasatorres-tecnativa wants to merge 47 commits into
Conversation
|
The following commit authors need to sign the Contributor License Agreement: |
acc8ec0 to
9776eca
Compare
|
Could you please check Runboat @adasatorres-tecnativa ? It's returning the following error: {"detail":"Not Found"}. Thanks! |
[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'
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
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/
[MIG] document_url: Migration to 14.0
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
Currently translated at 100.0% (14 of 14 strings) Translation: knowledge-16.0/knowledge-16.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-document_url/it/
Currently translated at 100.0% (14 of 14 strings) Translation: knowledge-16.0/knowledge-16.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-document_url/it/
Other modules like web_pwa_oca uses url field for storing an indexed path for later being searched in the controller, so let's restrict the mimetype change if both url and type=url is set.
Currently translated at 100.0% (14 of 14 strings) Translation: knowledge-16.0/knowledge-16.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-document_url/it/
Currently translated at 92.8% (13 of 14 strings) Translation: knowledge-16.0/knowledge-16.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-document_url/sl/
Currently translated at 100.0% (14 of 14 strings) Translation: knowledge-16.0/knowledge-16.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-document_url/it/
Currently translated at 100.0% (17 of 17 strings) Translation: knowledge-16.0/knowledge-16.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-document_url/pt/
Currently translated at 100.0% (17 of 17 strings) Translation: knowledge-17.0/knowledge-17.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-document_url/sv/
Currently translated at 100.0% (17 of 17 strings) Translation: knowledge-17.0/knowledge-17.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-document_url/ca/
Fix download atachment widget. Document_url when activated causes error when opening attachment link on the chatter window This commit (odoo/odoo@366676c) move download buttons into a sub-component. I modified the module behavior to use canDownload() method instead of adding a t-if in the view and prevent the chatter component from breaking when the message has attachments.
- In a first step, instead of replacing a node content with its verbatim copy, we uses the xpath "replace" command with "$0" magic keyword to move all the <t> content into a <div>. - In a second step, the "Add URL" button is added after the existing "Attach files"button.
Currently translated at 76.4% (13 of 17 strings) Translation: knowledge-19.0/knowledge-19.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-19-0/knowledge-19-0-document_url/sl/
Currently translated at 100.0% (17 of 17 strings) Translation: knowledge-19.0/knowledge-19.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-19-0/knowledge-19-0-document_url/sl/
Currently translated at 58.8% (10 of 17 strings) Translation: knowledge-19.0/knowledge-19.0-document_url Translate-URL: https://translation.odoo-community.org/projects/knowledge-19-0/knowledge-19-0-document_url/pl/
9776eca to
0845953
Compare
|
@fcvalgar Check now. |
|
Thanks for fixing the Runboat issue! I can now access the test environment, but I get the following error when trying to add an attachment from the chatter:
The error occurs in the This issue prevents me from completing the functional tests. Could you please check it? I will test the module again once it is fixed. Thanks for your work! |
0845953 to
76278e1
Compare
|
@fcvalgar ready . |
fcvalgar
left a comment
There was a problem hiding this comment.
Thanks for your work on this migration @adasatorres-tecnativa and for fixing the previously reported error!
I have performed the following functional tests in Odoo 20:
Test 1: OK with remarks – Adding a URL attachment works, but a standard file must be attached first.
Test 2: OK – Opening the attached URL in a new browser tab.
Test 3: OK – Adding standard file attachments alongside URL attachments.
Test 4: OK – Removing a URL attachment without affecting other attachments.
In the latest Odoo versions, clicking the paperclip icon when there are no attachments opens the file browser directly. The Add URL option is only available after attaching at least one file.
I suggest updating the README to explain this prerequisite or, alternatively, adapting the module to allow users to add a URL without attaching a file first.
Functional approval with this remark. Thanks!
76278e1 to
e75c386
Compare
fcvalgar
left a comment
There was a problem hiding this comment.
Great work on this migration @adasatorres-tecnativa and thanks for improving the behavior of the attachment button.
I have performed the following tests in Odoo 20:
Test 1: OK - The attachment button now opens the attachments area and shows the Add URL option without requiring a first standard attachment.
Test 2: OK - A URL attachment can be created from the chatter and is correctly linked to the record.
Test 3: OK - The attached URL opens correctly in a new browser tab.
Test 4: OK - URL attachments and standard file attachments work together correctly.
Test 5: OK - A URL attachment can be removed without affecting other attachments.
Functional approval.
|
/ocabot migration document_url |
| onClickUnlink(attachment) { | ||
| if (this.env.inComposer) { | ||
| return this.props.unlinkAttachment(attachment); | ||
| } | ||
| this.dialog.add(ConfirmationDialog, { | ||
| body: _t('Do you really want to delete "%s"?', attachment.name), | ||
| // eslint-disable-next-line no-empty-function | ||
| cancel: () => {}, | ||
| confirm: () => this.onConfirmUnlink([attachment]), | ||
| }); | ||
| }, |
There was a problem hiding this comment.
unlinkAttachment prop doesn't exist anymore in 20.0, this breaks removing any attachment in the composer. Core already asks for confirmation, so the override can go:
| onClickUnlink(attachment) { | |
| if (this.env.inComposer) { | |
| return this.props.unlinkAttachment(attachment); | |
| } | |
| this.dialog.add(ConfirmationDialog, { | |
| body: _t('Do you really want to delete "%s"?', attachment.name), | |
| // eslint-disable-next-line no-empty-function | |
| cancel: () => {}, | |
| confirm: () => this.onConfirmUnlink([attachment]), | |
| }); | |
| }, |
| onClickAddAttachments(ev) { | ||
| ev.stopPropagation(); | ||
| const isOpening = this.state.activePanel !== this.CHATTER_PANEL.ATTACHMENT; | ||
| this.state.activePanel = isOpening | ||
| ? this.CHATTER_PANEL.ATTACHMENT | ||
| : this.CHATTER_PANEL.NONE; | ||
| if (isOpening) { | ||
| this.rootRef().scrollTop = 0; | ||
| this.state.thread.scrollTop = "bottom"; | ||
| } | ||
| }, |
There was a problem hiding this comment.
Only the empty case needs changes, keep core behavior otherwise:
| onClickAddAttachments(ev) { | |
| ev.stopPropagation(); | |
| const isOpening = this.state.activePanel !== this.CHATTER_PANEL.ATTACHMENT; | |
| this.state.activePanel = isOpening | |
| ? this.CHATTER_PANEL.ATTACHMENT | |
| : this.CHATTER_PANEL.NONE; | |
| if (isOpening) { | |
| this.rootRef().scrollTop = 0; | |
| this.state.thread.scrollTop = "bottom"; | |
| } | |
| }, | |
| onClickAddAttachments(ev) { | |
| if (this.attachments.length) { | |
| return super.onClickAddAttachments(...arguments); | |
| } | |
| ev.stopPropagation(); | |
| this.closeSearch(); | |
| this.state.activePanel = | |
| this.state.activePanel === this.CHATTER_PANEL.ATTACHMENT | |
| ? this.CHATTER_PANEL.NONE | |
| : this.CHATTER_PANEL.ATTACHMENT; | |
| }, |
| expr="//div[hasclass('o-mail-AttachmentContainer')]" | ||
| position="attributes" | ||
| > | ||
| <attribute name="t-att-class">{ |
There was a problem hiding this comment.
This drops o-inChatter and the !this.props.isSelecting check from core. Better put o_attachment_url_container on the chip and don't override the container class.
| > | ||
| <i class="oi oi-filled me-1" data-icon="link" /> | ||
| </a> | ||
| <span class="text-truncate ms-1" t-esc="attachment.name" /> |
There was a problem hiding this comment.
| <span class="text-truncate ms-1" t-esc="attachment.name" /> | |
| <span class="text-truncate ms-1" t-out="attachment.name" /> |
Also .o_attachment_url_delete in the SCSS is no longer used.
| <xpath expr="//div[hasclass('o-mail-Attachment-hover')]" position="attributes"> | ||
| <attribute | ||
| name="t-if" | ||
| >!isMobileOS and attachment.mimetype !== 'application/link'</attribute> |
There was a problem hiding this comment.
| >!isMobileOS and attachment.mimetype !== 'application/link'</attribute> | |
| >!this.isMobileOS and attachment.mimetype !== 'application/link'</attribute> |
| <xpath expr="//Actions" position="replace"> | ||
| <Actions | ||
| t-elif="this.isMobileOS and attachment.mimetype !== 'application/link'" | ||
| actions="getActions(attachment)" | ||
| /> | ||
| </xpath> |
There was a problem hiding this comment.
Lost !this.props.isSelecting and group.duplicates; also getActions needs this. now (same as env.inMessage). Patch only the condition:
| <xpath expr="//Actions" position="replace"> | |
| <Actions | |
| t-elif="this.isMobileOS and attachment.mimetype !== 'application/link'" | |
| actions="getActions(attachment)" | |
| /> | |
| </xpath> | |
| <xpath expr="//Actions" position="attributes"> | |
| <attribute | |
| name="t-elif" | |
| >!this.props.isSelecting and attachment.mimetype !== 'application/link'</attribute> | |
| </xpath> |
@Tecnativa TT65747