training cost should be bigger than zero

This commit is contained in:
Esraa-Exp 2025-02-18 10:36:40 +02:00
parent 2d714c0d0e
commit 83e36b36d7
2 changed files with 36 additions and 25 deletions

View File

@ -54,3 +54,9 @@ msgstr ""
#, python-format
msgid "You must Enter Purchase Product in Training Type Configuration"
msgstr "يجب ادخال منتج طلب الشراء في إعداد نوع المهام"
#. module: hr_training_payment
#: code:addons/hr_training_payment/models/hr_official_mission.py:0
#, python-format
msgid "Training Cost Must be Bigger than Zero"
msgstr "تكلفة مركز التدريب يجب ان تكون اكبر من صفر"

View File

@ -17,6 +17,7 @@ class HrOfficialMission(models.Model):
# check if there is dealing with financial
if self.mission_type.work_state == 'training':
if self.Training_cost > 0.0:
self.employee_ids.chick_not_overtime()
if not self.mission_type.pr_product_id.id:
@ -34,7 +35,7 @@ class HrOfficialMission(models.Model):
'date': date.today(),
'employee_id': self.employee_id.id,
'partner_id': self.partner_id.id,
'product_category_ids':[(4, self.mission_type.pr_product_id.categ_id.id)] ,
'product_category_ids': [(4, self.mission_type.pr_product_id.categ_id.id)],
'purchase_purpose': self.training_details,
'line_ids': [(0, 0, product_line)]
})
@ -44,8 +45,12 @@ class HrOfficialMission(models.Model):
if self.mission_type.work_state and self.mission_type.duration_type == 'days':
for emp in self.employee_ids:
if emp.date_to >= fields.Date.today() >= emp.date_from:
emp.employee_id.write({'work_state': self.mission_type.work_state, 'active_mission_id': emp.id})
emp.employee_id.write(
{'work_state': self.mission_type.work_state, 'active_mission_id': emp.id})
self.call_cron_function()
else:
raise exceptions.Warning(_('Training Cost Must be Bigger than Zero'))
else:
res = super(HrOfficialMission, self).approve()
return res