From e38974c5b62988c2887c0de0d2dbcb3526e6a214 Mon Sep 17 00:00:00 2001 From: Christophe Combelles Date: Sat, 13 Dec 2014 23:49:25 +0200 Subject: [PATCH 1/7] [FIX] mail: access link generaTION Catch only the error related to the access of the linked record. Previous was hidding error to access the ir.config_parameter and eventual other errors from the orm. Uses SUPERUSER_ID to access instance URL (e.g. portal has no access to it). Fixes #4234 #4234 --- addons/mail/mail_mail.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index b71176bcd08..19852e1b182 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -179,7 +179,10 @@ class mail_mail(osv.Model): related_user = partner.user_ids[0] try: self.pool.get(mail.model).check_access_rule(cr, related_user.id, [mail.res_id], 'read', context=context) - base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') + except except_orm, e: + pass + else: + base_url = self.pool.get('ir.config_parameter').get_param(cr, SUPERUSER_ID, 'web.base.url') # the parameters to encode for the query and fragment part of url query = {'db': cr.dbname} fragment = { @@ -190,8 +193,6 @@ class mail_mail(osv.Model): url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment))) text = _("""

Access this document directly in OpenERP

""") % url body = tools.append_content_to_html(body, ("

%s

" % text), plaintext=False) - except except_orm, e: - pass return body def send_get_mail_reply_to(self, cr, uid, mail, partner=None, context=None): From 60a361cd179e986fbe2ecb7f5cdd9f2379c6bde3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 15 Dec 2014 17:30:06 +0100 Subject: [PATCH 2/7] [FIX]web_gantt: value rendering with decimal separator other than dot --- addons/web_gantt/static/src/js/gantt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js index f30fa6a83e6..dc97aee4138 100644 --- a/addons/web_gantt/static/src/js/gantt.js +++ b/addons/web_gantt/static/src/js/gantt.js @@ -157,7 +157,7 @@ instance.web_gantt.GanttView = instance.web.View.extend({ self.fields[self.fields_view.arch.attrs.date_delay]); if (!tmp) return; - task_stop = task_start.clone().addMilliseconds(tmp * 60 * 60 * 1000); + task_stop = task_start.clone().addMilliseconds(instance.web.parse_value(tmp, {type:"float"}) * 60 * 60 * 1000); } var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60); var id = _.uniqueId("gantt_task_"); From f833d2eacdd3ee177529e4daa679a35179ec892c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 16 Dec 2014 10:49:18 +0100 Subject: [PATCH 3/7] [FIX] web_gantt: duration in business days if delay not set delay already being the hours amount in business hours opw-620189 --- addons/web_gantt/static/src/js/gantt.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js index dc97aee4138..77c228f26b5 100644 --- a/addons/web_gantt/static/src/js/gantt.js +++ b/addons/web_gantt/static/src/js/gantt.js @@ -144,6 +144,7 @@ instance.web_gantt.GanttView = instance.web.View.extend({ } } else { var task_name = task.__name; + var duration_in_business_hours = false; var task_start = instance.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_start]); if (!task_start) return; @@ -158,10 +159,14 @@ instance.web_gantt.GanttView = instance.web.View.extend({ if (!tmp) return; task_stop = task_start.clone().addMilliseconds(instance.web.parse_value(tmp, {type:"float"}) * 60 * 60 * 1000); + duration_in_business_hours = true; } var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60); var id = _.uniqueId("gantt_task_"); - var task_info = new GanttTaskInfo(id, task_name, task_start, ((duration / 24) * 8) || 1, 100); + if (!duration_in_business_hours){ + duration = (duration / 24) * 8; + } + var task_info = new GanttTaskInfo(id, task_name, task_start, (duration) || 1, 100); task_info.internal_task = task; task_ids[id] = task_info; return {task_info: task_info, task_start: task_start, task_stop: task_stop}; @@ -202,7 +207,11 @@ instance.web_gantt.GanttView = instance.web.View.extend({ var self = this; var itask = task_obj.TaskInfo.internal_task; var start = task_obj.getEST(); - var duration = (task_obj.getDuration() / 8) * 24; + var duration = task_obj.getDuration(); + var duration_in_business_hours = !!self.fields_view.arch.attrs.date_delay; + if (!duration_in_business_hours){ + duration = (duration / 8 ) * 24; + } var end = start.clone().addMilliseconds(duration * 60 * 60 * 1000); var data = {}; data[self.fields_view.arch.attrs.date_start] = From 36af222569738ef72cc15397a2d9d4b00dda09f3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 16 Dec 2014 15:50:43 +0100 Subject: [PATCH 4/7] [FIX] crm_partner_assign: more precise geolocation Google api geolocation service returns a precise latitude and longitude, greater or equal than 5 digits The precision is important as storing 2 digits instead of 5 can lead to an inaccuracy of allmost half a mile. --- addons/crm_partner_assign/crm_partner_assign.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm_partner_assign/crm_partner_assign.py b/addons/crm_partner_assign/crm_partner_assign.py index 3e3795eb653..0cbdd6929d7 100644 --- a/addons/crm_partner_assign/crm_partner_assign.py +++ b/addons/crm_partner_assign/crm_partner_assign.py @@ -85,8 +85,8 @@ class res_partner_activation(osv.osv): class res_partner(osv.osv): _inherit = "res.partner" _columns = { - 'partner_latitude': fields.float('Geo Latitude'), - 'partner_longitude': fields.float('Geo Longitude'), + 'partner_latitude': fields.float('Geo Latitude', digits=(16, 5)), + 'partner_longitude': fields.float('Geo Longitude', digits=(16, 5)), 'date_localization': fields.date('Geo Localization Date'), 'partner_weight': fields.integer('Weight', help="Gives the probability to assign a lead to this partner. (0 means no assignation.)"), From ba70393bc4170f421952bb6d42cb909c79211350 Mon Sep 17 00:00:00 2001 From: Somesh Khare Date: Wed, 17 Dec 2014 11:25:58 +0530 Subject: [PATCH 5/7] [FIX] account: prevent selecting company's contacts for manual account.move.line Only the commercial partner (parent company) should be set in partner field of an account.move.line. Fixes #4261, opw 618763 --- addons/account/account_view.xml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 2716e39cd80..e942df0b56e 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -995,7 +995,9 @@ - + @@ -1068,7 +1070,9 @@ - + @@ -1112,7 +1116,9 @@ - + @@ -1289,7 +1295,9 @@ - + @@ -1353,7 +1361,9 @@ - + From 998db2c61f157afe0cd750fda970fde60f4aa2b5 Mon Sep 17 00:00:00 2001 From: Gaurav Panchal Date: Tue, 16 Dec 2014 18:13:13 +0530 Subject: [PATCH 6/7] [FIX]stock: return of 'To Be Invoiced' picking should also be invoiced When creating a return picking, the default invoice state is 'To Be Invoiced' if returned picking was invoiced. However if the invoice of the picking has not been generated yet (state '2binvoiced'), the return should also be invoiced. Fixes #4002 --- addons/stock/wizard/stock_return_picking.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py index 8e30fc01bd8..46d523d7546 100644 --- a/addons/stock/wizard/stock_return_picking.py +++ b/addons/stock/wizard/stock_return_picking.py @@ -69,10 +69,10 @@ class stock_return_picking(osv.osv_memory): pick = pick_obj.browse(cr, uid, record_id, context=context) if pick: if 'invoice_state' in fields: - if pick.invoice_state=='invoiced': - res.update({'invoice_state': '2binvoiced'}) + if pick.invoice_state in ['invoiced','2binvoiced']: + res['invoice_state'] = '2binvoiced' else: - res.update({'invoice_state': 'none'}) + res['invoice_state'] = 'none' return_history = self.get_return_history(cr, uid, record_id, context) for line in pick.move_lines: qty = line.product_qty - return_history.get(line.id, 0) From 43cf6d51d2b4ccd98dc02c1221bf4b51871f92fe Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 17 Dec 2014 13:57:34 +0100 Subject: [PATCH 7/7] [FIX] account: aged partner balance, advance partial payment Partners totals were not correct if the partner paid partially an invoice in advance For an invoice of 20.000 in the future, with a payment made in advance of 5000 The column not due must contains 20.000, as the amount is not yet due One of the column 1-30, 30-60, ... (accordingly on when the payment was made). must contains -5000 The total should be 15.000 --- addons/account/report/account_aged_partner_balance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index b2887bc0de2..57498f8a66d 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -188,9 +188,12 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): partial = date and date[0][0] <= form[str(i)]['stop'] if partial: # partial reconcilation + limit_date = 'COALESCE(l.date_maturity,l.date) %s %%s' % '<=' if self.direction_selection == 'past' else '>=' self.cr.execute('''SELECT SUM(l.debit-l.credit) FROM account_move_line AS l, account_move AS am - WHERE l.move_id = am.id AND am.state in %s AND l.reconcile_partial_id = %s''', (tuple(move_state), partner_info[2],)) + WHERE l.move_id = am.id AND am.state in %s + AND l.reconcile_partial_id = %s + AND ''' + limit_date, (tuple(move_state), partner_info[2], self.date_from)) unreconciled_amount = self.cr.fetchall() partners_amount[partner_info[0]] += unreconciled_amount[0][0] else: