From d93c47c7fb2a742688484abcc0870fa2beb3bf2b Mon Sep 17 00:00:00 2001 From: lreficent Date: Tue, 6 Jun 2017 12:38:50 +0200 Subject: [PATCH] [FIX] travis --- stock_demand_estimate/models/stock_demand_estimate.py | 10 ++++------ .../wizards/stock_demand_estimate_wizard.py | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/stock_demand_estimate/models/stock_demand_estimate.py b/stock_demand_estimate/models/stock_demand_estimate.py index a4ccf7b31..1ef7eaf70 100644 --- a/stock_demand_estimate/models/stock_demand_estimate.py +++ b/stock_demand_estimate/models/stock_demand_estimate.py @@ -22,7 +22,7 @@ class StockDemandEstimate(models.Model): rec.product_id.uom_id.id, rec.product_uom_qty, rec.product_uom.id) - def _set_product_qty(self): + def _inverse_product_qty(self): raise UserError(_('The requested operation cannot be ' 'processed because of a programming error ' 'setting the `product_qty` field instead ' @@ -47,7 +47,7 @@ class StockDemandEstimate(models.Model): string="Quantity", digits_compute=dp.get_precision('Product Unit of Measure')) product_qty = fields.Float('Real Quantity', compute='_compute_product_qty', - inverse='_set_product_qty', digits=0, + inverse='_inverse_product_qty', digits=0, store=True, help='Quantity in the default UoM of the ' 'product', readonly=True) @@ -77,10 +77,8 @@ class StockDemandEstimate(models.Model): # We need only the periods that overlap # the dates introduced by the user. - if ( - date_start <= period_date_start <= date_end - or date_start <= period_date_end <= date_end - ): + if (date_start <= period_date_start <= date_end or date_start <= + period_date_end <= date_end): overlap_date_start = max(period_date_start, date_start) overlap_date_end = min(period_date_end, date_end) days = (abs(overlap_date_end-overlap_date_start)).days + 1 diff --git a/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py b/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py index 67b8ae22e..ebab92e02 100644 --- a/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py +++ b/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py @@ -6,7 +6,7 @@ from openerp import api, fields, models, _ import openerp.addons.decimal_precision as dp -from openerp.exceptions import ValidationError +from openerp.exceptions import UserError, ValidationError class StockDemandEstimateSheet(models.TransientModel): @@ -171,7 +171,7 @@ class DemandEstimateWizard(models.TransientModel): def create_sheet(self): self.ensure_one() if not self.product_ids: - raise UserError(_('You must select at lease one product.')) + raise UserError(_('You must select at least one product.')) context = { 'default_date_start': self.date_start,