From c959f49179cead52d42d15bf4ac50a3936a51e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 15 Jul 2014 11:15:27 +0200 Subject: [PATCH 01/27] [FIX] website_forum: fixed controller creating a new forum tha was crashing. --- addons/website_forum/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 346445f478b..c0a2b8735c5 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -79,7 +79,7 @@ class WebsiteForum(http.Controller): forum_id = request.registry['forum.forum'].create(request.cr, request.uid, { 'name': forum_name, }, context=request.context) - return request.redirect("/forum/%s" % slug(forum_id)) + return request.redirect("/forum/%s" % forum_id) @http.route('/forum/notification_read', type='json', auth="user", multilang=True, methods=['POST'], website=True) def notification_read(self, **kwargs): From d4b923aec9fc342830c4de9d2f901c177a860f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 15 Jul 2014 12:54:38 +0200 Subject: [PATCH 02/27] [FIX] project_mrp: prevent crash during installation if stock is not installed; use default view for product coming from the product module that is indeed in the dependencies. --- addons/project_mrp/project_mrp_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project_mrp/project_mrp_view.xml b/addons/project_mrp/project_mrp_view.xml index 90ab6682cd5..482d97bee31 100644 --- a/addons/project_mrp/project_mrp_view.xml +++ b/addons/project_mrp/project_mrp_view.xml @@ -14,9 +14,9 @@ product.form.view.inherit product.template - + - + From 99556240299a8350f7b73534056e19ed2b1b3b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 15 Jul 2014 16:44:55 +0200 Subject: [PATCH 03/27] website_forum: fixed issue when voting. The method should work in batch. Previously to this implementation having one post with a vote bypassed the other posts without vote when called with several ids. --- addons/website_forum/models/forum.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index caa9dff6e57..edcddfe8d67 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -256,6 +256,8 @@ class Post(osv.Model): def vote(self, cr, uid, ids, upvote=True, context=None): Vote = self.pool['forum.post.vote'] vote_ids = Vote.search(cr, uid, [('post_id', 'in', ids), ('user_id', '=', uid)], context=context) + new_vote = '1' if upvote else '-1' + voted_forum_ids = set() if vote_ids: for vote in Vote.browse(cr, uid, vote_ids, context=context): if upvote: @@ -263,9 +265,9 @@ class Post(osv.Model): else: new_vote = '0' if vote.vote == '1' else '-1' Vote.write(cr, uid, vote_ids, {'vote': new_vote}, context=context) - else: + voted_forum_ids.add(vote.post_id.id) + for post_id in set(ids) - voted_forum_ids: for post_id in ids: - new_vote = '1' if upvote else '-1' Vote.create(cr, uid, {'post_id': post_id, 'vote': new_vote}, context=context) return {'vote_count': self._get_vote_count(cr, uid, ids, None, None, context=context)[ids[0]]} From f8d8179a92214566af8812cb187d859d5690417e Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 18 Jun 2014 18:19:01 +0200 Subject: [PATCH 04/27] [FIX] website_sale: add shop/pricelist controller --- addons/website_sale/controllers/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 525530fca79..bcd86aff7a4 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -238,6 +238,12 @@ class website_sale(http.Controller): context=dict(context, mail_create_nosubcribe=True)) return werkzeug.utils.redirect(request.httprequest.referrer + "#comments") + @http.route(['/shop/pricelist'], type='http', auth="public", website=True) + def pricelist(self, promo, **post): + cr, uid, context = request.cr, request.uid, request.context + request.website.sale_get_order(code=promo, context=context) + return request.redirect("/shop/cart") + @http.route(['/shop/cart'], type='http', auth="public", website=True) def cart(self, **post): order = request.website.sale_get_order() From 6ac1deccf64e35de062ed960f84bd8a794d310d4 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 16 Jul 2014 22:51:43 +0200 Subject: [PATCH 05/27] [FIX] mail, website_mail: specific mailing-list footer + better unsubscribe option - remove the default footer for mail.group messages, replace with specific footer with archive and unsubscribe link - remove the automatic addition of user signature in mail.group messages, as many of them will be posted via the mail gateway and already contain a user signature. - make it easier to unsubscribe even when not logged in, as followers who have not signed up will have no way to login short of signing up. - remove tests looking for user signature in mail.group posts --- addons/mail/mail_followers.py | 9 ++--- addons/mail/tests/test_mail_features.py | 8 ----- addons/website_mail/static/src/js/follow.js | 24 +++++++------ addons/website_mail/views/website_mail.xml | 3 +- .../website_mail_group/models/mail_group.py | 36 ++++++++++++++++++- .../views/website_mail_group.xml | 3 ++ 6 files changed, 59 insertions(+), 24 deletions(-) diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index 1e2c6c8d9e6..a4eee04a69c 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -138,10 +138,10 @@ class mail_notification(osv.Model): company = "%s" % (website_url, user.company_id.name) else: company = user.company_id.name - sent_by = _('Sent by %(company)s using %(openerp)s.') + sent_by = _('Sent by %(company)s using %(odoo)s.') signature_company = '%s' % (sent_by % { 'company': company, - 'openerp': "OpenERP" + 'odoo': "Odoo" }) footer = tools.append_content_to_html(footer, signature_company, plaintext=False, container_tag='div') @@ -174,8 +174,9 @@ class mail_notification(osv.Model): # compute email body (signature, company data) body_html = message.body - user_id = message.author_id and message.author_id.user_ids and message.author_id.user_ids[0] and message.author_id.user_ids[0].id or None - if user_signature: + # add user signature except for mail groups, where users are usually adding their own signatures already + if user_signature and message.model != 'mail.group': + user_id = message.author_id and message.author_id.user_ids and message.author_id.user_ids[0] and message.author_id.user_ids[0].id or None signature_company = self.get_signature_footer(cr, uid, user_id, res_model=message.model, res_id=message.res_id, context=context) body_html = tools.append_content_to_html(body_html, signature_company, plaintext=False, container_tag='div') diff --git a/addons/mail/tests/test_mail_features.py b/addons/mail/tests/test_mail_features.py index bea80b729a4..ff9ce5d82cc 100644 --- a/addons/mail/tests/test_mail_features.py +++ b/addons/mail/tests/test_mail_features.py @@ -468,14 +468,10 @@ class test_mail(TestMail): 'message_post: notification email subject incorrect') self.assertIn(_body1, sent_email['body'], 'message_post: notification email body incorrect') - self.assertIn(user_raoul.signature, sent_email['body'], - 'message_post: notification email body should contain the sender signature') self.assertIn('Pigs rules', sent_email['body_alternative'], 'message_post: notification email body alternative should contain the body') self.assertNotIn('

