From 0e80defb81e1c025e27ffa4db00e3e88c3505b3d Mon Sep 17 00:00:00 2001 From: clementthomas Date: Thu, 22 Jun 2023 14:28:18 +0200 Subject: [PATCH] [NEW] hr_expense_analytic_account_preselect_with_project: new module --- .../README.rst | 43 +++++++++++++++++++ .../__init__.py | 3 ++ .../__manifest__.py | 37 ++++++++++++++++ .../i18n/README | 1 + .../models/__init__.py | 1 + .../models/hr_expense.py | 13 ++++++ .../views/hr_expense_views.xml | 13 ++++++ 7 files changed, 111 insertions(+) create mode 100644 hr_expense_analytic_account_preselect_with_project/README.rst create mode 100644 hr_expense_analytic_account_preselect_with_project/__init__.py create mode 100644 hr_expense_analytic_account_preselect_with_project/__manifest__.py create mode 100644 hr_expense_analytic_account_preselect_with_project/i18n/README create mode 100644 hr_expense_analytic_account_preselect_with_project/models/__init__.py create mode 100644 hr_expense_analytic_account_preselect_with_project/models/hr_expense.py create mode 100644 hr_expense_analytic_account_preselect_with_project/views/hr_expense_views.xml diff --git a/hr_expense_analytic_account_preselect_with_project/README.rst b/hr_expense_analytic_account_preselect_with_project/README.rst new file mode 100644 index 0000000..40e4375 --- /dev/null +++ b/hr_expense_analytic_account_preselect_with_project/README.rst @@ -0,0 +1,43 @@ +============================== +hr_expense_analytic_account_preselect_with_project +============================== + +In expenses, preselect analytic account with project + +Installation +============ + +Use Odoo normal module installation procedure to install +``hr_expense_analytic_account_preselect_with_project``. + +Known issues / Roadmap +====================== + +None yet. +Bug Tracker +=========== + +Bugs are tracked on `our issues website `_. In case of +trouble, please check there if your issue has already been +reported. If you spotted it first, help us smashing it by providing a +detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Clément Thomas + +Funders +------- + +The development of this module has been financially supported by: +* Elabore (https://elabore.coop) + + +Maintainer +---------- + +This module is maintained by Elabore. diff --git a/hr_expense_analytic_account_preselect_with_project/__init__.py b/hr_expense_analytic_account_preselect_with_project/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/hr_expense_analytic_account_preselect_with_project/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/hr_expense_analytic_account_preselect_with_project/__manifest__.py b/hr_expense_analytic_account_preselect_with_project/__manifest__.py new file mode 100644 index 0000000..4ac64da --- /dev/null +++ b/hr_expense_analytic_account_preselect_with_project/__manifest__.py @@ -0,0 +1,37 @@ +# Copyright 2023 Stéphan Sainléger (Elabore) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "hr_expense_analytic_account_preselect_with_project", + "version": "14.0.0.0.0", + "author": "Elabore", + "website": "https://elabore.coop", + "maintainer": "Clément Thomas", + "license": "AGPL-3", + "category": "Tools", + "summary": "Provide indication that attendance are effectively worked periods or not", + # any module necessary for this one to work correctly + "depends": [ + "base", + "hr_expense", + ], + "qweb": [ + # "static/src/xml/*.xml", + ], + "external_dependencies": { + "python": [], + }, + # always loaded + "data": [ + "views/hr_expense_views.xml", + ], + # only loaded in demonstration mode + "demo": [], + "js": [], + "css": [], + "installable": True, + # Install this module automatically if all dependency have been previously + # and independently installed. Used for synergetic or glue modules. + "auto_install": False, + "application": False, +} \ No newline at end of file diff --git a/hr_expense_analytic_account_preselect_with_project/i18n/README b/hr_expense_analytic_account_preselect_with_project/i18n/README new file mode 100644 index 0000000..62197a1 --- /dev/null +++ b/hr_expense_analytic_account_preselect_with_project/i18n/README @@ -0,0 +1 @@ +This directory should contain the *.po for Odoo translation. diff --git a/hr_expense_analytic_account_preselect_with_project/models/__init__.py b/hr_expense_analytic_account_preselect_with_project/models/__init__.py new file mode 100644 index 0000000..c51cc08 --- /dev/null +++ b/hr_expense_analytic_account_preselect_with_project/models/__init__.py @@ -0,0 +1 @@ +from . import hr_expense \ No newline at end of file diff --git a/hr_expense_analytic_account_preselect_with_project/models/hr_expense.py b/hr_expense_analytic_account_preselect_with_project/models/hr_expense.py new file mode 100644 index 0000000..d369f13 --- /dev/null +++ b/hr_expense_analytic_account_preselect_with_project/models/hr_expense.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from odoo import fields, models, api + +class HrExpense(models.Model): + _inherit = "hr.expense" + + project_id = fields.Many2one('project.project') + + @api.onchange('project_id') + def set_analytic_account(self): + self.analytic_account_id = self.project_id.analytic_account_id + \ No newline at end of file diff --git a/hr_expense_analytic_account_preselect_with_project/views/hr_expense_views.xml b/hr_expense_analytic_account_preselect_with_project/views/hr_expense_views.xml new file mode 100644 index 0000000..3f705e3 --- /dev/null +++ b/hr_expense_analytic_account_preselect_with_project/views/hr_expense_views.xml @@ -0,0 +1,13 @@ + + + + hr.expense.view.form.analytic.account.preselect.with.project + hr.expense + + + + + + + + \ No newline at end of file