diff --git a/addons/stock/static/src/js/report_stock_forecasted.js b/addons/stock/static/src/js/report_stock_forecasted.js index 27121e8e472e002aa6fbb85e982dae18ff5bc879..1624839dedbd2554f85d33509cb4a53214f14333 100644 --- a/addons/stock/static/src/js/report_stock_forecasted.js +++ b/addons/stock/static/src/js/report_stock_forecasted.js @@ -63,6 +63,9 @@ const ReplenishReport = clientAction.extend({ promController.then(() => { this.iframe.removeEventListener('load', appendGraph); const $reportGraphDiv = $(this.iframe).contents().find('.o_report_graph'); + if (!$reportGraphDiv) { + return; + } dom.append(this.$el, viewController.$el, { in_DOM: true, callbacks: [{widget: viewController}], diff --git a/addons/stock_account/report/report_stock_forecasted.py b/addons/stock_account/report/report_stock_forecasted.py index 79d3f4b1e3f5a970d4024e4f57da892da3ea6160..a90bb3ea4764883b7c643d8b493aa126d694c3d2 100644 --- a/addons/stock_account/report/report_stock_forecasted.py +++ b/addons/stock_account/report/report_stock_forecasted.py @@ -11,6 +11,8 @@ class ReplenishmentReport(models.AbstractModel): def _compute_draft_quantity_count(self, product_template_ids, product_variant_ids, wh_location_ids): """ Overrides to computes the valuations of the stock. """ res = super()._compute_draft_quantity_count(product_template_ids, product_variant_ids, wh_location_ids) + if not self.user_has_groups('stock.group_stock_manager'): + return res domain = self._product_domain(product_template_ids, product_variant_ids) company = self.env['stock.location'].browse(wh_location_ids).mapped('company_id') svl = self.env['stock.valuation.layer'].search(domain + [('company_id', '=', company.id)]) diff --git a/addons/stock_account/report/report_stock_forecasted.xml b/addons/stock_account/report/report_stock_forecasted.xml index 0bfe7876a3bdbe9dfc7c3be4476946984d7e49f4..cd2d1ee1150d127f2ecd78fad14716a7ea377e8f 100644 --- a/addons/stock_account/report/report_stock_forecasted.xml +++ b/addons/stock_account/report/report_stock_forecasted.xml @@ -2,7 +2,7 @@ <odoo> <template id="stock_account_report_product_product_replenishment" inherit_id="stock.report_replenishment_header"> <xpath expr="//div[@name='pending_forecasted']" position="after"> - <div t-attf-class="mx-3 text-center"> + <div t-attf-class="mx-3 text-center" t-if="env.user.has_group('stock.group_stock_manager')"> <div class="h3"> <t t-esc="docs['value']"/> </div>