diff --git a/magic_note/README.rst b/magic_note/README.rst new file mode 100644 index 000000000..ea4d06144 --- /dev/null +++ b/magic_note/README.rst @@ -0,0 +1,38 @@ +Magic Note for Odoo8 notes +========================== + +This module aims to automatically update the color of the notes/memo +in organizer tab under messaging menu. + +Features +======== + +* set a name for the category of coloured notes +* Select color from a pre defined list of colors +* Select a range of date limit(days) in integer form +* Updates the note's color in on-load of kanban view + + + .. note:: + + By default on installation of this module it creates + a field called dead date and sets it to the current date + + A new tab is created under settings-configuration where + >set default color when no date intervals are defined + >set color when any record doesn't come under date intervals + >set color for notes which exceed the deadline date + + |formview| + +* select a name which is not compulsory set lower and upper limit of days +* Select the color + + |listview| +* shows you the defied color and days(interval) + +Credits +======= + +Developer: Rahul @ cybrosys +Guidance: Nilmar Shereef @ cybrosys, shereef@cybrosys.in \ No newline at end of file diff --git a/magic_note/__init__.py b/magic_note/__init__.py new file mode 100644 index 000000000..73235f8a0 --- /dev/null +++ b/magic_note/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2008-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import models diff --git a/magic_note/__openerp__.py b/magic_note/__openerp__.py new file mode 100644 index 000000000..ce2c9a864 --- /dev/null +++ b/magic_note/__openerp__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2008-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': "Magic Color Note", + 'summary': """ + Automatically Change the Colour Based on Deadline of Notes""", + 'description': """ + Set a date interval in integers. + All notes belonging to the period will be assigned the defined colour + """, + 'version': '0.2', + 'author': "Cybrosys Techno Solutions", + 'company': "Cybrosys Techno Solutions", + 'website': "http://www.cybrosys.com", + 'category': 'Tools', + 'depends': ['base', 'note'], + 'data': ['views/color_note.xml', + 'views/color_config.xml'], + 'demo': [], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, +} diff --git a/magic_note/models/__init__.py b/magic_note/models/__init__.py new file mode 100644 index 000000000..f2fc0856c --- /dev/null +++ b/magic_note/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2008-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import colour_note_fields diff --git a/magic_note/models/colour_note_fields.py b/magic_note/models/colour_note_fields.py new file mode 100644 index 000000000..c9a25ead2 --- /dev/null +++ b/magic_note/models/colour_note_fields.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2008-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from openerp import models, fields +from datetime import datetime +from dateutil.relativedelta import relativedelta +from lxml import etree + + +class ColorPickerCustom(models.Model): + _name = 'note.color' + + name = fields.Char(string="Criteria", help="Name for this date interval") + color_note = fields.Selection( + [('0', 'White'), ('1', 'Grey'), ('2', 'Orange'), ('3', 'Light yellow'), ('4', 'Light green'), + ('5', 'Green'), ('6', 'Sky Blue'), ('7', 'Blue'), ('8', 'Purple'), + ('9', 'Pink')], required=True, default='0', help="Colour of the record") + + start_interval = fields.Integer(string="Lower limit", default='1', required=True, + help="Starting interval should be a integer (Number of days)") + end_interval = fields.Integer(string="Upper limit", default='2', required=True, + help="End interval should be a integer (Number of days)") + + +class NoteConfiguration(models.Model): + _name = 'note.config' + _rec_name = "default_magic_color" + + default_magic_color = fields.Selection( + [('0', 'White'), ('1', 'Grey'), ('2', 'Orange'), ('3', 'Light yellow'), ('4', 'Light green'), + ('5', 'Green'), ('6', 'Sky Blue'), ('7', 'Blue'), ('8', 'Purple'), + ('9', 'Pink')], string="Default", required=True, default='0', + help="This color will be set to the records if no date interval record is found" + "By default records are coloured to white") + + not_in_interval = fields.Selection( + [('0', 'White'), ('1', 'Grey'), ('2', 'Orange'), ('3', 'Light yellow'), ('4', 'Light green'), + ('5', 'Green'), ('6', 'Sky Blue'), ('7', 'Blue'), ('8', 'Purple'), + ('9', 'Pink')], string="If Not inside the Interval", required=True, default='1', + help="This color will be set to the records which doesn't come under any defined interval stages." + "By default the records are coloured to Grey") + + deadline_cross = fields.Selection( + [('0', 'White'), ('1', 'Grey'), ('2', 'Orange'), ('3', 'Light yellow'), ('4', 'Light green'), + ('5', 'Green'), ('6', 'Sky Blue'), ('7', 'Blue'), ('8', 'Purple'), + ('9', 'Pink')], string="After deadline ", required=True, default='8', + help="This color will be set to the notes once they cross the dead date") + + +class NoteField(models.Model): + _name = 'note.note' + _inherit = 'note.note' + + dead_date = fields.Date(string="Dead Date", default=fields.Date.today(), required=True, + help="The deadline of this note:: Activate developer mode to set color") + + def fields_view_get(self, cr, uid, view_id=None, view_type='kanban', context=None, toolbar=False, submenu=False): + ret_val = super(NoteField, self).fields_view_get( + cr, uid, view_id=view_id, view_type=view_type, context=context, + toolbar=toolbar, submenu=submenu) + doc = etree.XML(ret_val['arch']) + current_date = fields.datetime.now() + value = self.pool.get('note.color').search(cr, uid, [], context=None) + if len(value) == 0: + note = self.pool.get('note.note').search(cr, uid, [], context=None) + for each in note: + obj = self.pool.get('note.note').browse(cr, uid, each) + obj2 = self.pool.get('note.config').browse(cr, uid, 1) + col_default = obj2.default_magic_color + obj.write({'color': col_default}) + else: + note = self.pool.get('note.note').search(cr, uid, [], context=None) + for each in note: + obj = self.pool.get('note.note').browse(cr, uid, each) + fmt = '%Y-%m-%d' + date_dead = datetime.strptime(obj.dead_date, fmt) + if current_date > date_dead: + obj2 = self.pool.get('note.config').browse(cr, uid, 1) + dead_line_cross = obj2.deadline_cross + obj.write({'color': dead_line_cross}) + else: + r = relativedelta(date_dead, current_date) + for i in value: + flag = 0 + obj1 = self.pool.get('note.color').browse(cr, uid, i) + st_date = obj1.start_interval + end_date = obj1.end_interval + if st_date < r.days < end_date: + col = obj1.color_note + obj.write({'color': col}) + flag += 1 + if flag == 0: + obj3 = self.pool.get('note.config').browse(cr, uid, 1) + col_not_in_range = obj3.not_in_interval + obj.write({'color': col_not_in_range}) + for node in doc.xpath("//ul[@class='oe_kanban_colorpicker']"): + ret_val['arch'] = etree.tostring(doc) + return ret_val diff --git a/magic_note/security/ir.model.access.csv b/magic_note/security/ir.model.access.csv new file mode 100644 index 000000000..ffb1b1b93 --- /dev/null +++ b/magic_note/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_colour_note_colour_note,colour_note.colour_note,model_colour_note_colour_note,,1,0,0,0 \ No newline at end of file diff --git a/magic_note/static/description/banner.jpg b/magic_note/static/description/banner.jpg new file mode 100644 index 000000000..9cf24f14e Binary files /dev/null and b/magic_note/static/description/banner.jpg differ diff --git a/magic_note/static/description/configuration.png b/magic_note/static/description/configuration.png new file mode 100644 index 000000000..1a856381c Binary files /dev/null and b/magic_note/static/description/configuration.png differ diff --git a/magic_note/static/description/cybro_logo.png b/magic_note/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/magic_note/static/description/cybro_logo.png differ diff --git a/magic_note/static/description/date_interval.png b/magic_note/static/description/date_interval.png new file mode 100644 index 000000000..8e6d44f79 Binary files /dev/null and b/magic_note/static/description/date_interval.png differ diff --git a/magic_note/static/description/disply.png b/magic_note/static/description/disply.png new file mode 100644 index 000000000..c449a5900 Binary files /dev/null and b/magic_note/static/description/disply.png differ diff --git a/magic_note/static/description/icon.png b/magic_note/static/description/icon.png new file mode 100644 index 000000000..b781c2211 Binary files /dev/null and b/magic_note/static/description/icon.png differ diff --git a/magic_note/static/description/index.html b/magic_note/static/description/index.html new file mode 100644 index 000000000..a67434a29 --- /dev/null +++ b/magic_note/static/description/index.html @@ -0,0 +1,93 @@ +
+
+

