@ -0,0 +1,45 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Listview Change Background Color |
|||
================================ |
|||
This module allow change background colors of most priority records in tree/list view very easily and quickly. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V16) Albin P J @cybrosys, |
|||
(V17) Safa Faheem PE @cybrosys |
|||
(V18) Farook Al Ameen |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import models |
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
{ |
|||
'name': 'Listview Change Background Color', |
|||
'version': '18.0.1.0.0', |
|||
'summary': """Change Background Colors Of Most Priority Records In Tree or |
|||
List View""", |
|||
'description': """Change background colors of important or favorite records |
|||
or most priority records from tree/list view very easily and quickly |
|||
regardless of pagination limits.""", |
|||
'category': 'Tools', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'depends': ['base', 'web', 'crm', 'sale'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
], |
|||
'images': ['static/description/banner.gif'], |
|||
'assets': { |
|||
'web.assets_backend': [ |
|||
'listview_change_background_color/static/src/css/color_picker.css', |
|||
('after', 'web/static/src/views/list/list_renderer.xml', 'listview_change_background_color/static/src/xml/color_picker.xml'), |
|||
'listview_change_background_color/static/src/js/color_picker.js', |
|||
] |
|||
}, |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,10 @@ |
|||
## Module <listview_change_background_color> |
|||
|
|||
#### 11.01.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Listview Change Background Color |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import color_picker |
@ -0,0 +1,46 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class ColorPicker(models.Model): |
|||
"""We can store the fields on this model temporarily and used to save""" |
|||
_name = 'color.picker' |
|||
_description = "Color Picker" |
|||
|
|||
record_id = fields.Integer(string="Record Id", help='Record id of color') |
|||
res_model = fields.Char(string="Model", help='Corresponding model') |
|||
color = fields.Char(string="Color", help='Color code') |
|||
|
|||
@api.model |
|||
def get_color_picker_model_and_id(self, **kw): |
|||
"""We can get the all records, models and colors""" |
|||
record = self.search([('record_id', '=', kw['record_id']), |
|||
('res_model', '=', kw['model_name'])]) |
|||
if record: |
|||
record.write({'color': kw['record_color']}) |
|||
else: |
|||
self.create({ |
|||
'record_id': kw['record_id'], |
|||
'res_model': kw['model_name'], |
|||
'color': kw['record_color'], |
|||
}) |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 172 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,3 @@ |
|||
.o_list_renderer .o_list_table { |
|||
--table-bg: transparent; |
|||
} |
@ -0,0 +1,91 @@ |
|||
/** @odoo-module **/ |
|||
import { patch } from "@web/core/utils/patch"; |
|||
import { ListRenderer } from "@web/views/list/list_renderer"; |
|||
import { ListController } from '@web/views/list/list_controller'; |
|||
import { useService } from "@web/core/utils/hooks"; |
|||
|
|||
const { useRef, onPatched, onMounted, useState, onWillUpdateProps } = owl; |
|||
|
|||
patch(ListRenderer.prototype, { |
|||
setup() { |
|||
if (this.constructor.name == 'SectionAndNoteListRenderer') { |
|||
// Call method for removing color picking field from one2many
|
|||
onMounted(() => { |
|||
this.__owl__.bdom.el.children[0].children[1].childNodes.forEach((item) => { |
|||
if (item.nodeName != "#text"){ |
|||
if(!item.attributes.length == 0){ |
|||
var list_one2many = item.children[1]; |
|||
list_one2many.remove(); |
|||
} |
|||
} |
|||
}) |
|||
}) |
|||
} |
|||
super.setup() |
|||
this.orm = useService("orm"); |
|||
onMounted(this.color); |
|||
if (this.constructor.name == 'SectionAndNoteListRenderer') { |
|||
// Call method for removing color picking field from one2many
|
|||
onPatched(()=>{ |
|||
this.__owl__.bdom.el.children[0].children[1].childNodes.forEach((item) => { |
|||
if (item.nodeName != "#text"){ |
|||
if(!item.attributes.length == 0){ |
|||
var list_one2many = item.children[1]; |
|||
list_one2many.remove(); |
|||
} |
|||
} |
|||
}) |
|||
}); |
|||
} |
|||
onPatched(()=>{ |
|||
this.color() |
|||
}); |
|||
}, |
|||
color_pick(ev, record) { |
|||
var color = ev.target.value |
|||
var res_id = record.resId |
|||
var res_model = record.resModel |
|||
|
|||
// Update color picker input value
|
|||
ev.target.value = color; |
|||
|
|||
// ORM Call
|
|||
this.orm.call("color.picker", "get_color_picker_model_and_id", [], { |
|||
record_id: res_id, |
|||
model_name: res_model, |
|||
record_color: color, |
|||
}).then(function(data) { |
|||
// You might want to handle the response here if needed
|
|||
}) |
|||
|
|||
// Update row background color
|
|||
ev.target.closest('tr').style.backgroundColor = color; |
|||
}, |
|||
|
|||
color() { |
|||
var current_model = this.props.list.model.env.searchModel.resModel |
|||
var tr_list = document.getElementsByClassName('o_data_row') |
|||
var self = this; |
|||
|
|||
this.orm.call("color.picker", "search_read", [], { |
|||
domain: [ |
|||
['res_model', '=', current_model], |
|||
], |
|||
}).then(function(data) { |
|||
Array.prototype.forEach.call(tr_list, function(tr) { |
|||
data.forEach((item) => { |
|||
if (tr.firstChild.nextElementSibling.dataset.id == item.record_id) { |
|||
// Update row background color
|
|||
tr.style.backgroundColor = item.color; |
|||
|
|||
// Update color picker input value
|
|||
let colorPicker = tr.querySelector('input[type="color"]'); |
|||
if (colorPicker) { |
|||
colorPicker.value = item.color; |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}) |
|||
}, |
|||
}) |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<templates id="template" xml:space="preserve"> |
|||
|
|||
<t t-inherit="web.ListRenderer" t-inherit-mode="extension"> |
|||
<xpath expr="//th[hasclass('o_list_record_selector')]" position="after"> |
|||
<th> |
|||
<td class="color_picker_td">Color</td> |
|||
</th> |
|||
</xpath> |
|||
</t> |
|||
<!-- Add the color field on tree--> |
|||
<t t-name="ListColorTemplate" t-inherit="web.ListRenderer.RecordRow" |
|||
t-inherit-mode="extension"> |
|||
<xpath expr="//td[hasclass('o_list_record_selector')]" position="after"> |
|||
<td class="not_display" t-att-data-id="record.resId" |
|||
style="display:none"> |
|||
</td> |
|||
<td class="color_picker_checkbox"> |
|||
<input type="color" value="#e7d8d5" class="row_color_pick" |
|||
name="row_color_value" |
|||
style="width:20px;border: 1px;height: 20px;" |
|||
t-on-change="(ev) => this.color_pick(ev, record)"/> |
|||
</td> |
|||
</xpath> |
|||
</t> |
|||
</templates> |