Impacted modules:
hr, hr_contract, hr_recruitment, hr_payroll, fleet, hr_skills, hr_appraisal, ....
Several onchanges have been converted to computed fields in the following modules :
Community :
- hr
- hr_contract
- hr_recruitment
- hr_work_entry
- hr_maintenance
- hr_expense
- hr_expense_check
- hr_holidays
- sale_expense
- account_analytic_default_hr_expense
Enterprise:
- hr_contract_salary
- hr_referral
- hr_payroll
- hr_payroll_expense
- test_l10n_be_hr_payroll_account
There are still 2 onchanges with complex behavior that couldn't be converted easily:
- an onchange that updates "tz" (timezone) that is defined as a related field
to "resource_id.tz". Apparently it is useless except to initialize the default
value of "tz".
- an onchange that updates "name" that is defined as a related field to
"resource_id.name".
the applicant.
closes odoo/odoo#45414
Taskid: 2169099
Related: odoo/enterprise#8572
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class ResConfigSettings(models.TransientModel):
|
|
_inherit = 'res.config.settings'
|
|
|
|
expense_alias_prefix = fields.Char('Default Alias Name for Expenses', compute='_compute_expense_alias_prefix',
|
|
store=True, readonly=False)
|
|
use_mailgateway = fields.Boolean(string='Let your employees record expenses by email',
|
|
config_parameter='hr_expense.use_mailgateway')
|
|
|
|
module_hr_payroll_expense = fields.Boolean(string='Reimburse Expenses in Payslip')
|
|
module_hr_expense_extract = fields.Boolean(string='Send bills to OCR to generate expenses')
|
|
|
|
|
|
@api.model
|
|
def get_values(self):
|
|
res = super(ResConfigSettings, self).get_values()
|
|
res.update(
|
|
expense_alias_prefix=self.env.ref('hr_expense.mail_alias_expense').alias_name,
|
|
)
|
|
return res
|
|
|
|
def set_values(self):
|
|
super(ResConfigSettings, self).set_values()
|
|
self.env.ref('hr_expense.mail_alias_expense').write({'alias_name': self.expense_alias_prefix})
|
|
|
|
@api.depends('use_mailgateway')
|
|
def _compute_expense_alias_prefix(self):
|
|
self.filtered(lambda w: not w.use_mailgateway).update({'expense_alias_prefix': False})
|