Skip to content

Commit

Permalink
[4894][ADD] website_sale_hide_price #47
Browse files Browse the repository at this point in the history
[4894][ADD] website_sale_hide_price
  • Loading branch information
kanda999 authored Oct 16, 2024
1 parent db6df75 commit 0af7cf7
Show file tree
Hide file tree
Showing 78 changed files with 5,905 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/website_sale_hide_price/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,
)
129 changes: 129 additions & 0 deletions website_sale_hide_price/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
=======================
Website Sale Hide Price
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:801dff459466a77edac836cad22c5c0d6f28b7670fe350ba9c73c5d994433273
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fe--commerce-lightgray.png?logo=github
:target: https://github.com/OCA/e-commerce/tree/15.0/website_sale_hide_price
:alt: OCA/e-commerce
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_hide_price
: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/e-commerce&target_branch=15.0
:alt: Try me on Runboat

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

This module allows to have hidden product prices on the website store.

**Table of contents**

.. contents::
:local:

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

If you want to hide prices at customer level:

#. Go to *Customers* and choose one.
#. Go to *Sales and Purchases* tab.
#. In *Sales* group set *Show prices on website* on or off so this customer can
see them or not. The default value is `True`, so every partner website user
can see the prices.

For not logged in customers:

#. If you want to have the prices hidden by default when no user is logged
in you should go to Public User's partner and set *Show prices on website*
off. (Remember that the Public User's user and partner use to be archived).

Hide prices at product level:

#. Go to *Website > Catalog > Products* and choose one.
#. Go to *eCommerce* tab.
#. In the *Shop* section you have the option *Hide prices on website*.
#. You can optionally set a message that will be displayed when the prices are
hidden.

Usage
=====

After configuring the module go to the website store and check your expected results:

#. On the search box writing the name of a product.
#. On the product list (/shop).
#. On the product page.
#. On the recently viewed products.

You shouldn't be able to either see the prices or buy any of the forbidden items if any.

Known issues / Roadmap
======================

- This feature doesn't support multi website. The default behavior is to hide the prices
along every website. It could be modified the boolean field on the partner to a many2many
relation between res_partner and website_website, so that this price-hiding feature might
be made website-dependant.
- This module is incompatible with the website_sale_stock_force_block module because it
makes changes to the same attributes in the website_sale.products_add_to_cart template.

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

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

* Tecnativa

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

* `Tecnativa <https://www.tecnativa.com>`__:

* David Vidal
* Pilar Vargas

* Abraham González <abraham@trey.es>
* Juanjo Algaz <jalgaz@gmail.com>

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/e-commerce <https://github.com/OCA/e-commerce/tree/15.0/website_sale_hide_price>`_ 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 website_sale_hide_price/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions website_sale_hide_price/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2017 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Website Sale Hide Price",
"version": "15.0.1.3.0",
"category": "Website",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/e-commerce",
"license": "AGPL-3",
"summary": "Hide product prices on the shop",
"depends": ["website_sale"],
"data": [
"data/product_snippet_template_data.xml",
"views/partner_view.xml",
"views/product_template_views.xml",
"views/res_config_settings_views.xml",
"views/website_sale_template.xml",
],
"qweb": ["static/src/xml/website_sale_templates.xml"],
"installable": True,
"assets": {
"web.assets_frontend": [
"/website_sale_hide_price/static/src/js/website_sale_hide_price.js"
]
},
}
78 changes: 78 additions & 0 deletions website_sale_hide_price/data/product_snippet_template_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Hide add to cart button and prices from dynamic product snippet templates if not
website_show_price -->
<template
id="price_dynamic_filter_template_product_product"
inherit_id="website_sale.price_dynamic_filter_template_product_product"
>
<xpath expr="//span[hasclass('font-weight-bold')]" position="before">
<div
id="website_hide_price"
t-if="user_id.partner_id.website_show_price and not data.get('website_hide_price')"
/>
</xpath>
<xpath expr="//div[@id='website_hide_price']" position="inside">
<xpath expr="//span[hasclass('font-weight-bold')]" position="move" />
<xpath expr="//del" position="move" />
</xpath>
</template>
<!-- The id of the templates is changed so that they do not appear in the selector
repeatedly. The change is from "dynamic_filter_template_%" to "filter_template_dynamic_%". -->
<template
id="filter_template_dynamic_product_product_borderless_2"
inherit_id="website_sale.dynamic_filter_template_product_product_borderless_2"
>
<xpath expr="//button[hasclass('js_add_cart')]" position="attributes">
<attribute name="t-if">
website.website_show_price and not record.website_hide_price
</attribute>
</xpath>
</template>
<template
id="filter_template_dynamic_product_product_add_to_cart"
inherit_id="website_sale.dynamic_filter_template_product_product_add_to_cart"
>
<xpath
expr="//div[hasclass('o_carousel_product_card_footer')]"
position="attributes"
>
<attribute name="t-if">
website.website_show_price and not record.website_hide_price
</attribute>
</xpath>
</template>
<template
id="filter_template_dynamic_product_product_horizontal_card"
inherit_id="website_sale.dynamic_filter_template_product_product_horizontal_card"
>
<xpath
expr="//div[hasclass('o_dynamic_snippet_btn_wrapper')]"
position="attributes"
>
<attribute name="t-if">
website.website_show_price and not record.website_hide_price
</attribute>
</xpath>
</template>
<template
id="filter_template_dynamic_product_product_mini_price"
inherit_id="website_sale.dynamic_filter_template_product_product_mini_price"
>
<xpath expr="//div[hasclass('rounded-pill')]" position="attributes">
<attribute name="t-if">
website.website_show_price and not record.website_hide_price
</attribute>
</xpath>
</template>
<template
id="filter_template_dynamic_product_product_banner"
inherit_id="website_sale.dynamic_filter_template_product_product_banner"
>
<xpath expr="//button[hasclass('js_add_cart')]" position="attributes">
<attribute name="t-if">
website.website_show_price and not record.website_hide_price
</attribute>
</xpath>
</template>
</odoo>
91 changes: 91 additions & 0 deletions website_sale_hide_price/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_price
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-16 01:57+0000\n"
"PO-Revision-Date: 2017-12-16 01:57+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#. module: website_sale_hide_price
#: model:ir.model,name:website_sale_hide_price.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: website_sale_hide_price
#: model:ir.model,name:website_sale_hide_price.model_res_partner
msgid "Contact"
msgstr ""