Color your notes automatically

+

Prioritize your notes by colour

+

Author : Cybrosys Techno Solutions , www.cybrosys.com

+
+
+
+
+ ☀ User Defined Colour Configuration for Notes.
+ ☀ Automatic Colour Change of Notes Based on Dead Date.
+ ☀ Default Colour for Forbidden.
+ ☀ Default Colour for Over Passed Notes.
+ ☀ Updates the note's colors every on-load of kanban view.
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+

+ ☛ Changes the note color in kanban view relative to the dead-date + field value and the date intervals +

+
+
+
+ +
+
+

How to..

+
+
+ +
+
+
+

+ ☛ After installation Activate developer mode. + Find two new tabs Date interval and Settings under note tab. + A new field Dead date will be added to the notes set a dead date. + set default colours in settings. +

+
+
+
+
+

+ ☛ Set date intervals and colors for the notes from Date interval tab under + notes--->date interval(NOTE:Activate Developer mode) +

+

+ ☛ Note: If a note does not belong to any date interval the note colour will + be set according to the color specified in the settings + + By default when installed on a running system the dead date will + be set to the current date of installation of this module +

+
+
+
+ +
+
+
+
+ +
+

Need Any Help?

+ + +
diff --git a/magic_note/static/description/note.png b/magic_note/static/description/note.png new file mode 100644 index 000000000..834548402 Binary files /dev/null and b/magic_note/static/description/note.png differ diff --git a/magic_note/views/color_config.xml b/magic_note/views/color_config.xml new file mode 100644 index 000000000..86ae0c4cd --- /dev/null +++ b/magic_note/views/color_config.xml @@ -0,0 +1,50 @@ + + + + + 1 + 7 + 8 + + + + + note_config + note.config + +
+

+ Edit configurations to change the colors +

+ + + + + + +
+
+
+ + + config_tree + note.config + + + + + + + + + + + General Settings + note.config + tree,form + + + + +
+
\ No newline at end of file diff --git a/magic_note/views/color_note.xml b/magic_note/views/color_note.xml new file mode 100644 index 000000000..e4873fc91 --- /dev/null +++ b/magic_note/views/color_note.xml @@ -0,0 +1,73 @@ + + + + + note_field + note.note + + + + + + + + + + + + note_color + note.color + +
+ + + + + + + +
+
+
+
+
+
+
+
+
+
+ + + color_tree + note.color + + + + + + + + + + + + + colour + note.color + form + + tree,form + +

Create the colour sets +

+
+
+ +
+
\ No newline at end of file