Skip to content

Commit

Permalink
Merge pull request #1537 from VoicuStefan2001/17.0-mig-deltatech_busi…
Browse files Browse the repository at this point in the history
…ness_process_documentation

[17.0][MIG] deltatech business process documentation
  • Loading branch information
VoicuStefan2001 authored Jul 5, 2024
2 parents 0bc6e8b + e7d0373 commit 3ec993e
Show file tree
Hide file tree
Showing 16 changed files with 854 additions and 0 deletions.
74 changes: 74 additions & 0 deletions deltatech_business_process_documentation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
==============================
Business process documentation
==============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e746bfee1fbe1c212af1a2c575931bae51e31786f9af2f5869323a09a75d8d05
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-OPL--1-blue.png
:target: https://www.odoo.com/documentation/master/legal/licenses.html
:alt: License: OPL-1
.. |badge3| image:: https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github
:target: https://github.com/dhongu/deltatech/tree/17.0/deltatech_business_process_documentation
:alt: dhongu/deltatech

|badge1| |badge2| |badge3|

Features:
---------

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `Terrabit Issues <https://www.terrabit.ro/helpdesk>`_.
In case of trouble, please check there if your issue has already been reported.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Terrabit
* Nexterp
* Fekete Mihai

Contributors
------------

- `NextERP Romania <https://www.nexterp.ro>`__:

- Fekete Mihai <[email protected]>

Do not contact contributors directly about support or help with
technical issues.

Maintainers
-----------

.. |maintainer-dhongu| image:: https://github.com/dhongu.png?size=40px
:target: https://github.com/dhongu
:alt: dhongu

Current maintainer:

|maintainer-dhongu|

This module is part of the `dhongu/deltatech <https://github.com/dhongu/deltatech/tree/17.0/deltatech_business_process_documentation>`_ project on GitHub.

You are welcome to contribute.
5 changes: 5 additions & 0 deletions deltatech_business_process_documentation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# © 2023 Deltatech
# See README.rst file on addons root folder for license details


from . import models
21 changes: 21 additions & 0 deletions deltatech_business_process_documentation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# © 2023 Deltatech
# See README.rst file on addons root folder for license details


{
"name": "Business process documentation",
"summary": "Business process documentation",
"version": "17.0.1.0.5",
"author": "Terrabit, Nexterp, Fekete Mihai",
"website": "https://www.terrabit.ro",
"license": "OPL-1",
"category": "Generic Modules/Other",
"depends": ["deltatech_business_process", "website_slides"],
"data": [
"views/business_project_view.xml",
"views/templates.xml",
],
"development_status": "Beta",
"maintainers": ["dhongu"],
"application": True,
}
57 changes: 57 additions & 0 deletions deltatech_business_process_documentation/i18n/ro.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * deltatech_business_process_documentation
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-17 10:35+0000\n"
"PO-Revision-Date: 2024-05-17 10:35+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: deltatech_business_process_documentation
#: model:ir.model.fields,field_description:deltatech_business_process_documentation.field_business_project__auto_generate_doc
msgid "Auto generate documentation"
msgstr "Generare automată documentație"

#. module: deltatech_business_process_documentation
#: model:ir.model,name:deltatech_business_process_documentation.model_business_process
msgid "Business process"
msgstr "Proces afaceri"

#. module: deltatech_business_process_documentation
#: model:ir.model,name:deltatech_business_process_documentation.model_business_project
msgid "Business project"
msgstr "Proiect afaceri"

#. module: deltatech_business_process_documentation
#: model:ir.model.fields,field_description:deltatech_business_process_documentation.field_business_project__channel_id
msgid "Channel"
msgstr "Canal"

#. module: deltatech_business_process_documentation
#: model_terms:ir.ui.view,arch_db:deltatech_business_process_documentation.business_process_documentation
msgid "Description"
msgstr "Descriere"

