Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] website_sale_product_external_link #2744

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
6 changes: 6 additions & 0 deletions setup/website_sale_product_external_link/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,
)
41 changes: 41 additions & 0 deletions website_sale_product_external_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==================================
Website Sale Product External Link
==================================

Add external link field to products and display it on the product page.

Description
-----------

This module adds an external link field to products in the backend, allowing you to enter a external page link. This link is displayed on the product page in the webshop.

Usage
-----

- Add a link to an external page in the product form view under the "Website Link" field.
- The link will be displayed on the product page in the webshop, allowing customers to visit an external page.

License
-------

This module is licensed under the AGPL-3 License. See `License Information <http://www.gnu.org/licenses/agpl-3.0-standalone.html>`_.

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

Bugs are tracked on `GitHub Issues <https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback.

Credits
=======

Contributors
------------
* Ana Juaristi <[email protected]>
* Unai Beristain <[email protected]>

Do not contact contributors directly about support or help with technical issues.
1 change: 1 addition & 0 deletions website_sale_product_external_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions website_sale_product_external_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Website Sale Product External Link",
"version": "16.0.1.0.0",
"summary": "Add external link field to products and display it on the product page",
"category": "Website",
"author": "Avanzosc",
"website": "https://github.com/avanzosc/odoo-addons",
"license": "AGPL-3",
"depends": ["website_sale"],
"data": [
"views/product_template_views.xml",
"views/website_sale_templates.xml",
],
"installable": True,
"auto_install": False,
}
39 changes: 39 additions & 0 deletions website_sale_product_external_link/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_product_external_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-29 15:48+0000\n"
"PO-Revision-Date: 2024-07-29 15:48+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_sale_product_external_link
#: model_terms:ir.ui.view,arch_db:website_sale_product_external_link.product_detail
#: model_terms:ir.ui.view,arch_db:website_sale_product_external_link.product_detail_item
msgid "A short description that will also appear on documents."
msgstr "Una breve descripción que aparecerás en los documentos."

#. module: website_sale_product_external_link
#: model:ir.model.fields,help:website_sale_product_external_link.field_product_product__website_link
#: model:ir.model.fields,help:website_sale_product_external_link.field_product_template__website_link
msgid "Website page. Example: http://www.example.com"
msgstr "Página web. Ejemplo: http://www.ejemplo.com"

#. module: website_sale_product_external_link
#: model:ir.model,name:website_sale_product_external_link.model_product_template
msgid "Product"
msgstr "Producto"

#. module: website_sale_product_external_link
#: model:ir.model.fields,field_description:website_sale_product_external_link.field_product_product__website_link
#: model:ir.model.fields,field_description:website_sale_product_external_link.field_product_template__website_link
msgid "Website Link"
msgstr "Enlace Web"
40 changes: 40 additions & 0 deletions website_sale_product_external_link/i18n/eu_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_product_external_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-29 15:49+0000\n"
"PO-Revision-Date: 2024-07-29 15:49+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_sale_product_external_link
#: model_terms:ir.ui.view,arch_db:website_sale_product_external_link.product_detail
#: model_terms:ir.ui.view,arch_db:website_sale_product_external_link.product_detail_item
msgid "A short description that will also appear on documents."
msgstr ""

#. module: website_sale_product_external_link
#: model:ir.model.fields,help:website_sale_product_external_link.field_product_product__website_link
#: model:ir.model.fields,help:website_sale_product_external_link.field_product_template__website_link
msgid "Website page. Example: http://www.example.com"
msgstr "Web orrialdea. Adibidez: http://www.example.com"

#. module: website_sale_product_external_link
#: model:ir.model,name:website_sale_product_external_link.model_product_template
msgid "Product"
msgstr "Produktua"

#. module: website_sale_product_external_link
#: model:ir.model.fields,field_description:website_sale_product_external_link.field_product_product__website_link
#: model:ir.model.fields,field_description:website_sale_product_external_link.field_product_template__website_link
msgid "Website Link"
msgstr "Web orrialdearen lotura"

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_product_external_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-29 15:47+0000\n"
"PO-Revision-Date: 2024-07-29 15:47+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_sale_product_external_link
#: model_terms:ir.ui.view,arch_db:website_sale_product_external_link.product_detail
#: model_terms:ir.ui.view,arch_db:website_sale_product_external_link.product_detail_item
msgid "A short description that will also appear on documents."
msgstr ""

#. module: website_sale_product_external_link
#: model:ir.model.fields,help:website_sale_product_external_link.field_product_product__website_link
#: model:ir.model.fields,help:website_sale_product_external_link.field_product_template__website_link
msgid "Website page. Example: http://www.example.com"
msgstr ""

#. module: website_sale_product_external_link
#: model:ir.model,name:website_sale_product_external_link.model_product_template
msgid "Product"
msgstr ""

#. module: website_sale_product_external_link
#: model:ir.model.fields,field_description:website_sale_product_external_link.field_product_product__website_link
#: model:ir.model.fields,field_description:website_sale_product_external_link.field_product_template__website_link
msgid "Website Link"
msgstr ""
1 change: 1 addition & 0 deletions website_sale_product_external_link/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_template
9 changes: 9 additions & 0 deletions website_sale_product_external_link/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

website_link = fields.Char(
help="Website page. Example: http://www.example.com",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_product_template_form_inherit" model="ir.ui.view">
<field name="name">product.template.form.inherit.external.link</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<xpath expr="//notebook/page/group[2]" position="after">
<group name="website_link" string="Website Link">
<field name="website_link" />
</group>
</xpath>
</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="product_detail" inherit_id="website_sale.product">
<xpath expr="//div[@id='product_details']/p[1]" position="attributes">
<attribute name="t-if">False</attribute>
</xpath>
<xpath expr="//div[@id='product_details']/p[1]" position="after">

<t t-if="product.website_link">
<a t-att-href="product.website_link" target="_blank">
<p
t-field="product.description_sale"
class="text-muted my-2"
placeholder="A short description that will also appear on documents."
/>
</a>
</t>
<t t-else="">
<p
t-field="product.description_sale"
class="text-muted my-2"
placeholder="A short description that will also appear on documents."
/>
</t>
</xpath>
</template>
<template id="product_detail_item" inherit_id="website_sale.products_item">
<xpath expr="//form/div[2]" position="after">
<t t-if="product.website_link">
<div class="oe_structure" />
<div class="mt16">
<a t-att-href="product.website_link" target="_blank">
<span
t-field="product.description_sale"
class="text-muted my-2"
placeholder="A short description that will also appear on documents."
/>
</a>
</div>
</t>
</xpath>
</template>
</odoo>
Loading