Skip to content

Commit 76c2c27

Browse files
committed
[FIX] estate: fix default value for the "date_availability" field in "estate_property" model
- Use a lambda function in order to recompute the default value for each record. Before this change, the default was computed once (on server launch).
1 parent 622c144 commit 76c2c27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

estate/models/estate_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class EstateProperty(models.Model):
1212
name = fields.Char(string="Title", required=True)
1313
description = fields.Text()
1414
postcode = fields.Char()
15-
date_availability = fields.Date(string="Available From", default=fields.Date.today() + relativedelta(months=3), copy=False)
15+
date_availability = fields.Date(string="Available From", default=lambda self: fields.Date.context_today(self) + relativedelta(months=3), copy=False)
1616
expected_price = fields.Float(required=True)
1717
selling_price = fields.Float(readonly=True, copy=False)
1818
bedrooms = fields.Integer(default=2)

0 commit comments

Comments
 (0)