From 313c4ef511115dd598a23a3698dc8ad25fe21126 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 17 Sep 2012 14:30:54 +0200 Subject: [PATCH 01/14] [IMP] note: search, css bzr revid: chm@openerp.com-20120917123054-futj80nzfo725kiv --- addons/note/note.py | 17 ++++++++++++----- addons/note/note_demo.xml | 9 --------- addons/note/note_view.xml | 17 +++++++++-------- addons/note/security/ir.rule.xml | 9 +++++++++ 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/addons/note/note.py b/addons/note/note.py index 429c16eed6d..33d138de641 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -22,6 +22,7 @@ from openerp.osv import osv, fields from tools.translate import _ import re +from openerp.tools.misc import html2plaintext class note_stage(osv.osv): """ Category of Note """ @@ -60,6 +61,10 @@ class note_note(osv.osv): rec_id = self.create(cr, uid, {'memo': name}, context=context) return self.name_get(cr, uid, [rec_id], context)[0] + def _from_xml(self, mappings): + return chr(int( mappings.group(1) )) + + #read the first line (convert hml into text) def _get_note_first_line(self, cr, uid, ids, name="", args={}, context=None): res = {} @@ -67,13 +72,14 @@ class note_note(osv.osv): text_note = (note.memo or '').strip().split('\n')[0] text_note = re.sub(r'(\S?)(|<[/]?p>|<[/]?div>|)[\s\S]*',r'\1',text_note) text_note = re.sub(r'<[^>]+>','',text_note) + text_note = html2plaintext(text_note) res[note.id] = text_note return res #unactivate a sticky note and record the date def onclick_note_is_done(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, { 'active' : False, 'date_done' : fields.date.today() }) + self.write(cr, uid, ids, { 'open' : False, 'date_done' : fields.date.today() }) self.message_post(cr, uid, ids[0], body='This sticky note is active', subject=False, type='notification', parent_id=False, attachments=None, context=context) @@ -82,7 +88,7 @@ class note_note(osv.osv): #activate a Sticky note def onclick_note_not_done(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, { 'active' : True }) + self.write(cr, uid, ids, { 'open' : True }) self.message_post(cr, uid, ids[0], body='This sticky note is close', subject=False, type='notification', parent_id=False, attachments=None, context=context) @@ -124,7 +130,8 @@ class note_note(osv.osv): _columns = { 'name': fields.function(_get_note_first_line, string='Sticky note Summary', - type='text', store=True), + type='text', + store=True), 'memo': fields.html('Pad Content'), 'sequence': fields.integer('Sequence'), @@ -140,7 +147,7 @@ class note_note(osv.osv): # stage per user 'stage_ids': fields.many2many('note.stage','note_stage_rel','note_id','stage_id','Linked stages users'), - 'active': fields.boolean('Active'), + 'open': fields.boolean('Active'), # when the user unactivate the Sticky note, record de date for un display Sticky note after 1 days 'date_done': fields.date('Date done'), 'color': fields.integer('Color Index'), @@ -151,7 +158,7 @@ class note_note(osv.osv): } _defaults = { - 'active' : 1, + 'open' : 1, 'stage_id' : _get_default_stage_id, 'memo': " " } diff --git a/addons/note/note_demo.xml b/addons/note/note_demo.xml index 88b21effb7e..8b76887e577 100644 --- a/addons/note/note_demo.xml +++ b/addons/note/note_demo.xml @@ -115,14 +115,5 @@ 7 - -
* Open ERP: a modern approach to integrated business management -
* Open ERP for Retail and Industrial Management - ]]> -
- -
- diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml index 232b96f643a..5617fae4376 100644 --- a/addons/note/note_view.xml +++ b/addons/note/note_view.xml @@ -51,7 +51,7 @@ - + @@ -65,8 +65,8 @@
- W - è + W + è @@ -80,7 +80,7 @@
-
+
@@ -107,7 +107,7 @@ - + @@ -143,8 +143,9 @@ - - + + + @@ -188,7 +189,7 @@ form kanban,tree,form - {'search_default_active_true':True} + {'search_default_open_true':True} diff --git a/addons/note/security/ir.rule.xml b/addons/note/security/ir.rule.xml index 82994b960c2..5f4882c3048 100644 --- a/addons/note/security/ir.rule.xml +++ b/addons/note/security/ir.rule.xml @@ -1,12 +1,21 @@ + Only followers can access a sticky notes ['|',('message_follower_ids','=',False),('message_follower_ids','=',user.partner_id.id)] + + + Each user have his stage name + + ['|',('user_id','=',False),('user_id','=',user.id)] + + + From 61ebb4042b5d7d0e98a1ac6be8cc63f917fd84de Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 18 Sep 2012 17:11:08 +0200 Subject: [PATCH 02/14] [IMP] kanban: many2many_tags => bzr revid: chm@openerp.com-20120918151108-8fpv61vmlmbjkws7 --- addons/base_calendar/base_calendar_view.xml | 2 +- addons/base_setup/res_partner_view.xml | 2 +- addons/note/note_view.xml | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index 89066ce74bb..0ea2be4f37f 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -418,7 +418,7 @@ ir.actions.act_window calendar.event form - tree,form,calendar + calendar,tree,form diff --git a/addons/base_setup/res_partner_view.xml b/addons/base_setup/res_partner_view.xml index 5e54c0b8629..ad520799c1f 100644 --- a/addons/base_setup/res_partner_view.xml +++ b/addons/base_setup/res_partner_view.xml @@ -13,10 +13,10 @@ + - diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml index 5617fae4376..e7636aa4b85 100644 --- a/addons/note/note_view.xml +++ b/addons/note/note_view.xml @@ -2,8 +2,6 @@ - - note.stage.form @@ -39,8 +37,6 @@ [('user_id','=',uid)] - - note.note.kanban @@ -85,7 +81,8 @@
-
+ +
@@ -192,7 +189,11 @@ {'search_default_open_true':True} - + + + + + \ No newline at end of file From 8cb1f558a0f7d0c5eb43b75f153e2b374351999d Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 18 Sep 2012 17:15:01 +0200 Subject: [PATCH 03/14] [IMP] kanban: many2many_tags => other views bzr revid: chm@openerp.com-20120918151501-4kkf7ve1m7wvj3le --- addons/base_setup/res_partner_view.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/base_setup/res_partner_view.xml b/addons/base_setup/res_partner_view.xml index ad520799c1f..57e8d70531d 100644 --- a/addons/base_setup/res_partner_view.xml +++ b/addons/base_setup/res_partner_view.xml @@ -10,9 +10,6 @@ - - - From 3fd98b0f80f4bfe20fbced3f4990f79065b06b1e Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 18 Sep 2012 17:30:35 +0200 Subject: [PATCH 04/14] [IMP]kanban : div widget many2many_tags => field bzr revid: chm@openerp.com-20120918153035-xutvjflw057s8t18 --- addons/web_kanban/static/src/js/kanban.js | 40 +++++++++++++++-------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index fe15b22feee..6d68e62899a 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -71,6 +71,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this.fields_keys = _.keys(this.fields_view.fields); this.add_qweb_template(); this.has_been_loaded.resolve(); + + this._super.apply(this, arguments); + return $.when(); }, _is_quick_create_enabled: function() { @@ -85,6 +88,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ return false; return this._super(action); }, + /* add_qweb_template + * select the nodes into the xml and send to extract_aggregates the nodes with TagName="field" + */ add_qweb_template: function() { for (var i=0, ii=this.fields_view.arch.children.length; i < ii; i++) { var child = this.fields_view.arch.children[i]; @@ -97,6 +103,9 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } } }, + /* extract_aggregates + * extract the agggregates from the nodes (TagName="field") + */ extract_aggregates: function(node) { for (var j = 0, jj = this.group_operators.length; j < jj; j++) { if (node.attrs[this.group_operators[j]]) { @@ -121,9 +130,15 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } switch (node.tag) { case 'field': - node.tag = QWeb.prefix; - node.attrs[QWeb.prefix + '-esc'] = 'record.' + node.attrs['name'] + '.value'; - this.extract_aggregates(node); + if(this.fields_view.fields[ node.attrs['name'] ].type == 'many2many'){ + node.tag = 'div'; + node.attrs['class'] = 'oe_kanban_many2many_tags'; + node.attrs['model'] = this.fields_view.fields[node.attrs['name']].relation; + node.attrs['t-att-data'] = 'record.' + node.attrs['name'] + '.raw_value'; + }else { + node.tag = QWeb.prefix; + node.attrs[QWeb.prefix + '-esc'] = 'record.' + node.attrs['name'] + '.value'; + } break; case 'button': case 'a': @@ -163,17 +178,16 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } } }, - /* widget for list of tags/categories... - * make :
+ /* widget for list of tags/categories... */ transform_widget_many2many: function(){ var self=this, arg={}; // select all widget - self.$el.find("[widget='many2many_tags']").each(function(){ - var model = $(this).attr("model"), - data = $(this).attr("data"), - list = data.split(","); + self.$el.find(".oe_kanban_many2many_tags").each(function(){ + var model = $(this).attr("model"); + var data = $(this).attr("data"); + var list = data.split(","); //select all id (per model) if(!arg[model]) arg[model]=[]; for(var t=0;t'+result[t][1]+''); } - }, - function(r){ - console.log('Error',r); } ); } @@ -717,6 +728,9 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ transform_record: function(record) { var self = this, new_record = {}; + + console.log(this, record); + _.each(record, function(value, name) { var r = _.clone(self.view.fields_view.fields[name] || {}); if ((r.type === 'date' || r.type === 'datetime') && value) { From 24ed9b15630e0c772cbcfab98fe456f6f82d024f Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 18 Sep 2012 18:59:02 +0200 Subject: [PATCH 05/14] [IMP]kanban: css bzr revid: chm@openerp.com-20120918165902-c5nh169w4c1ur14v --- addons/web_kanban/static/src/css/kanban.css | 4 ++++ addons/web_kanban/static/src/css/kanban.sass | 3 +++ 2 files changed, 7 insertions(+) diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 48cf725ead3..fec1bc508ec 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -143,6 +143,10 @@ position: relative; top: -8px; } +.openerp .oe_kanban_view .oe_kanban_add, .openerp .oe_kanban_view .oe_kanban_card .oe_dropdown_toggle { + cursor: pointer; + display:inline-block; +} .openerp .oe_kanban_view .oe_kanban_add { float: right; } diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index 95a63dbd1a2..5ae4c9c4f10 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -154,6 +154,9 @@ cursor: pointer position: relative top: -8px + .oe_kanban_card, .oe_dropdown_toggle + cursor: pointer + display:inline-block .oe_kanban_add float: right From f4f7cfcb0c81a43d45eb30719ebc3ad8d120237d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 18 Sep 2012 19:01:53 +0200 Subject: [PATCH 06/14] [FIX] fixed taxes tags css bzr revid: fva@openerp.com-20120918170153-uojxm4qqwq3qfzff --- addons/web/static/src/css/base.css | 5 +++++ addons/web/static/src/css/base.sass | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 10ee9dea2de..a1a6f5a15e7 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -30,6 +30,11 @@ position: relative; } +.text-tag .text-button { + height: auto !important; + min-height: 16px; +} + .openerp { padding: 0; margin: 0; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 1aa4726725c..49a60a80e2a 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -145,6 +145,11 @@ $sheet-max-width: 860px height: 100% position: relative +// jQueryUI css bug fixing +.text-tag .text-button + height: auto !important + min-height: 16px + .openerp // Global style {{{ padding: 0 From 3ad1a9614378f606721d1ee904e130fd1fe5dbb8 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 18 Sep 2012 19:19:47 +0200 Subject: [PATCH 07/14] [IMP]kanban: correctif bzr revid: chm@openerp.com-20120918171947-f2114v0oa0cu8wb7 --- addons/web_kanban/static/src/js/kanban.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index d5389c6fa0b..970a4e81fca 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -396,6 +396,8 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } else { this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); } + + this.transform_widget_many2many(); }, on_record_moved : function(record, old_group, old_index, new_group, new_index) { var self = this; @@ -811,7 +813,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ } }); - if (this.$el.find('.oe_kanban_global_click').length) { + if (this.$el.find('.oe_kanban_global_click,.oe_kanban_global_click_edit').length) { this.$el.on('click', function(ev) { if (!ev.isTrigger && !$(ev.target).data('events')) { var trigger = true; @@ -852,8 +854,15 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ }); } }, + /* actions when user click on the block with a specific class + * open on normal view : oe_kanban_global_click + * open on form/edit view : oe_kanban_global_click_edit + */ on_card_clicked: function(ev) { - this.view.open_record(this.id); + if(this.$el.find('.oe_kanban_global_click_edit').size()>0) + this.do_action_edit(); + else + this.do_action_open(); }, setup_color_picker: function() { var self = this; From ab8722f1b4d4de2aacc7e42a77ce08cb141ab86e Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 18 Sep 2012 21:38:56 +0200 Subject: [PATCH 08/14] [IMP] kanban: field many2many_tags bzr revid: chm@openerp.com-20120918193856-2lq5q8lnw3dtpqbe --- addons/base_setup/res_partner_view.xml | 2 +- addons/hr_recruitment/hr_recruitment_view.xml | 4 +--- addons/note/note_view.xml | 2 ++ addons/portal_project_issue/portal_project_issue_view.xml | 1 + addons/project_issue/project_issue_view.xml | 4 +--- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/base_setup/res_partner_view.xml b/addons/base_setup/res_partner_view.xml index 57e8d70531d..15b80151831 100644 --- a/addons/base_setup/res_partner_view.xml +++ b/addons/base_setup/res_partner_view.xml @@ -9,7 +9,7 @@ - + diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 098a8aec210..08e5f31a2d2 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -314,9 +314,7 @@
diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml index ca684b42522..b356efc9549 100644 --- a/addons/note/note_view.xml +++ b/addons/note/note_view.xml @@ -82,7 +82,9 @@
+ +
diff --git a/addons/portal_project_issue/portal_project_issue_view.xml b/addons/portal_project_issue/portal_project_issue_view.xml index 5d0b4ce081e..1030dedbdf8 100644 --- a/addons/portal_project_issue/portal_project_issue_view.xml +++ b/addons/portal_project_issue/portal_project_issue_view.xml @@ -27,6 +27,7 @@ +
Creation: diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index fea22c519a8..be7427fe8f4 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -269,9 +269,7 @@