Remove 'field' from 'value_to_html' method attributes
't-esc' escape the result of the widget.
(Added 'remove_span' as option for monetary widget)
E.g.: <t t-esc="32" t-options='t-options='{"widget": "monetary", "display_currency": website.currency_id, "remove_span": True}'>
result: $ 365.00
ie, make `converter` argument not a path but a string. Converter
in our codebase are one-word string anyway (html, pdf).
This is done because a less asset in the report module is not reachable
in debug mode (it is a fake file that is reachable by a fallback in the
http dispatching and the fallback is not done because the `/report/converter
` matched the route of the fake file).
This change concerns reports of `qweb-html` type. Previously, they were
openned in a popup and it was not very practical. We chose to open these
reports in an iframe (as opposed to what's done in `account_report`) in
order to be the most close to the pdf version in terms of apperance.
The client action allows an integration with the control panel. Apart from
the breadcrumbs integration, we also add buttons to handle the web_editor
(save, discard, etc). We also add a button to print the pdf version.
As there is some security concern to communicate with an iframe, we use
the postMessage[1] technology and we fix the `targetOrigin` to the
`web.base.url` parameter, that means that if the window to which we send
the message does not match the `web.base.url` origin, the event is not
even dispatched.
In order to to that, the report module uses the ir_http `session_info`
override mechanism to add the `web.base.url` in the DOM of the webclient,
and the report module adds to the DOM of report the `web.base.url`
content. This way, both scripts (in the webclient and in the iframe)
have the information of the trusted origin.
The client action does not have a complicated logic: it opens the
report's url in an iframe to show the report or open the web_editor
(the editor is activated by using the `enable_editor` query string.
If you click on the control panel button (save/discard) it'll send
message to the web_editor in the iframe to ask for save and discard.
It also waits for messages to know if the edition is done / cancelled
and toggle buttons of the control panel accordingly.
To allow that, we override the web_editor mechanism if it's opened in
an iframe and we chain to the `save` and `cancel` method deferred that
send message to the client action's window. We also make the web_editor
waits for message to start and stop the edition (controlled by the
control panel buttons).
The override of the action manager has been refactored / improved in
order to open the clien action and not the popup anymore. This way
we are able to, in the client action, return the current action with
the type `qweb-pdf` and the report is downloaded.
[1] https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
To be displayed correctly on odoo app (In a given category and not only in all or hidden)
the module category in the __openerp__.py file should be one of these:
"Accounting",
"Discuss",
"Document Management",
"eCommerce",
"Human Resources",
"Industries",
"Localization",
"Manufacturing",
"Marketing",
"Point of Sale",
"Productivity",
"Project",
"Purchases",
"Sales",
"Warehouse",
"Website",
"Extra Tools",
'Accounting & Finance' will not work, as 'Project Management', ...
* The compiled templates are cached per user, lang, inherit context values
* ir.ui.fields: attributes method return an dict, and record_to_html return only the content value of the field
* all rendered text use build_text and all attributes use build_attribute
* t-esc-options is removed and replace by format_value method
* AssetsBundle receive the list files and remains
Closes#12131
[FIX] report: don't hide errors in custom reports
If a custom report's render_html raises a KeyError for some
reason, Report.get_html would swallow the exception and fallback
on generic HTML rendering, usually blowing up with unfathomable
errors of missing rendering context data.
Check if a custom report object exists instead of waiting for a
KeyError.
A lock occurs when the user wants to print a report having multiple barcode while the server is
started in threaded-mode. The reason is that reportlab has to build a cache of the T1 fonts
before rendering a barcode (done in a C extension) and this part is not thread safe. We attempt
here to init the T1 fonts cache at the start-up of Odoo so that rendering of barcode in multiple
thread does not lock the server.
Another workaround was to set an explicit lock around the reportlab's function call, but it's
more dangerous as it may introduce undetectable lock between python and postgresql.
Thanks to @odony and @KangOl.
Fixes#12236
When cancelling and resetting to draft an invoice,
delete only the invoice report attachment from the
attachment, not all of them.
The reason why the report is removed from the
attachments on the invoice resetted to draft
is explained in
db0def38cc
opw-680295
session_instance.js moved from framework/ to services/ and renamed into
session.js, which required to change the bundles in report and web_editor
addons.
PURPOSE
=======
I've seen this new improvement regarding the naming of the printed reports:
https://www.odoo.com/web?#id=10870&view_type=form&model=project.task&menu_id=3942&action=327
This makes the report have the pdf name being the name instead of the report_name of
the ir.actions.report.xml, which is already an improvement.
But why don't we allow the users to have their own naming conventions?
I mean, we could allow our client to create and name their pdf the way they want, as
they do regarding the attachment.
Not only when it's about saving it as an attachment on the record, but also when downloading
directly the pdf, such that the modification in the previous screenshot, would give the following
result when downloaded:
People need to have their pdf named automatically according to a convention. When you print 10 sales
order during an hour, you don't want to get lost in having the following:
Devis / Commande.pdf
Devis / Commande(1).pdf
Devis / Commande(2).pdf
Devis / Commande(3).pdf
Devis / Commande(4).pdf
Devis / Commande(5).pdf
Devis / Commande(6).pdf
Devis / Commande(7).pdf
especially when those are for different partners.
If a custom report's render_html raises a KeyError for some
reason, Report.get_html would swallow the exception and fallback
on generic HTML rendering, usually blowing up with unfathomable
errors of missing rendering context data.
Check if a custom report object exists instead of waiting for a
KeyError.