-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
21 changed files
with
853 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
=================================== | ||
HR Timesheet Predefined Description | ||
=================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:fccad56802cca66a08690e8b5d366ea9f87aece7ef61a6cb27593287378ab4c9 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ftimesheet-lightgray.png?logo=github | ||
:target: https://github.com/OCA/timesheet/tree/14.0/hr_timesheet_predefined_description | ||
:alt: OCA/timesheet | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/timesheet-14-0/timesheet-14-0-hr_timesheet_predefined_description | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/timesheet&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows you to manage predefined descriptions for timesheets in Odoo. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
**Add Predefined Descriptions:** | ||
|
||
#. Go to *Timesheets* > *Configuration* > *Predefined Descriptions*. | ||
#. Click on *Create*. | ||
#. Enter the description name. | ||
#. In a multi-company environment, check the company visibility. | ||
#. Save. | ||
|
||
**Modify Predefined Descriptions:** | ||
|
||
#. Go to *Timesheets* > *Configuration* > *Predefined Descriptions*. | ||
#. Click on an existing description. | ||
#. Type the new description. | ||
|
||
NOTE: These changes are not retro-actively applied to existing timesheets. | ||
|
||
Usage | ||
===== | ||
|
||
**Create and Select Predefined Descriptions:** | ||
|
||
#. When entering or editing a timesheet, simply select a predefined description from the | ||
Predefined Description dropdown. | ||
#. The Description field will be automatically filled based on the selected predefined | ||
description. | ||
|
||
**Override Descriptions if Necessary:** | ||
|
||
#. You can manually edit the description in the timesheet if needed. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/timesheet/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/timesheet/issues/new?body=module:%20hr_timesheet_predefined_description%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Juan José Seguí | ||
* Pedro M. Baeza | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
.. |maintainer-juanjosesegui-tecnativa| image:: https://github.com/juanjosesegui-tecnativa.png?size=40px | ||
:target: https://github.com/juanjosesegui-tecnativa | ||
:alt: juanjosesegui-tecnativa | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-juanjosesegui-tecnativa| | ||
|
||
This module is part of the `OCA/timesheet <https://github.com/OCA/timesheet/tree/14.0/hr_timesheet_predefined_description>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2024 Tecnativa - Juan José Seguí | ||
# Copyright 2024 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "HR Timesheet Predefined Description", | ||
"version": "14.0.1.0.0", | ||
"category": "Timesheet", | ||
"summary": "Predefined descriptions for timesheet entries", | ||
"license": "AGPL-3", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/timesheet", | ||
"installable": True, | ||
"auto_install": False, | ||
"depends": ["hr_timesheet"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"security/timesheet_predefined_description_security.xml", | ||
"views/account_analytic_line_views.xml", | ||
"views/timesheet_predefined_description_views.xml", | ||
], | ||
"demo": [ | ||
"demo/hr_timesheet_predefined_description_demo.xml", | ||
], | ||
"maintainers": ["juanjosesegui-tecnativa"], | ||
} |
28 changes: 28 additions & 0 deletions
28
hr_timesheet_predefined_description/demo/hr_timesheet_predefined_description_demo.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<data noupdate="1"> | ||
<!-- Predefined Description 1 --> | ||
<record | ||
id="timesheet_predefined_description_1" | ||
model="timesheet.predefined.description" | ||
> | ||
<field name="name">Development Task</field> | ||
</record> | ||
|
||
<!-- Predefined Description 2 --> | ||
<record | ||
id="timesheet_predefined_description_2" | ||
model="timesheet.predefined.description" | ||
> | ||
<field name="name">Bug Fixing</field> | ||
</record> | ||
|
||
<!-- Predefined Description 3 --> | ||
<record | ||
id="timesheet_predefined_description_3" | ||
model="timesheet.predefined.description" | ||
> | ||
<field name="name">Meeting with Client</field> | ||
</record> | ||
</data> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import hr_timesheet_predefined_description | ||
from . import account_analytic_line |
39 changes: 39 additions & 0 deletions
39
hr_timesheet_predefined_description/models/account_analytic_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2024 Tecnativa - Juan José Seguí | ||
# Copyright 2024 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountAnalyticLine(models.Model): | ||
_inherit = "account.analytic.line" | ||
|
||
predefined_description_id = fields.Many2one( | ||
comodel_name="timesheet.predefined.description", string="Predefined Description" | ||
) | ||
|
||
@api.model | ||
def _adjust_name_from_predefined_description(self, vals): | ||
"""Set description on the analytic line if no valid description is provided in | ||
the dictionary vals and there's a predefined description. | ||
""" | ||
if "predefined_description_id" in vals and (vals.get("name") or "/") == "/": | ||
description = self.env["timesheet.predefined.description"].browse( | ||
vals["predefined_description_id"] | ||
) | ||
vals["name"] = description.name | ||
|
||
@api.model_create_multi | ||
def create(self, vals_list): | ||
for vals in vals_list: | ||
self._adjust_name_from_predefined_description(vals) | ||
return super().create(vals_list) | ||
|
||
def write(self, vals): | ||
self._adjust_name_from_predefined_description(vals) | ||
return super().write(vals) | ||
|
||
@api.onchange("predefined_description_id") | ||
def _onchange_predefined_description(self): | ||
if self.predefined_description_id: | ||
self.name = self.predefined_description_id.name |
16 changes: 16 additions & 0 deletions
16
hr_timesheet_predefined_description/models/hr_timesheet_predefined_description.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 Tecnativa - Juan José Seguí | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class TimesheetPredefinedDescription(models.Model): | ||
_name = "timesheet.predefined.description" | ||
_description = "Predefined Description for Timesheets" | ||
|
||
name = fields.Char(string="Description", required=True) | ||
company_id = fields.Many2one( | ||
comodel_name="res.company", | ||
string="Company", | ||
default=lambda self: self.env.company, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
**Add Predefined Descriptions:** | ||
|
||
#. Go to *Timesheets* > *Configuration* > *Predefined Descriptions*. | ||
#. Click on *Create*. | ||
#. Enter the description name. | ||
#. In a multi-company environment, check the company visibility. | ||
#. Save. | ||
|
||
**Modify Predefined Descriptions:** | ||
|
||
#. Go to *Timesheets* > *Configuration* > *Predefined Descriptions*. | ||
#. Click on an existing description. | ||
#. Type the new description. | ||
|
||
NOTE: These changes are not retro-actively applied to existing timesheets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Juan José Seguí | ||
* Pedro M. Baeza |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows you to manage predefined descriptions for timesheets in Odoo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
**Create and Select Predefined Descriptions:** | ||
|
||
#. When entering or editing a timesheet, simply select a predefined description from the | ||
Predefined Description dropdown. | ||
#. The Description field will be automatically filled based on the selected predefined | ||
description. | ||
|
||
**Override Descriptions if Necessary:** | ||
|
||
#. You can manually edit the description in the timesheet if needed. |
3 changes: 3 additions & 0 deletions
3
hr_timesheet_predefined_description/security/ir.model.access.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_timesheet_predefined_description_user,timesheet.predefined.description.user,model_timesheet_predefined_description,hr_timesheet.group_hr_timesheet_user,1,0,0,0 | ||
access_timesheet_predefined_description_admin,timesheet.predefined.description.admin,model_timesheet_predefined_description,hr_timesheet.group_timesheet_manager,1,1,1,1 |
8 changes: 8 additions & 0 deletions
8
hr_timesheet_predefined_description/security/timesheet_predefined_description_security.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<odoo> | ||
<record id="timesheet_predefined_description_rule" model="ir.rule"> | ||
<field name="name">Predefined Descriptions: multi-company access</field> | ||
<field name="model_id" ref="model_timesheet_predefined_description" /> | ||
<field name="global" eval="True" /> | ||
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field> | ||
</record> | ||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.