[IMP] website_sale: allow hide attributes in filter
task-2466988 closes odoo/odoo#75898 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
committed by
Jeremy Kersten
parent
28efd996b6
commit
046189fb53
@@ -17,6 +17,7 @@
|
||||
'data/mail_template_data.xml',
|
||||
'data/product_snippet_template_data.xml',
|
||||
'data/digest_data.xml',
|
||||
'views/product_attribute_views.xml',
|
||||
'views/product_views.xml',
|
||||
'views/account_views.xml',
|
||||
'views/onboarding_views.xml',
|
||||
|
||||
@@ -343,7 +343,10 @@ class WebsiteSale(http.Controller):
|
||||
ProductAttribute = request.env['product.attribute']
|
||||
if products:
|
||||
# get all products without limit
|
||||
attributes = ProductAttribute.search([('product_tmpl_ids', 'in', search_product.ids)])
|
||||
attributes = ProductAttribute.search([
|
||||
('product_tmpl_ids', 'in', search_product.ids),
|
||||
('visibility', '=', 'visible'),
|
||||
])
|
||||
else:
|
||||
attributes = ProductAttribute.browse(attributes_ids)
|
||||
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="product_attribute_brand" model="product.attribute">
|
||||
<field name="name">Brand</field>
|
||||
<field name="sequence">0</field>
|
||||
</record>
|
||||
|
||||
<record id="website_sale.sale_ribbon" model="product.ribbon">
|
||||
<field name="html">Sale</field>
|
||||
<field name="html_class">bg-success o_ribbon_left</field>
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
<field name="salesteam_id" ref="sales_team.salesteam_website_sales"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_attribute_2" model="product.attribute">
|
||||
<field name="visibility">hidden</field>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_24" model="product.product">
|
||||
<field name="is_published" eval="True"/>
|
||||
</record>
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from odoo import models
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class ProductAttribute(models.Model):
|
||||
_inherit = 'product.attribute'
|
||||
|
||||
visibility = fields.Selection([('visible', 'Visible'), ('hidden', 'Hidden')], default='visible')
|
||||
|
||||
|
||||
class ProductTemplateAttributeLine(models.Model):
|
||||
|
||||
@@ -23,6 +23,7 @@ class TestUi(HttpCaseWithUserDemo, HttpCaseWithUserPortal):
|
||||
|
||||
product_attribute = self.env['product.attribute'].create({
|
||||
'name': 'Legs',
|
||||
'visibility': 'visible',
|
||||
'sequence': 10,
|
||||
})
|
||||
product_attribute_value_1 = self.env['product.attribute.value'].create({
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="product_attribute_view_form" model="ir.ui.view">
|
||||
<field name="name">product.attribute.view.form</field>
|
||||
<field name="model">product.attribute</field>
|
||||
<field name="inherit_id" ref="product.product_attribute_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="create_variant" position="after">
|
||||
<field name="visibility" string="eCommerce Filter Visibility" widget="radio"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<record id="attribute_tree_view" model="ir.ui.view">
|
||||
<field name="name">product.attribute.tree</field>
|
||||
<field name="model">product.attribute</field>
|
||||
<field name="inherit_id" ref="product.attribute_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="create_variant" position="after">
|
||||
<field name="visibility" string="eCommerce Filter Visibility"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -22,13 +22,12 @@
|
||||
<field name="category_id" ref="product_attribute_category_general_features"/>
|
||||
</record>
|
||||
|
||||
<record id="product_attribute_1" model="product.attribute">
|
||||
<field name="name">Brand</field>
|
||||
<record id="website_sale.product_attribute_brand" model="product.attribute">
|
||||
<field name="category_id" ref="product_attribute_category_general_features"/>
|
||||
</record>
|
||||
<record id="product_attribute_value_1" model="product.attribute.value">
|
||||
<field name="name">Apple</field>
|
||||
<field name="attribute_id" ref="product_attribute_1"/>
|
||||
<field name="attribute_id" ref="website_sale.product_attribute_brand"/>
|
||||
</record>
|
||||
|
||||
<record id="product_attribute_7" model="product.attribute">
|
||||
@@ -51,7 +50,7 @@
|
||||
|
||||
<record id="product_6_attribute_1_product_template_attribute_line" model="product.template.attribute.line">
|
||||
<field name="product_tmpl_id" ref="product.product_product_6_product_template"/>
|
||||
<field name="attribute_id" ref="product_attribute_1"/>
|
||||
<field name="attribute_id" ref="website_sale.product_attribute_brand"/>
|
||||
<field name="value_ids" eval="[(6,0,[ref('product_attribute_value_1')])]"/>
|
||||
</record>
|
||||
<record id="product_6_attribute_7_product_template_attribute_line" model="product.template.attribute.line">
|
||||
|
||||
Reference in New Issue
Block a user