Files
odoo_source/addons/hr_expense/models/res_config_settings.py
T
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00

31 lines
1.0 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')
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')
@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.onchange('use_mailgateway')
def _onchange_use_mailgateway(self):
if not self.use_mailgateway:
self.expense_alias_prefix = False