forked from Yaltik/golem
[IMP]Activity : form hour_end to more coherent hour_stop
This commit is contained in:
parent
2a0d7abc6a
commit
8245c63761
@ -256,8 +256,8 @@ msgid "End date"
|
|||||||
msgstr "Date de fin"
|
msgstr "Date de fin"
|
||||||
|
|
||||||
#. module: golem_activity
|
#. module: golem_activity
|
||||||
#: field:golem.activity,hour_end:0
|
#: field:golem.activity,hour_stop:0
|
||||||
msgid "End time"
|
msgid "Stop time"
|
||||||
msgstr "Heure de fin"
|
msgstr "Heure de fin"
|
||||||
|
|
||||||
#. module: golem_activity
|
#. module: golem_activity
|
||||||
|
@ -254,8 +254,8 @@ msgid "End date"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: golem_activity
|
#. module: golem_activity
|
||||||
#: field:golem.activity,hour_end:0
|
#: field:golem.activity,hour_stop:0
|
||||||
msgid "End time"
|
msgid "Stop time"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: golem_activity
|
#. module: golem_activity
|
||||||
|
@ -120,20 +120,20 @@ class GolemActivity(models.Model):
|
|||||||
('sat', _('Saturday')),
|
('sat', _('Saturday')),
|
||||||
('sun', _('Sunday'))], copy=False)
|
('sun', _('Sunday'))], copy=False)
|
||||||
hour_start = fields.Float('Start time', copy=False)
|
hour_start = fields.Float('Start time', copy=False)
|
||||||
hour_end = fields.Float('End time', copy=False)
|
hour_stop = fields.Float('Stop time', copy=False)
|
||||||
|
|
||||||
@api.onchange('hour_start')
|
@api.onchange('hour_start')
|
||||||
def onchange_hour_start(self):
|
def onchange_hour_start(self):
|
||||||
""" Sets end hour to start hour if no start hour """
|
""" Sets end hour to start hour if no start hour """
|
||||||
for s in self:
|
for s in self:
|
||||||
if s.hour_start and not s.hour_end:
|
if s.hour_start and not s.hour_stop:
|
||||||
s.hour_end = s.hour_start + 1
|
s.hour_stop = s.hour_start + 1
|
||||||
|
|
||||||
@api.constrains('hour_start', 'hour_end')
|
@api.constrains('hour_start', 'hour_stop')
|
||||||
def _check_hour_period(self):
|
def _check_hour_period(self):
|
||||||
""" Check if end hour if after start hour """
|
""" Check if end hour if after start hour """
|
||||||
for s in self:
|
for s in self:
|
||||||
if s.hour_start > s.hour_end:
|
if s.hour_start > s.hour_stop:
|
||||||
raise models.ValidationError(_('Start of the period cannot be '
|
raise models.ValidationError(_('Start of the period cannot be '
|
||||||
'after end of the period.'))
|
'after end of the period.'))
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
attrs="{'invisible': [('is_recurrent', '=', False)]}" />
|
attrs="{'invisible': [('is_recurrent', '=', False)]}" />
|
||||||
<field name="hour_start" widget="float_time"
|
<field name="hour_start" widget="float_time"
|
||||||
attrs="{'invisible': [('is_recurrent', '=', False)]}" />
|
attrs="{'invisible': [('is_recurrent', '=', False)]}" />
|
||||||
<field name="hour_end" widget="float_time"
|
<field name="hour_stop" widget="float_time"
|
||||||
attrs="{'invisible': [('is_recurrent', '=', False)]}" />
|
attrs="{'invisible': [('is_recurrent', '=', False)]}" />
|
||||||
<field name="date_start"
|
<field name="date_start"
|
||||||
attrs="{'invisible': [('is_recurrent', '=', True)]}" />
|
attrs="{'invisible': [('is_recurrent', '=', True)]}" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user