Skip to content

Commit

Permalink
[IMP] product_product_template_navigation: Make link a stat button
Browse files Browse the repository at this point in the history
  • Loading branch information
renda-dev committed Nov 21, 2023
1 parent 0c6266b commit d50b842
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 31 deletions.
14 changes: 7 additions & 7 deletions product_product_template_navigation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Product Template Navigation
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:83755055c41f725d0424def4b702282e4cafa169511541fcc325682c47567bc9
!! source digest: sha256:de5e04d33dcadb6c6a7efe8eb30acac317759500fcaecb1d1186adb7761deda9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,20 +17,20 @@ Product Template Navigation
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/14.0/product_product_template_navigation
:target: https://github.com/OCA/product-attribute/tree/16.0/product_product_template_navigation
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_product_template_navigation
:target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_product_template_navigation
: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/product-attribute&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=16.0
:alt: Try me on Runboat

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

This module adds a button in the product form to view the product template.

.. image:: https://raw.githubusercontent.com/OCA/product-attribute/14.0/product_product_template_navigation/static/img/template_navigation.gif
.. image:: https://raw.githubusercontent.com/OCA/product-attribute/16.0/product_product_template_navigation/static/img/template_navigation.gif

**Table of contents**

Expand All @@ -43,7 +43,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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/product-attribute/issues/new?body=module:%20product_product_template_navigation%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_product_template_navigation%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.

Expand Down Expand Up @@ -80,6 +80,6 @@ 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/product-attribute <https://github.com/OCA/product-attribute/tree/14.0/product_product_template_navigation>`_ project on GitHub.
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_product_template_navigation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 2 additions & 1 deletion product_product_template_navigation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-attribute",
"category": "Product",
"version": "14.0.1.0.1",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": ["product"],
"data": ["views/product_product_views.xml"],
"installable": True,
"application": False,
}
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ <h1 class="title">Product Template Navigation</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:83755055c41f725d0424def4b702282e4cafa169511541fcc325682c47567bc9
!! source digest: sha256:de5e04d33dcadb6c6a7efe8eb30acac317759500fcaecb1d1186adb7761deda9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/14.0/product_product_template_navigation"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_product_template_navigation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/16.0/product_product_template_navigation"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_product_template_navigation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a button in the product form to view the product template.</p>
<img alt="https://raw.githubusercontent.com/OCA/product-attribute/14.0/product_product_template_navigation/static/img/template_navigation.gif" src="https://raw.githubusercontent.com/OCA/product-attribute/14.0/product_product_template_navigation/static/img/template_navigation.gif" />
<img alt="https://raw.githubusercontent.com/OCA/product-attribute/16.0/product_product_template_navigation/static/img/template_navigation.gif" src="https://raw.githubusercontent.com/OCA/product-attribute/16.0/product_product_template_navigation/static/img/template_navigation.gif" />
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -389,7 +389,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-attribute/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/product-attribute/issues/new?body=module:%20product_product_template_navigation%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/product-attribute/issues/new?body=module:%20product_product_template_navigation%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -421,7 +421,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/14.0/product_product_template_navigation">OCA/product-attribute</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/16.0/product_product_template_navigation">OCA/product-attribute</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from odoo.tests import tagged
from odoo.tests.common import TransactionCase


@tagged("post_install", "-at_install")
class TestCommon(TransactionCase):
def setUp(self, *args, **kwargs):
super(TestCommon, self).setUp(*args, **kwargs)
@classmethod
def setUpClass(cls):
super().setUpClass()

self.products = self.env["product.product"].create([{"name": "product1"}])
cls.products = cls.env["product.product"].create([{"name": "product1"}])

def test_action_open_product_template(self):
actual = {
Expand Down
28 changes: 15 additions & 13 deletions product_product_template_navigation/views/product_product_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<xpath
expr="//div[hasclass('oe_title')]/label[@for='name']"
position="before"
>
<div>
<button
type="object"
name="action_open_product_template"
class="oe_link"
string="View Template"
colspan="2"
/>
</div>
<xpath expr="//button[hasclass('oe_stat_button')]" position="before">

<button
class="oe_stat_button"
name="action_open_product_template"
icon="fa-archive"
type="object"
>
<div class="o_field_widget">
<span>
View Template
</span>
</div>
</button>

</xpath>
</field>
</record>
Expand Down

0 comments on commit d50b842

Please sign in to comment.