-
- Downloads
[FIX] stock: allow "Print" of MRP reception report
During the OWL refactoring of the reception report, the "Print" button was hardcoded to only work for pickings. Unfortunately this means the button did NOT work when the report was opened for a MO. This is due to the report printing being dependent on the report's context values which can either be `default_picking_ids` or `default_production_ids` (and this is by design to avoid additional file extensions to handle both cases). When this button was used in the previous legacy_web_report's client_action, the entire action's context + data used to be passed as part of the Print action: https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/stock/static/src/legacy_web_report/client_action.js#L109-L119 The `data` and `context` is then stringified and added into the reportURL: https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/web/static/src/webclient/actions/action_service.js#L1042-L1050 But passing of the data isn't necessary in this case, and most of the context's content is not needed since the backend is still receiving + apply the current user's context thanks to the action_service: https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/web/static/src/webclient/actions/action_service.js#L1079 always providing it to the backend https://github.com/odoo/odoo/blob/30fcb2e60fed17a473353b21bac4916e9ab77b10/addons/web/controllers/report.py#L87 Therefore, to avoid an extra long report URL of all of the report's data/context, this fix has been designed to capture only the necessary context value and manually build the print URL accordingly. Noticed during task: 3046178 closes odoo/odoo#119954 Signed-off-by:Steve Van Essche <svs@odoo.com>
Please register or sign in to comment