diff --git a/hr_expense_usability_akretion/__init__.py b/hr_expense_usability_akretion/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/hr_expense_usability_akretion/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/hr_expense_usability_akretion/__manifest__.py b/hr_expense_usability_akretion/__manifest__.py new file mode 100644 index 0000000..2898702 --- /dev/null +++ b/hr_expense_usability_akretion/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2025 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'HR Expense Usability by Akretion', + 'version': '16.0.1.0.0', + 'category': 'Human Resources/Expenses', + 'license': 'AGPL-3', + 'summary': 'Usability improvements on expenses', + 'description': """ +This module includes several small usability improvements to expenses. + +This module has been written by Alexis de Lattre from Akretion +. + """, + 'author': 'Akretion', + 'maintainers': ['alexis-via'], + 'website': 'https://github.com/akretion/odoo-usability', + 'depends': ['hr_expense'], + 'data': [], + 'installable': True, +} diff --git a/hr_expense_usability_akretion/models/__init__.py b/hr_expense_usability_akretion/models/__init__.py new file mode 100644 index 0000000..02264fd --- /dev/null +++ b/hr_expense_usability_akretion/models/__init__.py @@ -0,0 +1 @@ +from . import hr_expense_sheet diff --git a/hr_expense_usability_akretion/models/hr_expense_sheet.py b/hr_expense_usability_akretion/models/hr_expense_sheet.py new file mode 100644 index 0000000..28163dd --- /dev/null +++ b/hr_expense_usability_akretion/models/hr_expense_sheet.py @@ -0,0 +1,16 @@ +# Copyright 2025 Akretion France (https://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models, Command + + +class HrExpenseSheet(models.Model): + _inherit = "hr.expense.sheet" + + def _prepare_move_vals(self): + """Copy attachments from hr.expense.sheet to supplier invoice""" + vals = super()._prepare_move_vals() + if self.attachment_ids: + vals['attachment_ids'] = [Command.create({'res_model': 'account.move', 'name': attach.name, 'datas': attach.datas}) for attach in self.attachment_ids] + return vals