From 0fcea1037940d1af9eaca7fecc0f12bf707ab8a9 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Wed, 23 May 2018 11:47:37 -0700 Subject: [PATCH] Initial commit of `timesheet_description` and `timesheet_description_sale` for 11.0 -- Forces popup for timesheet (detail) and allows you to display them as Markdown in the portal. --- timesheet_description/__init__.py | 1 + timesheet_description/__manifest__.py | 24 ++++++++++ timesheet_description/models/__init__.py | 1 + timesheet_description/models/timesheet.py | 23 ++++++++++ .../views/project_templates.xml | 9 ++++ .../views/timesheet_views.xml | 46 +++++++++++++++++++ 6 files changed, 104 insertions(+) create mode 100644 timesheet_description/__init__.py create mode 100644 timesheet_description/__manifest__.py create mode 100644 timesheet_description/models/__init__.py create mode 100644 timesheet_description/models/timesheet.py create mode 100644 timesheet_description/views/project_templates.xml create mode 100644 timesheet_description/views/timesheet_views.xml 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..2bc871a1 --- /dev/null +++ b/timesheet_description/__manifest__.py @@ -0,0 +1,24 @@ +{ + 'name': 'Timesheet Description', + 'version': '11.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..30cd3401 --- /dev/null +++ b/timesheet_description/models/timesheet.py @@ -0,0 +1,23 @@ +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') + + @api.multi + 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..e2d78d0b --- /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..640a616a --- /dev/null +++ b/timesheet_description/views/timesheet_views.xml @@ -0,0 +1,46 @@ + + + + project.task.form.inherit + project.task + + + + {'default_project_id': project_id, 'default_task_id': active_id} + + + + + +
+ + + + + + + + + + + + + + + +
+
+
+
+ + + account.analytic.line.tree.hr_timesheet.inherit + account.analytic.line + + + + + + + +
\ No newline at end of file