diff --git a/timesheet_description/__init__.py b/timesheet_description/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/timesheet_description/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/timesheet_description/__manifest__.py b/timesheet_description/__manifest__.py new file mode 100644 index 00000000..339043f7 --- /dev/null +++ b/timesheet_description/__manifest__.py @@ -0,0 +1,24 @@ +{ + 'name': 'Timesheet Description', + 'version': '18.0.1.0.0', + 'author': 'Hibou Corp. ', + 'website': 'https://hibou.io/', + 'license': 'AGPL-3', + 'category': 'Tools', + 'complexity': 'easy', + 'description': """ +Timesheet entries will be made in a form view, allowing the end user to enter more descriptive timesheet entries. + +Optionally, allows you to display your timesheet entries in markdown on the front end of the website. + """, + 'depends': [ + 'project', + 'hr_timesheet', + ], + 'data': [ + 'views/project_templates.xml', + 'views/timesheet_views.xml', + ], + 'installable': True, + 'auto_install': False, +} diff --git a/timesheet_description/models/__init__.py b/timesheet_description/models/__init__.py new file mode 100644 index 00000000..1b7bb1fb --- /dev/null +++ b/timesheet_description/models/__init__.py @@ -0,0 +1 @@ +from . import timesheet diff --git a/timesheet_description/models/timesheet.py b/timesheet_description/models/timesheet.py new file mode 100644 index 00000000..30b71e43 --- /dev/null +++ b/timesheet_description/models/timesheet.py @@ -0,0 +1,22 @@ +try: + from markdown import markdown +except ImportError: + markdown = None + +from odoo import api, fields, models + + +class AnalyticLine(models.Model): + _inherit = 'account.analytic.line' + + name_markdown = fields.Html(compute='_compute_name_markdown') + + def _compute_name_markdown(self): + if not markdown: + for line in self: + # Why not just name? Because it needs to be escaped. + # Use nothing to indicate that it shouldn't be used. + line.name_markdown = '' + else: + for line in self: + line.name_markdown = markdown(line.name) diff --git a/timesheet_description/views/project_templates.xml b/timesheet_description/views/project_templates.xml new file mode 100644 index 00000000..d691233c --- /dev/null +++ b/timesheet_description/views/project_templates.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/timesheet_description/views/timesheet_views.xml b/timesheet_description/views/timesheet_views.xml new file mode 100644 index 00000000..6cc8f692 --- /dev/null +++ b/timesheet_description/views/timesheet_views.xml @@ -0,0 +1,29 @@ + + + + project.task.form.inherit + project.task + + + + + + + text + Describe your activity (you can use markdown) + 2 + + + + + + account.analytic.line.tree.hr_timesheet.inherit + account.analytic.line + + + + + + + + \ No newline at end of file