Add raise error

This commit is contained in:
Oscar Alvarez 2021-02-04 11:35:52 -05:00
parent 61597aacc7
commit c3a6293081

View file

@ -113,6 +113,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
'wrong_start_end': ('The date end can not smaller than date start'),
'sequence_missing': ('Sequence liquidation is missing!'),
'payroll_not_posted': ('The employee has payrolls does not posted!'),
'error_dates': ('The dates for employee is wrong "%s"!'),
})
cls._transitions |= set((
('draft', 'cancel'),
@ -489,7 +490,10 @@ class Liquidation(Workflow, ModelSQL, ModelView):
def on_change_with_time_contracting(self):
delta = None
if self.start_period and self.end_period and self.contract:
date_start, date_end = self._get_dates()
try:
date_start, date_end = self._get_dates()
except:
self.raise_user_error('error_dates', self.employee.party.name)
delta = self.get_time_contracting(date_start, date_end)
return delta