summaryrefslogtreecommitdiff
path: root/hr_employee_updation/models/updation_config.py
blob: 34a958da2c85c6f50df2d8e501c2750fe14ecfcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import fields, models, api


class JournalConfig(models.TransientModel):
    _inherit = ['res.config.settings']

    notice_period = fields.Boolean(string='Notice Period')
    no_of_days = fields.Integer()

    def set_values(self):
        super(JournalConfig, self).set_values()
        self.env['ir.config_parameter'].sudo().set_param("hr_resignation.notice_period",
                                                         self.notice_period)
        self.env['ir.config_parameter'].sudo().set_param("hr_resignation.no_of_days",
                                                         self.no_of_days)

    @api.model
    def get_values(self):
        res = super(JournalConfig, self).get_values()
        get_param = self.env['ir.config_parameter'].sudo().get_param
        res['notice_period'] = get_param('hr_resignation.notice_period')
        res['no_of_days'] = int(get_param('hr_resignation.no_of_days'))
        return res

    # @api.onchange('service_expense_journal')
    # def onchange_accounts(self):
    #     self.service_credit_account = self.service_expense_journal.default_credit_account_id.id
    #     self.service_debit_account = self.service_expense_journal.default_debit_account_id.id