Files
odoo_source/addons/hr_expense/models/res_config_settings.py
T
Thomas Carlier 4eeeb4f172 [ADD] hr_expense : add the ability to install OCR module
- if checked in settings, OCR can be used to get infos from the attached receipt image

- set default product to EXP_GEN when created from picture

- use "register_as_main attachment" when expenses are created from receipt images

- Add the upload button to the kanban view to see it immediately in the mobile version
  and use it to create expenses from pictures. (with or without OCR installed)

closes odoo/odoo#39559

Related: odoo/enterprise#6493
Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
2020-01-28 14:41:37 +00:00

35 lines
1.3 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')
module_hr_expense_extract = fields.Boolean(string='Send bills to OCR to generate expenses')
expense_extract_show_ocr_option_selection = fields.Selection(related='company_id.expense_extract_show_ocr_option_selection',
string='Expense processing option', readonly=False)
@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