Skip to content

Commit

Permalink
Merge PR #986 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Nov 26, 2024
2 parents f1d2003 + 0e54d0b commit 4f271ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 12 additions & 0 deletions website_sale_hide_price/models/product_template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2022 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.tools import config


class ProductTemplate(models.Model):
Expand Down Expand Up @@ -58,3 +59,14 @@ def _search_render_results(self, fetch_fields, mapping, icon, limit):
}
)
return results_data

def _website_show_quick_add(self):
show_price = (
self.env["website"].get_current_website().website_show_price
and not self.website_hide_price
)
if config["test_enable"] and not self.env.context.get(
"website_sale_hide_price_test"
):
return show_price
return show_price and super()._website_show_quick_add()
8 changes: 0 additions & 8 deletions website_sale_hide_price/views/website_sale_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@
</attribute>
</xpath>
</template>
<!-- Hide add to cart button if "Add to cart" option is enabled and not website_show_price -->
<template id="products_add_to_cart" inherit_id="website_sale.products_add_to_cart">
<xpath expr="//a[hasclass('a-submit')]" position="attributes">
<attribute name="t-if">
website.website_show_price and not product.website_hide_price
</attribute>
</xpath>
</template>
<template id="website_search_box" inherit_id="website.website_search_box">
<xpath expr="//input[@name='search']" position="attributes">
<attribute
Expand Down

0 comments on commit 4f271ce

Please sign in to comment.