Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ addon | version | maintainers | summary
[partner_search_fuzzy](partner_search_fuzzy/) | 18.0.1.0.0 | <a href='https://github.com/ecino'><img src='https://github.com/ecino.png' width='32' height='32' style='border-radius:50%;' alt='ecino'/></a> | Add fuzzy search on partners
[partner_segmentation](partner_segmentation/) | 18.0.1.0.0 | | Segment Sponsors
[sbc_compassion](sbc_compassion/) | 18.0.1.0.0 | | SBC - Supporter to Participant Communication
[sbc_translation](sbc_translation/) | 18.0.1.0.0 | | SBC - Translation Platform
[sponsorship_compassion](sponsorship_compassion/) | 18.0.1.0.2 | | Compassion Sponsorships
[sponsorship_reporting](sponsorship_reporting/) | 18.0.1.0.0 | | Add the reports for the sponsorships
[sponsorship_sub_management](sponsorship_sub_management/) | 18.0.1.0.0 | <a href='https://github.com/ecino'><img src='https://github.com/ecino.png' width='32' height='32' style='border-radius:50%;' alt='ecino'/></a> <a href='https://github.com/NoeBerdoz'><img src='https://github.com/NoeBerdoz.png' width='32' height='32' style='border-radius:50%;' alt='NoeBerdoz'/></a> | Compassion SUB Sponsorships Management
Expand Down
115 changes: 115 additions & 0 deletions sbc_translation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
========================
SBC Translation Platform
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0618759b92e4125f0843a051132da282dc211ff0aeae0368c4eac2cd73fecaae
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-CompassionCH%2Fcompassion--modules-lightgray.png?logo=github
:target: https://github.com/CompassionCH/compassion-modules/tree/18.0/sbc_translation
:alt: CompassionCH/compassion-modules

|badge1| |badge2| |badge3|

Compassion SBC Translation Platform
-----------------------------------

