default date value computed at server startup

Bug #624509 reported by Xavier ALT
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 1

Bug Description

Summary
========
When encoding a new line of "task work" inside the project task, the default date provided is always the same.

Use Case:
========
Start openerp-server, start time is: 2010-08-25 08:00:15
encode a new task work, the default date is: 2010-08-25 08:00:15
5 minutes later, encode a new task work, the default date is still: 2010-08-25 08:00:15

Details
======
The default value for task.work is specified like this:

_defaults = {
    ...
    'date': time.strftime('%Y-%m-%d'),
    ...
}

The problem here, is that the "date" will be computed when the object is instantiated, not when the client request default date. For this kind of default value, we should specify it using the "lambda" way.

Lot of others modules seems to declare default value like this, for example:
...
sale/sale.py:284: 'date_order': time.strftime('%Y-%m-%d'),
...
stock/stock.py:1260: 'date': time.strftime('%Y-%m-%d %H:%M:%S'),
...

Code Versions
============
Mainline: 6.0
Server: <email address hidden>
Addons: codehost@crowberry-20100826035718-f9pjmr6ydefie407
Client: <email address hidden>

Related branches

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Medium
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
tfr (Openerp) (tfr)
Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.