[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.
This commit is contained in:
Arnold Moyaux
2017-11-13 17:33:17 +01:00
parent 8900dc2204
commit 6b7ac1c5d7
@@ -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()