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

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

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

.. |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/16.0/template_content_swapper>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
