Skip to content
Open
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
151 changes: 151 additions & 0 deletions template_content_swapper/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

========================
Template Content Swapper
========================

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

.. |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/license-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/19.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-19-0/server-ux-19-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=19.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.
- **Domain** (optional): Domain used to restrict the records this
configuration applies to. This option is only available for report
configurations. Example: [('partner_id', '=', 1)]
- **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.

As a limitation, domain-based configurations that change content outside
the article section (for example, header or footer content) only work
when printing a single record. When multiple records are printed in one
batch, those domain conditions are not applied to the header/footer and
only affect the article content.

Usage
=====

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

|image|

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

|image1|

|image2|

.. |image| image:: https://raw.githubusercontent.com/OCA/server-ux/19.0/template_content_swapper/static/img/mapping.png
.. |image1| image:: https://raw.githubusercontent.com/OCA/server-ux/19.0/template_content_swapper/static/img/login_before.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/server-ux/19.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:%2019.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

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.

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

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yostashiro| |maintainer-AungKoKoLin1997|

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/19.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
17 changes: 17 additions & 0 deletions template_content_swapper/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Template Content Swapper",
"version": "19.0.1.0.0",
"author": "Quartile, 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",
],
"maintainers": ["yostashiro", "AungKoKoLin1997"],
"installable": True,
}
145 changes: 145 additions & 0 deletions template_content_swapper/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# 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: 2025-05-16 08:24+0000\n"
"Last-Translator: mymage <[email protected]>\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 5.10.4\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,name:template_content_swapper.model_ir_qweb
msgid "Qweb"
msgstr "Qweb"

#. 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"

#~ msgid "View"
#~ msgstr "Vista"
Loading