diff --git a/addons/stock_account/__init__.py b/addons/stock_account/__init__.py index d4786823b49..fd3f4a2eddb 100644 --- a/addons/stock_account/__init__.py +++ b/addons/stock_account/__init__.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import models +from . import report from . import wizard from odoo import api, SUPERUSER_ID, _, tools diff --git a/addons/stock_account/__manifest__.py b/addons/stock_account/__manifest__.py index 62873c1c87c..6ec18a56208 100644 --- a/addons/stock_account/__manifest__.py +++ b/addons/stock_account/__manifest__.py @@ -32,7 +32,8 @@ Dashboard / Reports for Warehouse Management includes: 'views/product_views.xml', 'views/stock_quant_views.xml', 'views/stock_valuation_layer_views.xml', - 'wizard/stock_valuation_layer_revaluation_views.xml' + 'wizard/stock_valuation_layer_revaluation_views.xml', + 'report/report_stock_forecasted.xml', ], 'test': [ ], diff --git a/addons/stock_account/report/__init__.py b/addons/stock_account/report/__init__.py new file mode 100644 index 00000000000..2f702c8dc1f --- /dev/null +++ b/addons/stock_account/report/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import report_stock_forecasted diff --git a/addons/stock_account/report/report_stock_forecasted.py b/addons/stock_account/report/report_stock_forecasted.py new file mode 100644 index 00000000000..10a2dd3ebe8 --- /dev/null +++ b/addons/stock_account/report/report_stock_forecasted.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models +from odoo.tools.float_utils import float_repr + + +class ReplenishmentReport(models.AbstractModel): + _inherit = 'report.stock.report_product_product_replenishment' + + 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) + domain = self._product_domain(product_template_ids, product_variant_ids) + svl = self.env['stock.valuation.layer'].search(domain) + currency = svl.currency_id or self.env.company.currency_id + value = float_repr(sum(svl.mapped('value')), precision_digits=currency.decimal_places) + if currency.position == 'after': + value = '%s %s' % (value, currency.symbol) + else: + value = '%s %s' % (currency.symbol, value) + res['value'] = value + return res diff --git a/addons/stock_account/report/report_stock_forecasted.xml b/addons/stock_account/report/report_stock_forecasted.xml new file mode 100644 index 00000000000..0bfe7876a3b --- /dev/null +++ b/addons/stock_account/report/report_stock_forecasted.xml @@ -0,0 +1,13 @@ + + + +