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

[IMP] documentation: update many2many_binary widget #11415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amdi-odoo
Copy link

The widget now also display an image preview for the files of MIME type "image".
A new option 'reverse_order' has been added to visually reverse the files order.

The widget now also display an image preview for the files of MIME type "image".
A new option 'reverse_order' has been added to visually reverse the files order.
@robodoo
Copy link
Collaborator

robodoo commented Nov 19, 2024

Pull request status dashboard

@@ -1212,6 +1214,8 @@ Many2many Binary File (`many2many_binary`)

(cf: ``accept`` attribute on `<input type="file" />`)

- `reverse_order`: set to `true` to add new files at the top of the list (default: `false`, new files are added at the bottom).
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not what you implemented, and this is not what the specs say.

In your implementation, files are received in a given order, and you display them the order way around. It's thus indeed also the same for added files: as the list is reversed, files added in the end of the list are displayed first.

The specs say that we want the same order as in the post. By reversing the files, new files are indeed added to the top, but when you open an existing record, files are ordered from less recent to more recent, which isn't the order you want. I don't know the business logic, so I don't know how to enforce that, but I don't think such an option is the way to go (and your comment on the specs makes me think that you doubt as well). I just confirmed with framework py that for now, there's no way to enforce an order on a many2many relation (it's the order of the comodel that's used, which in this case is id desc).

I showed your usecase to cth, he'll take a look to determine whether there's something we could/should do in the many2many_binary field (all the time, not through an option).

Copy link
Author

Choose a reason for hiding this comment

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

@aab-odoo
Ok got it 😄
I'll try to find another way to fix the functional issue without messing with the widget or I'll simply wait for a potential widget improvement.
Thanks for looking into it! 🙂

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.

3 participants