mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
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.
This commit is contained in:
1
timesheet_description/models/__init__.py
Normal file
1
timesheet_description/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import timesheet
|
||||
23
timesheet_description/models/timesheet.py
Normal file
23
timesheet_description/models/timesheet.py
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user