Skip to content
Permalink
Browse files

[IMP]hr_contract: Move hr_responsible in hr_contract

Move hr_responsible from hr_contract_salary (enterprise) to
hr_contract (community)
  • Loading branch information...
jbm-odoo committed Feb 26, 2019
1 parent 940f1c0 commit 2c622af5b8f327cba802a9b6114b632219f8a7a6
@@ -98,6 +98,8 @@ class Contract(models.Model):
visa_expire = fields.Date('Visa Expire Date', related="employee_id.visa_expire", readonly=False)
reported_to_secretariat = fields.Boolean('Social Secretariat',
help='Green this button when the contract information has been transfered to the social secretariat.')
hr_responsible_id = fields.Many2one('res.users', 'HR Responsible', tracking=True,
help='Person responsible of validating the employee\'s contracts.')

def _expand_states(self, states, domain, order):
return [key for key, val in type(self).state.selection]
@@ -133,6 +133,7 @@
</div>
<field name="trial_date_end"/>
<field name="resource_calendar_id"/>
<field name="hr_responsible_id"/>
</group>
</group>
<group string="Notes">
@@ -24,7 +24,7 @@ class HrContract(models.Model):
hours_per_week = fields.Float(related='resource_calendar_id.hours_per_week')
full_time_required_hours = fields.Float(related='resource_calendar_id.full_time_required_hours')
is_fulltime = fields.Boolean(related='resource_calendar_id.is_fulltime')
work_time_rate = fields.Float(string='Work time rate', related='resource_calendar_id.work_time_rate', help='Work time rate versus full time working schedule. Should be between 0 and 100 %.')
work_time_rate = fields.Float(string='Work time rate', related='resource_calendar_id.work_time_rate', help='Work time rate versus full time working schedule, should be between 0 and 100 %.')


@api.constrains('date_start', 'date_end', 'state')
@@ -13,7 +13,7 @@ class ResourceCalendar(models.Model):
hours_per_week = fields.Float(compute="_compute_hours_per_week", string="Hours per Week")
full_time_required_hours = fields.Float(string="Fulltime Hours", help="Number of hours to work to be considered as fulltime.")
is_fulltime = fields.Boolean(compute='_compute_is_fulltime', string="Is Full Time")
work_time_rate = fields.Float(string='Work time rate', compute='_compute_work_time_rate', help='Work time rate versus full time working schedule. Should be between 0 and 100 %.')
work_time_rate = fields.Float(string='Work time rate', compute='_compute_work_time_rate', help='Work time rate versus full time working schedule, should be between 0 and 100 %.')

# UI fields
normal_attendance_ids = fields.One2many(
@@ -73,7 +73,7 @@ class HrContract(models.Model):
ip = fields.Boolean(default=False, tracking=True)
ip_wage_rate = fields.Float(string="IP percentage", help="Should be between 0 and 100 %")

time_credit = fields.Boolean('Time credit', help='This contract is a time credit contract')
time_credit = fields.Boolean('Credit time', help='This contract is a credit time contract')

@api.constrains('ip_wage_rate')
def _check_ip_wage_rate(self):
@@ -10,20 +10,20 @@

class L10nBeHrPayrollCreditTime(models.TransientModel):
_name = 'l10n_be.hr.payroll.credit.time.wizard'
_description = 'Manage Belgian Time Credit'
_description = 'Manage Belgian Credit Time'

contract_id = fields.Many2one('hr.contract', string='Contract', default=lambda self: self.env.context.get('active_id'))
date_start = fields.Date('Start Time Credit Contract', help="Start date of the time credit contract.", required=True)
date_end = fields.Date('End Time Credit Contract', required=True,
help="Last day included of the time credit contract (if it's a fixed-term contract or parental leave).")
date_start = fields.Date('Start Credit Time Contract', help="Start date of the credit time contract.", required=True)
date_end = fields.Date('End Credit Time Contract', required=True,
help="Last day included of the credit time contract (if it's a fixed-term contract or parental leave).")

resource_calendar_id = fields.Many2one(
'resource.calendar', 'New Working Schedule',
default=lambda self: self.env['res.company']._company_default_get().resource_calendar_id.id)
wage = fields.Monetary('New Wage', digits=(16, 2), required=True, help="Employee's monthly gross wage in time credit.")
wage = fields.Monetary('New Wage', digits=(16, 2), required=True, help="Employee's monthly gross wage in credit time.")
currency_id = fields.Many2one(string="Currency", related='contract_id.company_id.currency_id', readonly=True)

work_time = fields.Float(string='Work time rate', related='resource_calendar_id.work_time_rate', help='Work time rate versus full time working schedule. Should be between 0 and 100 %.')
work_time = fields.Float(string='Work time rate', related='resource_calendar_id.work_time_rate', help='Work time rate versus full time working schedule, should be between 0 and 100 %.')

@api.onchange('work_time')
def _onchange_work_time(self):
@@ -33,12 +33,12 @@ def validate_credit_time(self):
if self.date_start > self.date_end:
raise ValidationError(_('Start date must be earlier than end date.'))
if self.contract_id.date_end and self.contract_id.date_end < self.date_start:
raise ValidationError(_('Current contract is finish before the start of time credit period.'))
raise ValidationError(_('Current contract is finish before the start of credit time period.'))
if self.contract_id.date_end and self.contract_id.date_end < self.date_end:
raise ValidationError(_('Current contract is finish before the end of time credit period.'))
raise ValidationError(_('Current contract is finish before the end of credit time period.'))

credit_time_contract = self.contract_id.copy({
'name': _('%s - Time Credit') % (self.contract_id.name),
'name': _('%s - Credit Time') % (self.contract_id.name),
'date_start': self.date_start,
'date_end': self.date_end,
'wage_with_holidays': self.wage,
@@ -51,7 +51,7 @@ def validate_credit_time(self):
self.contract_id.date_end = self.date_start + timedelta(days=-1)

return {
'name': _('Time credit contract'),
'name': _('Credit time contract'),
'domain': [('id', 'in', [credit_time_contract.id, self.contract_id.id])],
'view_type': 'form',
'res_model': 'hr.contract',

0 comments on commit 2c622af

Please sign in to comment.
You can’t perform that action at this time.