From e4eff4ba66881c48122a18085c0c5f8cd9db140e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 2 Oct 2014 17:34:59 +0200 Subject: [PATCH 01/10] [FIX] mail: keep breadcrumb on click on chatter follower --- addons/mail/static/src/js/mail_followers.js | 23 ++++++++++++++++++- addons/mail/static/src/xml/mail_followers.xml | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index c103e4d4ab2..6d143557c6c 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -76,7 +76,8 @@ openerp_mail_followers = function(session, mail) { // event: click on 'edit_subtype(pencil)' button to edit subscription this.$el.on('click', '.oe_edit_subtype', self.on_edit_subtype); this.$el.on('click', '.oe_remove_follower', self.on_remove_follower); - this.$el.on('click', '.oe_show_more', self.on_show_more_followers) + this.$el.on('click', '.oe_show_more', self.on_show_more_followers); + this.$el.on('click', 'a[data-partner]', self.on_follower_clicked); }, on_edit_subtype: function(event) { @@ -136,6 +137,26 @@ openerp_mail_followers = function(session, mail) { } }, + on_follower_clicked: function (event) { + event.preventDefault(); + var partner_id = $(event.target).data('partner'); + var state = { + 'model': 'res.partner', + 'id': partner_id, + 'title': this.record_name + }; + session.webclient.action_manager.do_push_state(state); + var action = { + type:'ir.actions.act_window', + view_type: 'form', + view_mode: 'form', + res_model: 'res.partner', + views: [[false, 'form']], + res_id: partner_id, + } + this.do_action(action); + }, + read_value: function () { var self = this; this.displayed_nb = this.displayed_limit; diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 6e8682cb533..5a4d25144f7 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -30,7 +30,7 @@ -->
- + & X
From b2cb31c0fbb049e56cdd3bf7f092e014e76e8038 Mon Sep 17 00:00:00 2001 From: dhr-odoo Date: Fri, 19 Sep 2014 15:08:46 +0530 Subject: [PATCH 02/10] [FIX] account: return format of function field When no result is found on the function field 'invoice' (account.move.line), instead of returning {move_id: (False, '')}, return {move_id: False} (expected for m2o fields) Fixes #2138, opw 613096 --- addons/account/account_move_line.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 756c40ea612..9f85f58fb00 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -338,12 +338,12 @@ class account_move_line(osv.osv): for line_id, invoice_id in cursor.fetchall(): res[line_id] = invoice_id invoice_ids.append(invoice_id) - invoice_names = {False: ''} + invoice_names = {} for invoice_id, name in invoice_obj.name_get(cursor, user, invoice_ids, context=context): invoice_names[invoice_id] = name for line_id in res.keys(): invoice_id = res[line_id] - res[line_id] = (invoice_id, invoice_names[invoice_id]) + res[line_id] = invoice_id and (invoice_id, invoice_names[invoice_id]) or False return res def name_get(self, cr, uid, ids, context=None): From 6d4e1cc73e4b3754f3c14edbd3307525edd2dd8b Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 3 Oct 2014 11:20:19 +0200 Subject: [PATCH 03/10] [FIX] ir_translation: remove control characters from translations This is possible that control characters (such as line returns) are inserted wrongly in translations These should not influence on the web interface --- openerp/addons/base/ir/ir_translation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index cdbec59c65c..f8eecc70856 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -20,6 +20,7 @@ ############################################################################## import logging +import unicodedata from openerp import tools import openerp.modules @@ -335,10 +336,11 @@ class ir_translation(osv.osv): AND name=%s""", (lang or '', types, tools.ustr(name))) res = cr.fetchone() - trad = res and res[0] or u'' + trad = res and tools.ustr(res[0]) or u'' if source and not trad: return tools.ustr(source) - return trad + # Remove control characters + return filter(lambda c: unicodedata.category(c) != 'Cc', trad) def create(self, cr, uid, vals, context=None): if context is None: From 7cbd5244480ead4450b8e6e646ecf939399a722c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 3 Oct 2014 12:08:49 +0200 Subject: [PATCH 04/10] [FIX] ir_translation: apply tools.ustr on the trad itself tools.ustr(None) returns u'None', res[0] can be None. --- openerp/addons/base/ir/ir_translation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index f8eecc70856..0ff497e0274 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -336,11 +336,11 @@ class ir_translation(osv.osv): AND name=%s""", (lang or '', types, tools.ustr(name))) res = cr.fetchone() - trad = res and tools.ustr(res[0]) or u'' + trad = res and res[0] or u'' if source and not trad: return tools.ustr(source) # Remove control characters - return filter(lambda c: unicodedata.category(c) != 'Cc', trad) + return filter(lambda c: unicodedata.category(c) != 'Cc', tools.ustr(trad)) def create(self, cr, uid, vals, context=None): if context is None: From 9066da3369ddf36ffe187c0d199667070ac32be6 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 3 Oct 2014 12:09:48 +0200 Subject: [PATCH 05/10] [FIX] point_of_sale: do not display False as currency if symbol is not set --- addons/point_of_sale/static/src/js/widget_base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/widget_base.js b/addons/point_of_sale/static/src/js/widget_base.js index 124be4e9f82..e69dd77e64d 100644 --- a/addons/point_of_sale/static/src/js/widget_base.js +++ b/addons/point_of_sale/static/src/js/widget_base.js @@ -33,9 +33,9 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of amount = amount.toFixed(decimals); } if(this.currency.position === 'after'){ - return amount + ' ' + this.currency.symbol; + return amount + ' ' + (this.currency.symbol || ''); }else{ - return this.currency.symbol + ' ' + amount; + return (this.currency.symbol || '') + ' ' + amount; } } From 066fbb66132724b23129071193785e33d0c2bdd9 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 29 Sep 2014 14:48:11 +0200 Subject: [PATCH 06/10] [FIX] account_anglo_saxon: price difference, discount and taxes When computing the price difference amount do not integrate the eventual discount and taxes included in the price. Otherwise the total of the generated accounting enty would be higher than the total of the invoice. opw 611350 --- addons/account_anglo_saxon/invoice.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index 8a816b0c962..ec455fc49d8 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -110,14 +110,18 @@ class account_invoice_line(osv.osv): if inv.currency_id.id != company_currency: standard_price = self.pool.get('res.currency').compute(cr, uid, company_currency, inv.currency_id.id, standard_price, context={'date': inv.date_invoice}) if standard_price != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: - price_diff = round(i_line.price_unit - standard_price, account_prec) - line.update({'price': round(standard_price * line['quantity'], account_prec)}) + # price with discount and without tax included + price_unit = self.pool['account.tax'].compute_all(cr, uid, line['taxes'], + i_line.price_unit * (1-(i_line.discount or 0.0)/100.0), line['quantity'])['total'] + price_line = round(standard_price * line['quantity'], account_prec) + price_diff = round(price_unit - price_line, account_prec) + line.update({'price': price_line}) diff_res.append({ 'type':'src', 'name': i_line.name[:64], - 'price_unit':price_diff, + 'price_unit': round(price_diff / line['quantity'], account_prec), 'quantity':line['quantity'], - 'price': round(price_diff * line['quantity'], account_prec), + 'price': price_diff, 'account_id':acc, 'product_id':line['product_id'], 'uos_id':line['uos_id'], From e11d44eab499a59e09aadcf170177bd5b18d5c2f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 3 Oct 2014 15:12:04 +0200 Subject: [PATCH 07/10] [FIX] event: missing context This fixes some translation issues (templates not translated at event confirmation) --- addons/event/event.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/event/event.py b/addons/event/event.py index 937884fd087..f62551fb359 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -114,7 +114,7 @@ class event_event(osv.osv): reg_ids = register_pool.search(cr, uid, [ ('event_id', '=', self.event.id), ('state', 'not in', ['draft', 'cancel'])], context=context) - register_pool.mail_user_confirm(cr, uid, reg_ids) + register_pool.mail_user_confirm(cr, uid, reg_ids, context=context) return self.write(cr, uid, ids, {'state': 'confirm'}, context=context) def button_confirm(self, cr, uid, ids, context=None): @@ -165,7 +165,7 @@ class event_event(osv.osv): res = {} for event in self.browse(cr, uid, ids, context=context): res[event.id] = False - curr_reg_id = register_pool.search(cr, uid, [('user_id', '=', uid), ('event_id', '=' ,event.id)]) + curr_reg_id = register_pool.search(cr, uid, [('user_id', '=', uid), ('event_id', '=' ,event.id)], context=context) if curr_reg_id: for reg in register_pool.browse(cr, uid, curr_reg_id, context=context): if reg.state in ('open','done'): @@ -226,7 +226,7 @@ class event_event(osv.osv): curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , ids[0])]) #the subscription is done with SUPERUSER_ID because in case we share the kanban view, we want anyone to be able to subscribe if not curr_reg_ids: - curr_reg_ids = [register_pool.create(cr, SUPERUSER_ID, {'event_id': ids[0] ,'email': user.email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats})] + curr_reg_ids = [register_pool.create(cr, SUPERUSER_ID, {'event_id': ids[0] ,'email': user.email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats}, context=context)] else: register_pool.write(cr, uid, curr_reg_ids, {'nb_register': num_of_seats}, context=context) return register_pool.confirm_registration(cr, SUPERUSER_ID, curr_reg_ids, context=context) @@ -234,7 +234,7 @@ class event_event(osv.osv): def unsubscribe_to_event(self, cr, uid, ids, context=None): register_pool = self.pool.get('event.registration') #the unsubscription is done with SUPERUSER_ID because in case we share the kanban view, we want anyone to be able to unsubscribe - curr_reg_ids = register_pool.search(cr, SUPERUSER_ID, [('user_id', '=', uid), ('event_id', '=', ids[0])]) + curr_reg_ids = register_pool.search(cr, SUPERUSER_ID, [('user_id', '=', uid), ('event_id', '=', ids[0])], context=context) return register_pool.button_reg_cancel(cr, SUPERUSER_ID, curr_reg_ids, context=context) def _check_closing_date(self, cr, uid, ids, context=None): @@ -250,7 +250,7 @@ class event_event(osv.osv): def onchange_event_type(self, cr, uid, ids, type_event, context=None): values = {} if type_event: - type_info = self.pool.get('event.type').browse(cr,uid,type_event,context) + type_info = self.pool.get('event.type').browse(cr,uid,type_event,context, context=context) dic ={ 'reply_to': type_info.default_reply_to, 'email_registration_id': type_info.default_email_registration.id, From b3485fb59c5b488e887feb4b356341be86e9db82 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 3 Oct 2014 15:15:12 +0200 Subject: [PATCH 08/10] [FIX] event: double context --- addons/event/event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/event/event.py b/addons/event/event.py index f62551fb359..5027cfaf717 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -250,7 +250,7 @@ class event_event(osv.osv): def onchange_event_type(self, cr, uid, ids, type_event, context=None): values = {} if type_event: - type_info = self.pool.get('event.type').browse(cr,uid,type_event,context, context=context) + type_info = self.pool.get('event.type').browse(cr,uid,type_event, context=context) dic ={ 'reply_to': type_info.default_reply_to, 'email_registration_id': type_info.default_email_registration.id, From dfc2e1ce1b175895e7dfef6e28a6a3b8d69e6384 Mon Sep 17 00:00:00 2001 From: Young Joy Date: Mon, 6 Oct 2014 11:27:55 +0800 Subject: [PATCH 09/10] [FIX] project: typo in protect.task create that typo will cause project task create error when set date_end before the time right now --- addons/project/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index b91c61d5f21..610764128c4 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1048,7 +1048,7 @@ class task(osv.osv): if vals.get('project_id') and not context.get('default_project_id'): context['default_project_id'] = vals.get('project_id') # user_id change: update date_start - if vals.get('user_id') and not vals.get('start_date'): + if vals.get('user_id') and not vals.get('date_start'): vals['date_start'] = fields.datetime.now() # context: no_log, because subtype already handle this From fc9fc3e0b83065c97bcadb1ef0f5c4ccd976e440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Zl=C3=A1mal?= Date: Wed, 27 Aug 2014 16:58:55 +0200 Subject: [PATCH 10/10] [FIX] common.py: missing import It was not possible to call "about" function via remote control (XML-RPC), because it contains string translation without import. --- openerp/service/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/service/common.py b/openerp/service/common.py index d7d58c2850f..97f36b7f964 100644 --- a/openerp/service/common.py +++ b/openerp/service/common.py @@ -4,6 +4,7 @@ import logging import openerp.release import openerp.tools +from openerp.tools.translate import _ import security