', sent_email['body_alternative'], 'message_post: notification email body alternative still contains html') - self.assertIn(user_raoul.signature, sent_email['body_alternative'], - 'message_post: notification email body alternative should contain the sender signature') self.assertFalse(sent_email['references'], 'message_post: references should be False when sending a message that is not a reply') @@ -539,14 +535,10 @@ class test_mail(TestMail): 'message_post: notification email subject incorrect') self.assertIn(html_sanitize(_body2), sent_email['body'], 'message_post: notification email does not contain the body') - self.assertIn(user_raoul.signature, sent_email['body'], - 'message_post: notification email body should contain the sender signature') self.assertIn('Pigs rocks', sent_email['body_alternative'], 'message_post: notification email body alternative should contain the body') self.assertNotIn('

', sent_email['body_alternative'], 'message_post: notification email body alternative still contains html') - self.assertIn(user_raoul.signature, sent_email['body_alternative'], - 'message_post: notification email body alternative should contain the sender signature') self.assertIn(msg_message_id, sent_email['references'], 'message_post: notification email references lacks parent message message_id') # Test: attachments + download diff --git a/addons/website_mail/static/src/js/follow.js b/addons/website_mail/static/src/js/follow.js index 18c36378328..a8b351efa6c 100644 --- a/addons/website_mail/static/src/js/follow.js +++ b/addons/website_mail/static/src/js/follow.js @@ -40,17 +40,21 @@ } this.$target.removeClass('has-error'); - openerp.jsonRpc('/website_mail/follow', 'call', { - 'id': +this.$target.data('id'), - 'object': this.$target.data('object'), - 'message_is_follower': this.$target.attr("data-follow") || "off", - 'email': $email.length ? $email.val() : false, - }).then(function (follow) { - self.toggle_subscription(follow, self.email); - }); + var email = $email.length ? $email.val() : false; + if (email) { + openerp.jsonRpc('/website_mail/follow', 'call', { + 'id': +this.$target.data('id'), + 'object': this.$target.data('object'), + 'message_is_follower': this.$target.attr("data-follow") || "off", + 'email': email, + }).then(function (follow) { + self.toggle_subscription(follow, email); + }); + } }, toggle_subscription: function(follow, email) { console.log(follow, email); + follow = follow || (!email && this.$target.attr('data-unsubscribe')); if (follow) { this.$target.find(".js_follow_btn").addClass("hidden"); this.$target.find(".js_unfollow_btn").removeClass("hidden"); @@ -60,8 +64,8 @@ this.$target.find(".js_unfollow_btn").addClass("hidden"); } this.$target.find('input.js_follow_email') - .val(email ? email : "") - .attr("disabled", follow || (email.length && this.is_user) ? "disabled" : false); + .val(email || "") + .attr("disabled", email && (follow || this.is_user) ? "disabled" : false); this.$target.attr("data-follow", follow ? 'on' : 'off'); }, }); diff --git a/addons/website_mail/views/website_mail.xml b/addons/website_mail/views/website_mail.xml index 3b6d1bb96d6..8e365c1aaf5 100644 --- a/addons/website_mail/views/website_mail.xml +++ b/addons/website_mail/views/website_mail.xml @@ -5,7 +5,8 @@