diff --git a/stock_demand_estimate/__manifest__.py b/stock_demand_estimate/__manifest__.py index ad326cd4b..075dd1cc9 100644 --- a/stock_demand_estimate/__manifest__.py +++ b/stock_demand_estimate/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Demand Estimate", "summary": "Allows to create demand estimates.", - "version": "11.0.1.0.0", + "version": "11.0.1.1.0", "author": "Eficent, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-warehouse", diff --git a/stock_demand_estimate/models/stock_demand_estimate.py b/stock_demand_estimate/models/stock_demand_estimate.py index 1259e1a72..7cf73e526 100644 --- a/stock_demand_estimate/models/stock_demand_estimate.py +++ b/stock_demand_estimate/models/stock_demand_estimate.py @@ -62,7 +62,10 @@ class StockDemandEstimate(models.Model): @api.depends('product_qty', 'date_range_id.days') def _compute_daily_qty(self): for rec in self: - rec.daily_qty = rec.product_qty / rec.date_range_id.days + if rec.date_range_id.days: + rec.daily_qty = rec.product_qty / rec.date_range_id.days + else: + rec.daily_qty = 0.0 @api.multi @api.depends('product_id', 'product_uom', 'product_uom_qty') @@ -94,6 +97,7 @@ class StockDemandEstimate(models.Model): @api.model def get_quantity_by_date_range(self, date_start, date_end): + """To be used in other modules""" # Check if the dates overlap with the period period_date_start = fields.Date.from_string( self.date_range_id.date_start diff --git a/stock_demand_estimate/views/stock_demand_estimate_view.xml b/stock_demand_estimate/views/stock_demand_estimate_view.xml index 45e084004..f6e412c91 100644 --- a/stock_demand_estimate/views/stock_demand_estimate_view.xml +++ b/stock_demand_estimate/views/stock_demand_estimate_view.xml @@ -6,7 +6,7 @@ stock.demand.estimate.tree stock.demand.estimate - +