[NEW] pad_hedgedoc_tasks: create addon

This commit is contained in:
Stéphan Sainléger
2022-08-09 23:03:43 +02:00
parent 0606229cb5
commit a6d16036ef
11 changed files with 259 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,83 @@
# Copyright 2021 Elabore ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Pad Hedgedoc Tasks",
"version": "12.0.1.0.0",
"author": "Elabore",
"maintainer": "False",
"website": "False",
"license": "AGPL-3",
"category": "False",
"summary": "Add hedgedoc pad to Project tasks",
"description": """
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
===============
Pad Hedgedoc Tasks
===============
Add hedgedoc pad to Project tasks
Installation
============
Just install Pad Hedgedoc Tasks, all dependencies will be installed by default.
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/elabore-coop/pad-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
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Stéphan Sainléger <https://github.com/stephansainleger>
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by ELABORE.
""",
# any module necessary for this one to work correctly
"depends": [
"base",
"pad_hedgedoc_connector",
"project",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"security/ir.model.access.csv",
"views/project_task.xml",
"wizard/create_pad.xml",
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"qweb": [],
"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,79 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pad_hedgedoc_tasks
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-10 06:26+0000\n"
"PO-Revision-Date: 2022-08-10 06:26+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: pad_hedgedoc_tasks
#: code:addons/pad_hedgedoc_tasks/models/hedgedoc_pad.py:0
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_hedgedoc_pad__task_id
#, python-format
msgid "Associated task"
msgstr "Tâche associée"
#. module: pad_hedgedoc_tasks
#: model:ir.model,name:pad_hedgedoc_tasks.model_create_hedgedoc_pad_wizard
msgid "Create a Hedgedoc Pad"
msgstr "Créer un pad Hedgedoc"
#. module: pad_hedgedoc_tasks
#: model_terms:ir.ui.view,arch_db:pad_hedgedoc_tasks.view_task_form2_hedgedoc
msgid "Create a pad"
msgstr "Créer un pad"
#. module: pad_hedgedoc_tasks
#: model_terms:ir.ui.view,arch_db:pad_hedgedoc_tasks.view_task_form2_hedgedoc
msgid "Current linked pads"
msgstr "Pads liés"
#. module: pad_hedgedoc_tasks
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_create_hedgedoc_pad_wizard__display_name
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_hedgedoc_pad__display_name
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_project_task__display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: pad_hedgedoc_tasks
#: model:ir.model,name:pad_hedgedoc_tasks.model_hedgedoc_pad
msgid "Hedgedoc Pad"
msgstr "Pad Hedgedoc"
#. module: pad_hedgedoc_tasks
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_project_task__hedgedoc_pads
msgid "Hedgedoc Pads"
msgstr "Pads Hedgedoc"
#. module: pad_hedgedoc_tasks
#: model_terms:ir.ui.view,arch_db:pad_hedgedoc_tasks.view_task_form2_hedgedoc
msgid "Hedgedoc pads"
msgstr "Pads Hedgedoc"
#. module: pad_hedgedoc_tasks
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_create_hedgedoc_pad_wizard__id
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_hedgedoc_pad__id
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_project_task__id
msgid "ID"
msgstr "ID"
#. module: pad_hedgedoc_tasks
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_create_hedgedoc_pad_wizard____last_update
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_hedgedoc_pad____last_update
#: model:ir.model.fields,field_description:pad_hedgedoc_tasks.field_project_task____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: pad_hedgedoc_tasks
#: model:ir.model,name:pad_hedgedoc_tasks.model_project_task
msgid "Task"
msgstr "Tâche"

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import project_task
from . import hedgedoc_pad

View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, _
class TaskHedgedocPad(models.Model):
_name = "task.hedgedoc.pad"
_inherit = "hedgedoc.pad"
task_id = fields.Many2one("project.task", string=_("Associated task"), copy=True)

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class Task(models.Model):
_inherit = "project.task"
task_hedgedoc_pads = fields.One2many("task.hedgedoc.pad", "task_id")
def create_hedgedoc_pad(self):
return {
"name": "Create a Hedgedoc pad",
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "create.hedgedoc.pad.wizard",
"target": "new",
"context": {'default_task_id': self.id},
}

View File

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_task_hedgedoc_pad_user,task.hedgedoc.pad.user,pad_hedgedoc_tasks.model_task_hedgedoc_pad,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_task_hedgedoc_pad_user task.hedgedoc.pad.user pad_hedgedoc_tasks.model_task_hedgedoc_pad base.group_user 1 1 1 1

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_task_form2_hedgedoc" model="ir.ui.view">
<field name="name">project.task.form.hedgedoc</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2" />
<field name="priority" eval="99" />
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page name="hedgedoc_pads" string="Hedgedoc pads">
<button string="Create a pad" name="create_hedgedoc_pad" type="object" class="oe_stat_button" icon="fa-plus-circle" style="margin: 0px 4px 0px 0px" />
<separator string="Current linked pads" />
<field name="task_hedgedoc_pads" nolabel="1" mode="tree">
<tree create="0" delete="1">
<field name="name" />
<field name="url" widget="url" />
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>

View File

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

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class CreateHedgedocPadWizard(models.TransientModel):
_inherit = "create.hedgedoc.pad.wizard"
task_id = fields.Many2one('project.task', string='Task')
def _compute_pad_values(self):
values = super(CreateHedgedocPadWizard, self)._compute_pad_values()
values["task_id"] = self.task_id.id
return values
def create_hedgedoc_pad(self):
values = self._compute_pad_values()
self.env["task.hedgedoc.pad"].create(values)
return super(CreateHedgedocPadWizard, self).create_hedgedoc_pad()

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="create_hedgedoc_pad_wizard_task_inherit" model="ir.ui.view">
<field name="name">create.hedgedoc.pad.wizard.task.inherit</field>
<field name="model">create.hedgedoc.pad.wizard</field>
<field name="inherit_id" ref="pad_hedgedoc_connector.create_hedgedoc_pad_wizard" />
<field name="arch" type="xml">
<xpath expr="//field[@name='pad_name']" position="after">
<field name="task_id" invisible="1" />
</xpath>
</field>
</record>
</odoo>