-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[13.0][MIG] web_tree_many2one_clickable #1438
[13.0][MIG] web_tree_many2one_clickable #1438
Conversation
Clickable many2one fields for tree views ======================================== This addon provides a separate widget to allow many2one fields in a tree view open the linked resource when clicking on their name. You can also define a system parameter to have this behaviour for all the existing many2one fields in tree views. Installation ============ Install it the regular way. Configuration ============= If you want to have all many2one fields clickable by default, you have to define in *Configuration > Technical > Parameters > System parameters*, a new parameter with name `web_tree_many2one_clickable.default` and with value `true`. Usage ===== For the widget option, you need to add `widget="many2one_clickable"` attribute in the XML field definition in the tree view. For example: `<field name="partner_id" widget="many2one_clickable" />` will open the linked partner in a form view. Known issues / Roadmap ====================== * You cannot deactivate clickable behaviour for an specific many2one field if you configure the system parameter. * The value of the system parameter is retrieved for each many2one field present in the view instead of only once.
If a list contains a node which is not a field (e.g. a button), it will not be found in the fields so we'll have an error trying to get 'type' from undefined.
Hey @Daemo00, thank you for your Pull Request. It looks like some users haven't signed our Contributor License Agreement, yet.
Appreciation of efforts, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional test 👍
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pedrobaeza and @lfreeke for the review! I can confirm that it is not working in the SO lines but it works for instance in the invoice lines.. Investigating deeper 🔍 |
It is rather odd because everywhere else it is working. |
Hehe, I went directly to the only case it's failing by chance! |
that's because of https://github.com/OCA/OCB/blob/13.0/addons/sale/views/sale_views.xml#L332 defined in https://github.com/OCA/OCB/blob/13.0/addons/account/static/src/js/section_and_note_fields_backend.js - I think it's out of scope for this addon to fix those |
thanks for the pointer, @hbrunn. I don't think so, unless that widget is defined in |
it's in |
Well, if it can be done compatible without requiring glue module, then better to have it. But if not, at least add it to the ROADMAP for being aware. |
Hi, what I discovered is that what causes the strange behavior is actually the With this change, the I do not completely understand the |
Well, if no_open is defined, then it doesn't matter about the inheritance, so for me we can continue. I can't say about JS inheritance though. |
Yep I can confirm that field Noticing that in the beginning would have saved a few headaches about JS debugging :) |
@hbrunn do you approve this as is then or do you think it's worth to mention something in the ROADMAP? |
Anyway I'll try to submit a PR with the mentioned change to JS inheritance of the |
I'm not sure the proposal to change the base class will be successful, because then it would be awkward to use the widget in some other view type. Like kanban, this is what lists degrade to nowadays in responsive mode. Ah, this is something you should check: How does the addon perform in responsive mode? I'd expect we won't have a link, so you'll probably have to override the kanban version too. We'll run into this kind of situations repeatedly in the future due to the way widget classes are selected by the new framework (which is super well done btw in my opinion). I think you can solve this by adding some function In this specific case the widget probably relies on https://github.com/odoo/odoo/blob/22a11a6f4d0b08a56712fafd0f87a2e7bb5b00ec/addons/sale/static/src/js/product_configurator_widget.js#L35 being called when rendering in read mode, you'll have to see how much trouble this causes. Another option would be to iterate through the fields registry and depending on some conditions (inherits from |
As it is planned (appearing when you hover over the field), I don't think we should provide an alternative on responsive mode (where there's no hover as you are on a mobile). For me it's OK to limit to current scope. |
cd05543
to
c8299a3
Compare
c8299a3
to
ca1690f
Compare
/ocabot merge |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at eb1c726. Thanks a lot for contributing to OCA. ❤️ |
standard migration