Achraf a94f3f4dcb [FIX] mrp: Allow users to edit 'MO Overview' report on studio
Steps:
	- Install `mrp`
	- Install `web_studio`
	- Open `Inventory`
	- Click on `Toggle Studio` button
	- Click on `Reports` tab
	- Remove default filter
	- Try to open `MO Overview` report via reports view
	- Traceback

When loading the `MO Overview` report, `_get_report_qweb` is called and builds the context rendering here

https://github.com/odoo/enterprise/blob/b7d0d3034d53cdab831f42f8b37a14cf50f3720e/web_studio/controllers/report.py#L549

We therefore call _get_rendering_context with `[0]` in `docids`,
which will call `_get_report_values` in `mrp/report/mrp_report_mo_overview`.

https://github.com/odoo/odoo/blob/6e8e62db1fa2010c3e6696baacaedf997fd8fa89/addons/mrp/report/mrp_report_mo_overview.py#L29-L30

https://github.com/odoo/odoo/blob/6e8e62db1fa2010c3e6696baacaedf997fd8fa89/addons/mrp/report/mrp_report_mo_overview.py#L53-L54

`_get_report_data` performs a `browse(0)` on `mrp.production`.

BaseModels::browse replaces falsy values with empty tuples `()`.

https://github.com/odoo/odoo/blob/5d726c933b591468bcef85a4e14b183278a00e5b/odoo/models.py#L5441-L5442

This implies the return of an empty model record.

`mrp_report_mo_overview` will therefore use a record containing null
values in its operations, for example division,
which causes a division by 0 error, or a log10(0) in
`_get_uom_precision` because `product_uom.rounding` is 0.

https://github.com/odoo/odoo/blob/6e8e62db1fa2010c3e6696baacaedf997fd8fa89/addons/mrp/report/mrp_report_mo_overview.py#L105-L106

This commit corrects these incorrect defaults with fallbacks

opw-3725827

closes odoo/odoo#153919

X-original-commit: 1bad2b3b2e285e6e7b8f6e93430b6415c3c65303
Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
2024-02-14 08:21:40 +00:00
2023-11-02 21:02:44 +00:00
2024-02-13 12:21:52 +00:00
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%