Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sisted-by: Claude Opus 5.5
5f00584 to
72aaa4e
Compare
hbrunn
left a comment
There was a problem hiding this comment.
not sure why you renamed this? i mean, it still pops up help?
please remove all the bullshit comments in code files, they have negative value for readability of the code.
| def _response(self, html): | ||
| return request.make_response( | ||
| html, headers=[("Content-Type", "text/html; charset=utf-8")] | ||
| ) |
There was a problem hiding this comment.
what's the point of this function?
There was a problem hiding this comment.
def _response is now removed. Thanks
| else: | ||
| title, prefix = env["ir.model"]._get(model).name or model, "help" | ||
| body, toc = env["help.section"]._for(action, model)._html(prefix) | ||
| html = env["ir.actions.report"]._render_template( |
There was a problem hiding this comment.
what's the reason for rendering this as a report instead of passing template and context to the response? I'd also rather see ir.http#webclient_rendering_context included here instead of the _dark function, making all of this more standard Odoo
| @http.route("/screen_help/app/<int:menu_id>", type="http", auth="user") | ||
| def app_help(self, menu_id): | ||
| """Help of all the screens of an application (root menu)""" | ||
| html, __ = request.env["ir.actions.report"]._render_qweb_html( |
| FRONT_MATTER_RE = re.compile(r"\A---\s*\n(.*?)\n---\s*\n", re.DOTALL) | ||
|
|
||
|
|
||
| def front_matter(text): |
There was a problem hiding this comment.
why is this not a model function to allow overrides?
There was a problem hiding this comment.
is now def _front_matter(self, text):
| as Markdown files (see `_load_markdown`). | ||
|
|
||
| A section targets either a window action, or a model: then it is shown on | ||
| every screen of this model, whatever the action.""" |
There was a problem hiding this comment.
I suggest to allow also targeting specific menus, as some window actions are generic and depending on the menu, other help texts are appropriate
There was a problem hiding this comment.
Maybe I can add it in ROADMAP if you need a such feature ?
| from odoo import fields, models | ||
|
|
||
|
|
||
| class IrActionsActWindow(models.Model): |
There was a problem hiding this comment.
support for client actions would be nice, but I see how this is difficult
There was a problem hiding this comment.
Can you explain use cases ? And shouldn't implement it in another module ?
| - [Akretion](https://www.akretion.com): | ||
| - David Beal <david.beal@akretion.com> | ||
| Original help_popup author augmented and renamed to screen_help | ||
| Assisted-by: Claude Opus 5.5 |
| <div class="o_help_content flex-grow-1" style="min-width: 0;"> | ||
| <t t-out="0" /> | ||
| </div> | ||
| </div> |
There was a problem hiding this comment.
it would be nice if this included some javascript that looks for data-* attributes which allow linking to some action in Odoo, as not all actions have paths
| t-on-click="onClickHelp" | ||
| > | ||
| <!-- Book icon: documentation of the screen --> | ||
| <i class="fa fa-book" /> |
There was a problem hiding this comment.
I'd find circle-question or some other icon involving a question mark more appropriate
| if ( | ||
| not self.env.context.get("install_module") | ||
| and set(vals) & set(self._file_fields) | ||
| and any(self.mapped("file")) |
There was a problem hiding this comment.
this seems to make it impossible to overwrite some generic help texts in a customer-specific module with xml records? I'd suggest to also check for install_mode
There was a problem hiding this comment.
Ok, for install mode. If you have to override this section, maybe it's easy to do it when you'll have a such case ?
|
Thanks @hbrunn for your full review. I renamed because a popup is inside a tab. In this case this a new window. But @tonygalmiche suggest me to support a way to embed documentation near chatter place. It seems a good idea with user preference. The main purpose of the module, is that the documentation is contextual to the current page. I don't know if we could find a good name with this consideration. Thanks for any suggestion I'll answer to all your other requests. |
|
the word pop-up was a thing long before there was the concept of browser tabs ;-) but anyways, why not just the exact way of displaying should be something easy to tinker with in other modules/user preferences in any case, as I can imagine ie showing this full screen on mobile, or indeed a popup to move to a second screen can be very useful. finally, as there's not really anything left of the old module, I'm not sure it makes sense to carry the old commits forward. |
|
|
||
| _name = "help.section" | ||
| _description = "Help Section" | ||
| _order = "sequence, id" |
There was a problem hiding this comment.
set _rec_name to something useful here or override _compute_display_name
There was a problem hiding this comment.
I addded _compute_display_name to have a better display
0381335 to
dcb6784
Compare
| FRONT_MATTER_RE = re.compile(r"\A---\s*\n(.*?)\n---\s*\n", re.DOTALL) | ||
|
|
||
|
|
||
| def front_matter(text): |
There was a problem hiding this comment.
is now def _front_matter(self, text):
| def _response(self, html): | ||
| return request.make_response( | ||
| html, headers=[("Content-Type", "text/html; charset=utf-8")] | ||
| ) |
There was a problem hiding this comment.
def _response is now removed. Thanks
| t-on-click="onClickHelp" | ||
| > | ||
| <!-- Book icon: documentation of the screen --> | ||
| <i class="fa fa-book" /> |
| - [Akretion](https://www.akretion.com): | ||
| - David Beal <david.beal@akretion.com> | ||
| Original help_popup author augmented and renamed to screen_help | ||
| Assisted-by: Claude Opus 5.5 |
| else: | ||
| title, prefix = env["ir.model"]._get(model).name or model, "help" | ||
| body, toc = env["help.section"]._for(action, model)._html(prefix) | ||
| html = env["ir.actions.report"]._render_template( |
|
|
||
| _name = "help.section" | ||
| _description = "Help Section" | ||
| _order = "sequence, id" |
There was a problem hiding this comment.
I addded _compute_display_name to have a better display
| from odoo import fields, models | ||
|
|
||
|
|
||
| class IrActionsActWindow(models.Model): |
There was a problem hiding this comment.
Can you explain use cases ? And shouldn't implement it in another module ?
| @http.route("/screen_help/app/<int:menu_id>", type="http", auth="user") | ||
| def app_help(self, menu_id): | ||
| """Help of all the screens of an application (root menu)""" | ||
| html, __ = request.env["ir.actions.report"]._render_qweb_html( |
| as Markdown files (see `_load_markdown`). | ||
|
|
||
| A section targets either a window action, or a model: then it is shown on | ||
| every screen of this model, whatever the action.""" |
There was a problem hiding this comment.
Maybe I can add it in ROADMAP if you need a such feature ?
Not a really critical module but convenient to document features
cc @gurneyalex @hbrunn @dreispt