From 3e781fbdcb1d1af39c53b89dee7619b746bbcde9 Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Mon, 6 Oct 2008 12:11:57 +0200 Subject: [PATCH] Imporved stock computation wizards: * better naming * added missing wizard title * added default values --- location.py | 7 ++++++- product.py | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/location.py b/location.py index eecdcc7da2..7b0daad3af 100644 --- a/location.py +++ b/location.py @@ -147,11 +147,16 @@ Party() class ChooseStockDateInit(WizardOSV): _name = 'stock.location_stock_date.init' + _description = "Compute stock quantities" forecast_date = fields.Date( - 'Forecast Date', help='Allow to compute expected '\ + 'At Date', help='Allow to compute expected '\ 'stock quantities for this date.\n'\ '* An empty value is an infinite date in the future.\n'\ '* A date in the past will provide historical values.') + + def default_forecast_date(self, cursor, user, context=None): + return datetime.date.today() + ChooseStockDateInit() diff --git a/product.py b/product.py index be4dd956ea..1686d9d39d 100644 --- a/product.py +++ b/product.py @@ -118,7 +118,7 @@ class Product(OSV): state_date_clause = "True" state_date_vals = [] else: - # date end in the past: filter on state done for the moves + # date end in the past or today: filter on state done for the moves if context['stock_date_end'] <= datetime.date.today(): state_date_clause = '(state in (%s)) AND ('\ '(effective_date IS NULL '\ @@ -326,11 +326,16 @@ Product() class ChooseStockDateInit(WizardOSV): _name = 'stock.product_stock_date.init' + _description = "Compute stock quantities" forecast_date = fields.Date( - 'Forecast Date', help='Allow to compute expected '\ + 'At Date', help='Allow to compute expected '\ 'stock quantities for this date.\n'\ '* An empty value is an infinite date in the future.\n'\ '* A date in the past will provide historical values.') + + def default_forecast_date(self, cursor, user, context=None): + return datetime.date.today() + ChooseStockDateInit() class OpenLocation(Wizard):