This adds the backend management of SBC letters in the translation
stage. Once can manage all letters in translation and keep track of the
progress. It also serves as XMLRPC-API for the Translation Platform
written in OWL
(https://github.com/compassionch/translation-platform-web).

**Table of contents**

.. contents::
:local:

Installation
============

To install this module, you need to:

1. Clone the translation-platform project
(https://github.com/compassionch/translation-platform-web).
2. Create a ``.env.production.local`` file and compile the web-app.
3. Copy the compiled app created in the ``dist`` folder into the
``/static/tp/`` folder of the module.
4. This will make the front-end interface available from your Odoo
server with ``http://server_url/translation-platform`` route.

Configuration
=============

To configure this module, you need to:

1. Give access rights to users

- Front end translators need the User rights.
- Managers need the Manager rights for accessing the backend.

|image1|

.. |image1| image:: https://raw.githubusercontent.com/CompassionCH/compassion-modules/18.0/sbc_translation/static/description/user_rights.jpg

Usage
=====

To use this module, you need to:

1. Go to /Sponsorship/Correspondence/Translation Platform/ menu

- Translation Pool is the list of all letters currently in
translation
- Translators is the list of translators
- Competences is the available skills of translations. It is also an
entry point to the translation pool, filtered by language.

Changelog
=========

12.0.1.0.0 (2023-02-28)
-----------------------

- First version

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

Bugs are tracked on `GitHub Issues <https://github.com/CompassionCH/compassion-modules/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/CompassionCH/compassion-modules/issues/new?body=module:%20sbc_translation%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Compassion CH

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

- Emanuel Cino <ecino@compassion.ch>

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

This module is part of the `CompassionCH/compassion-modules <https://github.com/CompassionCH/compassion-modules/tree/18.0/sbc_translation>`_ project on GitHub.

You are welcome to contribute.
4 changes: 4 additions & 0 deletions sbc_translation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import models
from . import controllers
from . import wizards
from .hooks.post_init_hook import post_init_hook
61 changes: 61 additions & 0 deletions sbc_translation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
##############################################################################
#
# ______ Releasing children from poverty _
# / ____/___ ____ ___ ____ ____ ___________(_)___ ____
# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \
# / /___/ /_/ / / / / / / /_/ / /_/ (__ |__ ) / /_/ / / / /
# \____/\____/_/ /_/ /_/ .___/\__,_/____/____/_/\____/_/ /_/
# /_/
# in Jesus' name
#
# Copyright (C) 2022 Compassion CH (http://www.compassion.ch)
# @author: Emanuel Cino <ecino@compassion.ch>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# pylint: disable=C8101
{
"name": "SBC Translation Platform",
"version": "18.0.1.0.0",
"category": "Compassion",
"summary": "SBC - Translation Platform",
"sequence": 150,
"author": "Compassion CH",
"license": "AGPL-3",
"website": "https://github.com/CompassionCH/compassion-modules",
"depends": ["sbc_compassion", "partner_contact_birthdate", "website"],
"assets": {
"web.assets_backend": ["sbc_translation/js/translation_letter_counting_js.js"]
},
"data": [
"security/ir_groups.xml",
"security/ir.model.access.csv",
"security/access_rules.xml",
"wizards/reply_to_comments_view.xml",
"wizards/reply_to_issue_view.xml",
"wizards/translation_letter_counting_view.xml",
"data/mail_template.xml",
"data/update_translation_priority_cron.xml",
"data/website.xml",
"data/queue_job.xml",
"views/translation_user_view.xml",
"views/correspondence_view.xml",
"views/translation_pool_view.xml",
],
"demo": [],
"installable": True,
"auto_install": False,
"post_init_hook": "post_init_hook",
}
10 changes: 10 additions & 0 deletions sbc_translation/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##############################################################################
#
# Copyright (C) 2023 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
##############################################################################
from . import main
37 changes: 37 additions & 0 deletions sbc_translation/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##############################################################################
#
# Copyright (C) 2023 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
#
# The licence is in the file __manifest__.py
#
##############################################################################
import logging

from werkzeug.utils import redirect

from odoo import http
from odoo.tools import file_open

_logger = logging.getLogger(__name__)


class RestController(http.Controller):
@http.route(
["/translation-platform", "/translation-platform/<path:page>"],
type="http",
auth="public",
)
def translation_platform(self, page=""):
"""
Simple server for the translation platform which should be compiled into
/static/tp folder.
:param page: This the route requested
:return: index.html, or assets.
"""
if (
"assets" in page or page.endswith(".png") or page.endswith(".jpg")
): # Serving assets
return redirect(f"/sbc_translation/static/tp/{page}")
with file_open("sbc_translation/static/tp/index.html") as app:
return app.read()
Comment thread
ecino marked this conversation as resolved.
86 changes: 86 additions & 0 deletions sbc_translation/data/mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<odoo noupdate="1">
<record id="translation_issue_notification" model="mail.template">
<field name="name">Translation issue notification</field>
<field name="subject">A translation issue was raised</field>
<field name="model_id" ref="model_correspondence" />
<field name="email_from">
${object.new_translator_id.partner_id.email}
</field>
<field name="email_to">${object.translation_supervisor_id.email}</field>
<field name="body_html" type="html">
<ul>
<li>Issue type: ${object.translate("translation_issue")}</li>
</ul>
<span>
${object.translation_issue_comments | safe}
</span>
</field>
</record>

<template id="translation_issue_log">
<p>
<b>Issue type</b>:
<span t-field="record.translation_issue" />
</p>
<span t-field="record.translation_issue_comments" />
</template>

<template id="translation_comments_update">
<p>
Comments updated
</p>
<ul>
<li t-foreach="comments" t-as="comment">
Page
<t t-esc="comment['page_index']"/>
paragraph
<t t-esc="comment['paragraph_index']"/>:
<t t-esc="comment['old']" />
<span
class="o_Message_trackingValueSeparator o_Message_trackingValueItem fa fa-long-arrow-right"
title="Changed"
role="img"
/>
<t t-esc="comment['new']" />
</li>
</ul>
</template>

<template id="comments_reply">
<p t-raw="reply" />
<hr />
<table>
<tr>
<th style="width: 40%">Paragraph</th>
<th style="width: 40%">Comments</th>
</tr>
<t
t-foreach="object.mapped('page_ids.paragraph_ids')"
t-as="paragraph"
>
<t t-if="paragraph.comments">
<tr>
<td
t-esc="paragraph.translated_text"
style="width: 40%"
/>
<td
t-esc="paragraph.comments"
style="width: 40%; margin-left: 10px"
/>
</tr>
</t>
</t>
</table>
<hr />
<p><a
t-att-href="object.translation_url"
>Open the letter in the translation platform</a></p>
</template>

<template id="issue_reply">
<p>Dear <span t-field="object.new_translator_id.partner_id.name" />,</p>
<p>You have just received a response to a problem about a letter on the translation platform you reported:</p>
<p t-raw="reply" />
</template>
</odoo>
8 changes: 8 additions & 0 deletions sbc_translation/data/queue_job.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<odoo>
<!-- Job functions -->
<record id="move_pool_job" model="queue.job.function">
<field name="model_id" ref="model_correspondence"/>
<field name="method">move_pool</field>
<field name="channel_id" ref="sbc_compassion.channel_sbc_compassion"/>
</record>
</odoo>
13 changes: 13 additions & 0 deletions sbc_translation/data/update_translation_priority_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="update_translation_priority_cron" model="ir.cron">
<field name="name">Update translation priority</field>
<field name="model_id" ref="model_correspondence"/>
<field name="type">ir.action.server</field>
<field name="state">code</field>
<field name="code">model.update_translation_priority_cron()</field>
<field name="interval_number">1</field>
<field name="interval_type">weeks</field>
<field name="nextcall" eval="datetime.now().strftime('%Y-%m-%d')"/>
</record>
</odoo>
6 changes: 6 additions & 0 deletions sbc_translation/data/website.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<odoo>
<record id="translation_website" model="website">
<field name="name">Translation Platform</field>
<field name="domain">translate.compassion.ch</field>
</record>
</odoo>
Loading