Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bvanjeelharia
Copy link
Contributor

@bvanjeelharia bvanjeelharia commented Dec 15, 2023

This commit would allow the attachment previews to load by default wherever applicable like for Invoices.
Check the following screenshot for invoices before this change:
Before Change
Check the following screenshot for invoices after this change is merged:
After Change

@OCA-git-bot
Copy link
Contributor

Hi @SplashS, @Tardo, @yajo,
some modules you are maintaining are being modified, check this out!

@bvanjeelharia bvanjeelharia changed the title [FIX] web_responsive: Show Attachment Preview By Default In Form view [16.0][FIX] web_responsive: Show Attachment Preview By Default In Form view Dec 15, 2023
Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

hi @bvanjeelharia.

Thanks a lot for your contribution. That is a good improvment to allow to have the preview attachment by default, because it saves click to users.

However, there are some problem in your implementation.

  • blocking point : the place of the chatter changed. It is now allways on the bottom. (should not). Also, if user click on the invoice, there is a double display.

image

runboat / firefox 120.0.1 (64 bits)

  • Performance : This should be an option per user (opt out by default) : This feature is great, but make the UI slower, because there are extra read call to the server.

Kind regards.

@pedrobaeza
Copy link
Member

Exactly, I see this feature very annoying, and should be at least configurable, but I don't really see why having the preview always (although not needed), and having to scroll down for the chatter is an improvement...

@legalsylvain
Copy link
Contributor

legalsylvain commented Dec 15, 2023

Exactly, I see this feature very annoying, and should be at least configurable,

👍

why having the preview always (although not needed)

i see this feature very important for accountant people. In my company,

  • There a a lot of user that generate invoices. (no interesting for them)
  • There are also accountants that are doing supplier invoicing control. For them, this feature saves 2 click.

@pedrobaeza
Copy link
Member

The problem is that when you access an invoice, you don't want to see the attachment most of the times. Only for the initial encoding is needed, or some later checks. But the rest of the time, this preview is useless. And this only works when then first attachment is the correct one. I have for example one ISP vendor that attaches a PDF with the call list, and as second attachment, the invoice, so in this case, it's worst the solution than the illness.

Doing 2 clicks is not so bad then. One thing we can do is to unfold attachment by default (when there are any), so the preview is only 1 click away. I think Odoo does this on v17.

@legalsylvain
Copy link
Contributor

I think Odoo does this on v17.

Just tested on v17 :
-> the "just one click is NOT implemented"
-> but the V17 works EXACTLY like the current PR ;-)

When user click on an invoice and open a form view AND IF len(attachments)
---> the attachments[0] is displayed automatically in the right.
---> the chatter is in the bottom

image

@bvanjeelharia
Copy link
Contributor Author

I think Odoo does this on v17.

Just tested on v17 : -> the "just one click is NOT implemented" -> but the V17 works EXACTLY like the current PR ;-)

When user click on an invoice and open a form view AND IF len(attachments) ---> the attachments[0] is displayed automatically in the right. ---> the chatter is in the bottom

image

Yes, that's the same in v16 as well(also the double display). That is why I had made the change likewise

@bvanjeelharia
Copy link
Contributor Author

I think Odoo does this on v17.

Just tested on v17 : -> the "just one click is NOT implemented" -> but the V17 works EXACTLY like the current PR ;-)
When user click on an invoice and open a form view AND IF len(attachments) ---> the attachments[0] is displayed automatically in the right. ---> the chatter is in the bottom
image

Yes, that's the same in v16 as well(also the double display). That is why I had made the change likewise.
Also, if there are multiple attachments , it allows us to go through each of it by next/previous buttons

@pedrobaeza
Copy link
Member

Well, as said, this was intentionally put this way on web_responsive for not acting like that, as such behavior is worst than the current (and in previous version one). It was explained in #2405 (comment), and discussed, being implemented as it is, so this should be put as an option, and disabled by default for stability reasons.

@legalsylvain
Copy link
Contributor

It was explained in #2405 (comment), and discussed, being implemented as it is

Thanks ! I didn't know all that analysis.

so this should be put as an option, and disabled by default for stability reasons.

👍

@bvanjeelharia
Copy link
Contributor Author

So, the current PR is fine , but only should be put as an option , right? @pedrobaeza

@pedrobaeza pedrobaeza added this to the 16.0 milestone Dec 15, 2023
@pedrobaeza
Copy link
Member

Check the issue commented by Sylvain, but if you put it as an option disabled by default, then go ahead. I suppose you put the option selectable per user, but it should also attend the core option for display it per model.

@bvanjeelharia
Copy link
Contributor Author

but it should also attend the core option for display it per model.

Yes, this preview only comes up when the attachment_preview div is added like how chatter_div is added on the form view.

I suppose you put the option selectable per user

Yes, which would be disabled by default

@bvanjeelharia bvanjeelharia force-pushed the 16.0-fix-attachment_preview-web_responsive branch 5 times, most recently from d691d0e to 3d7c865 Compare December 18, 2023 06:50
@bvanjeelharia
Copy link
Contributor Author

@legalsylvain and @pedrobaeza , can you please review it once now?

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Tested and working. The preference field is not shown, and needed to add it manually to the UI. I'm seeing that web_chatter_position (I needed to uninstall it for avoiding interferences) has an option called "Sided", that seems to be thought for recovering this option. It's not working, but don't you think it's better to add this code in such module and have it all controlled the same way?

Added configurable option for attachment preview

Prettify Code

Prettify Code

Remove Redundant string for field

Fixed access rights for files

Added Radio Widget
@bvanjeelharia bvanjeelharia force-pushed the 16.0-fix-attachment_preview-web_responsive branch from 3d7c865 to bee0d12 Compare December 19, 2023 05:30
@bvanjeelharia
Copy link
Contributor Author

The preference field is not shown, and needed to add it manually to the UI

The Preference field would show up in My Profile section exactly how the chatter position options show up.

I'm seeing that web_chatter_position (I needed to uninstall it for avoiding interferences) has an option called "Sided", that seems to be thought for recovering this option. It's not working, but don't you think it's better to add this code in such module and have it all controlled the same way?

The web_chatter_position module may or may not be installed by everyone who use the web_responsive module so this change(code) has to be added in web_responsive module I believe.

And the sided option in web_chatter_position module doesn't work even if you uninstall the web_responsive module and check in invoices as this feature (Attachment Preview) is actually independent of the chatter position. So if needed, changes should also be added in the web_chatter_position module to allow/disallow Attachment Previews based on the chatter position or handle it any other way.

Copy link

@PaulGoubert PaulGoubert left a comment

Choose a reason for hiding this comment

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

lgtm

davidtranhp pushed a commit to Viindoo/branding that referenced this pull request Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants