From 71ebce80184cb142426fa1adcb6f093626afccdc Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Mon, 11 Jun 2012 16:04:25 +0530 Subject: [PATCH 01/34] [IMP]remove res.partner.address and sequence from ir.sequence bzr revid: kjo@tinyerp.com-20120611103425-ekeoso4m1475d6rq --- openerp/addons/base/ir/ir.xml | 1 - openerp/tests/test_ir_sequence.py | 2 +- openerp/tests/test_orm.py | 28 ++++++++++++++-------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/openerp/addons/base/ir/ir.xml b/openerp/addons/base/ir/ir.xml index 837374d371b..c718b8e165a 100644 --- a/openerp/addons/base/ir/ir.xml +++ b/openerp/addons/base/ir/ir.xml @@ -595,7 +595,6 @@ ir.needaction_users_rel.tree ir.needaction_users_rel tree - 10 diff --git a/openerp/tests/test_ir_sequence.py b/openerp/tests/test_ir_sequence.py index fcc5888e47e..2943676d1bc 100644 --- a/openerp/tests/test_ir_sequence.py +++ b/openerp/tests/test_ir_sequence.py @@ -114,7 +114,7 @@ class test_ir_sequence_change_implementation(unittest2.TestCase): d = dict(code='test_sequence_type_3', name='Test sequence type') c = registry('ir.sequence.type').create(cr, ADMIN_USER_ID, d, {}) assert c - d = dict(code='test_sequence_type_3', name='Test sequence') + d = dict(code='test_sequence_type_3', name='Test sequence', 'implementation': 'standard') c = registry('ir.sequence').create(cr, ADMIN_USER_ID, d, {}) assert c d = dict(code='test_sequence_type_4', name='Test sequence type') diff --git a/openerp/tests/test_orm.py b/openerp/tests/test_orm.py index 0c4046df2a4..197694d6552 100644 --- a/openerp/tests/test_orm.py +++ b/openerp/tests/test_orm.py @@ -20,7 +20,7 @@ class TestO2MSerialization(common.TransactionCase): def setUp(self): super(TestO2MSerialization, self).setUp() self.partner = self.registry('res.partner') - self.address = self.registry('res.partner.address') +# self.address = self.registry('res.partner.address') def test_no_command(self): " empty list of commands yields an empty list of records " @@ -43,9 +43,9 @@ class TestO2MSerialization(common.TransactionCase): def test_LINK_TO_command(self): " reads the records from the database, records are returned with their ids. " ids = [ - self.address.create(self.cr, UID, {'name': 'foo'}), - self.address.create(self.cr, UID, {'name': 'bar'}), - self.address.create(self.cr, UID, {'name': 'baz'}) + self.partner.create(self.cr, UID, {'name': 'foo'}), + self.partner.create(self.cr, UID, {'name': 'bar'}), + self.partner.create(self.cr, UID, {'name': 'baz'}) ] commands = map(LINK_TO, ids) @@ -61,9 +61,9 @@ class TestO2MSerialization(common.TransactionCase): def test_bare_ids_command(self): " same as the equivalent LINK_TO commands " ids = [ - self.address.create(self.cr, UID, {'name': 'foo'}), - self.address.create(self.cr, UID, {'name': 'bar'}), - self.address.create(self.cr, UID, {'name': 'baz'}) + self.partner.create(self.cr, UID, {'name': 'foo'}), + self.partner.create(self.cr, UID, {'name': 'bar'}), + self.partner.create(self.cr, UID, {'name': 'baz'}) ] results = self.partner.resolve_o2m_commands_to_record_dicts( @@ -77,9 +77,9 @@ class TestO2MSerialization(common.TransactionCase): def test_UPDATE_command(self): " take the in-db records and merge the provided information in " - id_foo = self.address.create(self.cr, UID, {'name': 'foo'}) - id_bar = self.address.create(self.cr, UID, {'name': 'bar'}) - id_baz = self.address.create(self.cr, UID, {'name': 'baz', 'city': 'tag'}) + id_foo = self.partner.create(self.cr, UID, {'name': 'foo'}) + id_bar = self.partner.create(self.cr, UID, {'name': 'bar'}) + id_baz = self.partner.create(self.cr, UID, {'name': 'baz', 'city': 'tag'}) results = self.partner.resolve_o2m_commands_to_record_dicts( self.cr, UID, 'address', [ @@ -96,7 +96,7 @@ class TestO2MSerialization(common.TransactionCase): def test_mixed_commands(self): ids = [ - self.address.create(self.cr, UID, {'name': name}) + self.partner.create(self.cr, UID, {'name': name}) for name in ['NObar', 'baz', 'qux', 'NOquux', 'NOcorge', 'garply'] ] @@ -126,9 +126,9 @@ class TestO2MSerialization(common.TransactionCase): def test_LINK_TO_pairs(self): "LINK_TO commands can be written as pairs, instead of triplets" ids = [ - self.address.create(self.cr, UID, {'name': 'foo'}), - self.address.create(self.cr, UID, {'name': 'bar'}), - self.address.create(self.cr, UID, {'name': 'baz'}) + self.partner.create(self.cr, UID, {'name': 'foo'}), + self.partner.create(self.cr, UID, {'name': 'bar'}), + self.partner.create(self.cr, UID, {'name': 'baz'}) ] commands = map(lambda id: (4, id), ids) From 73b14dae77dfa0d6b9a5b31f3cfcdc2046382214 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Tue, 12 Jun 2012 16:47:40 +0200 Subject: [PATCH 02/34] mail define new layout blog/default bzr revid: al@openerp.com-20120612144740-gnx4z9h0tnpy6cha --- addons/mail/static/src/js/mail.js | 3 ++- addons/mail/static/src/xml/mail.xml | 30 ++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 905e95f3aef..03d114df7b4 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -278,7 +278,8 @@ openerp.mail = function(session) { // format date according to the user timezone record.date = session.web.format_value(record.date, {type:"datetime"}); // render - $(session.web.qweb.render('ThreadMsg', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) + // OPTIONS + $(session.web.qweb.render('mail.Thread.default', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) ).appendTo(this.$element.children('div.oe_mail_thread_display:first')); // truncated: hide full-text, show summary, add buttons if (record.tr_body) { diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index a34e362960b..04a373fc8a5 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -57,19 +57,21 @@ -
  • + + +
  • - - + +
  • - - + +

    @@ -98,8 +100,8 @@

    - - + +

    @@ -129,4 +131,18 @@ + + +

  • +
    + + +
    + + +
    + +
    +
  • + From a153714bcc3b82d0a2e701020d396b10c4204c27 Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Thu, 14 Jun 2012 14:26:46 +0530 Subject: [PATCH 03/34] [IMP] remove res.partner.address bzr revid: kjo@tinyerp.com-20120614085646-vvbx0fegqxar2kot --- openerp/tests/test_orm.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openerp/tests/test_orm.py b/openerp/tests/test_orm.py index 197694d6552..ea9b37e5f3b 100644 --- a/openerp/tests/test_orm.py +++ b/openerp/tests/test_orm.py @@ -20,7 +20,6 @@ class TestO2MSerialization(common.TransactionCase): def setUp(self): super(TestO2MSerialization, self).setUp() self.partner = self.registry('res.partner') -# self.address = self.registry('res.partner.address') def test_no_command(self): " empty list of commands yields an empty list of records " From e27e0efed428bf48a9ddcb00a95a34f5173e1e89 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Thu, 14 Jun 2012 19:18:51 +0200 Subject: [PATCH 04/34] [ADD] demo data for mail module bzr revid: abo@openerp.com-20120614171851-nyrnd7gjo5k0t9jq --- addons/crm/crm_lead_demo.xml | 52 ++++++++++++++++++++++++++++++++++++ addons/mail/__openerp__.py | 3 +++ 2 files changed, 55 insertions(+) diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index 21c7f9e31ab..8767bf35e22 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -271,7 +271,59 @@ Grand-Rosière + 8 + + + Reply + crm.lead + + html + world (note on opportunity) !]]> + comment + + + + Reply + crm.lead + + html + world (first comment on note) !]]> + + comment + + + + Reply + crm.lead + + html + world (second comment on note) !]]> + + comment + + + + Mail reply + crm.lead + + html + world (email reply on opportunity) !]]> + email + sent + + + + Mail received + crm.lead + + html + world (email received on opportunity) !]]> + email + received + + + opportunity diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py index 39413a80bed..1d676bfbdf2 100644 --- a/addons/mail/__openerp__.py +++ b/addons/mail/__openerp__.py @@ -92,5 +92,8 @@ The main features are: 'qweb': [ 'static/src/xml/mail.xml', ], + 'demo': [ + 'mail_message_demo.xml', + ], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From ff354166b4eab15e0b3fe2e1f9f6d619dcd476d5 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Fri, 15 Jun 2012 17:09:10 +0530 Subject: [PATCH 05/34] [IMP] improve in server side bzr revid: fka@tinyerp.com-20120615113910-qd6xmaistkrioc0y --- .../addons/base/test/test_osv_expression.yml | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/openerp/addons/base/test/test_osv_expression.yml b/openerp/addons/base/test/test_osv_expression.yml index fa7a69b74e9..0165b61b275 100644 --- a/openerp/addons/base/test/test_osv_expression.yml +++ b/openerp/addons/base/test/test_osv_expression.yml @@ -75,7 +75,7 @@ Trying the "in" operator, for scalar value - !python {model: res.partner }: | - ids = self.search(cr, uid, [('parent_id','in','Agrolait')]) + ids = self.search(cr, uid, [('parent_id','=','Agrolait')]) assert len(ids) >= 1, ids - Trying the "in" operator for list value @@ -229,7 +229,7 @@ res_0.sort() res_1 = self.search(cr, uid, [('parent_id', 'not in', [max_partner_id + 1])]) # get all rows, included null parent_id res_1.sort() - res_2 = self.search(cr, uid, [('parent_id', 'not in', False)]) # get rows with not null parent_id, deprecated syntax + res_2 = self.search(cr, uid, [('parent_id', '!=', False)]) # get rows with not null parent_id, deprecated syntax res_2.sort() res_3 = self.search(cr, uid, [('parent_id', 'not in', [])]) # get all rows, included null parent_id res_3.sort() @@ -249,7 +249,7 @@ res_5.sort() res_6 = self.search(cr, uid, [('parent_id', 'in', [max_partner_id + 1])]) res_6.sort() - res_7 = self.search(cr, uid, [('parent_id', 'in', False)]) + res_7 = self.search(cr, uid, [('parent_id', '=', False)]) res_7.sort() res_8 = self.search(cr, uid, [('parent_id', 'in', [])]) res_8.sort() @@ -270,7 +270,7 @@ res_10.sort() res_11 = self.search(cr, uid, ['!', ('parent_id', 'in', [max_partner_id + 1])]) res_11.sort() - res_12 = self.search(cr, uid, ['!', ('parent_id', 'in', False)]) + res_12 = self.search(cr, uid, ['!', ('parent_id', '=', False)]) res_12.sort() res_13 = self.search(cr, uid, ['!', ('parent_id', 'in', [])]) res_13.sort() @@ -291,7 +291,7 @@ res_16.sort() assert res_16 == partner_ids - res_17 = self.search(cr, uid, [('website', 'not in', False)]) + res_17 = self.search(cr, uid, [('website', '!=', False)]) res_17.sort() assert res_17 == with_website @@ -306,21 +306,21 @@ assert res_101 == [], 'res_101: expected %r, got %r' % ([], res_101) assert res_102 == company_ids, 'res_102: expected %r, got %r' % (company_ids, res_102) - - Property of the query (one2many not in False). + Property of the query (one2many != False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'not in', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '!=', False)])) assert referenced_companies == companies - - Property of the query (one2many in False). + Property of the query (one2many = False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) unreferenced_companies = set(self.pool.get('res.company').search(cr, uid, [])).difference(referenced_companies) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'in', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '=', False)])) assert unreferenced_companies == companies - Equivalent queries. @@ -331,7 +331,7 @@ res_1 = self.search(cr, uid, [('name', 'not like', 'probably_unexisting_name')]) res_2 = self.search(cr, uid, [('id', 'not in', [max_currency_id + 1003])]) res_3 = self.search(cr, uid, [('id', 'not in', [])]) - res_4 = self.search(cr, uid, [('id', 'not in', False)]) + res_4 = self.search(cr, uid, [('id', '!=', False)]) res_0.sort() res_1.sort() res_2.sort() @@ -414,7 +414,7 @@ # get the companies referenced by some currency (this is normally the main company) res_10 = self.search(cr, uid, [('currency_ids', 'not like', 'probably_unexisting_name')]) res_11 = self.search(cr, uid, [('currency_ids', 'not in', [max_currency_id + 1])]) - res_12 = self.search(cr, uid, [('currency_ids', 'not in', False)]) + res_12 = self.search(cr, uid, [('currency_ids', '!=', False)]) res_13 = self.search(cr, uid, [('currency_ids', 'not in', [])]) res_10.sort() res_11.sort() @@ -527,3 +527,4 @@ res_ids = self.search(cr, uid, [('child_ids.country_id','=','Belgium'),('active','=',False)]) assert len(res_ids) != 0, "Record not Found with country Belgium and active False." + From 2047f3789dab5c4fafb66ac0f8381163ed1bb98b Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Fri, 15 Jun 2012 15:05:14 +0200 Subject: [PATCH 06/34] [ADD] demo data for the mail module bzr revid: abo@openerp.com-20120615130514-tunqw9t0j5hrl37q --- addons/mail/mail_message_demo.xml | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 addons/mail/mail_message_demo.xml diff --git a/addons/mail/mail_message_demo.xml b/addons/mail/mail_message_demo.xml new file mode 100644 index 00000000000..0a96f6326db --- /dev/null +++ b/addons/mail/mail_message_demo.xml @@ -0,0 +1,55 @@ + + + + + + A cool blogpost about something clean + mail.group + + html + sit amet, consectetur adipiscing elit. Pellentesque et quam sapien, in sagittis tellus. + Praesent vel massa sed massa consequat egestas in tristique orci. Praesent iaculis libero et neque vehicula iaculis. Vivamus placerat tincidunt orci ac ornare. Proin ut dolor fringilla velit ultricies consequat. Maecenas sit amet ipsum non leo interdum imperdiet. Donec sapien mi, varius a consequat id, consectetur sit amet nulla. + +Fusce tempus elit volutpat mi auctor adipiscing. Nam congue luctus suscipit. Duis vestibulum dapibus enim vitae dignissim. Sed tellus libero, venenatis ut mollis ut, luctus quis dui. Sed rhoncus pulvinar orci in consectetur. + +Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in dolor in sapien tempus vehicula.]]> + comment + + + + + Reply + mail.group + + html + tremendous blogpost (first comment) !]]> + + comment + + + + + Reply + mail.group + + html + + + comment + + + + + Reply + mail.group + + html + + + comment + + + + + From 87d4588d4b5633a1480b09c7c2a33a858aa49e97 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Fri, 15 Jun 2012 15:10:26 +0200 Subject: [PATCH 07/34] [IMP] better look for mail messages bzr revid: abo@openerp.com-20120615131026-t6af0vdg49tsqpsk --- addons/mail/mail_message_demo.xml | 7 ++- addons/mail/static/src/js/mail.js | 2 +- addons/mail/static/src/xml/mail.xml | 72 ++++++++++++++++++++++++++--- 3 files changed, 72 insertions(+), 9 deletions(-) diff --git a/addons/mail/mail_message_demo.xml b/addons/mail/mail_message_demo.xml index 0a96f6326db..5ae97e24d65 100644 --- a/addons/mail/mail_message_demo.xml +++ b/addons/mail/mail_message_demo.xml @@ -34,7 +34,7 @@ Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in html +Is it possible to learn more about the author (second comment) ?]]> comment @@ -45,7 +45,10 @@ Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in mail.group html - + comment diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 03d114df7b4..2920df7033d 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -279,7 +279,7 @@ openerp.mail = function(session) { record.date = session.web.format_value(record.date, {type:"datetime"}); // render // OPTIONS - $(session.web.qweb.render('mail.Thread.default', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) + $(session.web.qweb.render('mail.Thread.new', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) ).appendTo(this.$element.children('div.oe_mail_thread_display:first')); // truncated: hide full-text, show summary, add buttons if (record.tr_body) { diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 04a373fc8a5..69012ae77ee 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -57,7 +57,7 @@ - +
  • @@ -131,18 +131,78 @@ - + -
  • +
  • - - + +
    - +
  • + +

    + + + + +
    +

    +

    +
    + + +

    + + + +

    +

    From:

    +

    Subject:

    +

    + + +

    + + +
    + From e8c290282f74e46765f424e46635ba924669141b Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Fri, 15 Jun 2012 16:25:45 +0200 Subject: [PATCH 08/34] [MERGE] handling of nl2br from tde's branch bzr revid: abo@openerp.com-20120615142545-icxqla225h0fkkw6 --- addons/mail/static/src/js/mail.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 2920df7033d..1d0c659b669 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -268,6 +268,7 @@ openerp.mail = function(session) { * Display a record */ display_comment: function (record) { + record.body = this.do_text_nl2br(record.body, true); if (record.type == 'email') { record.mini_url = ('/mail/static/src/img/email_icon.png'); } else { record.mini_url = this.thread_get_avatar('res.users', 'avatar', record.user_id[0]); } // body text manipulation @@ -428,11 +429,18 @@ openerp.mail = function(session) { else return string.slice(0, max_length); }, + /** Removes html tags, except b, em, br */ do_clean_text: function (string) { - var html = $('
    ').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('<(/)?(b|em)\\s*>', 'gi'), '<$1$2>'); + var html = $('
    ').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('<(/)?(b|em|br|br /)\\s*>', 'gi'), '<$1$2>'); return html; }, + /** Replaces line bracks by html line breaks (br) */ + do_text_nl2br: function (str, is_xhtml) { + var break_tag = (is_xhtml || typeof is_xhtml === 'undefined') ? '
    ' : '
    '; + return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ break_tag +'$2'); + }, + /** * * var regex_login = new RegExp(/(^|\s)@((\w|@|\.)*)/g); From 3ebcb195d0ba17f0348dd3f23083b4358738ae3a Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Fri, 15 Jun 2012 19:26:47 +0200 Subject: [PATCH 09/34] [IMP] continue to improve new messages layout bzr revid: abo@openerp.com-20120615172647-vfnbd2x4ve0q6w3g --- addons/mail/mail_message_demo.xml | 20 +++--- addons/mail/static/src/css/mail.css | 97 ++++++++++++++++++++++++++--- addons/mail/static/src/xml/mail.xml | 71 ++++++++------------- 3 files changed, 125 insertions(+), 63 deletions(-) diff --git a/addons/mail/mail_message_demo.xml b/addons/mail/mail_message_demo.xml index 5ae97e24d65..18da3a9d083 100644 --- a/addons/mail/mail_message_demo.xml +++ b/addons/mail/mail_message_demo.xml @@ -5,45 +5,45 @@ A cool blogpost about something clean mail.group - + html - sit amet, consectetur adipiscing elit. Pellentesque et quam sapien, in sagittis tellus. + sit amet, consectetur adipiscing elit. Pellentesque et quam sapien, in sagittis tellus. Praesent vel massa sed massa consequat egestas in tristique orci. Praesent iaculis libero et neque vehicula iaculis. Vivamus placerat tincidunt orci ac ornare. Proin ut dolor fringilla velit ultricies consequat. Maecenas sit amet ipsum non leo interdum imperdiet. Donec sapien mi, varius a consequat id, consectetur sit amet nulla. Fusce tempus elit volutpat mi auctor adipiscing. Nam congue luctus suscipit. Duis vestibulum dapibus enim vitae dignissim. Sed tellus libero, venenatis ut mollis ut, luctus quis dui. Sed rhoncus pulvinar orci in consectetur. Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in dolor in sapien tempus vehicula.]]> comment - + Reply mail.group - + html tremendous blogpost (first comment) !]]> comment - + Reply mail.group - + html +Would it be possible to learn more about the author (second comment) ?]]> comment - + Reply mail.group - + html Donec viverra congue dui eu blandit. In lacinia molestie nulla, ut sagittis risus feugiat eu. (third comment)]]> comment - + diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index f8975d67b78..55efc7ff42c 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -56,6 +56,7 @@ } .openerp div.oe_mail_msg_content { + position: relative; width: 486px; } @@ -284,20 +285,98 @@ -box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(82, 168, 236, 0.6); } -.openerp p.oe_mail_msg { +.openerp div.oe_mail_msg { padding: 0; margin: 0 0 4px 0; } -.openerp a.oe_mail_oe_intlink { - color: #8786b7; -} - .openerp .oe_mail_oe_bold { font-weight: bold; } -/*.openerp .oe_mail_oe_space:after {*/ - /*content: " · ";*/ - /*margin-right: 2px;*/ -/*}*/ +/* ------------------------------ */ +/* New layouts' style */ +/* ------------------------------ */ + +.openerp .oe_mail_msg .oe_mail_msg_title { + font-size: 1.3em; + font-weight: bold; +} +.openerp .oe_mail_msg .oe_mail_msg_title a:link, +.openerp .oe_mail_msg .oe_mail_msg_title a:visited { + color: #4C4C4C; + text-decoration: none; +} + +.openerp .oe_mail_msg_intlinks, +.openerp .oe_mail_msg_subtitle { + color: #888; +} +.openerp .oe_mail_msg_intlinks a:link { + color: #8786b7; +} + +/* Gear menu */ +.openerp .oe_mail_msg_comment a.oe_gear_menuaction { + position: absolute; + top: 0px; + right: 3px; + display: none; + color: #4c4c4c; + cursor: pointer; +} +.openerp .oe_mail_msg_comment:hover .oe_gear_menuaction { + display: block; +} +.openerp .oe_mail_msg_comment a.oe_gear_menuaction:hover { + text-decoration: none; +} +.openerp .oe_mail_msg_comment a.oe_gear_menuaction:hover { + text-decoration: none; +} +.openerp .oe_mail_msg_comment ul.oe_gear_menu { + list-style-type: none; + display: none; + position: absolute; + top: 30px; + right: -140px; + padding: 4px; + border: 1px solid #afafb6; + min-width: 160px; + overflow-x: hidden; + z-index: 900; + background: white; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); +} +.openerp .oe_mail_msg_comment a.oe_gear_menuaction:hover ~ .oe_gear_menu { + display: block; +} +.openerp .oe_mail_msg_comment ul.oe_gear_menu > li { + float: none; +} +.openerp .oe_mail_msg_comment .oe_gear_menu > li > a { + display: block; + padding: 3px 6px; + line-height: 14px; + color: #4c4c4c; + text-decoration: none; +} +.openerp .oe_mail_msg_comment .oe_gear_menu > li > a:hover { + background: #f0f0fa; + background: -moz-linear-gradient(#f0f0fa, #eeeef6); + background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); + background: -webkit-linear-gradient(#f0f0fa, #eeeef6); + -moz-box-shadow: none; + -webkit-box-shadow: none; + -box-shadow: none; +} +.openerp .oe_mail_msg_comment .oe_gear_menu p { + margin-left: 12px; +} + + diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 69012ae77ee..7458f972fa2 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -65,9 +65,9 @@
    - +
    - +
    @@ -138,21 +138,39 @@
    - - +
    - +
    -

    + B +

    +
    + + +

    + +

    +
    +

    + + · + +

    -
    -
      + + +
      + -

      - - - -

      - - - -

      -

      From:

      -

      Subject:

      -

      - - -

      - - +
    From af91983abb9d0c52ffc20f1ac99c5925ce017bfa Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Tue, 19 Jun 2012 19:20:26 +0200 Subject: [PATCH 10/34] [ADD] better demo data bzr revid: abo@openerp.com-20120619172026-z5a7xvw6b57931d4 --- addons/mail/mail_message_demo.xml | 47 +++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/addons/mail/mail_message_demo.xml b/addons/mail/mail_message_demo.xml index 18da3a9d083..bbcc5b2b5ef 100644 --- a/addons/mail/mail_message_demo.xml +++ b/addons/mail/mail_message_demo.xml @@ -2,6 +2,28 @@ + + A cool attachment + PT1Tb21lIGNvb2wgYXR0YWNobWVudD09ClByYWVzZW50IHZlbCBtYXNzYSBzZWQgbWFzc2EgY29uc2VxdWF0IGVnZXN0YXMgaW4gdHJpc3RpcXVlIG9yY2ku + a_cool_attachment + + Mail group + mail.group + + binary + + + + Another clean attachment + PT1Tb21lIGNsZWFuIGF0dGFjaG1lbnQ9PQpOdWxsYSB0dXJwaXMgbGVvLCByaG9uY3VzIHV0IGVnZXN0YXMgc2l0IGFtZXQsIGNvbnNlY3RldHVyIHZpdGFlIHVybmEu + a_clean_attachment + + Mail group + mail.group + + binary + + A cool blogpost about something clean mail.group @@ -15,6 +37,7 @@ Fusce tempus elit volutpat mi auctor adipiscing. Nam congue luctus suscipit. Dui Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in dolor in sapien tempus vehicula.]]>
    comment +
    @@ -22,7 +45,7 @@ Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in mail.group html - tremendous blogpost (first comment) !]]> + tremendous blogpost ! (first comment)]]> comment @@ -34,24 +57,38 @@ Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in html +Would it be possible to learn more about the author ? (second comment)]]> comment + + Author's full biography + PT1BYm91dCB0aGUgYXV0aG9yPT0KSW50ZWdlciBzb2RhbGVzIGRvbG9yIGV1IGVsaXQgZnJpbmdpbGxhIGJsYW5kaXQu + blogpost_author_biography + + Mail group + mail.group + + binary + + Reply mail.group html + +In quis purus neque. Integer sodales dolor eu elit fringilla blandit. Maecenas lacus nisi, facilisis sit amet viverra eu, tristique vel augue. +Donec viverra congue dui eu blandit. In lacinia molestie nulla, ut sagittis risus feugiat eu. + +Check the file in attachment for more information ! (third comment)]]> comment + From 04289e6ef1dc2d8231625aea3cffb68196fe7fa3 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Tue, 19 Jun 2012 20:27:23 +0200 Subject: [PATCH 11/34] [IMP] when loading messages, retrieve attachments names in order to display them within the messages bzr revid: abo@openerp.com-20120619182723-i0baoeqnf77hwoyk --- addons/mail/mail_thread.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index b1b6c68e4cc..11fc203d890 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -413,7 +413,31 @@ class mail_thread(osv.osv): """ OpenChatter feature: return thread messages """ msg_ids = self.message_load_ids(cr, uid, ids, limit, offset, domain, ascent, root_ids, context=context) - msgs = self.pool.get('mail.message').read(cr, uid, msg_ids, context=context) + msgs = self.pool.get('mail.message').read(cr, uid, msg_ids, [], context=context) + + """ Retrieve all attachments names """ + map_id_to_name = {} + + for msg in msgs: + for attach_id in msg["attachment_ids"]: + map_id_to_name[attach_id] = '' # use empty string as a placeholder + + ids = map_id_to_name.keys() + names = self.pool.get('ir.attachment').name_get(cr, uid, ids) + + # convert the list of tuples into a dictionnary + for name in names: + map_id_to_name[name[0]] = name[1] + + # give corresponding ids and names to each message + for msg in msgs: + msg["attachments"] = [] + + for attach_id in msg["attachment_ids"]: + msg["attachments"].append({'id': attach_id, 'name': map_id_to_name[attach_id]}) + + + """ Sort and return messages """ msgs = sorted(msgs, key=lambda d: (-d['id'])) return msgs From 7e674428333b9e8b9496be9c2c75f0cc67f7632e Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Tue, 19 Jun 2012 20:28:10 +0200 Subject: [PATCH 12/34] [IMP] messages display bzr revid: abo@openerp.com-20120619182810-k4m1w8gkntdw5weq --- addons/mail/static/src/css/mail.css | 58 ++++++++++++++-------- addons/mail/static/src/js/mail.js | 67 ++++++++++++++++++++----- addons/mail/static/src/xml/mail.xml | 76 +++++++++++++++++++---------- 3 files changed, 142 insertions(+), 59 deletions(-) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 55efc7ff42c..2f2daa4692a 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -60,10 +60,6 @@ width: 486px; } -.openerp div.oe_mail_msg_content p { - margin: 4px 0; -} - .openerp div.oe_mail_msg_content li{ float: left; margin-right: 3px; @@ -299,6 +295,7 @@ /* ------------------------------ */ .openerp .oe_mail_msg .oe_mail_msg_title { + margin: 0; font-size: 1.3em; font-weight: bold; } @@ -308,16 +305,28 @@ text-decoration: none; } -.openerp .oe_mail_msg_intlinks, +.openerp .oe_mail_msg_subtitle { + margin: 0 0 .5em 0; +} +.openerp .oe_mail_msg_footer, .openerp .oe_mail_msg_subtitle { color: #888; } -.openerp .oe_mail_msg_intlinks a:link { - color: #8786b7; + +.openerp .oe_mail_msg_body, +.openerp .oe_mail_msg_body_short { + margin-bottom: .5em; + text-align: justify; +} + +/* Read more/less link */ +.openerp .oe_mail_msg_content .expand, +.openerp .oe_mail_msg_content .reduce { + font-weight: bold; } /* Gear menu */ -.openerp .oe_mail_msg_comment a.oe_gear_menuaction { +.openerp .oe_mail_msg_content a.oe_gear_menuaction { position: absolute; top: 0px; right: 3px; @@ -325,16 +334,13 @@ color: #4c4c4c; cursor: pointer; } -.openerp .oe_mail_msg_comment:hover .oe_gear_menuaction { +.openerp .oe_mail_msg_content:hover .oe_gear_menuaction { display: block; } -.openerp .oe_mail_msg_comment a.oe_gear_menuaction:hover { +.openerp .oe_mail_msg_content a.oe_gear_menuaction:hover { text-decoration: none; } -.openerp .oe_mail_msg_comment a.oe_gear_menuaction:hover { - text-decoration: none; -} -.openerp .oe_mail_msg_comment ul.oe_gear_menu { +.openerp .oe_mail_msg_content ul.oe_gear_menu { list-style-type: none; display: none; position: absolute; @@ -353,20 +359,17 @@ -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); } -.openerp .oe_mail_msg_comment a.oe_gear_menuaction:hover ~ .oe_gear_menu { - display: block; -} -.openerp .oe_mail_msg_comment ul.oe_gear_menu > li { +.openerp .oe_mail_msg_content ul.oe_gear_menu > li { float: none; } -.openerp .oe_mail_msg_comment .oe_gear_menu > li > a { +.openerp .oe_mail_msg_content .oe_gear_menu > li > a { display: block; padding: 3px 6px; line-height: 14px; color: #4c4c4c; text-decoration: none; } -.openerp .oe_mail_msg_comment .oe_gear_menu > li > a:hover { +.openerp .oe_mail_msg_content .oe_gear_menu > li > a:hover { background: #f0f0fa; background: -moz-linear-gradient(#f0f0fa, #eeeef6); background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); @@ -375,8 +378,21 @@ -webkit-box-shadow: none; -box-shadow: none; } -.openerp .oe_mail_msg_comment .oe_gear_menu p { +.openerp .oe_mail_msg_content .oe_gear_menu p { margin-left: 12px; } +/* Attachments */ +.openerp ul.oe_mail_msg_attachments { + display: none; + width: 100%; + border-top: 1px solid #CCC; + margin-top: .5em; + padding: .5em 0; +} +.openerp ul.oe_mail_msg_attachments li { + float: none; +} + + diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 1d0c659b669..0abd48f098f 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -117,15 +117,43 @@ openerp.mail = function(session) { }, start: function() { + var self = this; + this._super.apply(this, arguments); // customize display - if (! this.display.show_post_comment) this.$element.find('div.oe_mail_thread_act').hide(); + if (! this.display.show_post_comment) { + this.$element.find('div.oe_mail_thread_act').hide(); + } // add events this.add_events(); - /* display user, fetch comments */ + + // display user, fetch comments this.display_current_user(); - if (this.params.records) var display_done = this.display_comments_from_parameters(this.params.records); - else var display_done = this.init_comments(); + + if (this.params.records) { + var display_done = this.display_comments_from_parameters(this.params.records); + } else { + var display_done = this.init_comments(); + } + + // handle the dropdown menu + var dropdown_menu_trigger = '.oe_gear_menuaction'; // css class name + var dropdown_menu_elts = '.oe_gear_menu'; // css class name + + this.$element.on('click', dropdown_menu_trigger, function (ev) { + $gear_menu = $(this).siblings(dropdown_menu_elts); + + if ($gear_menu.is(':visible')) { + $gear_menu.hide(); + } else { + $gear_menu.show(); + } + + // hide others menus if opened + $(dropdown_menu_trigger).not(this).siblings(dropdown_menu_elts).hide(); + return false; + }); + return display_done }, @@ -175,7 +203,7 @@ openerp.mail = function(session) { return false; }); // event: click on an internal link - this.$element.find('div.oe_mail_thread_display').delegate('a.intlink', 'click', function (event) { + this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_internal_link', 'click', function (event) { // lazy implementation: fetch data and try to redirect if (! event.srcElement.dataset.resModel) return false; else var res_model = event.srcElement.dataset.resModel; @@ -193,6 +221,12 @@ openerp.mail = function(session) { } else self.do_action({ type: 'ir.actions.act_window', res_model: res_model, res_id: parseInt(res_id), views: [[false, 'form']]}); }); + // event: click on 'attachment(s)' in msg + this.$element.delegate('a.oe_mail_msg_view_attachments', 'click', function (event) { + var act_dom = $(this).parent().parent().parent().find('.oe_mail_msg_attachments'); + act_dom.toggle(); + return false; + }); }, destroy: function () { @@ -270,7 +304,7 @@ openerp.mail = function(session) { display_comment: function (record) { record.body = this.do_text_nl2br(record.body, true); if (record.type == 'email') { record.mini_url = ('/mail/static/src/img/email_icon.png'); } - else { record.mini_url = this.thread_get_avatar('res.users', 'avatar', record.user_id[0]); } + else { record.mini_url = this.thread_get_avatar('res.users', 'avatar', record.user_id[0]); } // body text manipulation record.body = this.do_clean_text(record.body); record.tr_body = this.do_truncate_string(record.body, this.params.msg_more_limit); @@ -284,8 +318,8 @@ openerp.mail = function(session) { ).appendTo(this.$element.children('div.oe_mail_thread_display:first')); // truncated: hide full-text, show summary, add buttons if (record.tr_body) { - var node_body = this.$element.find('span.oe_mail_msg_body:last').append(' [ ... Show less]'); - var node_body_short = this.$element.find('span.oe_mail_msg_body_short:last').append(' [ ... Show more]'); + var node_body = this.$element.find('.oe_mail_msg_body:last').append('

    See less'); + var node_body_short = this.$element.find('.oe_mail_msg_body_short:last').append('... See more'); node_body.hide(); node_body.find('a:last').click(function() { node_body.hide(); node_body_short.show(); return false; }); node_body_short.find('a:last').click(function() { node_body_short.hide(); node_body.show(); return false; }); @@ -405,7 +439,7 @@ openerp.mail = function(session) { var regex_res = regex_login.exec(string); while (regex_res != null) { var login = regex_res[2]; - string = string.replace(regex_res[0], regex_res[1] + '@' + login + ''); + string = string.replace(regex_res[0], regex_res[1] + '@' + login + ''); regex_res = regex_login.exec(string); } /* special shortcut: :name, try to find an icon if in list */ @@ -424,9 +458,18 @@ openerp.mail = function(session) { return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || ''); }, + /** + * @param {String} string to truncate + * @param {Number} max number of chars to display + * @returns {String} truncated string + */ do_truncate_string: function(string, max_length) { - if (string.length <= (max_length * 1.2)) return false; - else return string.slice(0, max_length); + // multiply by 1.2: prevent truncating an just too little long string + if (string.length <= (max_length * 1.2)) { + return false; + } else { + return string.slice(0, max_length); + } }, /** Removes html tags, except b, em, br */ @@ -550,7 +593,7 @@ openerp.mail = function(session) { if (record.id == self.session.uid) { self.is_subscriber = true; } var mini_url = self.thread_get_avatar('res.users', 'avatar', record.id); $('
  • ' + - '' + record.name + '
  • ').appendTo(user_list); + '' + record.name + '').appendTo(user_list); }); if (self.is_subscriber) { self.$element.find('button.oe_mail_button_follow').hide(); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 7458f972fa2..adedb8e6bc3 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -147,44 +147,68 @@ B -
    - - + + +
  • Hide
  • +
    +
    + + +
    +

    - +

    +

    - + + + · + + · - +

    - + +
    - -
    -
    From 6292e896a186562682757952c27385adf9996592 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Wed, 20 Jun 2012 17:21:42 +0530 Subject: [PATCH 13/34] [IMP] solve Can not `import openerp.tests`. bzr revid: fka@tinyerp.com-20120620115142-euaid51ad2xgwevc --- openerp/tests/test_ir_sequence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tests/test_ir_sequence.py b/openerp/tests/test_ir_sequence.py index 2943676d1bc..fcc5888e47e 100644 --- a/openerp/tests/test_ir_sequence.py +++ b/openerp/tests/test_ir_sequence.py @@ -114,7 +114,7 @@ class test_ir_sequence_change_implementation(unittest2.TestCase): d = dict(code='test_sequence_type_3', name='Test sequence type') c = registry('ir.sequence.type').create(cr, ADMIN_USER_ID, d, {}) assert c - d = dict(code='test_sequence_type_3', name='Test sequence', 'implementation': 'standard') + d = dict(code='test_sequence_type_3', name='Test sequence') c = registry('ir.sequence').create(cr, ADMIN_USER_ID, d, {}) assert c d = dict(code='test_sequence_type_4', name='Test sequence type') From 7d53b3977f9698d47583902f2c7be523f8bd8f27 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Wed, 20 Jun 2012 16:02:04 +0200 Subject: [PATCH 14/34] [IMP] attachments display and accessibility in mail messages a user can now download an attachment in one click bzr revid: abo@openerp.com-20120620140204-1mphi5tjyp57i74t --- addons/mail/mail_thread.py | 3 +- addons/mail/static/src/css/mail.css | 82 +++++++++++++++-------------- addons/mail/static/src/js/mail.js | 13 ++++- addons/mail/static/src/xml/mail.xml | 2 +- 4 files changed, 57 insertions(+), 43 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 11fc203d890..0f404155f42 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -423,7 +423,7 @@ class mail_thread(osv.osv): map_id_to_name[attach_id] = '' # use empty string as a placeholder ids = map_id_to_name.keys() - names = self.pool.get('ir.attachment').name_get(cr, uid, ids) + names = self.pool.get('ir.attachment').name_get(cr, uid, ids, context=context) # convert the list of tuples into a dictionnary for name in names: @@ -436,7 +436,6 @@ class mail_thread(osv.osv): for attach_id in msg["attachment_ids"]: msg["attachments"].append({'id': attach_id, 'name': map_id_to_name[attach_id]}) - """ Sort and return messages """ msgs = sorted(msgs, key=lambda d: (-d['id'])) return msgs diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 2f2daa4692a..2a253154fde 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -327,59 +327,59 @@ /* Gear menu */ .openerp .oe_mail_msg_content a.oe_gear_menuaction { - position: absolute; - top: 0px; - right: 3px; - display: none; - color: #4c4c4c; - cursor: pointer; + position: absolute; + top: 0px; + right: 3px; + display: none; + color: #4c4c4c; + cursor: pointer; } .openerp .oe_mail_msg_content:hover .oe_gear_menuaction { - display: block; + display: block; } .openerp .oe_mail_msg_content a.oe_gear_menuaction:hover { - text-decoration: none; + text-decoration: none; } .openerp .oe_mail_msg_content ul.oe_gear_menu { - list-style-type: none; - display: none; - position: absolute; - top: 30px; - right: -140px; - padding: 4px; - border: 1px solid #afafb6; - min-width: 160px; - overflow-x: hidden; - z-index: 900; - background: white; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + list-style-type: none; + display: none; + position: absolute; + top: 30px; + right: -140px; + padding: 4px; + border: 1px solid #afafb6; + min-width: 160px; + overflow-x: hidden; + z-index: 900; + background: white; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); } .openerp .oe_mail_msg_content ul.oe_gear_menu > li { float: none; } .openerp .oe_mail_msg_content .oe_gear_menu > li > a { - display: block; - padding: 3px 6px; - line-height: 14px; - color: #4c4c4c; - text-decoration: none; + display: block; + padding: 3px 6px; + line-height: 14px; + color: #4c4c4c; + text-decoration: none; } .openerp .oe_mail_msg_content .oe_gear_menu > li > a:hover { - background: #f0f0fa; - background: -moz-linear-gradient(#f0f0fa, #eeeef6); - background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); - background: -webkit-linear-gradient(#f0f0fa, #eeeef6); - -moz-box-shadow: none; - -webkit-box-shadow: none; - -box-shadow: none; + background: #f0f0fa; + background: -moz-linear-gradient(#f0f0fa, #eeeef6); + background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); + background: -webkit-linear-gradient(#f0f0fa, #eeeef6); + -moz-box-shadow: none; + -webkit-box-shadow: none; + -box-shadow: none; } .openerp .oe_mail_msg_content .oe_gear_menu p { - margin-left: 12px; + margin-left: 12px; } /* Attachments */ @@ -387,11 +387,15 @@ display: none; width: 100%; border-top: 1px solid #CCC; - margin-top: .5em; + margin: .5em 0 0 0; padding: .5em 0; + list-style-position: inside; } .openerp ul.oe_mail_msg_attachments li { float: none; + margin: 0; + padding: 0; + list-style-type: square; } diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 0abd48f098f..8f0e2c8303a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -249,10 +249,21 @@ openerp.mail = function(session) { $.when(defer).then(function (records) { if (records.length <= self.params.limit) self.display.show_more = false; else { self.display.show_more = true; records.pop(); } + + //build attachments download urls + for (var k in records) { + if (records[k].attachments) { + for (var l in records[k].attachments) { + records[k].attachments[l].url = self.session.origin + '/web/binary/saveas?session_id=' + self.session.session_id + '&model=ir.attachment&field=datas&filename_field=datas_fname&id='+records[k].attachments[l].id; + } + } + } + self.display_comments(records); if (self.display.show_more == true) self.$element.find('div.oe_mail_thread_more:last').show(); else self.$element.find('div.oe_mail_thread_more:last').hide(); - }); + }); + return defer; }, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index adedb8e6bc3..87b82899cd6 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -202,7 +202,7 @@
    • - +
    • From 231b8ca886f0879186ce2a5ed82632ccec271557 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Wed, 20 Jun 2012 16:32:22 +0200 Subject: [PATCH 15/34] [IMP] better markup, remove some dead code bzr revid: abo@openerp.com-20120620143222-oyw84qxbzlia7lb6 --- addons/mail/static/src/js/mail.js | 2 +- addons/mail/static/src/xml/mail.xml | 86 ++--------------------------- 2 files changed, 6 insertions(+), 82 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 8f0e2c8303a..6faf8dbd40c 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -325,7 +325,7 @@ openerp.mail = function(session) { record.date = session.web.format_value(record.date, {type:"datetime"}); // render // OPTIONS - $(session.web.qweb.render('mail.Thread.new', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) + $(session.web.qweb.render('mail.Thread.default', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) ).appendTo(this.$element.children('div.oe_mail_thread_display:first')); // truncated: hide full-text, show summary, add buttons if (record.tr_body) { diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 87b82899cd6..e972e2d3f28 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -29,8 +29,7 @@

      History and Comments

      -
      -
      +
      @@ -44,7 +43,7 @@
      -
        +
        User img
        @@ -55,96 +54,21 @@
        -
      +
      -
    • - - +
      - +
    • -

      - - - - -
      -

      -

      -
      - - -

      - - - -

      -

      From:

      -

      Subject:

      -

      - - -

      - - -
      - - - -
    • -
      - - -
      - -
      - -
      -
    • - - B
        From 688ced2225e6491a78c9a100aed8ed7984a7fbc1 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Wed, 20 Jun 2012 17:54:34 +0200 Subject: [PATCH 16/34] [ADD] introduce timeago.js (check the end of mail.js) bzr revid: abo@openerp.com-20120620155434-8qos8oooxfwxkm6u --- addons/mail/static/src/js/mail.js | 192 +++++++++++++++++++++++++--- addons/mail/static/src/xml/mail.xml | 2 +- 2 files changed, 177 insertions(+), 17 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 6faf8dbd40c..d3d67d0f6ee 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -5,21 +5,21 @@ openerp.mail = function(session) { var mail = session.mail = {}; /** - * Add records to sorted_comments array - * @param {Array} records records from mail.message sorted by date desc - * @returns {Object} cs comments_structure: dict - * cs.model_to_root_ids = {model: [root_ids], } - * cs.new_root_ids = [new_root_ids] - * cs.root_ids = [root_ids] - * cs.msgs = {record.id: record,} - * cs.tree_struct = {record.id: { - * 'level': record_level in hierarchy, 0 is root, - * 'msg_nbr': number of childs, - * 'direct_childs': [msg_ids], - * 'all_childs': [msg_ids], - * 'for_thread_msgs': [records], - * 'ancestors': [msg_ids], } } - */ + * Add records to sorted_comments array + * @param {Array} records records from mail.message sorted by date desc + * @returns {Object} cs comments_structure: dict + * cs.model_to_root_ids = {model: [root_ids], } + * cs.new_root_ids = [new_root_ids] + * cs.root_ids = [root_ids] + * cs.msgs = {record.id: record,} + * cs.tree_struct = {record.id: { + * 'level': record_level in hierarchy, 0 is root, + * 'msg_nbr': number of childs, + * 'direct_childs': [msg_ids], + * 'all_childs': [msg_ids], + * 'for_thread_msgs': [records], + * 'ancestors': [msg_ids], } } + */ function tools_sort_comments(cs, records, parent_id) { var cur_iter = 0; var max_iter = 10; var modif = true; while ( modif && (cur_iter++) < max_iter) { @@ -250,8 +250,10 @@ openerp.mail = function(session) { if (records.length <= self.params.limit) self.display.show_more = false; else { self.display.show_more = true; records.pop(); } - //build attachments download urls + //build attachments download urls and compute time-relative from dates for (var k in records) { + records[k].timerelative = $.timeago(records[k].date); + if (records[k].attachments) { for (var l in records[k].attachments) { records[k].attachments[l].url = self.session.origin + '/web/binary/saveas?session_id=' + self.session.session_id + '&model=ir.attachment&field=datas&filename_field=datas_fname&id='+records[k].attachments[l].id; @@ -839,6 +841,164 @@ openerp.mail = function(session) { var call_done = this.ds_users.call('message_append_note', [[this.session.uid], 'Tweet', body_text, false, 'comment', 'html']).then(this.proxy('init_and_fetch_comments')); }, }); + + /** + * Compute relative time from a date (ISO format) + * Code from http://timeago.yarp.com/ + * + * + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.11.3 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ + (function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator; + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); + }(jQuery)); }; // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index e972e2d3f28..fe371de5728 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -97,7 +97,7 @@ · - +

        From 86b2f33f712d04a0088cf940a9858d92c329dd9e Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Wed, 20 Jun 2012 19:47:43 +0200 Subject: [PATCH 17/34] [IMP] slightly refactor timeago.js for l18n's sake bzr revid: abo@openerp.com-20120620174743-s603skiqcisu2yhm --- addons/mail/i18n/fr.po | 34 +++++++++++++++++++-- addons/mail/static/src/js/mail.js | 51 +++++++++++++++++++------------ 2 files changed, 62 insertions(+), 23 deletions(-) diff --git a/addons/mail/i18n/fr.po b/addons/mail/i18n/fr.po index 9062a02c6d4..8ac20093e62 100644 --- a/addons/mail/i18n/fr.po +++ b/addons/mail/i18n/fr.po @@ -166,17 +166,17 @@ msgstr "" #. module: mail #: view:mail.message:0 field:mail.message,state:0 msgid "State" -msgstr "" +msgstr "État" #. module: mail #: view:mail.message:0 msgid "Reply" -msgstr "" +msgstr "Répondre" #. module: mail #: view:mail.message:0 selection:mail.message,state:0 msgid "Sent" -msgstr "" +msgstr "Envoyé" #. module: mail #: help:mail.compose.message,subtype:0 help:mail.message,subtype:0 @@ -514,6 +514,34 @@ msgstr "" msgid "Preferred response address for the message" msgstr "Adresse de réponse préférée pour le message" +#. openerp-web +msgid "about a minute ago" +msgstr "il y a une minute" + +#. openerp-web +msgid "%d minutes ago" +msgstr "il y a %d minutes" + +#. openerp-web +msgid "a day ago" +msgstr "il y a un jour" + +#. openerp-web +msgid "%d days ago" +msgstr "il y a %d jours" + +#. openerp-web +msgid "a month ago" +msgstr "il y a un mois" + +#. openerp-web +msgid "%d months ago" +msgstr "il y a %d mois" + +#. openerp-web +msgid "History and Comments" +msgstr "Historique et commentaires" + #~ msgid "Text contents" #~ msgstr "Contenu du texte" diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index d3d67d0f6ee..cbc3ef518bc 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -841,10 +841,13 @@ openerp.mail = function(session) { var call_done = this.ds_users.call('message_append_note', [[this.session.uid], 'Tweet', body_text, false, 'comment', 'html']).then(this.proxy('init_and_fetch_comments')); }, }); - + + + /** * Compute relative time from a date (ISO format) * Code from http://timeago.yarp.com/ + * Please note that the library has been slightly refactored for i18n's sake. * * * @@ -910,33 +913,41 @@ openerp.mail = function(session) { suffix = $l.suffixFromNow; } } - + var seconds = Math.abs(distanceMillis) / 1000; var minutes = seconds / 60; var hours = minutes / 60; var days = hours / 24; var years = days / 365; - - function substitute(stringOrFunction, number) { + + function convert(stringOrFunction, number) { var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; - var value = ($l.numbers && $l.numbers[number]) || number; - return string.replace(/%d/i, value); + + // return the proper string and the numeric value that goes in it + return stringAndNumber = {'string': string, 'value': ($l.numbers && $l.numbers[number]) || number}; } - - var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || - seconds < 90 && substitute($l.minute, 1) || - minutes < 45 && substitute($l.minutes, Math.round(minutes)) || - minutes < 90 && substitute($l.hour, 1) || - hours < 24 && substitute($l.hours, Math.round(hours)) || - hours < 42 && substitute($l.day, 1) || - days < 30 && substitute($l.days, Math.round(days)) || - days < 45 && substitute($l.month, 1) || - days < 365 && substitute($l.months, Math.round(days / 30)) || - years < 1.5 && substitute($l.year, 1) || - substitute($l.years, Math.round(years)); - + + var stringAndNumber = seconds < 45 && convert($l.seconds, Math.round(seconds)) || + seconds < 90 && convert($l.minute, 1) || + minutes < 45 && convert($l.minutes, Math.round(minutes)) || + minutes < 90 && convert($l.hour, 1) || + hours < 24 && convert($l.hours, Math.round(hours)) || + hours < 42 && convert($l.day, 1) || + days < 30 && convert($l.days, Math.round(days)) || + days < 45 && convert($l.month, 1) || + days < 365 && convert($l.months, Math.round(days / 30)) || + years < 1.5 && convert($l.year, 1) || + convert($l.years, Math.round(years)); + + var string = stringAndNumber.string; + var value = stringAndNumber.value; var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator; - return $.trim([prefix, words, suffix].join(separator)); + + // compose and translate the final string + var finalString = $.trim([prefix, string, suffix].join(separator)); + var translatedFinalString = _.str.sprintf(_t(finalString), value); + + return translatedFinalString; }, parse: function(iso8601) { var s = $.trim(iso8601); From 04448834bab55b53da17314a7400020ec3831a66 Mon Sep 17 00:00:00 2001 From: "Sbh (Openerp)" Date: Thu, 21 Jun 2012 14:54:49 +0530 Subject: [PATCH 18/34] [REVERT] revert changes of test_osv_expression.yml bzr revid: sbh@tinyerp.com-20120621092449-bz1bzdadrl13t50j --- .../addons/base/test/test_osv_expression.yml | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/openerp/addons/base/test/test_osv_expression.yml b/openerp/addons/base/test/test_osv_expression.yml index 0165b61b275..0fe6c98c359 100644 --- a/openerp/addons/base/test/test_osv_expression.yml +++ b/openerp/addons/base/test/test_osv_expression.yml @@ -75,7 +75,7 @@ Trying the "in" operator, for scalar value - !python {model: res.partner }: | - ids = self.search(cr, uid, [('parent_id','=','Agrolait')]) + ids = self.search(cr, uid, [('parent_id','in','Agrolait')]) assert len(ids) >= 1, ids - Trying the "in" operator for list value @@ -229,7 +229,7 @@ res_0.sort() res_1 = self.search(cr, uid, [('parent_id', 'not in', [max_partner_id + 1])]) # get all rows, included null parent_id res_1.sort() - res_2 = self.search(cr, uid, [('parent_id', '!=', False)]) # get rows with not null parent_id, deprecated syntax + res_2 = self.search(cr, uid, [('parent_id', 'not in', False)]) # get rows with not null parent_id, deprecated syntax res_2.sort() res_3 = self.search(cr, uid, [('parent_id', 'not in', [])]) # get all rows, included null parent_id res_3.sort() @@ -249,7 +249,7 @@ res_5.sort() res_6 = self.search(cr, uid, [('parent_id', 'in', [max_partner_id + 1])]) res_6.sort() - res_7 = self.search(cr, uid, [('parent_id', '=', False)]) + res_7 = self.search(cr, uid, [('parent_id', 'in', False)]) res_7.sort() res_8 = self.search(cr, uid, [('parent_id', 'in', [])]) res_8.sort() @@ -270,7 +270,7 @@ res_10.sort() res_11 = self.search(cr, uid, ['!', ('parent_id', 'in', [max_partner_id + 1])]) res_11.sort() - res_12 = self.search(cr, uid, ['!', ('parent_id', '=', False)]) + res_12 = self.search(cr, uid, ['!', ('parent_id', 'in', False)]) res_12.sort() res_13 = self.search(cr, uid, ['!', ('parent_id', 'in', [])]) res_13.sort() @@ -291,7 +291,7 @@ res_16.sort() assert res_16 == partner_ids - res_17 = self.search(cr, uid, [('website', '!=', False)]) + res_17 = self.search(cr, uid, [('website', 'not in', False)]) res_17.sort() assert res_17 == with_website @@ -306,21 +306,21 @@ assert res_101 == [], 'res_101: expected %r, got %r' % ([], res_101) assert res_102 == company_ids, 'res_102: expected %r, got %r' % (company_ids, res_102) - - Property of the query (one2many != False). + Property of the query (one2many not in False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '!=', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'not in', False)])) assert referenced_companies == companies - - Property of the query (one2many = False). + Property of the query (one2many in False). - !python {model: res.currency }: | ids = self.search(cr, uid, []) referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) unreferenced_companies = set(self.pool.get('res.company').search(cr, uid, [])).difference(referenced_companies) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '=', False)])) + companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', 'in', False)])) assert unreferenced_companies == companies - Equivalent queries. @@ -331,7 +331,7 @@ res_1 = self.search(cr, uid, [('name', 'not like', 'probably_unexisting_name')]) res_2 = self.search(cr, uid, [('id', 'not in', [max_currency_id + 1003])]) res_3 = self.search(cr, uid, [('id', 'not in', [])]) - res_4 = self.search(cr, uid, [('id', '!=', False)]) + res_4 = self.search(cr, uid, [('id', 'not in', False)]) res_0.sort() res_1.sort() res_2.sort() @@ -414,7 +414,7 @@ # get the companies referenced by some currency (this is normally the main company) res_10 = self.search(cr, uid, [('currency_ids', 'not like', 'probably_unexisting_name')]) res_11 = self.search(cr, uid, [('currency_ids', 'not in', [max_currency_id + 1])]) - res_12 = self.search(cr, uid, [('currency_ids', '!=', False)]) + res_12 = self.search(cr, uid, [('currency_ids', 'not in', False)]) res_13 = self.search(cr, uid, [('currency_ids', 'not in', [])]) res_10.sort() res_11.sort() @@ -526,5 +526,3 @@ !python {model: res.partner }: | res_ids = self.search(cr, uid, [('child_ids.country_id','=','Belgium'),('active','=',False)]) assert len(res_ids) != 0, "Record not Found with country Belgium and active False." - - From c8e5450ba3a0976b84777a89b4e1142abbf7af13 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Thu, 21 Jun 2012 14:48:43 +0200 Subject: [PATCH 19/34] [IMP] use the default openerp dropdown menu implementation. also improve markup (ul.oe_mail_wall_threads is now a list of li.oe_mail_wall_thread) more markup and css improvements to come bzr revid: abo@openerp.com-20120621124843-klk1oy2rxdcd08uh --- addons/mail/static/src/css/mail.css | 78 ++++------------------------- addons/mail/static/src/js/mail.js | 14 +++--- addons/mail/static/src/xml/mail.xml | 31 ++++++------ 3 files changed, 34 insertions(+), 89 deletions(-) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 2a253154fde..41f1331ef6f 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -170,7 +170,7 @@ margin-left: 66px; } -.openerp div.oe_mail_thread_subthread li.oe_mail_thread_msg:last-child { +.openerp div.oe_mail_thread_subthread .oe_mail_thread_msg:last-child { margin-bottom: 8px; } @@ -179,13 +179,13 @@ border-bottom: 1px solid #D2D9E7; } -.openerp li.oe_mail_thread_msg:after { +.openerp .oe_mail_thread_msg:after { content: ""; display: block; clear: both; } -.openerp li.oe_mail_thread_msg > div:after { +.openerp .oe_mail_thread_msg > div:after { content: ""; display: block; clear: both; @@ -246,15 +246,6 @@ /* Styling (should be openerp) */ /* ------------------------------ */ -.openerp ul.oe_mail { - padding: 0; - margin: 0; -} - -.openerp li.oe_mail { - list-style-type: none; -} - .openerp input.oe_mail, textarea.oe_mail { width: 432px; padding: 4px; @@ -291,7 +282,7 @@ } /* ------------------------------ */ -/* New layouts' style */ +/* Messages layout */ /* ------------------------------ */ .openerp .oe_mail_msg .oe_mail_msg_title { @@ -325,64 +316,20 @@ font-weight: bold; } -/* Gear menu */ -.openerp .oe_mail_msg_content a.oe_gear_menuaction { +/* Dropdown menu */ +.openerp .oe_mail_msg_content .oe_dropdown_toggle { position: absolute; top: 0px; right: 3px; - display: none; - color: #4c4c4c; - cursor: pointer; } -.openerp .oe_mail_msg_content:hover .oe_gear_menuaction { - display: block; +.openerp .oe_mail_msg_content .oe_dropdown_arrow:after { + border-top: 4px solid transparent; } -.openerp .oe_mail_msg_content a.oe_gear_menuaction:hover { - text-decoration: none; -} -.openerp .oe_mail_msg_content ul.oe_gear_menu { - list-style-type: none; - display: none; - position: absolute; - top: 30px; - right: -140px; - padding: 4px; - border: 1px solid #afafb6; - min-width: 160px; - overflow-x: hidden; - z-index: 900; - background: white; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); -} -.openerp .oe_mail_msg_content ul.oe_gear_menu > li { - float: none; -} -.openerp .oe_mail_msg_content .oe_gear_menu > li > a { - display: block; - padding: 3px 6px; - line-height: 14px; - color: #4c4c4c; - text-decoration: none; -} -.openerp .oe_mail_msg_content .oe_gear_menu > li > a:hover { - background: #f0f0fa; - background: -moz-linear-gradient(#f0f0fa, #eeeef6); - background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); - background: -webkit-linear-gradient(#f0f0fa, #eeeef6); - -moz-box-shadow: none; - -webkit-box-shadow: none; - -box-shadow: none; -} -.openerp .oe_mail_msg_content .oe_gear_menu p { - margin-left: 12px; +.openerp .oe_mail_msg_content:hover .oe_dropdown_arrow:after { + border-top: 4px solid #404040; } -/* Attachments */ +/* Attachments list */ .openerp ul.oe_mail_msg_attachments { display: none; width: 100%; @@ -397,6 +344,3 @@ padding: 0; list-style-type: square; } - - - diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index cbc3ef518bc..9b209c137a2 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -182,7 +182,7 @@ openerp.mail = function(session) { var msg_id = event.srcElement.dataset.id; if (! msg_id) return false; var call_defer = self.ds_msg.unlink([parseInt(msg_id)]); - $(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).hide(); + $(event.srcElement).parents('.oe_mail_thread_msg').eq(0).hide(); if (self.params.thread_level > 0) { $(event.srcElement).parents('ul.oe_mail_thread').eq(0).hide(); } @@ -196,9 +196,9 @@ openerp.mail = function(session) { if (! msg_id) return false; //console.log(msg_id); var call_defer = self.ds.call('message_remove_pushed_notifications', [[self.params.res_id], [parseInt(msg_id)], true]); - $(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).hide(); + $(event.srcElement).parents('.oe_mail_thread_msg').eq(0).hide(); if (self.params.thread_level > 0) { - $(event.srcElement).parents('ul.oe_mail_thread').eq(0).hide(); + $(event.srcElement).parents('.oe_mail_thread').eq(0).hide(); } return false; }); @@ -300,7 +300,7 @@ openerp.mail = function(session) { self.display_comment(record); self.thread = new mail.Thread(self, {'res_model': self.params.res_model, 'res_id': self.params.res_id, 'uid': self.params.uid, 'records': sub_msgs, 'thread_level': (self.params.thread_level-1), 'parent_id': record.id}); - self.$element.find('li.oe_mail_thread_msg:last').append('
        '); + self.$element.find('.oe_mail_thread_msg:last').append('
        '); self.thread.appendTo(self.$element.find('div.oe_mail_thread_subthread:last')); } else if (self.params.thread_level == 0) { @@ -749,7 +749,7 @@ openerp.mail = function(session) { this.search['context'] = _.extend(this.params.context, this.search_results.context); this.display_show_more = true; this.comments_structure = {'root_ids': [], 'new_root_ids': [], 'msgs': {}, 'tree_struct': {}, 'model_to_root_ids': {}}; - this.$element.find('div.oe_mail_wall_threads').empty(); + this.$element.find('ul.oe_mail_wall_threads').empty(); return this.fetch_comments(this.params.limit, 0); }, @@ -782,13 +782,13 @@ openerp.mail = function(session) { var model_name = self.comments_structure.msgs[root_id]['model']; var res_id = self.comments_structure.msgs[root_id]['res_id']; var render_res = session.web.qweb.render('WallThreadContainer', {}); - $('
        ').html(render_res).appendTo(self.$element.find('div.oe_mail_wall_threads')); + $('
      • ').html(render_res).appendTo(self.$element.find('ul.oe_mail_wall_threads')); var thread = new mail.Thread(self, { 'res_model': model_name, 'res_id': res_id, 'uid': self.session.uid, 'records': records, 'parent_id': false, 'thread_level': self.params.thread_level, 'show_hide': true} ); self.thread_list.push(thread); - return thread.appendTo(self.$element.find('div.oe_mail_wall_thread:last')); + return thread.appendTo(self.$element.find('li.oe_mail_wall_thread:last')); }); // update TODO this.comments_structure['root_ids'] = _.union(this.comments_structure['root_ids'], this.comments_structure['new_root_ids']); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index fe371de5728..a5d669a4f00 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -15,8 +15,8 @@
      • -
        -
        +
          +
        @@ -57,7 +57,7 @@
        -
      • +
        @@ -66,22 +66,23 @@
        -
      • +
        - B - +
        From e0f324ac25b0f89065c39bec8b6d216f0365009d Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 21 Jun 2012 16:06:42 +0200 Subject: [PATCH 20/34] [FIX] field text width bzr revid: fme@openerp.com-20120621140642-s96lwuycykbxo719 --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 1bc566db860..b5276c982d6 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1720,7 +1720,7 @@ .openerp .oe_form .oe_form_field_selection select { width: inherit; } -.openerp .oe_form .oe_form_sheet textarea { +.openerp .oe_form .oe_form_field_text.oe_inline, .openerp .oe_form .oe_form_field_text.oe_inline > textarea { width: 500px; } .openerp .oe_form .oe_form_field_float input { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 07026bc69d1..4db214a7a48 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1378,7 +1378,7 @@ $colour4: #8a89ba .oe_form_field_text textarea, .oe_form_field_selection select width: inherit - .oe_form_sheet textarea + .oe_form_field_text.oe_inline, .oe_form_field_text.oe_inline > textarea width: 500px .oe_form_field_float input width: 100px From b821d42061465fe6f49449cecc2e87c2b57079da Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Thu, 21 Jun 2012 17:00:02 +0200 Subject: [PATCH 21/34] [IMP] properly prefix templates names with 'mail.' use 'main' and 'aside' instead of 'left' and 'right' in the mail main boxes' class names bzr revid: abo@openerp.com-20120621150002-u7saes5bc06bt51l --- addons/mail/static/src/css/mail.css | 69 ++++++++++++++++++----------- addons/mail/static/src/js/mail.js | 20 ++++----- addons/mail/static/src/xml/mail.xml | 16 +++---- 3 files changed, 60 insertions(+), 45 deletions(-) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 41f1331ef6f..e9b2b8ebd79 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -9,35 +9,19 @@ background: white; } -.openerp div.oe_mail_wall_act { +.openerp div.oe_mail_wall_action { padding: 8px; background: #eee; border: 1px solid #ccc; } -.openerp div.oe_mail_wall_act:after { +.openerp div.oe_mail_wall_action:after { content: ""; display: block; clear: both; } -/* 2 columns view */ -.openerp div.oe_mail_wall_left { - float: left; - width: 560px; - margin: 8px; -} - -.openerp div.oe_mail_wall_right { - margin-left: 565px; - margin: 8px; -} - -.openerp div.oe_mail_wall_threads { - margin-top: 8px; -} - -.openerp textarea.oe_mail_wall_action_textarea { +.openerp .oe_mail_wall_action textarea { width: 474px; height: 60px; padding: 4px; @@ -45,11 +29,31 @@ float: right; } -.openerp div.oe_mail_wall_threads textarea { +/* 2 columns view */ +.openerp div.oe_mail_wall_main { + float: left; + width: 560px; + margin: 8px; +} + +.openerp div.oe_mail_wall_aside { + margin-left: 565px; + margin: 8px; +} + +/* Threads */ +.openerp .oe_mail_wall_threads { + margin-top: 8px; +} +.openerp .oe_mail_wall_threads textarea { height: 40px; padding: 4px; } +.openerp .oe_mail_wall_thread:first .oe_mail_msg_notification { + border-top: 0; +} + .openerp div.oe_mail_thread_subthread img { width: 28px; height: 28px; @@ -149,14 +153,14 @@ /* ThreadDisplay */ /* ------------------------------ */ -.openerp div.oe_mail_thread_act { +.openerp div.oe_mail_thread_action { white-space: normal; padding: 8px; background: #eee; - border-top: 1px solid #ccc + border-top: 1px solid #ccc; } -.openerp div.oe_mail_thread_act:after { +.openerp div.oe_mail_thread_action:after { content: ""; display: block; clear: both; @@ -191,13 +195,22 @@ clear: both; } -.openerp .oe_mail_msg_notification, .openerp .oe_mail_msg_comment, .openerp .oe_mail_msg_email { +.openerp .oe_mail_msg_notification, +.openerp .oe_mail_msg_comment, +.openerp .oe_mail_msg_email { padding: 8px; } -.openerp .oe_mail_msg_comment, .openerp .oe_mail_msg_email, .openerp .oe_mail_msg_notification { +.openerp .oe_mail_msg_comment, +.openerp .oe_mail_msg_email, +.openerp .oe_mail_msg_notification { background: white; - border-top: 1px solid #ccc + border-top: 1px solid #ccc; +} +.openerp .oe_mail_wall_threads > .oe_mail_wall_thread:first-child > .oe_mail_msg_comment, +.openerp .oe_mail_wall_threads > .oe_mail_wall_thread:first-child > .oe_mail_msg_email, +.openerp .oe_mail_wall_threads > .oe_mail_wall_thread:first-child > .oe_mail_msg_notification { + border-top: 0; } .openerp .oe_email_icon { @@ -209,7 +222,9 @@ background: #eee; } -.openerp .oe_mail_msg_notification:after, .openerp .oe_mail_msg_comment:after, .openerp .oe_mail_msg_email:after { +.openerp .oe_mail_msg_notification:after, +.openerp .oe_mail_msg_comment:after, +.openerp .oe_mail_msg_email:after { content: ""; display: block; clear: both; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 9b209c137a2..7339af7c612 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -72,7 +72,7 @@ openerp.mail = function(session) { * either it will fetch [limit] messages related to [res_model]:[res_id]. */ mail.Thread = session.web.Widget.extend({ - template: 'Thread', + template: 'mail.Thread', /** * @param {Object} parent parent @@ -122,7 +122,7 @@ openerp.mail = function(session) { this._super.apply(this, arguments); // customize display if (! this.display.show_post_comment) { - this.$element.find('div.oe_mail_thread_act').hide(); + this.$element.find('div.oe_mail_thread_action').hide(); } // add events this.add_events(); @@ -171,7 +171,7 @@ openerp.mail = function(session) { }); // event: click on 'reply' in msg this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply', 'click', function (event) { - var act_dom = $(this).parents('div.oe_mail_thread_display').find('div.oe_mail_thread_act:first'); + var act_dom = $(this).parents('div.oe_mail_thread_display').find('div.oe_mail_thread_action:first'); act_dom.toggle(); event.preventDefault(); }); @@ -184,7 +184,7 @@ openerp.mail = function(session) { var call_defer = self.ds_msg.unlink([parseInt(msg_id)]); $(event.srcElement).parents('.oe_mail_thread_msg').eq(0).hide(); if (self.params.thread_level > 0) { - $(event.srcElement).parents('ul.oe_mail_thread').eq(0).hide(); + $(event.srcElement).parents('.oe_mail_thread').eq(0).hide(); } return false; }); @@ -539,7 +539,7 @@ openerp.mail = function(session) { /* ThreadView widget: thread of comments */ mail.RecordThread = session.web.form.AbstractField.extend({ // QWeb template to use when rendering the object - template: 'RecordThread', + template: 'mail.RecordThread', init: function() { this._super.apply(this, arguments); @@ -581,7 +581,7 @@ openerp.mail = function(session) { this._super.apply(this, arguments); var self = this; this.reinit(); - if (! this.view.datarecord.id) { this.$element.find('ul.oe_mail_thread').hide(); return; } + if (! this.view.datarecord.id) { this.$element.find('.oe_mail_thread').hide(); return; } // fetch followers var fetch_sub_done = this.fetch_subscribers(); // create and render Thread widget @@ -645,7 +645,7 @@ openerp.mail = function(session) { /* WallView widget: a wall of messages */ mail.WallView = session.web.Widget.extend({ - template: 'Wall', + template: 'mail.Wall', /** * @param {Object} parent parent @@ -695,7 +695,7 @@ openerp.mail = function(session) { add_event_handlers: function () { var self = this; // post a comment - this.$element.find('button.oe_mail_wall_button_comment').click(function () { return self.do_comment(); }); + this.$element.find('.oe_mail_wall_action button').click(function () { return self.do_comment(); }); // display more threads this.$element.find('button.oe_mail_wall_button_more').click(function () { return self.do_more(); }); }, @@ -781,7 +781,7 @@ openerp.mail = function(session) { var records = self.comments_structure.tree_struct[root_id]['for_thread_msgs']; var model_name = self.comments_structure.msgs[root_id]['model']; var res_id = self.comments_structure.msgs[root_id]['res_id']; - var render_res = session.web.qweb.render('WallThreadContainer', {}); + var render_res = session.web.qweb.render('mail.WallThreadContainer', {}); $('
      • ').html(render_res).appendTo(self.$element.find('ul.oe_mail_wall_threads')); var thread = new mail.Thread(self, { 'res_model': model_name, 'res_id': res_id, 'uid': self.session.uid, 'records': records, @@ -835,7 +835,7 @@ openerp.mail = function(session) { /** Action: Posts a comment */ do_comment: function () { - var comment_node = this.$element.find('textarea.oe_mail_wall_action_textarea'); + var comment_node = this.$element.find('.oe_mail_wall_action textarea'); var body_text = comment_node.val(); comment_node.val(''); var call_done = this.ds_users.call('message_append_note', [[this.session.uid], 'Tweet', body_text, false, 'comment', 'html']).then(this.proxy('init_and_fetch_comments')); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index a5d669a4f00..7f74f3f5d80 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -1,15 +1,15 @@