Add module product_priority_star

This commit is contained in:
Alexis de Lattre
2023-01-20 12:01:57 +01:00
parent dbad21c13a
commit 1d463a744d
5 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,26 @@
# Copyright 2023 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# 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 <alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'https://github.com/akretion/odoo-usability',
'depends': ['product'],
'excludes': ['product_priority'],
'data': ['views/product_template.xml'],
'installable': True,
}

View File

@@ -0,0 +1 @@
from . import product

View File

@@ -0,0 +1,20 @@
# Copyright 2023 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# 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'

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2023 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="product_template_tree_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field name="priority" widget="priority" optional="show" nolabel="1"/>
</field>
</field>
</record>
<record id="product_template_form_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="name" position="before">
<field name="priority" widget="priority" class="mr-3"/>
</field>
</field>
</record>
<record id="product_template_kanban_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_kanban_view"/>
<field name="arch" type="xml">
<field name="lst_price" position="after">
<field name="priority" widget="priority"/>
</field>
</field>
</record>
</odoo>