| @ -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 | |||
| @ -0,0 +1,23 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2008-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<http://www.cybrosys.com>) | |||
| #    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 <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################## | |||
| import models | |||
| @ -0,0 +1,44 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2008-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<http://www.cybrosys.com>) | |||
| #    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 <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################## | |||
| { | |||
|     '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, | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2008-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<http://www.cybrosys.com>) | |||
| #    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 <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################## | |||
| import colour_note_fields | |||
| @ -0,0 +1,117 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################## | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| #    Copyright (C) 2008-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | |||
| #    Author: Nilmar Shereef(<http://www.cybrosys.com>) | |||
| #    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 <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################## | |||
| 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 | |||
| 
 | 
| After Width: | Height: | Size: 139 KiB | 
| After Width: | Height: | Size: 36 KiB | 
| After Width: | Height: | Size: 50 KiB | 
| After Width: | Height: | Size: 43 KiB | 
| After Width: | Height: | Size: 9.4 KiB | 
| After Width: | Height: | Size: 9.7 KiB | 
| @ -0,0 +1,93 @@ | |||
| <section class="oe_container"> | |||
|     <div class="oe_row oe_spaced"> | |||
|         <h2 class="oe_slogan">Color your notes automatically</h2> | |||
|         <h3 class="oe_slogan">Prioritize your notes by colour</h3> | |||
|         <h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4> | |||
|         <br/> | |||
|     </div> | |||
|     <div class="row oe_row oe_spaced"> | |||
|         <div class="col-md-6"> | |||
|                 ☀ User Defined Colour Configuration for Notes.<br> | |||
|                 ☀ Automatic Colour Change of Notes Based on Dead Date.<br> | |||
|                 ☀ Default Colour for Forbidden.<br> | |||
|                 ☀ Default Colour for Over Passed Notes.<br> | |||
|                 ☀ Updates the note's colors every on-load of kanban view.<br> | |||
|         </div> | |||
|         <div class="col-md-6"> | |||
|             <div class="oe_bg_img"> | |||
|                 <img class="oe_picture oe_screenshot center-block" src="disply.png" style="margin-top: 0px !important;"> | |||
|             </div> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <section class="oe_container"> | |||
|     <div class="oe_row oe_spaced"> | |||
|         <div class="oe_span6"> | |||
|             <div class="oe_demo oe_picture oe_screenshot"> | |||
|                 <img src="note.png"> | |||
|             </div> | |||
|         </div> | |||
|         <div class="oe_span6"> | |||
|             <p class='oe_mt32'> | |||
|                 ☛ Changes the note color in kanban view relative to the dead-date | |||
|                 field value and the date intervals | |||
|             </p> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <section class="oe_container oe_dark"> | |||
|     <div class="oe_row"> | |||
|         <h2 class="oe_slogan">How to..</h2> | |||
|         <div class="oe_span6"> | |||
|             <div class="oe_bg_img"> | |||
|                 <img class="oe_picture oe_screenshot" src="configuration.png"> | |||
|             </div> | |||
|         </div> | |||
|         <div class="oe_span6"> | |||
|             <p class='oe_mt32'> | |||
|                ☛ 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. | |||
|             </p> | |||
|         </div> | |||
|     </div> | |||
|     <div class="oe_row"> | |||
|         <div class="oe_span6"> | |||
|             <p class='oe_mt32'> | |||
|                ☛ Set date intervals and colors for the notes from Date interval tab under | |||
|                 notes--->date interval(NOTE:Activate Developer mode) | |||
|             </p> | |||
|             <p class='oe_mt32'> | |||
|                ☛ 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 | |||
|             </p> | |||
|         </div> | |||
|         <div class="oe_span6"> | |||
|             <div class="oe_bg_img"> | |||
|                 <img class="oe_picture oe_screenshot" src="date_interval.png"> | |||
|             </div> | |||
|         </div> | |||
|     </div> | |||
| </section> | |||
| 
 | |||
| <section class="oe_container oe_dark"> | |||
|     <h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> | |||
|     <div class="oe_slogan" style="margin-top:10px !important;"> | |||
|         <a  class="btn btn-primary btn-lg mt8" | |||
|             style="color: #FFFFFF !important;" href="http://www.cybrosys.com"><i | |||
|             class="fa fa-envelope"></i> Email </a> <a | |||
|             class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" | |||
|             href="http://www.cybrosys.com/contact/"><i | |||
|             class="fa fa-phone"></i> Contact Us </a> <a | |||
|             class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" | |||
|             href="http://www.cybrosys.com/odoo-customization-and-installation/"><i | |||
|             class="fa fa-check-square"></i> Request Customization </a> | |||
|     </div> | |||
|             <img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> | |||
| </section> | |||
| After Width: | Height: | Size: 42 KiB | 
| @ -0,0 +1,50 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <openerp> | |||
|     <data noupdate="0"> | |||
|         <record id="view_note_configuration1" model="note.config"> | |||
|             <field name="default_magic_color">1</field> | |||
|             <field name="not_in_interval">7</field> | |||
|             <field name="deadline_cross">8</field> | |||
|         </record> | |||
|     </data> | |||
|     <data> | |||
|         <record id="view_note_configuration" model="ir.ui.view"> | |||
|             <field name="name">note_config</field> | |||
|             <field name="model">note.config</field> | |||
|             <field name="arch" type="xml"> | |||
|                 <form edit="true" create="false" delete="false"> | |||
|                     <h3 style="text-align: center"> | |||
|                         Edit configurations to change the colors | |||
|                     </h3> | |||
| 
 | |||
|                     <group col="4"> | |||
|                         <field name="default_magic_color"/> | |||
|                         <field name="not_in_interval"/> | |||
|                         <field name="deadline_cross"/> | |||
|                     </group> | |||
|                 </form> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <record model="ir.ui.view" id="config_tree_view"> | |||
|             <field name="name">config_tree</field> | |||
|             <field name="model">note.config</field> | |||
|             <field name="arch" type="xml"> | |||
|                 <tree create="false" delete="false"> | |||
|                     <field name="deadline_cross"/> | |||
|                     <field name="not_in_interval"/> | |||
|                     <field name="deadline_cross"/> | |||
|                 </tree> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <record id="action_general_configuration1" model="ir.actions.act_window"> | |||
|             <field name="name">General Settings</field> | |||
|             <field name="res_model">note.config</field> | |||
|             <field name="view_mode">tree,form</field> | |||
|         </record> | |||
| 
 | |||
|         <menuitem name="Settings" id="magic_note" parent="note.menu_note_configuration" action="action_general_configuration1"/> | |||
| 
 | |||
|     </data> | |||
| </openerp> | |||
| @ -0,0 +1,73 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <openerp> | |||
|     <data> | |||
|         <record model="ir.ui.view" id="view_note_note_form1"> | |||
|             <field name="name">note_field</field> | |||
|             <field name="model">note.note</field> | |||
|             <field name="inherit_id" ref="note.view_note_note_form"/> | |||
|             <field name="arch" type="xml"> | |||
|                 <xpath expr="//field[@name='tag_ids']" position="after"> | |||
|                     <group> | |||
|                         <field name="dead_date" /> | |||
|                     </group> | |||
|                 </xpath> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <record model="ir.ui.view" id="view_note_note_form2"> | |||
|             <field name="name">note_color</field> | |||
|             <field name="model">note.color</field> | |||
|             <field name="arch" type="xml"> | |||
|                 <form> | |||
|                     <group> | |||
|                         <group> | |||
|                             <field name="name" placeholder="Urgent/Freezy/Least etc"/> | |||
|                             <field name="color_note"/> | |||
|                         </group> | |||
|                         <group> | |||
|                             <group> | |||
|                                 <div class="o_row"> | |||
|                                     <label for="start_interval"/> | |||
|                                     <field name="start_interval"/> | |||
|                                     <span class="oe_grey">Days</span> | |||
|                                 </div> | |||
|                                 <div class="o_row"> | |||
|                                     <label for="end_interval"/> | |||
|                                     <field name="end_interval"/> | |||
|                                     <span class="oe_grey">Days</span> | |||
|                                 </div> | |||
|                             </group> | |||
|                         </group> | |||
|                     </group> | |||
|                 </form> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
|         <record model="ir.ui.view" id="session_tree_view"> | |||
|             <field name="name">color_tree</field> | |||
|             <field name="model">note.color</field> | |||
|             <field name="arch" type="xml"> | |||
|                 <tree > | |||
|                     <field name="name"/> | |||
|                     <field name="color_note"/> | |||
|                     <field name="start_interval"/> | |||
|                     <field name="end_interval"/> | |||
|                 </tree> | |||
|             </field> | |||
|         </record> | |||
| 
 | |||
| 
 | |||
|         <record model="ir.actions.act_window" id="colour_define"> | |||
|             <field name="name">colour</field> | |||
|             <field name="res_model">note.color</field> | |||
|             <field name="view_type">form</field> | |||
|             <field name="view_id" ref="session_tree_view"> </field> | |||
|             <field name="view_mode">tree,form</field> | |||
|             <field name="help" type="html"> | |||
|                 <p class="oe_view_nocontent_create">Create the colour sets | |||
|                 </p> | |||
|             </field> | |||
|         </record> | |||
|         <menuitem name="Date interval" id="date_intervals" parent="note.menu_note_configuration" action="colour_define"/> | |||
|     </data> | |||
| </openerp> | |||