From 0f534670ea04d1f785b0155010a0d229e434e7fc Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Wed, 3 Oct 2012 13:27:30 +0530 Subject: [PATCH 01/29] [IMP] open chatter messages on the procurement. bzr revid: tta@openerp.com-20121003075730-hkwuqmpkriswphgh --- addons/mrp/procurement.py | 12 ++++++++++-- addons/procurement/procurement.py | 9 --------- addons/project_mrp/project_procurement.py | 11 +++++++++-- addons/purchase/purchase.py | 8 +++++++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index 7f417dc18b1..40da3ab4425 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -31,6 +31,7 @@ class procurement_order(osv.osv): _columns = { 'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True), 'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'), + 'production_id': fields.many2one('mrp.production', 'Manufucture Order'), } def check_produce_product(self, cr, uid, procurement, context=[]): @@ -95,16 +96,23 @@ class procurement_order(osv.osv): 'move_prod_id': res_id, 'company_id': procurement.company_id.id, }) + res[procurement.id] = produce_id - self.write(cr, uid, [procurement.id], {'state': 'running'}) - self.running_send_note(cr, uid, ids, context=context) + self.write(cr, uid, [procurement.id], {'state': 'running', 'production_id': produce_id}) + bom_result = production_obj.action_compute(cr, uid, [produce_id], properties=[x.id for x in procurement.property_ids]) wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr) if res_id: move_obj.write(cr, uid, [res_id], {'location_id': procurement.location_id.id}) + self.production_order_create_note(cr, uid, ids, context=context) return res + + def production_order_create_note(self, cr, uid, ids, context=None): + for procurement in self.browse(cr, uid, ids, context=context): + body = "%s %s %s" % (_("Manufacturing Order"), procurement.production_id.name, _("Created")) + self.message_post(cr, uid, ids, body=body, context=context) procurement_order() diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index c9b09761ed0..d47c3fe350f 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -366,7 +366,6 @@ class procurement_order(osv.osv): self.write(cr, uid, ids, {'state': 'running', 'message': message}, context=context) self.message_post(cr, uid, ids, body=message, context=context) - self.running_send_note(cr, uid, ids, context=context) return True def _check_make_to_stock_service(self, cr, uid, procurement, context=None): @@ -407,7 +406,6 @@ class procurement_order(osv.osv): """ for procurement in self.browse(cr, uid, ids, context=context): self.write(cr, uid, [procurement.id], {'state': 'running'}) - self.running_send_note(cr, uid, ids, context=None) return True def action_produce_assign_product(self, cr, uid, ids, context=None): @@ -469,7 +467,6 @@ class procurement_order(osv.osv): @return: True """ res = self.write(cr, uid, ids, {'state': 'ready'}) - self.ready_send_note(cr, uid, ids, context=None) return res def action_done(self, cr, uid, ids): @@ -503,12 +500,6 @@ class procurement_order(osv.osv): def confirm_send_note(self, cr, uid, ids, context=None): self.message_post(cr, uid, ids, body=_("Procurement has been confirmed."), context=context) - def running_send_note(self, cr, uid, ids, context=None): - self.message_post(cr, uid, ids, body=_("Procurement has been set to running."), context=context) - - def ready_send_note(self, cr, uid, ids, context=None): - self.message_post(cr, uid, ids, body=_("Procurement has been set to ready."), context=context) - def cancel_send_note(self, cr, uid, ids, context=None): self.message_post(cr, uid, ids, body=_("Procurement has been cancelled."), context=context) diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index 1c347c8ae02..f70d43426b9 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -20,6 +20,7 @@ ############################################################################## from osv import fields, osv +from tools.translate import _ class procurement_order(osv.osv): _name = "procurement.order" @@ -82,11 +83,17 @@ class procurement_order(osv.osv): 'description': procurement.note, 'project_id': project and project.id or False, 'company_id': procurement.company_id.id, - },context=context) + },context=context) self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':'from project: task created.'}, context=context) - self.running_send_note(cr, uid, ids, context=None) + self.document_send_note(cr, uid, [procurement.id], body='%s %s:%s %s' % (_("Task"), procurement.origin or '', procurement.product_id.name, _("created")), context=context) + self.project_task_create_note(cr, uid, ids, context=context) return task_id + def project_task_create_note(self, cr, uid, ids, context=None): + for procurement in self.browse(cr, uid, ids, context=context): + body = "%s %s %s" % (_("Task"), procurement.task_id.name, _("Created")) + self.message_post(cr, uid, ids, body=body, context=context) + procurement_order() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 8502fd7ee3f..ed99b9f2a58 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1082,9 +1082,15 @@ class procurement_order(osv.osv): } res[procurement.id] = self.create_procurement_purchase_order(cr, uid, procurement, po_vals, line_vals, context=new_context) self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': res[procurement.id]}) - self.running_send_note(cr, uid, [procurement.id], context=context) + self.document_send_note(cr, uid, [procurement.id], body='%s %s %s' % (_("Draft Purchase Order"), name or '', _("created")), context=context) + self.purchase_order_create_note(self, cr, uid, ids, context=context) return res + def purchase_order_create_note(self, cr, uid, ids, context=None): + for procurement in self.browse(cr, uid, ids, context=context): + body = "%s %s %s" % (_("Draft Purchase Order"), procurement.purchase_id.name, _("Created")) + self.message_post(cr, uid, ids, body=body, context=context) + procurement_order() class mail_mail(osv.osv): From 9c2ca851e23d5f93b59668e633618a6c3cd9f678 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Wed, 3 Oct 2012 15:13:41 +0530 Subject: [PATCH 02/29] [IMP] procurement: Products reserverd from stock & added Manufucture Order in procurement. bzr revid: tta@openerp.com-20121003094341-suosaw2sum3grn7k --- addons/mrp/mrp_view.xml | 1 + addons/procurement/procurement.py | 2 +- addons/project_mrp/project_procurement.py | 3 +-- addons/purchase/purchase.py | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index a198d736bbc..7294ad043b0 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -954,6 +954,7 @@ + diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index d47c3fe350f..ab644dd08db 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -362,7 +362,7 @@ class procurement_order(osv.osv): """ Changes procurement state to Running and writes message. @return: True """ - message = _('From stock: products assigned.') + message = _('Products reserverd from stock.') self.write(cr, uid, ids, {'state': 'running', 'message': message}, context=context) self.message_post(cr, uid, ids, body=message, context=context) diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index f70d43426b9..5f9a94f1894 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -84,8 +84,7 @@ class procurement_order(osv.osv): 'project_id': project and project.id or False, 'company_id': procurement.company_id.id, },context=context) - self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':'from project: task created.'}, context=context) - self.document_send_note(cr, uid, [procurement.id], body='%s %s:%s %s' % (_("Task"), procurement.origin or '', procurement.product_id.name, _("created")), context=context) + self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':'from project: task created.'}, context=context) self.project_task_create_note(cr, uid, ids, context=context) return task_id diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index ed99b9f2a58..4dda418c2ad 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1082,8 +1082,7 @@ class procurement_order(osv.osv): } res[procurement.id] = self.create_procurement_purchase_order(cr, uid, procurement, po_vals, line_vals, context=new_context) self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': res[procurement.id]}) - self.document_send_note(cr, uid, [procurement.id], body='%s %s %s' % (_("Draft Purchase Order"), name or '', _("created")), context=context) - self.purchase_order_create_note(self, cr, uid, ids, context=context) + self.purchase_order_create_note(cr, uid, ids, context=context) return res def purchase_order_create_note(self, cr, uid, ids, context=None): From dd44dab68c94cf88b2d9e16e614741680483d508 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 3 Oct 2012 17:08:10 +0530 Subject: [PATCH 03/29] [FIX] small issues bzr revid: hmo@tinyerp.com-20121003113810-mnlg6rf50xi2ljnt --- addons/mrp/procurement.py | 8 +++++--- addons/procurement/procurement.py | 2 +- addons/project_mrp/project_procurement.py | 6 ++++-- addons/purchase/purchase.py | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index f718856fbf8..82390a2f2c1 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -31,7 +31,7 @@ class procurement_order(osv.osv): _columns = { 'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True), 'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'), - 'production_id': fields.many2one('mrp.production', 'Manufucture Order'), + 'production_id': fields.many2one('mrp.production', 'Manufacturing Order'), } def check_produce_product(self, cr, uid, procurement, context=None): @@ -80,8 +80,10 @@ class procurement_order(osv.osv): procurement_obj = self.pool.get('procurement.order') for procurement in procurement_obj.browse(cr, uid, ids, context=context): res_id = procurement.move_id.id + #TOFIX: split into new function to compute manufacturing lead time newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0) newdate = newdate - relativedelta(days=company.manufacturing_lead) + #TOFIX: implement hook method for creating production order produce_id = production_obj.create(cr, uid, { 'origin': procurement.origin, 'product_id': procurement.product_id.id, @@ -111,8 +113,8 @@ class procurement_order(osv.osv): def production_order_create_note(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): - body = "%s %s %s" % (_("Manufacturing Order"), procurement.production_id.name, _("Created")) - self.message_post(cr, uid, ids, body=body, context=context) + body = "%s %s %s" % (_("Manufacturing Order"), procurement.production_id.name, _("Created")) + self.message_post(cr, uid, [procurement.id], body=body, context=context) procurement_order() diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index aa3b2a2a673..5f8cd3c0b56 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -104,7 +104,7 @@ class procurement_order(osv.osv): " a make to order method."), 'note': fields.text('Note'), - 'message': fields.char('Latest error', size=124, help="Exception occurred while computing procurement orders."), + 'message': fields.char('Latest error', size=124, help="Exception occurred while computing procurement orders."), #TOCHECK: is it need after OpenChatter ? 'state': fields.selection([ ('draft','Draft'), ('cancel','Cancelled'), diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index 1daf03dfd9f..63e72493e35 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -69,8 +69,10 @@ class procurement_order(osv.osv): def action_produce_assign_service(self, cr, uid, ids, context=None): project_task = self.pool.get('project.task') for procurement in self.browse(cr, uid, ids, context=context): + #TOFIX: split into new function to compute task planning hours project = self._get_project(cr, uid, procurement, context=context) planned_hours = self._convert_qty_company_hours(cr, uid, procurement, context=context) + #TOFIX: implement hook method for creating Task task_id = project_task.create(cr, uid, { 'name': '%s:%s' % (procurement.origin or '', procurement.product_id.name), 'date_deadline': procurement.date_planned, @@ -90,8 +92,8 @@ class procurement_order(osv.osv): def project_task_create_note(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): - body = "%s %s %s" % (_("Task"), procurement.task_id.name, _("Created")) - self.message_post(cr, uid, ids, body=body, context=context) + body = "%s %s %s" % (_("Task"), procurement.task_id.name, _("Created")) + self.message_post(cr, uid, [procurement.id], body=body, context=context) procurement_order() diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index a574d8e4467..6bc76f14f34 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1083,8 +1083,8 @@ class procurement_order(osv.osv): def purchase_order_create_note(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): - body = "%s %s %s" % (_("Draft Purchase Order"), procurement.purchase_id.name, _("Created")) - self.message_post(cr, uid, ids, body=body, context=context) + body = "%s %s %s" % (_("Draft Purchase Order"), procurement.purchase_id.name, _("Created")) + self.message_post(cr, uid, [procurement.id], body=body, context=context) procurement_order() From 71bf16d126e2719fe9fd4da12e09d3e75be785b8 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 3 Oct 2012 17:49:04 +0530 Subject: [PATCH 04/29] [FIX] stock_location: fix issue to post message after created pulled procurement bzr revid: hmo@tinyerp.com-20121003121904-x930vx8rs0y80xre --- addons/stock_location/procurement_pull.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/stock_location/procurement_pull.py b/addons/stock_location/procurement_pull.py index 840e6c854c7..87af0c7e08d 100644 --- a/addons/stock_location/procurement_pull.py +++ b/addons/stock_location/procurement_pull.py @@ -57,6 +57,7 @@ class procurement_order(osv.osv): break assert line, 'Line cannot be False if we are on this state of the workflow' origin = (proc.origin or proc.name or '').split(':')[0] +':'+line.name + #TOFIX: implement hook method for creating picking picking_id = picking_obj.create(cr, uid, { 'origin': origin, 'company_id': line.company_id and line.company_id.id or False, @@ -67,6 +68,7 @@ class procurement_order(osv.osv): 'note': _('Picking for pulled procurement coming from original location %s, pull rule %s, via original Procurement %s (#%d)') % (proc.location_id.name, line.name, proc.name, proc.id), 'invoice_state': line.invoice_state, }) + #TOFIX: implement hook method for creating move move_id = move_obj.create(cr, uid, { 'name': line.name, 'picking_id': picking_id, @@ -92,6 +94,8 @@ class procurement_order(osv.osv): move_obj.write(cr,uid, [proc.move_id.id], { 'state':'waiting' }, context=context) + + #TOFIX: implement hook method for creating new procurement proc_id = proc_obj.create(cr, uid, { 'name': line.name, 'origin': origin, @@ -115,9 +119,9 @@ class procurement_order(osv.osv): if proc.move_id: move_obj.write(cr, uid, [proc.move_id.id], {'location_id':proc.location_id.id}) - self.write(cr, uid, [proc.id], {'state':'running', 'message':_('Pulled from another location via procurement %d') % proc_id}) - self.running_send_note(cr, uid, [proc.id], context=context) - + msg = _('Pulled from another location via procurement %d') % proc_id + self.write(cr, uid, [proc.id], {'state':'running', 'message': msg}) + self.message_post(cr, uid, [proc.id], body=msg, context=context) # trigger direct processing (the new procurement shares the same planned date as the original one, which is already being processed) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr) return False From c5ac7217a867146f6456978713cfe511c7a41966 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 4 Oct 2012 11:09:02 +0200 Subject: [PATCH 05/29] [IMP]mail: follower/partners list on wall posting message form bzr revid: chm@openerp.com-20121004090902-p4b3t4zvs9frc3ky --- addons/mail/mail_message_view.xml | 8 +-- addons/mail/static/src/css/mail.css | 36 +++++++++--- addons/mail/static/src/js/mail.js | 89 +++++++++++++++-------------- addons/mail/static/src/xml/mail.xml | 16 ++++++ 4 files changed, 93 insertions(+), 56 deletions(-) diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index 6d854d4d701..2992868bfcf 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -88,28 +88,28 @@ Inbox mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid, 'default_is_private':True} }""/> Wall mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid, 'default_is_private':False} }""/> Archives mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid} }""/> Sent mail.wall + 'context': {'default_model': 'res.partner', 'default_res_id': uid} }""/> diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 4ffb9013496..e5a9ad0c825 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -173,16 +173,41 @@ clear: both; } +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_all_follower { + color: blue; +} +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_partner_follower a { + color: red; +} +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_hidden, +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_header .oe_more_hidden { + display: none; +} + +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_bottom button.post { + float: left; +} + +.openerp .oe_mail .oe_mail_compose_textarea .oe_mail_post_bottom span { + float: right; +} + /* default textarea (oe_mail_compose_textarea), and body textarea for compose form view */ -.openerp .oe_mail_msg_content textarea.oe_mail_compose_textarea, -.openerp .oe_mail_msg_content div.oe_mail_compose_message_body textarea { +.openerp .oe_mail.oe_semantic_html_override .oe_mail_compose_textarea textarea, +.openerp .oe_mail div.oe_mail_compose_message_body textarea { width: 474px; - height: 60px; + min-height: 120px; + height: auto; padding: 4px; font-size: 12px; border: 1px solid #cccccc; } +/* not top textarea */ +.openerp .oe_mail.oe_semantic_html_override .oe_semantic_html_override .oe_mail_compose_textarea textarea { + height: 60px; +} + /* default textarea (oe_mail_compose_textarea), and body textarea for compose form view */ .openerp .oe_mail_msg_content textarea.oe_mail_compose_textarea:focus, .openerp .oe_mail_msg_content div.oe_mail_compose_message_body textarea:focus { @@ -413,11 +438,6 @@ } /* Dropdown menu */ -/*.openerp .oe_mail_msg_content .oe_dropdown_toggle { - position: absolute; - top: 0px; - right: 3px; -}*/ .openerp .oe_mail .oe_semantic_html_override { position: relative; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 8915f1387e1..b2fa071b191 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -336,13 +336,40 @@ openerp.mail = function(session) { */ init: function(parent, options) { this._super(parent); + + // record parameters + var param = options.parameters; + for(var i in param){ + this[i] = param[i]; + } + this.id = param.id || -1; + this.model = param.model || false; + this.parent_id= param.parent_id || false; + this.res_id = param.res_id || false; + this.type = param.type || false; + this.is_author = param.is_author || false; + this.subject = param.subject || false; + this.name = param.name || false; + this.record_name = param.record_name || false; + this.body = param.body || false; + this.vote_user_ids =param.vote_user_ids || []; + this.has_voted = param.has_voted || false; + + this.vote_user_ids = param.vote_user_ids || []; + + this.unread = param.unread || false; + this._date = param.date; + this.author_id = param.author_id || []; + this.attachment_ids = param.attachment_ids || []; + + // record domain and context this.domain = options.domain || []; this.context = _.extend({ default_model: 'mail.thread', default_res_id: 0, default_parent_id: false }, options.context || {}); - // options + // record options this.options={ 'thread' : options.options.thread, 'message' : { @@ -356,31 +383,9 @@ openerp.mail = function(session) { 'truncate_limit': options.options.message.truncate_limit || 250, } }; + // record options and data - this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0] ; - - var param = options.parameters; - // record parameters - this.id = param.id || -1; - this.model = param.model || false; - this.parent_id= param.parent_id || false; - this.res_id = param.res_id || false; - this.type = param.type || false; - this.is_author = param.is_author || false; - this.subject = param.subject || false; - this.name = param.name || false; - this.record_name = param.record_name || false; - this.body = param.body || false; - this.vote_user_ids =param.vote_user_ids || []; - this.has_voted = param.has_voted || false; - - this.vote_user_ids = param.vote_user_ids || []; - - this.unread = param.unread || false; - this._date = param.date; - this.author_id = param.author_id || []; - this.attachment_ids = param.attachment_ids || []; - + this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0]; this.thread = false; if( param.id > 0 ) { @@ -468,6 +473,7 @@ openerp.mail = function(session) { if(this.thread){ return false; } + var param = _.extend(self, {'parent_id': self.id}); /*create thread*/ self.thread = new mail.Thread(self, { 'domain': self.domain, @@ -480,11 +486,7 @@ openerp.mail = function(session) { 'thread' : self.options.thread, 'message' : self.options.message }, - 'parameters':{ - 'model': self.model, - 'id': self.id, - 'parent_id': self.id - } + 'parameters': param } ); /*insert thread in parent message*/ @@ -520,7 +522,7 @@ openerp.mail = function(session) { */ on_message_read_unread: function (event) { event.stopPropagation(); - this.animated_destroy({fadeTime:250}); + if($(event.srcElement).hasClass("oe_read")) this.animated_destroy({fadeTime:250}); // if this message is read, all childs message display is read var ids = [this.id].concat( this.get_child_ids() ); this.ds_notification.call('set_message_read', [ids,$(event.srcElement).hasClass("oe_read")]); @@ -667,6 +669,13 @@ openerp.mail = function(session) { this.id= param.id || false; this.model= param.model || false; this.parent_id= param.parent_id || false; + this.is_private = param.is_private || false; + this.partner_ids = []; + for(var i in param.partner_ids){ + if(param.partner_ids[i][0]!=(param.author_id ? param.author_id[0] : -1)){ + this.partner_ids.push(param.partner_ids[i]); + } + } this.messages = []; @@ -720,17 +729,9 @@ openerp.mail = function(session) { * in the function. */ bind_events: function() { var self = this; - // event: writing in basic textarea of composition form (quick reply) - // event: onblur for hide 'Reply' - this.$('.oe_mail_compose_textarea:first textarea') - .keyup(function (event) { - var charCode = (event.which) ? event.which : window.event.keyCode; - if (event.shiftKey && charCode == 13) { this.value = this.value+"\n"; } - else if (charCode == 13) { return self.message_post(); } - }) - .blur(function (event) { - $(this).parents('.oe_mail_thread_action:first').hide(); - }); + self.$('.oe_mail_compose_textarea:first button.post').click(function () {return self.message_post();}); + self.$('.oe_mail_compose_textarea .oe_more').click(function () { var p=$(this).parent(); p.find('.oe_more_hidden, .oe_hidden').show(); p.find('.oe_more').hide(); }); + self.$('.oe_mail_compose_textarea .oe_more_hidden').click(function () { var p=$(this).parent(); p.find('.oe_more_hidden, .oe_hidden').hide(); p.find('.oe_more').show(); }); }, /* get all child message/thread id linked @@ -1037,7 +1038,7 @@ openerp.mail = function(session) { 'options':{ 'thread':{ 'thread_level': this.options.thread_level, - 'show_header_compose': show_header_compose, + 'show_header_compose': 0, //show_header_compose, 'use_composer': show_header_compose, 'display_on_flat':true }, @@ -1142,7 +1143,7 @@ openerp.mail = function(session) { 'thread' :{ 'thread_level': this.options.thread_level, 'use_composer': true, - 'show_header_compose': 1, + 'show_header_compose': 0, }, 'message': { 'show_reply': this.options.thread_level > 0, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 1e2e6a970b6..b7eebd0b4d1 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -67,7 +67,23 @@
+
+ Post a message to: + All Followers + and + + + + + , others... + <<< + +