#. module: website_sale_hide_price
#: model:ir.model.fields,field_description:website_sale_hide_price.field_res_config_settings__website_hide_price_default_message
#: model:ir.model.fields,field_description:website_sale_hide_price.field_website__website_hide_price_default_message
msgid "Default Hidden price message"
msgstr ""

#. module: website_sale_hide_price
#: model:ir.model.fields,field_description:website_sale_hide_price.field_product_product__website_hide_price_message
#: model:ir.model.fields,field_description:website_sale_hide_price.field_product_template__website_hide_price_message
msgid "Hidden price message"
msgstr ""

#. module: website_sale_hide_price
#: model:ir.model.fields,field_description:website_sale_hide_price.field_product_product__website_hide_price
#: model:ir.model.fields,field_description:website_sale_hide_price.field_product_template__website_hide_price
msgid "Hide prices on website"
msgstr ""

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

#. module: website_sale_hide_price
#: model_terms:ir.ui.view,arch_db:website_sale_hide_price.res_config_settings_view_form
msgid "Set a default text when hiding prices"
msgstr ""

#. module: website_sale_hide_price
#: model:ir.model.fields,field_description:website_sale_hide_price.field_res_partner__website_show_price
#: model:ir.model.fields,field_description:website_sale_hide_price.field_res_users__website_show_price
msgid "Show prices on website"
msgstr ""

#. module: website_sale_hide_price
#: model:ir.model,name:website_sale_hide_price.model_website
msgid "Website"
msgstr "الموقع"

#. module: website_sale_hide_price
#: model:ir.model.fields,field_description:website_sale_hide_price.field_website__website_show_price
msgid "Website Show Price"
msgstr ""

#. module: website_sale_hide_price
#: model:ir.model.fields,help:website_sale_hide_price.field_product_product__website_hide_price_message
#: model:ir.model.fields,help:website_sale_hide_price.field_product_template__website_hide_price_message
#: model:ir.model.fields,help:website_sale_hide_price.field_res_config_settings__website_hide_price_default_message
#: model:ir.model.fields,help:website_sale_hide_price.field_website__website_hide_price_default_message
msgid ""
"When the price is hidden on the website we can give the customersome tips on "
"how to find it out."
msgstr ""

#. module: website_sale_hide_price
#. openerp-web
#: code:addons/website_sale_hide_price/static/src/xml/website_sale_templates.xml:0
#, python-format
msgid "widget.displayPrice & !product.website_hide_price"
msgstr ""
Loading

0 comments on commit 0af7cf7

Please sign in to comment.