Skip to content

Commit

Permalink
[4851][ADD] template_content_swapper #168
Browse files Browse the repository at this point in the history
[4851][ADD] template_content_swapper #168
  • Loading branch information
AungKoKoLin1997 authored Nov 28, 2024
1 parent 704bd43 commit 3ad0058
Show file tree
Hide file tree
Showing 23 changed files with 1,161 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/template_content_swapper/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
117 changes: 117 additions & 0 deletions template_content_swapper/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
========================
Template Content Swapper
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e37f2f6ea0333073814bf3941f71a14e7ab642f011bbd8bc9e8e5a37f0cef128
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-OCA%2Fserver--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/16.0/template_content_swapper
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-template_content_swapper
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-ux&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module offers a generic functionality for replacing QWeb view elements.
Typically, element replacements are conducted through a template using an XPATH replacement by creating a new module.
With this module, users don't need to do this; they simply need to create template.content.mapping records for the templates they wish to modify.

Examples:

* Replace 'Salesperson' label with 'Sales Representative' in the quotation print.
* Replace 'Add to Cart' button with 'Add to Basket' in the eCommerce product page.

**Table of contents**

.. contents::
:local:

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

Go to *Settings > Technical > User Interface > Template Content Mappings* to
create/maintain records.

Following fields should be filled in:

* **Report** (optional): Report record that includes the string you'd like to replace.
Setting a report record will automatically update the template field.
* **Template** (required): The main QWeb template (ir.ui.view record) that includes the
string you'd like to replace.
* **Language** (optional): Target language for string replacement. If left blank, the
replacement will be applied to all languages.
* **Content From** (required): An existing string to be replaced.
* **Content To** (optional): A new string to replace the existing string.

Usage
=====

To use this module, first configure the template content mappings.

.. image:: https://raw.githubusercontent.com/OCA/server-ux/16.0/template_content_swapper/static/img/mapping.png

Then, go to the UI where your configured template is utilized.

.. image:: https://raw.githubusercontent.com/OCA/server-ux/16.0/template_content_swapper/static/img/login_before.png

.. image:: https://raw.githubusercontent.com/OCA/server-ux/16.0/template_content_swapper/static/img/login_after.png

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/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/OCA/server-ux/issues/new?body=module:%20template_content_swapper%0Aversion:%2016.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
~~~~~~~

* Quartile Limited

Contributors
~~~~~~~~~~~~

* `Quartile <https://www.quartile.co>`_:

* Aung Ko Ko Lin
* Yoshi Tashiro
* Tatsuki Kanda

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/16.0/template_content_swapper>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions template_content_swapper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions template_content_swapper/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Template Content Swapper",
"version": "16.0.1.0.1",
"author": "Quartile Limited, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Tools",
"website": "https://github.com/OCA/server-ux",
"depends": ["base"],
"data": [
"security/ir.model.access.csv",
"views/template_content_mapping_views.xml",
],
"installable": True,
}
142 changes: 142 additions & 0 deletions template_content_swapper/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * template_content_swapper
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-04 16:36+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__active_lang_count
msgid "Active Lang Count"
msgstr "Numero lingue attive"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__content_from
msgid "Content From"
msgstr "Contenuto file"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__content_to
msgid "Content To"
msgstr "Contenuto a"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__create_uid
msgid "Created by"
msgstr "Creato da"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__create_date
msgid "Created on"
msgstr "Creato il"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: template_content_swapper
#: model_terms:ir.ui.view,arch_db:template_content_swapper.view_template_content_mapping_search
msgid "Frontend"
msgstr "Frontend"

#. module: template_content_swapper
#: model_terms:ir.ui.view,arch_db:template_content_swapper.view_template_content_mapping_search
msgid "Group By"
msgstr "Raggruppa per"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__id
msgid "ID"
msgstr "ID"

#. module: template_content_swapper
#: model:ir.model.fields,help:template_content_swapper.field_template_content_mapping__lang
msgid ""
"If no language is selected, the mapping will be applied to all languages."
msgstr ""
"Se non è selezionata una lingua, la mappatura verrà applicata a tutte le "
"lingue."

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__lang
#: model_terms:ir.ui.view,arch_db:template_content_swapper.view_template_content_mapping_search
msgid "Language"
msgstr "Lingua"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__write_uid
msgid "Last Updated by"
msgstr "Ultimo aggiornamento di"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__write_date
msgid "Last Updated on"
msgstr "Ultimo aggiornamento il"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__name
msgid "Name"
msgstr "Nome"

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__report_id
#: model_terms:ir.ui.view,arch_db:template_content_swapper.view_template_content_mapping_search
msgid "Report"
msgstr "Resoconto"

#. module: template_content_swapper
#: model:ir.model.fields,help:template_content_swapper.field_template_content_mapping__template_id
msgid "Select the main template of the report / frontend page to be modified."
msgstr ""
"Selezionare il modello principale del resoconto / pagina frontend da "
"modificare."

#. module: template_content_swapper
#: model:ir.model.fields,help:template_content_swapper.field_template_content_mapping__content_from
msgid "Set the content (string) to be replaced. e.g. 'Salesperson'."
msgstr "Impostare il contenuto (stringa) da sostituire. Es. 'Venditore'."

#. module: template_content_swapper
#: model:ir.model.fields,help:template_content_swapper.field_template_content_mapping__content_to
msgid "Set your new content (string). e.g. 'Sales Representative'."
msgstr "Impostare il nuovo contenuto (stringa). Es. 'Rappresentante'."

#. module: template_content_swapper
#: model:ir.model.fields,field_description:template_content_swapper.field_template_content_mapping__template_id
#: model_terms:ir.ui.view,arch_db:template_content_swapper.view_template_content_mapping_search
msgid "Template"
msgstr "Modello"

#. module: template_content_swapper
#: model:ir.model,name:template_content_swapper.model_template_content_mapping
msgid "Template Content Mapping"
msgstr "Modello mappatura contenuto"

#. module: template_content_swapper
#: model:ir.actions.act_window,name:template_content_swapper.action_template_content_mapping
#: model:ir.ui.menu,name:template_content_swapper.menu_template_content_mapping
#: model_terms:ir.ui.view,arch_db:template_content_swapper.view_template_content_mapping_search
msgid "Template Content Mappings"
msgstr "Modello mappature contenuto"

#. module: template_content_swapper
#: model:ir.model,name:template_content_swapper.model_ir_ui_view
msgid "View"
msgstr "Vista"
Loading

0 comments on commit 3ad0058

Please sign in to comment.