Add module product_priority_star
This commit is contained in:
1
product_priority_star/__init__.py
Normal file
1
product_priority_star/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
26
product_priority_star/__manifest__.py
Normal file
26
product_priority_star/__manifest__.py
Normal 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,
|
||||
}
|
||||
1
product_priority_star/models/__init__.py
Normal file
1
product_priority_star/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import product
|
||||
20
product_priority_star/models/product.py
Normal file
20
product_priority_star/models/product.py
Normal 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'
|
||||
41
product_priority_star/views/product_template.xml
Normal file
41
product_priority_star/views/product_template.xml
Normal 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>
|
||||
Reference in New Issue
Block a user