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
9 lines
153 B
Python
9 lines
153 B
Python
import abstract_report
|
|
import ir_actions
|
|
import ir_http
|
|
import report
|
|
import report_paperformat
|
|
import abstract_report
|
|
import ir_qweb
|
|
import res_company
|