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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions content/developer/reference/frontend/javascript_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,8 @@ Many2many (`many2many`)
Many2many Binary File (`many2many_binary`)
This widget helps the user to upload or delete one or more files at the same time.

An image preview is available for files with the MIME type "image".

Note that this widget is specific to the model `ir.attachment`.

- Supported field types: `many2many`
Expand All @@ -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! 🙂


Many2many Tags (`many2many_tags`)
Display a `many2many` field as a list of tags.

Expand Down