#. module: deltatech_business_process_documentation
#: model:ir.model.fields,field_description:deltatech_business_process_documentation.field_business_process__slide_id
msgid "Slide"
msgstr ""

#. module: deltatech_business_process_documentation
#: model_terms:ir.ui.view,arch_db:deltatech_business_process_documentation.business_process_documentation
msgid "Steps"
msgstr "Pași"

#. module: deltatech_business_process_documentation
#: model:ir.model.fields,field_description:deltatech_business_process_documentation.field_business_process__website_published
#: model:ir.model.fields,field_description:deltatech_business_process_documentation.field_business_project__website_published
msgid "Visible on current website"
msgstr "Vizibil pe site-ul curent"
5 changes: 5 additions & 0 deletions deltatech_business_process_documentation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# © 2023 Deltatech
# See README.rst file on addons root folder for license details

from . import business_process
from . import business_project
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# © 2023 Deltatech
# See README.rst file on addons root folder for license details

from odoo import fields, models


class BusinessProcess(models.Model):
_inherit = "business.process"

slide_id = fields.Many2one(string="Slide", comodel_name="slide.slide")
website_published = fields.Boolean(related="slide_id.website_published", store=True)

def write(self, vals):
result = super().write(vals)
self.generate_documentation()
return result

def generate_documentation(self):
for process in self:
if process.project_id.auto_generate_doc:
if not process.slide_id:
values = process._prepare_slide_values()
slide = self.env["slide.slide"].create(values)
process.slide_id = slide.id
if process.slide_id:
process.generate_documentation_from_steps()

def _prepare_slide_values(self):
tags = self.env["slide.tag"]
if self.process_group_id:
tags = self.env["slide.tag"].search([("name", "=", self.process_group_id.name)])
if not tags:
tags = self.env["slide.tag"].create({"name": self.process_group_id.name})
values = {
"name": self.name,
"channel_id": self.project_id.channel_id.id,
"active": True,
"slide_category": "article",
"website_published": True,
"tag_ids": [(6, 0, tags.ids)],
}
return values

def generate_documentation_from_steps(self):
for process in self:
# rendare template
template = "deltatech_business_process_documentation.business_process_documentation"
html_content = self.env["ir.ui.view"]._render_template(template, values={"doc": process})
process.slide_id.html_content = html_content
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# © 2023 Deltatech
# See README.rst file on addons root folder for license details

from odoo import fields, models


class BusinessProject(models.Model):
_inherit = "business.project"

auto_generate_doc = fields.Boolean(string="Auto generate documentation", default=False)
channel_id = fields.Many2one(string="Channel", comodel_name="slide.channel")
website_published = fields.Boolean(related="channel_id.website_published", store=True)

def write(self, vals):
result = super().write(vals)
self._generate_documentation()
return result

def _generate_documentation(self):
for project in self:
if project.auto_generate_doc:
project._generate_documentation_for_project()
else:
project._remove_documentation_for_project()

def _generate_documentation_for_project(self):
for project in self:
if not project.channel_id:
values = project._prepare_channel_values()
channel = self.env["slide.channel"].create(values)
project.channel_id = channel.id
if project.channel_id:
project.generate_documentation()

def _remove_documentation_for_project(self):
for project in self:
if project.channel_id:
project.channel_id.slide_ids.unlink()
project.channel_id.unlink()

def _prepare_channel_values(self):
values = {
"name": self.name,
"channel_type": "documentation",
"visibility": "members",
"enroll": "invite",
"active": True,
"website_published": True,
}
return values

def generate_documentation(self):
for project in self:
for process in project.process_ids:
process.generate_documentation()
3 changes: 3 additions & 0 deletions deltatech_business_process_documentation/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [NextERP Romania](https://www.nexterp.ro):
- Fekete Mihai \<<[email protected]>\>

Do not contact contributors directly about support or help with technical issues.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Features:

-
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3ec993e

Please sign in to comment.