From 1d463a744da5e84bd1eecad670a58fd2fa474c08 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 20 Jan 2023 12:01:57 +0100 Subject: [PATCH] Add module product_priority_star --- product_priority_star/__init__.py | 1 + product_priority_star/__manifest__.py | 26 ++++++++++++ product_priority_star/models/__init__.py | 1 + product_priority_star/models/product.py | 20 +++++++++ .../views/product_template.xml | 41 +++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 product_priority_star/__init__.py create mode 100644 product_priority_star/__manifest__.py create mode 100644 product_priority_star/models/__init__.py create mode 100644 product_priority_star/models/product.py create mode 100644 product_priority_star/views/product_template.xml diff --git a/product_priority_star/__init__.py b/product_priority_star/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/product_priority_star/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_priority_star/__manifest__.py b/product_priority_star/__manifest__.py new file mode 100644 index 0000000..80add48 --- /dev/null +++ b/product_priority_star/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright 2023 Akretion France (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +{ + 'name': 'Product Priority Star', + 'version': '14.0.1.0.0', + 'category': 'Product', + 'license': 'AGPL-3', + 'summary': 'Add a priority star on product', + 'description': """ +Product Priority Star +===================== + +This module adds a priority star on products (like on pickings and manufacturing order). If the star is yellow, the product will be displayed at the top. + +This module has been written by Alexis de Lattre from Akretion . + """, + 'author': 'Akretion', + 'website': 'https://github.com/akretion/odoo-usability', + 'depends': ['product'], + 'excludes': ['product_priority'], + 'data': ['views/product_template.xml'], + 'installable': True, +} diff --git a/product_priority_star/models/__init__.py b/product_priority_star/models/__init__.py new file mode 100644 index 0000000..9649db7 --- /dev/null +++ b/product_priority_star/models/__init__.py @@ -0,0 +1 @@ +from . import product diff --git a/product_priority_star/models/product.py b/product_priority_star/models/product.py new file mode 100644 index 0000000..161fe7a --- /dev/null +++ b/product_priority_star/models/product.py @@ -0,0 +1,20 @@ +# Copyright 2023 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + _order = "priority desc, name, id" + + priority = fields.Selection([ + ('0', 'Normal'), + ('1', 'Top List'), + ], default='0', index=True) + + +class ProductProduct(models.Model): + _inherit = 'product.product' + _order = 'priority desc, default_code, name, id' diff --git a/product_priority_star/views/product_template.xml b/product_priority_star/views/product_template.xml new file mode 100644 index 0000000..62e5a56 --- /dev/null +++ b/product_priority_star/views/product_template.xml @@ -0,0 +1,41 @@ + + + + + + + product.template + + + + + + + + + + product.template + + + + + + + + + + product.template + + + + + + + + + +