From 6b7ac1c5d71f8d18da68040e6035a2af8eca71e2 Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Mon, 13 Nov 2017 16:55:36 +0100 Subject: [PATCH] [FIX] stock: wrong default date with inventory at date When choosing inventory at specific date the default value is the start time of the server instead of the current time. When using fields.Datetime.now as default value, will set the function as default and future object will need to evaluate the funcion each time an object without default is created. fields.Datetime.now() will evaluate the function once at the server start and use the retun value as default value for future objects. --- addons/stock/wizard/stock_quantity_history.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/wizard/stock_quantity_history.py b/addons/stock/wizard/stock_quantity_history.py index 16dee8b4de1..e138bce9bb3 100644 --- a/addons/stock/wizard/stock_quantity_history.py +++ b/addons/stock/wizard/stock_quantity_history.py @@ -12,7 +12,7 @@ class StockQuantityHistory(models.TransientModel): (0, 'Current Inventory'), (1, 'At a Specific Date') ], string="Compute", help="Choose to analyze the current inventory or from a specific date in the past.") - date = fields.Datetime('Inventory at Date', help="Choose a date to get the inventory at that date", default=fields.Datetime.now()) + date = fields.Datetime('Inventory at Date', help="Choose a date to get the inventory at that date", default=fields.Datetime.now) def open_table(self): self.ensure_one()