Improve cron form view
This commit is contained in:
1 parent
e39129ee3d
commit
e63b43b0bb
2 files changed
+15
-7
No files matched your search
+9
-1
@@ -23,7 +23,7 @@ class Cron(DeactivableMixin, ModelSQL, ModelView):
|
||||
('days', 'Days'),
|
||||
('weeks', 'Weeks'),
|
||||
('months', 'Months'),
|
||||
], "Interval Type", required=True)
|
||||
], "Interval Type", sort=False, required=True)
|
||||
minute = fields.Integer("Minute",
|
||||
states={
|
||||
'invisible': Eval('interval_type').in_(['minutes']),
|
||||
@@ -80,6 +80,14 @@ class Cron(DeactivableMixin, ModelSQL, ModelView):
|
||||
def check_xml_record(crons, values):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return [
|
||||
('//label[@id="time_label"]', 'states', {
|
||||
'invisible': Eval('interval_type') == 'minutes',
|
||||
}),
|
||||
]
|
||||
|
||||
def compute_next_call(self, now):
|
||||
return (now
|
||||
+ relativedelta(**{self.interval_type: self.interval_number})
|
||||
|
||||
@@ -13,14 +13,14 @@ this repository contains the full copyright notices and license terms. -->
|
||||
</group>
|
||||
<label id="time_label" string="At"/>
|
||||
<group id="time" col="-1" colspan="3">
|
||||
<label name="minute"/>
|
||||
<field name="minute" xexpand="0"/>
|
||||
<label name="hour"/>
|
||||
<field name="hour" xexpand="0"/>
|
||||
<label name="day"/>
|
||||
<field name="day" xexpand="0"/>
|
||||
<label name="weekday"/>
|
||||
<field name="weekday" xexpand="0" widget="selection"/>
|
||||
<label name="day"/>
|
||||
<field name="day" xexpand="0"/>
|
||||
<label name="hour"/>
|
||||
<field name="hour" xexpand="0"/>
|
||||
<label name="minute"/>
|
||||
<field name="minute" xexpand="0"/>
|
||||
</group>
|
||||
<label name="next_call"/>
|
||||
<field name="next_call"/>
|
||||
|
||||
Reference in new issue
Block a user