From 76d2e870d6651810914779a486fc851393703d97 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 2 Oct 2013 11:37:30 +0200 Subject: [PATCH 01/10] [FIX] web_kanban: correct css for empty kanban bzr revid: chs@openerp.com-20131002093730-ucn089plydhsl71k --- addons/web_kanban/static/src/css/kanban.css | 4 ---- addons/web_kanban/static/src/css/kanban.sass | 3 --- 2 files changed, 7 deletions(-) diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 6f5bf241e17..731fab430b9 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -5,7 +5,6 @@ } .openerp .oe_kanban_view .oe_view_nocontent { position: relative; - z-index: 1; max-width: none; height: 100%; } @@ -91,9 +90,6 @@ .openerp .oe_kanban_view .oe_kanban_groups { height: inherit; } -.openerp .oe_kanban_view.oe_kanban_ungrouped .oe_kanban_groups { - width: 100%; -} .openerp .oe_kanban_view.oe_kanban_grouped_by_m2o .oe_kanban_group_title { cursor: move; } diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index de06990ebb7..dfca3b09d50 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -53,7 +53,6 @@ height: inherit .oe_view_nocontent position: relative - z-index: 1 max-width: none height: 100% .oe_view_nocontent_content @@ -118,8 +117,6 @@ // KanbanGroups {{{ .oe_kanban_groups height: inherit - &.oe_kanban_ungrouped .oe_kanban_groups - width: 100% &.oe_kanban_grouped_by_m2o .oe_kanban_group_title cursor: move .oe_kanban_header From 58281701e99a03b671f60f614a6f1ce0a8f5def7 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 2 Oct 2013 11:46:34 +0200 Subject: [PATCH 02/10] [FIX] web: remove firefox css fix for view switch icons bzr revid: chs@openerp.com-20131002094634-9g7b20vs7n5yw4kh --- addons/web/static/src/css/base.css | 3 --- addons/web/static/src/css/base.sass | 2 -- 2 files changed, 5 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 97bbb2b207c..fe14cc28a62 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3211,9 +3211,6 @@ } @-moz-document url-prefix() { - .openerp .oe_view_manager .oe_view_manager_switch li { - line-height: 21px; - } .openerp .oe_searchview .oe_searchview_search { top: -1px; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e41a182407d..5571b5696fc 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2532,8 +2532,6 @@ $sheet-padding: 16px // }}} @-moz-document url-prefix() .openerp - .oe_view_manager .oe_view_manager_switch li - line-height: 21px .oe_searchview .oe_searchview_search top: -1px .oe_form_field_many2one .oe_m2o_cm_button From f2e1240522bd7eb5fbd8bf32d3865dd35ddc3644 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 2 Oct 2013 14:07:33 +0200 Subject: [PATCH 03/10] [FIX] mail: correct button on "Suggested Groups" bzr revid: chs@openerp.com-20131002120733-6hsz0ugl3ir2gwfp --- addons/mail/static/src/js/suggestions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js index 4d0fcec32bf..47a5bcf625c 100644 --- a/addons/mail/static/src/js/suggestions.js +++ b/addons/mail/static/src/js/suggestions.js @@ -48,7 +48,8 @@ openerp.mail.suggestions = function(session, mail) { join_group: function (event) { var self = this; - return this.mail_group.call('message_subscribe_users', [[$(event.currentTarget).attr('id')],[this.session.uid]]).then(function(res) { + var group_id = parseInt($(event.currentTarget).attr('id'), 10); + return this.mail_group.call('message_subscribe_users', [[group_id], [this.session.uid]]).then(function(res) { self.fetch_suggested_groups(); }); }, From fc13b6e3722e13d3457b4b41b7fbb825e3423b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 09:58:36 +0200 Subject: [PATCH 04/10] [IMP] web_kanban_sparkline: always begin y range at 0 instead of minimum value bzr revid: tde@openerp.com-20131003075836-qffb91gxe8uk4k0n --- addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js index de21cbba945..5335599478f 100644 --- a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js +++ b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js @@ -20,6 +20,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten barWidth: 4, barSpacing: 1, barColor: '#96d854', + chartRangeMin: 0, tooltipFormat: '{{offset:offset}} {{value}}', tooltipValueLookups: { 'offset': tooltips From f72927123e4fb68fe3bb00c48ddddc1cf058ad7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 10:27:36 +0200 Subject: [PATCH 05/10] [FIX] crm, sale_crm, mass_mailin: fixed computation for sparkline widgets. Added an end date in the read_group domain. Indeed having results outside the date range made the result computation crash because of list limits. There is now a begin and end date for groupby domain. bzr revid: tde@openerp.com-20131003082736-tw50xk2vmhpjh1e5 --- addons/crm/crm.py | 15 +++++++++------ addons/mass_mailing/mass_mailing.py | 11 +++++++---- addons/sale_crm/sale_crm.py | 8 +++++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 932fa998d0a..dc7ebf3ca95 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -19,6 +19,7 @@ # ############################################################################## +import calendar from datetime import date, datetime from dateutil import relativedelta @@ -117,9 +118,9 @@ class crm_case_section(osv.osv): """ month_begin = date.today().replace(day=1) section_result = [{ - 'value': 0, - 'tooltip': (month_begin + relativedelta.relativedelta(months=-i)).strftime('%B'), - } for i in range(self._period_number - 1, -1, -1)] + 'value': 0, + 'tooltip': (month_begin + relativedelta.relativedelta(months=-i)).strftime('%B'), + } for i in range(self._period_number - 1, -1, -1)] group_obj = obj.read_group(cr, uid, domain, read_fields, groupby_field, context=context) for group in group_obj: group_begin_date = datetime.strptime(group['__domain'][0][2], tools.DEFAULT_SERVER_DATE_FORMAT) @@ -135,12 +136,14 @@ class crm_case_section(osv.osv): obj = self.pool.get('crm.lead') res = dict.fromkeys(ids, False) month_begin = date.today().replace(day=1) - groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + date_begin = month_begin - relativedelta.relativedelta(months=self._period_number - 1) + date_end = month_begin.replace(day=calendar.monthrange(month_begin.year, month_begin.month)[1]) + date_domain = [('create_date', '>=', date_begin.strftime(tools.DEFAULT_SERVER_DATE_FORMAT)), ('create_date', '<=', date_end.strftime(tools.DEFAULT_SERVER_DATE_FORMAT))] for id in ids: res[id] = dict() - lead_domain = [('type', '=', 'lead'), ('section_id', '=', id), ('create_date', '>=', groupby_begin)] + lead_domain = date_domain + [('type', '=', 'lead'), ('section_id', '=', id)] res[id]['monthly_open_leads'] = self.__get_bar_values(cr, uid, obj, lead_domain, ['create_date'], 'create_date_count', 'create_date', context=context) - opp_domain = [('type', '=', 'opportunity'), ('section_id', '=', id), ('create_date', '>=', groupby_begin)] + opp_domain = date_domain + [('type', '=', 'opportunity'), ('section_id', '=', id)] res[id]['monthly_planned_revenue'] = self.__get_bar_values(cr, uid, obj, opp_domain, ['planned_revenue', 'create_date'], 'planned_revenue', 'create_date', context=context) return res diff --git a/addons/mass_mailing/mass_mailing.py b/addons/mass_mailing/mass_mailing.py index 49ee106bc69..4f59994d4a6 100644 --- a/addons/mass_mailing/mass_mailing.py +++ b/addons/mass_mailing/mass_mailing.py @@ -194,10 +194,13 @@ class MassMailing(osv.Model): } for id in ids: res[id] = {} - date_begin = self.browse(cr, uid, id, context=context).date - domain = [('mass_mailing_id', '=', id), ('opened', '>=', date_begin)] + date_begin = datetime.strptime(self.browse(cr, uid, id, context=context).date, tools.DEFAULT_SERVER_DATETIME_FORMAT) + date_end = date_begin + relativedelta.relativedelta(days=self._period_number - 1) + date_begin_str = date_begin.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT) + date_end_str = date_end.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT) + domain = [('mass_mailing_id', '=', id), ('opened', '>=', date_begin_str), ('opened', '<=', date_end_str)] res[id]['opened_monthly'] = self.__get_bar_values(cr, uid, id, obj, domain, ['opened'], 'opened_count', 'opened', context=context) - domain = [('mass_mailing_id', '=', id), ('replied', '>=', date_begin)] + domain = [('mass_mailing_id', '=', id), ('replied', '>=', date_begin_str), ('replied', '<=', date_end_str)] res[id]['replied_monthly'] = self.__get_bar_values(cr, uid, id, obj, domain, ['replied'], 'replied_count', 'replied', context=context) return res @@ -274,7 +277,7 @@ class MassMailing(osv.Model): } _defaults = { - 'date': fields.datetime.now(), + 'date': fields.datetime.now, } diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index d6413c994e7..47caad79c26 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -19,6 +19,7 @@ # ############################################################################## +import calendar from datetime import date from dateutil import relativedelta @@ -48,12 +49,13 @@ class crm_case_section(osv.osv): obj = self.pool.get('sale.order') res = dict.fromkeys(ids, False) month_begin = date.today().replace(day=1) - groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + date_begin = month_begin - relativedelta.relativedelta(months=self._period_number - 1).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + date_end = month_begin.replace(day=calendar.monthrange(month_begin.year, month_begin.month)[1]).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) for id in ids: res[id] = dict() - created_domain = [('section_id', '=', id), ('state', 'in', ['draft', 'sent']), ('date_order', '>=', groupby_begin)] + created_domain = [('section_id', '=', id), ('state', 'in', ['draft', 'sent']), ('date_order', '>=', date_begin), ('date_order', '<=', date_end)] res[id]['monthly_quoted'] = self.__get_bar_values(cr, uid, obj, created_domain, ['amount_total', 'date_order'], 'amount_total', 'date_order', context=context) - validated_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'sent']), ('date_confirm', '>=', groupby_begin)] + validated_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'sent']), ('date_confirm', '>=', date_begin), ('date_order', '<=', date_end)] res[id]['monthly_confirmed'] = self.__get_bar_values(cr, uid, obj, validated_domain, ['amount_total', 'date_confirm'], 'amount_total', 'date_confirm', context=context) return res From 6e6977e0f24fdf273f43b5d8a5a9a6aa4a22c007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 11:00:49 +0200 Subject: [PATCH 06/10] [FIX] web: form_view: FieldStatus widget: fixed hidden states/stages not appearing because behind displayed sheet. bzr revid: tde@openerp.com-20131003090049-88q0o69970eahb2h --- addons/web/static/src/css/base.css | 1 + addons/web/static/src/css/base.sass | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index fe14cc28a62..51c3fd30f3c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2741,6 +2741,7 @@ } .openerp ul.oe_form_status .oe_folded ul, .openerp ul.oe_form_status_clickable .oe_folded ul { position: absolute; + z-index: 1000; border-top: 1px solid #cacaca; float: none; top: 30px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 5571b5696fc..a0231387e7f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2179,6 +2179,7 @@ $sheet-padding: 16px padding-bottom: 8px ul position: absolute + z-index: 1000 border-top: 1px solid #cacaca float: none top: 30px From 187c9454d76ada420eb7ab8e66894732a4192bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 11:56:26 +0200 Subject: [PATCH 07/10] [FIX] sale_crm: fixed previous fix + forgot to complete domain on invoices, added an end date for invoice sparklines bzr revid: tde@openerp.com-20131003095626-dckhvcvi935fdgzf --- addons/sale_crm/sale_crm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index 47caad79c26..e5695daab09 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -49,7 +49,7 @@ class crm_case_section(osv.osv): obj = self.pool.get('sale.order') res = dict.fromkeys(ids, False) month_begin = date.today().replace(day=1) - date_begin = month_begin - relativedelta.relativedelta(months=self._period_number - 1).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + date_begin = (month_begin - relativedelta.relativedelta(months=self._period_number - 1)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) date_end = month_begin.replace(day=calendar.monthrange(month_begin.year, month_begin.month)[1]).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) for id in ids: res[id] = dict() @@ -63,9 +63,10 @@ class crm_case_section(osv.osv): obj = self.pool.get('account.invoice.report') res = dict.fromkeys(ids, False) month_begin = date.today().replace(day=1) - groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + date_begin = (month_begin - relativedelta.relativedelta(months=self._period_number - 1)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + date_end = month_begin.replace(day=calendar.monthrange(month_begin.year, month_begin.month)[1]).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) for id in ids: - created_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'cancel']), ('date', '>=', groupby_begin)] + created_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'cancel']), ('date', '>=', date_begin), ('date', '<=', date_end)] res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['price_total', 'date'], 'price_total', 'date', context=context) return res From ace96e02df9c9593d4479220fe19f0339392266e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 11:57:03 +0200 Subject: [PATCH 08/10] [FIX] sale_crm: fixed kanban view: correct groups on the whole div containing invoice data, not only on the label bzr revid: tde@openerp.com-20131003095703-zoqvii3nzmb2j024 --- addons/sale_crm/sale_crm_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml index a1e201d9b7f..34f32e0b58b 100644 --- a/addons/sale_crm/sale_crm_view.xml +++ b/addons/sale_crm/sale_crm_view.xml @@ -249,8 +249,8 @@ -
- Invoices +
+ Invoices Revenue of sent invoices per month.
Click to see a detailed analysis of invoices. From fed1b1e91c221d751b4f2b259463727f1e5b1dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 15:33:57 +0200 Subject: [PATCH 09/10] [REF] ir_actions in email_template: strange implementation of displaying template values based on copying fields replaced by a standard related fields + using an onchange on the template. bzr revid: tde@openerp.com-20131003133357-hbs35e3h4mleg9v5 --- addons/email_template/ir_actions.py | 54 +++++++++++++---------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/addons/email_template/ir_actions.py b/addons/email_template/ir_actions.py index bd860785da4..64c50651f11 100644 --- a/addons/email_template/ir_actions.py +++ b/addons/email_template/ir_actions.py @@ -33,48 +33,44 @@ class actions_server(osv.Model): return res _columns = { - 'email_from': fields.char('From', - help="Sender address; define the template to see its value. If not set, the default " - "value will be the author's email alias if configured, or email address."), - 'email_to': fields.char('To (Emails)', - help="Comma-separated recipient addresses; define the template to see its value"), - 'partner_to': fields.char('To (Partners)', - help="Comma-separated ids of recipient partners; define the template to see its value"), - 'subject': fields.char('Subject', - help="Email subject; define the template to see its value"), - 'body_html': fields.text('Body', - help="Rich-text/HTML version of the message; define the template to see its value"), - 'template_id': fields.many2one('email.template', 'Email Template', ondelete='set null', - help="Define the email template to use for the email to send.") + 'email_from': fields.related( + 'template_id', 'email_from', type='char', + readonly=True, string='From' + ), + 'email_to': fields.related( + 'template_id', 'email_to', type='char', + readonly=True, string='To (Emails)' + ), + 'partner_to': fields.related( + 'template_id', 'partner_to', type='char', + readonly=True, string='To (Partners)' + ), + 'subject': fields.related( + 'template_id', 'subject', type='char', + readonly=True, string='Subject' + ), + 'body_html': fields.related( + 'template_id', 'body_html', type='text', + readonly=True, string='Body' + ), + 'template_id': fields.many2one( + 'email.template', 'Email Template', ondelete='set null' + ), } def on_change_template_id(self, cr, uid, ids, template_id, context=None): """ Render the raw template in the server action fields. """ + fields = ['subject', 'body_html', 'email_from', 'email_to', 'partner_to'] if template_id: - fields = ['subject', 'body_html', 'email_from', 'email_to', 'partner_to', 'email_cc', 'reply_to', 'attachment_ids'] template_values = self.pool.get('email.template').read(cr, uid, template_id, fields, context) values = dict((field, template_values[field]) for field in fields if template_values.get(field)) if not values.get('email_from'): return {'warning': {'title': 'Incomplete template', 'message': 'Your template should define email_from'}, 'value': values} else: - values = self.default_get(cr, uid, ['subject', 'body_html', 'email_from', 'email_to', 'partner_to'], context=context) + values = dict.fromkeys(fields, False) return {'value': values} - def create(self, cr, uid, values, context=None): - if values.get('template_id'): - fields = ['subject', 'body_html', 'email_from', 'email_to', 'partner_to', 'email_cc', 'reply_to', 'attachment_ids'] - template_values = self.pool.get('email.template').read(cr, uid, values.get('template_id'), fields, context) - values.update(dict((field, template_values[field]) for field in fields if template_values.get(field))) - return super(actions_server, self).create(cr, uid, values, context=context) - - def write(self, cr, uid, ids, values, context=None): - if values.get('template_id'): - fields = ['subject', 'body_html', 'email_from', 'email_to', 'partner_to', 'email_cc', 'reply_to', 'attachment_ids'] - template_values = self.pool.get('email.template').read(cr, uid, values.get('template_id'), fields, context) - values.update(dict((field, template_values[field]) for field in fields if template_values.get(field))) - return super(actions_server, self).write(cr, uid, ids, values, context=context) - def run_action_email(self, cr, uid, action, eval_context=None, context=None): if not action.template_id or not context.get('active_id'): return False From bdd86a831f026c0a99dd5f71e772488f2bea4eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 16:04:58 +0200 Subject: [PATCH 10/10] [IMP] ir_actions in email_template: template_id domain not only on view, directly on field bzr revid: tde@openerp.com-20131003140458-ztnd9taih2rcq8ty --- addons/email_template/ir_actions.py | 3 ++- addons/email_template/ir_actions_view.xml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/email_template/ir_actions.py b/addons/email_template/ir_actions.py index 64c50651f11..ae2395e3b81 100644 --- a/addons/email_template/ir_actions.py +++ b/addons/email_template/ir_actions.py @@ -54,7 +54,8 @@ class actions_server(osv.Model): readonly=True, string='Body' ), 'template_id': fields.many2one( - 'email.template', 'Email Template', ondelete='set null' + 'email.template', 'Email Template', ondelete='set null', + domain="[('model_id', '=', model_id)]", ), } diff --git a/addons/email_template/ir_actions_view.xml b/addons/email_template/ir_actions_view.xml index fae9c364312..8f5875257aa 100644 --- a/addons/email_template/ir_actions_view.xml +++ b/addons/email_template/ir_actions_view.xml @@ -16,7 +16,6 @@

Choose a template to display its values.