Arregla el ordenamiento por novedades, la herencia no funciona bien...
This commit is contained in:
parent
ada6c142c9
commit
57a3d6e59b
2 changed files with 19 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2021 Criptomart
|
# Copyright 2021 Criptomart
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
{
|
{
|
||||||
'name': 'Website Sale Product Sort Creation Date',
|
'name': 'Website Sale Product Sort Creation Date',
|
||||||
|
@ -7,9 +7,10 @@
|
||||||
'development_status': 'Beta',
|
'development_status': 'Beta',
|
||||||
'category': 'Website',
|
'category': 'Website',
|
||||||
'website': 'https://github.com/criptomart/obook',
|
'website': 'https://github.com/criptomart/obook',
|
||||||
'author': 'Cripotmart',
|
'author': 'Criptomart',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'depends': [
|
'depends': [
|
||||||
|
'website',
|
||||||
'website_sale_product_sort',
|
'website_sale_product_sort',
|
||||||
],
|
],
|
||||||
'data': [
|
'data': [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2020 Tecnativa - David Vidal
|
# Copyright 2021 Criptomart
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
|
|
||||||
|
@ -8,6 +8,19 @@ class Website(models.Model):
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_product_sort_criterias(self):
|
def _get_product_sort_criterias(self):
|
||||||
res = super()._get_product_sort_criterias()
|
return [
|
||||||
return res.append(("create_date desc", _("Novedades")))
|
('website_sequence desc', _('Relevance')),
|
||||||
|
('list_price desc', _('Catalog price: High to Low')),
|
||||||
|
('list_price asc', _('Catalog price: Low to High')),
|
||||||
|
('name asc', _('Name - A to Z')),
|
||||||
|
('name desc', _('Name - Z to A')),
|
||||||
|
('create_date desc', 'Novedades'),
|
||||||
|
]
|
||||||
|
|
||||||
|
default_product_sort_criteria = fields.Selection(
|
||||||
|
selection='_get_product_sort_criterias',
|
||||||
|
string="Sort products by",
|
||||||
|
help="Default criteria for sorting products in the shop",
|
||||||
|
default='create_date desc',
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue