añadido addon para ordenar los productos en la web por su fecha de creación.
depende de website_sale_product_sort de OCA/e-commerce
This commit is contained in:
parent
f874606369
commit
f6231e3957
4 changed files with 49 additions and 0 deletions
1
website_sale_product_sort_creation_date/__init__.py
Normal file
1
website_sale_product_sort_creation_date/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import models
|
||||
20
website_sale_product_sort_creation_date/__manifest__.py
Normal file
20
website_sale_product_sort_creation_date/__manifest__.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Copyright 2021 Criptomart
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
'name': 'Website Sale Product Sort Creation Date',
|
||||
'summary': 'Permite ordenar por la fecha de creación de los productos.',
|
||||
'version': '12.0.1.0.1',
|
||||
'development_status': 'Beta',
|
||||
'category': 'Website',
|
||||
'website': 'https://github.com/criptomart/obook',
|
||||
'author': 'Criptomart',
|
||||
'license': 'AGPL-3',
|
||||
'depends': [
|
||||
'website',
|
||||
'website_sale_product_sort',
|
||||
],
|
||||
'data': [
|
||||
],
|
||||
'application': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
from . import website
|
||||
|
||||
26
website_sale_product_sort_creation_date/models/website.py
Normal file
26
website_sale_product_sort_creation_date/models/website.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Copyright 2021 Criptomart
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
from odoo import _, api, fields, models
|
||||
|
||||
|
||||
class Website(models.Model):
|
||||
_inherit = "website"
|
||||
|
||||
@api.model
|
||||
def _get_product_sort_criterias(self):
|
||||
return [
|
||||
('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
Add a link
Reference in a new issue