[NEW] hr_expense_analytic_account_preselect_with_project: new module

This commit is contained in:
clementthomas
2023-06-22 14:28:18 +02:00
parent 81010e0145
commit 0e80defb81
7 changed files with 111 additions and 0 deletions

View File

@@ -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 <https://github.com/elabore-coop/hr-tools/issues>`_. 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.

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -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,
}

View File

@@ -0,0 +1 @@
This directory should contain the *.po for Odoo translation.

View File

@@ -0,0 +1 @@
from . import hr_expense

View File

@@ -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

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="hr_expense_view_form_analytic_account_preselect_with_project" model="ir.ui.view">
<field name="name">hr.expense.view.form.analytic.account.preselect.with.project</field>
<field name="model">hr.expense</field>
<field name="inherit_id" ref="hr_expense.hr_expense_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='analytic_account_id']" position="before">
<field name="project_id" />
</xpath>
</field>
</record>
</odoo>