diff --git a/stock_demand_estimate/__openerp__.py b/stock_demand_estimate/__openerp__.py index 04f151bda..5aaec1224 100644 --- a/stock_demand_estimate/__openerp__.py +++ b/stock_demand_estimate/__openerp__.py @@ -5,7 +5,7 @@ { "name": "Stock Demand Estimate", "summary": "Allows to create demand estimates.", - "version": "9.0.1.0.0", + "version": "9.0.1.1.0", "author": "Eficent, " "Odoo Community Association (OCA)", "website": "https://www.odoo-community.org", diff --git a/stock_demand_estimate/models/stock_demand_estimate.py b/stock_demand_estimate/models/stock_demand_estimate.py index accf2f6cb..e214f438a 100644 --- a/stock_demand_estimate/models/stock_demand_estimate.py +++ b/stock_demand_estimate/models/stock_demand_estimate.py @@ -31,7 +31,10 @@ class StockDemandEstimate(models.Model): @api.multi 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 date_range_id = fields.Many2one( comodel_name="date.range", @@ -69,6 +72,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 343ba25a2..b54934605 100644 --- a/stock_demand_estimate/views/stock_demand_estimate_view.xml +++ b/stock_demand_estimate/views/stock_demand_estimate_view.xml @@ -7,7 +7,7 @@ stock.demand.estimate.tree stock.demand.estimate - +