From 841accd1793c1e092ebbd02f13a4885e988a4158 Mon Sep 17 00:00:00 2001 From: Vidhin Mehta Date: Thu, 23 May 2013 17:35:17 +0530 Subject: [PATCH 01/10] [IMP]Introduce float_time concept in Timesheet Widget. bzr revid: vme@tinyerp.com-20130523120517-y281pkgqj66atthr --- .../static/src/js/timesheet.js | 43 +++++++++++++++---- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/addons/hr_timesheet_sheet/static/src/js/timesheet.js b/addons/hr_timesheet_sheet/static/src/js/timesheet.js index fe7d0c82767..9a272051655 100644 --- a/addons/hr_timesheet_sheet/static/src/js/timesheet.js +++ b/addons/hr_timesheet_sheet/static/src/js/timesheet.js @@ -163,24 +163,41 @@ openerp.hr_timesheet_sheet = function(instance) { this.dfm = undefined; } }, + is_valid_value:function(value){ + var split_value = value.split(":"); + var wrong_value = true; + if (split_value.length > 2)return false; + _.detect(split_value,function(num){ + if(isNaN(num)){ + wrong_value = false; + } + }) + return wrong_value; + }, display_data: function() { var self = this; self.$el.html(QWeb.render("hr_timesheet_sheet.WeeklyTimesheet", {widget: self})); _.each(self.accounts, function(account) { _.each(_.range(account.days.length), function(day_count) { if (!self.get('effective_readonly')) { - self.get_box(account, day_count).val(self.sum_box(account, day_count)).change(function() { - var num = Number($(this).val()); + self.get_box(account, day_count).val(self.sum_box(account, day_count, true)).change(function() { + var num = $(this).val(); + if (self.is_valid_value(num)){ + num = Number(self.parse_client(num)); + } if (isNaN(num)) { - $(this).val(self.sum_box(account, day_count)); + $(this).val(self.sum_box(account, day_count, true)); } else { account.days[day_count].lines[0].unit_amount += num - self.sum_box(account, day_count); self.display_totals(); self.sync(); + if(!isNaN($(this).val())){ + $(this).val(self.sum_box(account, day_count, true)); + } } }); } else { - self.get_box(account, day_count).html(self.sum_box(account, day_count)); + self.get_box(account, day_count).html(self.sum_box(account, day_count, true)); } }); }); @@ -247,12 +264,12 @@ openerp.hr_timesheet_sheet = function(instance) { get_super_total: function() { return this.$('.oe_timesheet_weekly_supertotal'); }, - sum_box: function(account, day_count) { + sum_box: function(account, day_count, setter) { var line_total = 0; _.each(account.days[day_count].lines, function(line) { line_total += line.unit_amount; }); - return line_total; + return (setter)?this.format_client(line_total):line_total; }, display_totals: function() { var self = this; @@ -266,12 +283,12 @@ openerp.hr_timesheet_sheet = function(instance) { day_tots[day_count] += sum; super_tot += sum; }); - self.get_total(account).html(acc_tot); + self.get_total(account).html(self.format_client(acc_tot)); }); _.each(_.range(self.dates.length), function(day_count) { - self.get_day_total(day_count).html(day_tots[day_count]); + self.get_day_total(day_count).html(self.format_client(day_tots[day_count])); }); - self.get_super_total().html(super_tot); + self.get_super_total().html(self.format_client(super_tot)); }, sync: function() { var self = this; @@ -279,6 +296,14 @@ openerp.hr_timesheet_sheet = function(instance) { self.set({sheets: this.generate_o2m_value()}); self.setting = false; }, + //converts hour value to float + parse_client: function(value) { + return instance.web.parse_value(value, { type:"float_time" }); + }, + //converts float value to hour + format_client:function(value){ + return instance.web.format_value(value, { type:"float_time" }); + }, generate_o2m_value: function() { var self = this; var ops = []; From 41fd5d657da5d3d0a6d7e9dda851ec08d1a42d2c Mon Sep 17 00:00:00 2001 From: Vidhin Mehta Date: Thu, 23 May 2013 18:11:17 +0530 Subject: [PATCH 02/10] [IMP]Change Variable name. bzr revid: vme@tinyerp.com-20130523124117-g6hnj394fndmookq --- addons/hr_timesheet_sheet/static/src/js/timesheet.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/hr_timesheet_sheet/static/src/js/timesheet.js b/addons/hr_timesheet_sheet/static/src/js/timesheet.js index 9a272051655..90ce8eff39b 100644 --- a/addons/hr_timesheet_sheet/static/src/js/timesheet.js +++ b/addons/hr_timesheet_sheet/static/src/js/timesheet.js @@ -165,14 +165,14 @@ openerp.hr_timesheet_sheet = function(instance) { }, is_valid_value:function(value){ var split_value = value.split(":"); - var wrong_value = true; + var valid_value = true; if (split_value.length > 2)return false; _.detect(split_value,function(num){ if(isNaN(num)){ - wrong_value = false; + valid_value = false; } }) - return wrong_value; + return valid_value; }, display_data: function() { var self = this; @@ -264,12 +264,12 @@ openerp.hr_timesheet_sheet = function(instance) { get_super_total: function() { return this.$('.oe_timesheet_weekly_supertotal'); }, - sum_box: function(account, day_count, setter) { + sum_box: function(account, day_count, show_value_in_hour) { var line_total = 0; _.each(account.days[day_count].lines, function(line) { line_total += line.unit_amount; }); - return (setter)?this.format_client(line_total):line_total; + return (show_value_in_hour)?this.format_client(line_total):line_total; }, display_totals: function() { var self = this; From 423052ac68a626f2f4164c6e01c5f09fd15b8816 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of openerp <> Date: Fri, 24 May 2013 06:45:26 +0000 Subject: [PATCH 03/10] Launchpad automatic translations update. bzr revid: launchpad_translations_on_behalf_of_openerp-20130524064526-ezy0cy6343teva17 --- addons/edi/i18n/fi.po | 23 +++++++++++++---------- addons/portal_crm/i18n/fr.po | 14 +++++++------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/addons/edi/i18n/fi.po b/addons/edi/i18n/fi.po index 3b5705968e0..3604b67fe42 100644 --- a/addons/edi/i18n/fi.po +++ b/addons/edi/i18n/fi.po @@ -8,35 +8,35 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2013-03-07 08:38+0000\n" -"PO-Revision-Date: 2012-12-21 23:00+0000\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2013-05-24 05:55+0000\n" +"Last-Translator: Samuli Kivistö \n" "Language-Team: Finnish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-03-28 05:38+0000\n" -"X-Generator: Launchpad (build 16546)\n" +"X-Launchpad-Export-Date: 2013-05-24 06:45+0000\n" +"X-Generator: Launchpad (build 16640)\n" #. module: edi #. openerp-web #: code:addons/edi/static/src/js/edi.js:67 #, python-format msgid "Reason:" -msgstr "" +msgstr "Syy:" #. module: edi #. openerp-web #: code:addons/edi/static/src/js/edi.js:60 #, python-format msgid "The document has been successfully imported!" -msgstr "" +msgstr "Dokumentin tuonti onnistui!" #. module: edi #. openerp-web #: code:addons/edi/static/src/js/edi.js:65 #, python-format msgid "Sorry, the document could not be imported." -msgstr "" +msgstr "Dokumenttia ei voida tuoda." #. module: edi #: model:ir.model,name:edi.model_res_company @@ -53,13 +53,13 @@ msgstr "Valuutta" #: code:addons/edi/static/src/js/edi.js:71 #, python-format msgid "Document Import Notification" -msgstr "" +msgstr "Dokumentin tuonti-ilmoitus" #. module: edi #: code:addons/edi/models/edi.py:130 #, python-format msgid "Missing application." -msgstr "" +msgstr "Sovellus puuttuu." #. module: edi #: code:addons/edi/models/edi.py:131 @@ -69,6 +69,9 @@ msgid "" "You can install it by connecting as the administrator and opening the " "configuration assistant." msgstr "" +"Dokumentti, jota yrität tuoda, vaatii OpenERP `%s` sovelluksen. Voit asentaa " +"puuttuvan sovelluksen, jos olet kirjautunut administraattorina, käyttämällä " +"konfigurointi assistenttia." #. module: edi #: code:addons/edi/models/edi.py:47 @@ -84,4 +87,4 @@ msgstr "Kumppani" #. module: edi #: model:ir.model,name:edi.model_edi_edi msgid "EDI Subsystem" -msgstr "" +msgstr "EDI Alijärjestelmä" diff --git a/addons/portal_crm/i18n/fr.po b/addons/portal_crm/i18n/fr.po index 77089898352..3c2aafeb82d 100644 --- a/addons/portal_crm/i18n/fr.po +++ b/addons/portal_crm/i18n/fr.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2013-03-07 08:38+0000\n" -"PO-Revision-Date: 2013-05-22 16:37+0000\n" +"PO-Revision-Date: 2013-05-23 21:31+0000\n" "Last-Translator: Quentin THEURET \n" "Language-Team: French \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-05-23 06:19+0000\n" +"X-Launchpad-Export-Date: 2013-05-24 06:45+0000\n" "X-Generator: Launchpad (build 16640)\n" #. module: portal_crm @@ -40,27 +40,27 @@ msgstr "" #. module: portal_crm #: field:portal_crm.crm_contact_us,date_action:0 msgid "Next Action Date" -msgstr "" +msgstr "Date de la prochaine action" #. module: portal_crm #: field:portal_crm.crm_contact_us,fax:0 msgid "Fax" -msgstr "" +msgstr "Fax" #. module: portal_crm #: field:portal_crm.crm_contact_us,zip:0 msgid "Zip" -msgstr "" +msgstr "Code postal" #. module: portal_crm #: field:portal_crm.crm_contact_us,message_unread:0 msgid "Unread Messages" -msgstr "" +msgstr "Messages non-lus" #. module: portal_crm #: field:portal_crm.crm_contact_us,company_id:0 msgid "Company" -msgstr "" +msgstr "Société" #. module: portal_crm #: field:portal_crm.crm_contact_us,day_open:0 From fcff0fcbea15f1db6eebae81660ec0ca8d2850c0 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 24 May 2013 10:55:34 +0200 Subject: [PATCH 04/10] [IMP] don't format 0 values bzr revid: mat@openerp.com-20130524085534-coh7tjadajiu4bv3 --- .../hr_timesheet_sheet/static/src/js/timesheet.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/hr_timesheet_sheet/static/src/js/timesheet.js b/addons/hr_timesheet_sheet/static/src/js/timesheet.js index 90ce8eff39b..e7d13c425b6 100644 --- a/addons/hr_timesheet_sheet/static/src/js/timesheet.js +++ b/addons/hr_timesheet_sheet/static/src/js/timesheet.js @@ -166,12 +166,13 @@ openerp.hr_timesheet_sheet = function(instance) { is_valid_value:function(value){ var split_value = value.split(":"); var valid_value = true; - if (split_value.length > 2)return false; + if (split_value.length > 2) + return false; _.detect(split_value,function(num){ if(isNaN(num)){ valid_value = false; } - }) + }); return valid_value; }, display_data: function() { @@ -183,15 +184,15 @@ openerp.hr_timesheet_sheet = function(instance) { self.get_box(account, day_count).val(self.sum_box(account, day_count, true)).change(function() { var num = $(this).val(); if (self.is_valid_value(num)){ - num = Number(self.parse_client(num)); - } + num = (num == 0)?0:Number(self.parse_client(num)); + } if (isNaN(num)) { $(this).val(self.sum_box(account, day_count, true)); } else { account.days[day_count].lines[0].unit_amount += num - self.sum_box(account, day_count); self.display_totals(); self.sync(); - if(!isNaN($(this).val())){ + if(!isNaN($(this).val())){ $(this).val(self.sum_box(account, day_count, true)); } } @@ -269,7 +270,7 @@ openerp.hr_timesheet_sheet = function(instance) { _.each(account.days[day_count].lines, function(line) { line_total += line.unit_amount; }); - return (show_value_in_hour)?this.format_client(line_total):line_total; + return (show_value_in_hour && line_total != 0)?this.format_client(line_total):line_total; }, display_totals: function() { var self = this; From 0e8d719cd1f783aedbf12dd1e2e348022fd00462 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 24 May 2013 15:55:20 +0200 Subject: [PATCH 05/10] [FIX] web_calendar: today button should return the date_part only bzr revid: mat@openerp.com-20130524135520-8853j3kfxlmp2lpm --- addons/web_calendar/static/src/js/calendar.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index a9287c0021c..40539f7f0f6 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -15,6 +15,12 @@ old_scheduler_dblclick.apply(this, arguments); } }; + + scheduler._click.dhx_cal_today_button = function() { + if (scheduler.callEvent("onBeforeTodayDisplayed", [])) { + scheduler.setCurrentView( scheduler.date.date_part(new Date()) ); + } + }; } }()); From e528e410c2eebefe9ee1fde4f7e280e55417d46b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 24 May 2013 16:28:56 +0200 Subject: [PATCH 06/10] [IMP] explain monkey patch bzr revid: mat@openerp.com-20130524142856-gra4nuvl7upuldp5 --- addons/web_calendar/static/src/js/calendar.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 40539f7f0f6..8da2ad43819 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -4,9 +4,9 @@ (function() { // Monkey patch dhtml scheduler in order to fix a bug. - // It manually implements some kind of dbl click event - // bubbling but fails to do it properly. if (this.scheduler) { + // It manually implements some kind of dbl click event + // bubbling but fails to do it properly. var old_scheduler_dblclick = scheduler._on_dbl_click; scheduler._on_dbl_click = function(e, src) { if (src && !src.className) { @@ -16,6 +16,8 @@ } }; + // It uses the date+time format, leading to month range being between + // 1/5 08:53 - 1/6 08:52 instead of 1/5 00:00 - 31/5 23:59 scheduler._click.dhx_cal_today_button = function() { if (scheduler.callEvent("onBeforeTodayDisplayed", [])) { scheduler.setCurrentView( scheduler.date.date_part(new Date()) ); From d0f4f8d0177edc126a72abbb8229042dd6f9cc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 24 May 2013 16:29:32 +0200 Subject: [PATCH 07/10] [FIX] project_issue: fixed access rights issues when truing to find suggested partners. bzr revid: tde@openerp.com-20130524142932-0g47w650hqpirft1 --- addons/project_issue/project_issue.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index f8f6510cd49..13ccfcee8d0 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -23,7 +23,7 @@ from openerp.addons.base_status.base_stage import base_stage from openerp.addons.project.project import _TASK_STATE from openerp.addons.crm import crm from datetime import datetime -from openerp.osv import fields,osv +from openerp.osv import fields, osv, orm from openerp.tools.translate import _ import binascii import time @@ -489,11 +489,14 @@ class project_issue(base_stage, osv.osv): def message_get_suggested_recipients(self, cr, uid, ids, context=None): recipients = super(project_issue, self).message_get_suggested_recipients(cr, uid, ids, context=context) - for issue in self.browse(cr, uid, ids, context=context): - if issue.partner_id: - self._message_add_suggested_recipient(cr, uid, recipients, issue, partner=issue.partner_id, reason=_('Customer')) - elif issue.email_from: - self._message_add_suggested_recipient(cr, uid, recipients, issue, email=issue.email_from, reason=_('Customer Email')) + try: + for issue in self.browse(cr, uid, ids, context=context): + if issue.partner_id: + self._message_add_suggested_recipient(cr, uid, recipients, issue, partner=issue.partner_id, reason=_('Customer')) + elif issue.email_from: + self._message_add_suggested_recipient(cr, uid, recipients, issue, email=issue.email_from, reason=_('Customer Email')) + except (osv.except_osv, orm.except_orm): # no read access rights -> just ignore suggested recipients because this imply modifying followers + pass return recipients def message_new(self, cr, uid, msg, custom_values=None, context=None): From 08167175268a669b80b672aa0c2bb0f50b60cab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 24 May 2013 16:42:24 +0200 Subject: [PATCH 08/10] [FIX] Chatter: fixed suggested recipients, when having no email, unchecking the box was not taken into account. bzr revid: tde@openerp.com-20130524144224-wbi1o27regxed7mn --- addons/mail/static/src/js/mail.js | 4 ++-- addons/mail/static/src/xml/mail.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index f3e762d1f31..1e58dc47e22 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -850,9 +850,9 @@ openerp.mail = function (session) { on_checked_recipient: function (event) { var $input = $(event.target); - var email = $input.attr("data"); + var full_name = $input.attr("data"); _.each(this.recipients, function (recipient) { - if (recipient.email_address == email) { + if (recipient.full_name == full_name) { recipient.checked = $input.is(":checked"); } }); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index ab82d650f30..f5004941a8d 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -143,7 +143,7 @@