Hi, while developing a custom model, I just copy pasted (again) those fields:
start_date = fields.Date(
"Start Date",
domain=[
If(Eval('start_date') & Eval('end_date'),
('start_date', '<=', Eval('end_date')),
()),
])
end_date = fields.Date(
"End Date",
domain=[
If(Eval('start_date') & Eval('end_date'),
('end_date', '>=', Eval('start_date')),
()),
])
It is not a big deal but those 2 exists in many models, also being named as “from_date” and “to_date”, wouldn’t it be nice and simpler to have some kind of mixin like DateRangeMixin which just defines those 2 fields with the domain included? this would also have the benefit of having 1 translation for each.
Thanks.
For me it will be a typical case of too much abstraction.
If such mixin would exist, it will be very difficult to modify it because its usage would be too generic. And if it can not be modified, then it does not provide any benefit compare to copy/paste.