diff options
| author | Anael Closson <acl@openerp.com> | 2012-08-13 19:04:29 +0200 |
|---|---|---|
| committer | Anael Closson <acl@openerp.com> | 2012-08-13 19:04:29 +0200 |
| commit | 87c4a3a3b7406cd8bba071846e230f48d7c03da8 (patch) | |
| tree | 184d591d9453108313eddfa3de6d84abb4059dda /addons/note | |
| parent | 36aaaf4a32ab2eeadec780f784cf697989ac3f69 (diff) | |
initial note push
bzr revid: acl@openerp.com-20120813170429-91dibb1dpe32j6w2
Diffstat (limited to 'addons/note')
| -rw-r--r-- | addons/note/__init__.py | 23 | ||||
| -rw-r--r-- | addons/note/__openerp__.py | 59 | ||||
| -rw-r--r-- | addons/note/note.py | 134 | ||||
| -rw-r--r-- | addons/note/note_view.xml | 158 | ||||
| -rw-r--r-- | addons/note/security/ir.model.access.csv | 3 | ||||
| -rw-r--r-- | addons/note/security/note_security.xml | 12 | ||||
| -rw-r--r-- | addons/note/static/src/css/note.css | 58 |
7 files changed, 447 insertions, 0 deletions
diff --git a/addons/note/__init__.py b/addons/note/__init__.py new file mode 100644 index 00000000000..9bf064877b5 --- /dev/null +++ b/addons/note/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +import note + diff --git a/addons/note/__openerp__.py b/addons/note/__openerp__.py new file mode 100644 index 00000000000..96938f56ef1 --- /dev/null +++ b/addons/note/__openerp__.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + + +{ + 'name': 'Notes', + 'version': '0.1', + 'category': 'Tools', + 'description': """ +This module allows users to create their own notes inside OpenERP +============================================================================== + +With this module you can allow users to take notes inside OpenERP. +These notes can be shared with OpenERP or external users. +They also can be organized following user dependant categories. +Notes can be found in the 'Home' main menu, under 'Tool' submenu. +""", + 'author': 'OpenERP SA', + 'website': 'http://openerp.com', + 'depends': ['base_tools','mail','pad'], + 'init_xml': [], + 'update_xml': [ + 'security/note_security.xml', + 'security/ir.model.access.csv', + 'note_view.xml', + #'note_workflow.xml', + ], + 'demo_xml': [ + #"note_data.xml" + ], + 'test':[ + ], + 'css': [ + 'static/src/css/note.css', + ], + 'installable': True, + 'application': True, + 'category': 'Tools', + 'images': [], +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/note/note.py b/addons/note/note.py new file mode 100644 index 00000000000..a9afad770c4 --- /dev/null +++ b/addons/note/note.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.osv import osv, fields +from tools.translate import _ + +# +# Todo : + + +# ** fix editable when in form view ** not atm +# fix search +# fix design +# rights + + +class note_stage(osv.Model): + """ Category of Note """ + + _name = "note.stage" + _description = "Note Stage" + _columns = { + 'name': fields.char('Category Name', size=64, required=True), + 'sequence': fields.integer('Sequence', help="Used to order the note stages"), + 'user_id': fields.many2one('res.users', 'Owner', help="Owner of the note stage.", required=True, readonly=True), + 'fold': fields.boolean('Folded'), + + } + _sql_constraints = [ + ] + + _order = 'sequence asc' + + _defaults = { + 'fold': 0, + 'user_id': lambda self, cr, uid, ctx: uid, + 'sequence' : 1, + } + + def __init__(self, pool, cr): + osv.Model.__init__(self,pool, cr) + + +# class many2many_filter(fields.many2many) + +# grep many2many_mod dans le code + + + +class note_note(osv.Model): + """ Note """ + _name = 'note.note' + _inherit = ['mail.thread','pad.common'] + _pad_fields = ['note_pad'] + _description = "Note" + + def _get_note_first_line(self, cr, uid, ids, name, args, context=None): + res = {} + for note in self.browse(cr, uid, ids, context=context): + res[note.id] = note.note.split('\n')[0] + return res + + def _set_note_first_line(self, cr, uid, id, name, value, args, context=None): + # + # todo should set the pad first line (as title) + # + return self.write(cr, uid, [id], {'name': value}, context=context) + + _columns = { + 'name': fields.function(_get_note_first_line,_fnct_inv=_set_note_first_line, string='Note Summary', type="text", store=True), + 'note': fields.text('Pad Content'), + 'note_pad': fields.char('Pad Url', size=250), + 'sequence': fields.integer('Sequence'), + 'stage_id': fields.many2one('note.stage', 'Stage'), + 'active': fields.boolean('Active'), + 'color': fields.integer('Color Index'), + #'follower_ids': fields.one2many('mail.subscription', 'res_id', 'Followers', domain=[('res_model','=', 'note.note')]) + 'follower_ids': fields.many2many('res.users', 'mail_subscription', 'res_id', 'user_id', 'Followers', join_filter="mail_subscription.res_model='note.note'") + } + + _sql_constraints = [ + ] + + + def _get_default_stage_id(self,cr,uid,context=None): + id = self.pool.get('note.stage').search(cr,uid,[('sequence','=','1')]) + return id[0] + + _defaults = { + 'active' : 1, + 'stage_id' : _get_default_stage_id, + 'note_pad': lambda self, cr, uid, context: self.pad_generate_url(cr, uid, context), + } + + + _order = 'sequence asc' + + + + def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None): + access_rights_uid = access_rights_uid or uid + stage_obj = self.pool.get('note.stage') + + # only show stage groups not folded and owned by user + search_domain = [('fold', '=', False),('user_id', '=', uid)] + + stage_ids = stage_obj._search(cr, uid, search_domain, order=self._order, access_rights_uid=access_rights_uid, context=context) + result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) + return result + + _group_by_full = { + 'stage_id' : _read_group_stage_ids, + } + + def stage_set(self,cr,uid,ids,stage_id,context=None): + self.write(cr,uid,ids,{'stage_id': stage_id}) diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml new file mode 100644 index 00000000000..9f8c91e9c62 --- /dev/null +++ b/addons/note/note_view.xml @@ -0,0 +1,158 @@ +<?xml version="1.0"?> +<openerp> + <data> + + <!-- Note Stage Form View --> + <record model="ir.ui.view" id="view_note_stage_form"> + <field name="name">note.stage.form</field> + <field name="model">note.stage</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Stage of Notes" version="7.0"> + <group> + <field name="name"/> + </group> + </form> + </field> + </record> + + + + <!-- Note Stage Tree View --> + <record model="ir.ui.view" id="view_note_stage_tree"> + <field name="name">note.stage.tree</field> + <field name="model">note.stage</field> + <field name="type">tree</field> + <field name="field_parent"></field> + + <field name="arch" type="xml"> + <tree string="Stages of notes" editable="top"> + <field name="sequence" invisible="1" /> + <field name="name" /> + <field name="fold" /> + </tree> + </field> + </record> + + <!-- Note Stage Action --> + <record model="ir.actions.act_window" id="action_note_stage"> + <field name="name">Stages</field> + <field name="res_model">note.stage</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + <field name="domain">[('user_id','=',uid)]</field> + </record> + + <menuitem name="Notes" parent="base.menu_tools" id="menu_notes" sequence="20"/> + + <menuitem name="Categories" parent="menu_notes" + id="menu_notes_stage" action="action_note_stage" sequence="2" /> + + <!-- New Note Kanban View --> + <record model="ir.ui.view" id="view_note_note_kanban"> + <field name="name">note.note.kanban</field> + <field name="model">note.note</field> + <field name="type">kanban</field> + <field name="arch" type="xml"> + <kanban default_group_by="stage_id" > + <field name="color" /> + <field name="sequence" /> + <field name="name" /> + <field name="stage_id" /> + <field name="active" /> + <field name="note" /> + <field name="follower_ids" /> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click"> + <!-- dropdown menu --> + <div class="oe_dropdown_toggle oe_dropdown_kanban"> + <span class="oe_e">í</span> + <ul class="oe_dropdown_menu"> + <li><a type="edit" >Edit...</a></li> + <li><a type="delete">Delete</a></li> + <li><ul class="oe_kanban_colorpicker" data-field="color"/></li> + </ul> + </div> + + <!-- kanban note --> + <div class="oe_kanban_content"> + + <!-- title --> + <field name="name" /> + + </div> + + <div class="oe_kanban_project_avatars"> + <t t-foreach="record.follower_ids.raw_value" t-as="follower"> + <img t-att-src="kanban_image('res.users', 'image_small', follower)" t-att-data-member_id="follower"/> + </t> + </div> + + </div> + <div class="oe_clear"></div> + </t> + </templates> + </kanban> + </field> + </record> + + + + <!-- New Note Form View --> + <record model="ir.ui.view" id="view_note_note_form"> + <field name="name">note.note.form</field> + <field name="model">note.note</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Note" version="7.0"> + <header> + <!-- todo: remove domain --> + <field name="stage_id" domain="[('user_id','=',uid)]" widget="statusbar" clickable="1" /> + </header> + <field name="note" widget="pad" /> + <div class="oe_chatter"> + <field name="message_ids" widget="mail_thread"/> + </div> + </form> + </field> + </record> + + <!-- Search Note --> + <record model="ir.ui.view" id="view_note_note_filter"> + <field name="name">note.note.search</field> + <field name="model">note.note</field> + <field name="type">search</field> + <field name="arch" type="xml"> + <search string="Notes"> + <field name="note" string="Note"/> + <field name="stage_id"/> + <group expand="0" string="Group By..."> + <filter icon="terp-personal" string="Creator" help="By Creators" context="{'group_by':'create_uid'}"/> + <filter icon="terp-stock_symbol-selection" string="Stage" help="By Note Category" context="{'group_by':'stage_id'}"/> + </group> + </search> + </field> + </record> + + + <!-- New Note Tree View --> + <record model="ir.ui.view" id="view_note_note_tree"> + <field name="name">note.note.tree</field> + <field name="model">note.note</field> + <field name="type">tree</field> + </record> + + + <record model="ir.actions.act_window" id="action_note_note"> + <field name="name">Notes</field> + <field name="res_model">note.note</field> + <field name="view_type">form</field> + <field name="view_mode">kanban,tree,form</field> + <field name="search_view_id" ref="view_note_note_filter"/> + </record> + + <menuitem name="My notes" parent="menu_notes" id="menu_notes_note" action="action_note_note" sequence="1"/> + + </data> +</openerp> diff --git a/addons/note/security/ir.model.access.csv b/addons/note/security/ir.model.access.csv new file mode 100644 index 00000000000..fdd6030ca51 --- /dev/null +++ b/addons/note/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_note_stage_user,note.stage user,model_note_stage,base.group_user,1,1,1,1
+access_note_note_user,note.note user,model_note_note,base.group_user,1,1,1,1
diff --git a/addons/note/security/note_security.xml b/addons/note/security/note_security.xml new file mode 100644 index 00000000000..46eebee629c --- /dev/null +++ b/addons/note/security/note_security.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<openerp> +<data> + <record id="note_note_global" model="ir.rule"> + <field name="name">My notes</field> + <field ref="model_note_note" name="model_id"/> + <field eval="1" name="global"/> + <field name="domain_force">[('follower_ids','=',user.id)]</field> + </record> +</data> +</openerp> + diff --git a/addons/note/static/src/css/note.css b/addons/note/static/src/css/note.css new file mode 100644 index 00000000000..a6b097ece88 --- /dev/null +++ b/addons/note/static/src/css/note.css @@ -0,0 +1,58 @@ + + +.openerp .oe_webclient .oe_application .oe_view_manager .oe_view_manager_body .oe_view_manager_view_kanban .oe_kanban_view .oe_kanban_groups .oe_kanban_groups_records .oe_kanban_column .oe_fold_column .oe_kanban_card { + text-decoration:none; + color:#000; + display:block; + padding:1em; + margin-right: 1em; + margin-bottom: 1em; + + -moz-box-shadow:5px 5px 7px rgba(33,33,33,1); + -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7); + box-shadow: 5px 5px 7px rgba(33,33,33,.7); +} + + +.openerp .oe_webclient .oe_application .oe_view_manager .oe_view_manager_body .oe_view_manager_view_kanban .oe_kanban_view .oe_kanban_groups .oe_kanban_groups_records .oe_kanban_column .oe_fold_column .oe_kanban_card { + -webkit-transform: rotate(-3deg); + -o-transform: rotate(-3deg); + -moz-transform:rotate(-3deg); +} + +.openerp .oe_webclient .oe_application .oe_view_manager .oe_view_manager_body .oe_view_manager_view_kanban .oe_kanban_view .oe_kanban_groups:nth-child(even) .oe_kanban_groups_records .oe_kanban_column .oe_fold_column .oe_kanban_card { + -o-transform:rotate(1deg); + -webkit-transform:rotate(1deg); + -moz-transform:rotate(1deg); + position:relative; + top:3px; +} + +.openerp .oe_webclient .oe_application .oe_view_manager .oe_view_manager_body .oe_view_manager_view_kanban .oe_kanban_view .oe_kanban_groups:nth-child(2n) .oe_kanban_groups_records .oe_kanban_column .oe_fold_column .oe_kanban_card { + -o-transform:rotate(-2deg); + -webkit-transform:rotate(-2deg); + -moz-transform:rotate(-2deg); + position:relative; + top:-3px; +} + +.openerp .oe_webclient .oe_application .oe_view_manager .oe_view_manager_body .oe_view_manager_view_kanban .oe_kanban_view .oe_kanban_groups:nth-child(2n) .oe_kanban_groups_records .oe_kanban_column .oe_fold_column .oe_kanban_card { + -o-transform:rotate(2deg); + -webkit-transform:rotate(2deg); + -moz-transform:rotate(2deg); + position:relative; + top:-5px; +} + +.openerp .oe_webclient .oe_application .oe_view_manager .oe_view_manager_body .oe_view_manager_view_kanban .oe_kanban_view .oe_kanban_groups .oe_kanban_groups_records .oe_kanban_column .oe_fold_column .oe_kanban_card:hover, +.openerp .oe_webclient .oe_application .oe_view_manager .oe_view_manager_body .oe_view_manager_view_kanban .oe_kanban_view .oe_kanban_groups .oe_kanban_groups_records .oe_kanban_column .oe_fold_column .oe_kanban_card:focus +{ + box-shadow:10px 10px 7px rgba(0,0,0,.7); + -moz-box-shadow:10px 10px 7px rgba(0,0,0,.7); + -webkit-box-shadow: 10px 10px 7px rgba(0,0,0,.7); + -webkit-transform: scale(1.25); + -moz-transform: scale(1.25); + -o-transform: scale(1.25); + position:relative; + z-index:5; +} |
