From 0a71d06be3909cfde8e3bd41752af2ba84dae023 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 12 Mar 2014 14:22:13 +0100 Subject: [PATCH 01/16] [IMP] work in progress on stats buttons. The goal is to allow buttons with dynamic/statistical informations in form views (addon web) bzr revid: ged@openerp.com-20140312132213-hclaw6jc87u220zq --- addons/web/static/src/css/base.css | 17 ++++++++++++ addons/web/static/src/css/base.sass | 14 ++++++++++ addons/web/static/src/js/view_form.js | 37 +++++++++++++++++++++++++-- addons/web/static/src/xml/base.xml | 10 ++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index e43a2fb654e..263a867390e 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -462,6 +462,23 @@ .openerp .oe_button_box button { margin: 4px; } +.openerp .oe_button_box .oe_stat_button { + font-weight: normal; + display: inline-table; + width: 48% !important; + height: 45px; + margin: 1px; +} +.openerp .oe_button_box .oe_stat_button > div { + display: table-cell; + vertical-align: middle; + padding: 0; +} +.openerp .oe_button_box .oe_stat_button .stat_button_icon { + color: #7c7bad; + font-size: 24px; + padding: 4px; +} .openerp .oe_avatar > img { max-height: 90px; max-width: 90px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index b19db9e4ebd..2d5ae82135e 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -433,6 +433,20 @@ $sheet-padding: 16px text-align: right button margin: 4px + .oe_stat_button + font-weight: normal + display: inline-table + width: 48% !important + height: 45px + margin: 1px + > div + display: table-cell + vertical-align: middle + padding: 0 + .stat_button_icon + color: #7C7BAD + font-size: 24px + padding: 4px .oe_avatar > img max-height: 90px diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f1fc377fa94..a8973d760fa 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1218,6 +1218,9 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt $('button', doc).each(function() { $(this).attr('data-button-type', $(this).attr('type')).attr('type', 'button'); }); + $('statbutton', doc).each(function() { + $(this).attr('data-button-type', $(this).attr('type')).attr('type', 'button'); + }); // IE's html parser is also a css parser. How convenient... $('board', doc).each(function() { $(this).attr('layout', $(this).attr('style')); @@ -1277,6 +1280,9 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt var defs = []; _.each(this.to_replace, function(el) { defs.push(el[0].replace(el[1])); + if (el[1].children().length) { + el[0].$el.append(el[1].children()); + } }); this.to_replace = []; return $.when.apply($, defs); @@ -1304,7 +1310,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt var tagname = $tag[0].nodeName.toLowerCase(); if (this.tags_registry.contains(tagname)) { this.tags_to_init.push($tag); - return $tag; + return (tagname === 'statbutton') ? this.process_statbutton($tag) : $tag; } var fn = self['process_' + tagname]; if (fn) { @@ -1321,6 +1327,17 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt return $tag; } }, + process_statbutton: function ($button) { + var self = this; + console.log('yenrst'); + if ($button.children().length) { + $button.children().each(function() { + self.process($(this)); + }); + } + return $button; + }, + process_widget: function($widget) { this.widgets_to_init.push($widget); return $widget; @@ -1976,7 +1993,6 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ var self = this; var context = this.build_context(); - return this.view.do_execute_action( _.extend({}, this.node.attrs, {context: context}), this.view.dataset, this.view.datarecord.id, function () { @@ -1990,6 +2006,22 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ } }); +instance.web.form.StatButton = instance.web.form.WidgetButton.extend({ + template: 'StatButton', + + init: function(field_manager, node) { + var icon = node.attrs.icon; + this._super(field_manager, node); + + // debugger; + if (icon) { + this.icon = ""; + } + + }, + +}); + /** * Interface to be implemented by fields. * @@ -5899,6 +5931,7 @@ instance.web.form.widgets = new instance.web.Registry({ */ instance.web.form.tags = new instance.web.Registry({ 'button' : 'instance.web.form.WidgetButton', + 'statbutton' : 'instance.web.form.StatButton', }); instance.web.form.custom_widgets = new instance.web.Registry({ diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 80b82c1f40b..fa96fe1ac8a 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1360,6 +1360,16 @@ + + +
From ee478106748e52b314ac80a69d34a9b50cc29e4f Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 12 Mar 2014 14:45:38 +0100 Subject: [PATCH 02/16] [IMP] css tweaks to stat buttons bzr revid: ged@openerp.com-20140312134538-7b3o22lakb8qk45a --- addons/web/static/src/css/base.css | 3 ++- addons/web/static/src/css/base.sass | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 263a867390e..524bd79cc52 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -467,7 +467,8 @@ display: inline-table; width: 48% !important; height: 45px; - margin: 1px; + margin: 0px; + color: #666666; } .openerp .oe_button_box .oe_stat_button > div { display: table-cell; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 2d5ae82135e..f81232b7ee8 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -438,7 +438,8 @@ $sheet-padding: 16px display: inline-table width: 48% !important height: 45px - margin: 1px + margin: 0px + color: #666 > div display: table-cell vertical-align: middle From d2637811dec84306ab80cc49f40a8b823d7984a6 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 13 Mar 2014 13:48:43 +0100 Subject: [PATCH 03/16] [IMP] adds PercentPie and X2Many widgets to formview. PercentPie takes a field 'float' and displays a read-only pie chart to visualize the corresponding percent. X2Many takes a 1tomany or a manytomany field and display a read only string '
- - - - + + + + + + @@ -1945,7 +1947,7 @@ - +
From af61fd53bc86583aca872d4d884e976fed885d30 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Fri, 14 Mar 2014 15:21:55 +0100 Subject: [PATCH 07/16] [IMP] removes the tooltip when mouse hovers over a 'percentpie' widget (addon web) bzr revid: ged@openerp.com-20140314142155-u8suij5tikxwd0zi --- addons/web/static/src/js/view_form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index dcb15d3d16d..c4bddd90f34 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2837,6 +2837,7 @@ instance.web.form.FieldPercentPie = instance.web.form.AbstractField.extend({ .donut(true) .showLegend(false) .showLabels(false) + .tooltips(false) .color(['#7C7BAD','#DDD']) .donutRatio(0.62); From e8198d74b68c3f1fba677b596a2eedf60af8ad83 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Mon, 17 Mar 2014 16:27:10 +0100 Subject: [PATCH 08/16] [IMP] various tweaks to stat_button, to fix issues mentioned in code review. This is mostly cosmetic cleanups, only notable change is that stat_button is now a proper html button instead of a label (addon web) bzr revid: ged@openerp.com-20140317152710-c33q8kua33o001la --- addons/web/static/src/css/base.css | 9 +++++--- addons/web/static/src/css/base.sass | 10 +++++---- addons/web/static/src/js/view_form.js | 16 ++++++-------- addons/web/static/src/xml/base.xml | 31 +++++++++------------------ 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 0b432d0c145..1d843e7e250 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -460,6 +460,9 @@ width: 400px; text-align: left; } +.openerp .oe_button_box .oe_stat_button:hover { + background: #dddddd; +} .openerp .oe_button_box .oe_stat_button { font-weight: normal; display: inline-table; @@ -467,7 +470,8 @@ height: 45px; margin: 0px -1px -1px 0px; color: #666666; - border-color: #dddddd; + border: 1px solid #666666; + background: white; } .openerp .oe_button_box .oe_stat_button > div { display: table-cell; @@ -478,9 +482,8 @@ .openerp .oe_button_box .oe_stat_button .stat_button_icon { color: #7c7bad; font-size: 24px; - padding: 0px; + padding: 0px 3px; text-align: center; - width: 40px; } .openerp .oe_button_box .oe_stat_button svg { width: 38px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 336f583e019..cca0deb4a1f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -432,6 +432,8 @@ $sheet-padding: 16px .oe_button_box width: 400px text-align: left + .oe_stat_button:hover + background: #ddd .oe_stat_button font-weight: normal display: inline-table @@ -439,18 +441,18 @@ $sheet-padding: 16px height: 45px margin: 0px -1px -1px 0px color: #666 - border-color: #ddd + border: 1px solid #666 + background: white > div display: table-cell vertical-align: middle text-align: left - padding: 0 + padding: 0 .stat_button_icon color: #7C7BAD font-size: 24px - padding: 0px + padding: 0px 3px text-align: center - width: 40px svg width: 38px height: 38px diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index c4bddd90f34..969e0150737 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1916,8 +1916,8 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ template: 'WidgetButton', init: function(field_manager, node) { node.attrs.type = node.attrs['data-button-type']; - this.is_stat_button = node.attrs.class ? _.include(node.attrs.class.split(' '), 'oe_stat_button') : false; - this.icon = ""; + this.is_stat_button = /\boe_stat_button\b/.test(node.attrs['class']); + this.icon = node.attrs.icon && ""; this._super(field_manager, node); this.force_disabled = false; this.string = (this.node.attrs.string || '').replace(/_/g, ''); @@ -2845,16 +2845,12 @@ instance.web.form.FieldPercentPie = instance.web.form.AbstractField.extend({ .datum([{'x': 'value', 'y': value}, {'x': 'complement', 'y': 100 - value}]) .transition() .call(chart) - .attr('width', size) - .attr('height',size); + .attr({width:size, height:size}); d3.select(svg) .append("text") - .attr("x", size/2) - .attr("y", size/2 + 3) - .style("font-size", "10px") - .style("font-weight", "bold") - .attr("text-anchor", "middle") + .attr({x: size/2, y: size/2 + 3, 'text-anchor': 'middle'}) + .style({"font-size": "10px", "font-weight": "bold"}) .text(formatted_value); return chart; @@ -5923,7 +5919,7 @@ instance.web.form.StatInfo = instance.web.form.AbstractField.extend({ }, render_value: function() { var text = _.str.sprintf("%d %s", this.get("value") || 0, this.string); - this.$().html(QWeb.render("StatInfo", {text: text})); + this.$el.html(QWeb.render("StatInfo", {text: text})); }, }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index b24bd8642cc..cc56dc2de13 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1189,7 +1189,7 @@
- + @@ -1356,26 +1356,15 @@
- - - - - - + From 373cb908caf5792367e49050e3d4ae086a097d0c Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Tue, 18 Mar 2014 09:55:25 +0100 Subject: [PATCH 09/16] [FIX] correctly handle the case where a 'stat button' has a string attribute (it needs to be displayed in a div instead of a span) (addon web) bzr revid: ged@openerp.com-20140318085525-vllzeycht9841g41 --- addons/web/static/src/xml/base.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index cc56dc2de13..508c507d935 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1362,11 +1362,11 @@ t-att-autofocus="widget.node.attrs.autofocus" t-att-accesskey="widget.node.attrs.accesskey"> -
- +
+ +
-
- +
From f4cfed3f0e89f8841b16ad578dd2c360f01d18ec Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 19 Mar 2014 09:57:18 +0100 Subject: [PATCH 10/16] [IMP] improves the look of the stat buttons in form view: the statinfo widget displays the information on two lines, the padding/margin/width have been adjusted. (addon web) bzr revid: ged@openerp.com-20140319085718-9v1l3pb43ee6qws6 --- addons/web/static/src/css/base.css | 14 +++++++++++--- addons/web/static/src/css/base.sass | 13 ++++++++++--- addons/web/static/src/js/view_form.js | 9 ++++++--- addons/web/static/src/xml/base.xml | 5 ++--- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 1d843e7e250..53043f2f4c5 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -461,16 +461,22 @@ text-align: left; } .openerp .oe_button_box .oe_stat_button:hover { - background: #dddddd; + background: #7c7bad; + color: white; +} +.openerp .oe_button_box .oe_stat_button:hover .fa { + color: white; } .openerp .oe_button_box .oe_stat_button { font-weight: normal; display: inline-table; width: 33% !important; - height: 45px; + height: 42px; margin: 0px -1px -1px 0px; + padding: 0; color: #666666; - border: 1px solid #666666; + border: 1px solid #dddddd; + border-radius: 0; background: white; } .openerp .oe_button_box .oe_stat_button > div { @@ -478,11 +484,13 @@ vertical-align: middle; text-align: left; padding: 0; + line-height: 120%; } .openerp .oe_button_box .oe_stat_button .stat_button_icon { color: #7c7bad; font-size: 24px; padding: 0px 3px; + width: 37px; text-align: center; } .openerp .oe_button_box .oe_stat_button svg { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index cca0deb4a1f..466f60fa861 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -433,25 +433,32 @@ $sheet-padding: 16px width: 400px text-align: left .oe_stat_button:hover - background: #ddd + background: #7c7bad + color: white + .fa + color: white .oe_stat_button font-weight: normal display: inline-table width: 33% !important - height: 45px + height: 42px margin: 0px -1px -1px 0px + padding: 0 color: #666 - border: 1px solid #666 + border: 1px solid #dddddd + border-radius: 0 background: white > div display: table-cell vertical-align: middle text-align: left padding: 0 + line-height: 120% .stat_button_icon color: #7C7BAD font-size: 24px padding: 0px 3px + width: 37px text-align: center svg width: 38px diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 969e0150737..5840d718bf8 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1917,7 +1917,7 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ init: function(field_manager, node) { node.attrs.type = node.attrs['data-button-type']; this.is_stat_button = /\boe_stat_button\b/.test(node.attrs['class']); - this.icon = node.attrs.icon && ""; + this.icon = node.attrs.icon && ""; this._super(field_manager, node); this.force_disabled = false; this.string = (this.node.attrs.string || '').replace(/_/g, ''); @@ -5918,8 +5918,11 @@ instance.web.form.StatInfo = instance.web.form.AbstractField.extend({ this.set("value", 0); }, render_value: function() { - var text = _.str.sprintf("%d %s", this.get("value") || 0, this.string); - this.$el.html(QWeb.render("StatInfo", {text: text})); + var options = { + value: this.get("value") || 0, + text: this.string, + }; + this.$el.html(QWeb.render("StatInfo", options)); }, }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 508c507d935..e35d0c977b3 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1362,7 +1362,7 @@ t-att-autofocus="widget.node.attrs.autofocus" t-att-accesskey="widget.node.attrs.accesskey"> -
+
@@ -1937,6 +1937,5 @@
-
-
+
From 3a0fb1803547c081e90b44bbe4b8e78a32aa3d23 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 20 Mar 2014 09:21:29 +0100 Subject: [PATCH 11/16] [IMP] removes the shadow in stat buttons, to give them the 'flat' look (addon web) bzr revid: ged@openerp.com-20140320082129-o9jrdb962uuso4kb --- addons/web/static/src/css/base.css | 3 ++- addons/web/static/src/css/base.sass | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 0bf5a2d437e..66bfaca7c6e 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "utf-8"; +@charset "UTF-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -477,6 +477,7 @@ color: #666666; border: 1px solid #dddddd; border-radius: 0; + box-shadow: none; background: white; } .openerp .oe_button_box .oe_stat_button > div { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e6749747021..7110349557a 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -447,6 +447,7 @@ $sheet-padding: 16px color: #666 border: 1px solid #dddddd border-radius: 0 + box-shadow: none background: white > div display: table-cell From 2695cacea45051600682f22a02f812c5b77827df Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 1 Apr 2014 14:36:57 +0200 Subject: [PATCH 12/16] [FIX] account_analytic_analysis, analytic, hr_timesheet: do not override existing data of analytic account on template on_change bzr revid: dle@openerp.com-20140401123657-ozh4ycx36jojpg51 --- .../account_analytic_analysis.py | 51 +++++++++++-------- .../account_analytic_analysis_view.xml | 3 ++ addons/analytic/analytic.py | 5 +- addons/analytic/analytic_view.xml | 2 +- .../analytic_contract_hr_expense.py | 4 +- addons/hr_timesheet/hr_timesheet.py | 4 +- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index ec5e2c56e6c..99890a5f239 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -543,33 +543,40 @@ class account_analytic_account(osv.osv): 'nodestroy': True, } - def on_change_template(self, cr, uid, ids, template_id, context=None): + def on_change_template(self, cr, uid, ids, template_id, date_start=False, fix_price_invoices=False, invoice_on_timesheets=False, recurring_invoices=False, context=None): if not template_id: return {} obj_analytic_line = self.pool.get('account.analytic.invoice.line') - res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context) + res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) template = self.browse(cr, uid, template_id, context=context) - invoice_line_ids = [] - for x in template.recurring_invoice_line_ids: - invoice_line_ids.append((0, 0, { - 'product_id': x.product_id.id, - 'uom_id': x.uom_id.id, - 'name': x.name, - 'quantity': x.quantity, - 'price_unit': x.price_unit, - 'analytic_account_id': x.analytic_account_id and x.analytic_account_id.id or False, - })) - res['value']['fix_price_invoices'] = template.fix_price_invoices - res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets - res['value']['hours_qtt_est'] = template.hours_qtt_est - res['value']['amount_max'] = template.amount_max - res['value']['to_invoice'] = template.to_invoice.id - res['value']['pricelist_id'] = template.pricelist_id.id - res['value']['recurring_invoices'] = template.recurring_invoices - res['value']['recurring_interval'] = template.recurring_interval - res['value']['recurring_rule_type'] = template.recurring_rule_type - res['value']['recurring_invoice_line_ids'] = invoice_line_ids + + if not fix_price_invoices: + res['value']['fix_price_invoices'] = template.fix_price_invoices + res['value']['amount_max'] = template.amount_max + if not invoice_on_timesheets: + res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets + res['value']['hours_qtt_est'] = template.hours_qtt_est + + if template.to_invoice.id: + res['value']['to_invoice'] = template.to_invoice.id + if template.pricelist_id.id: + res['value']['pricelist_id'] = template.pricelist_id.id + if not recurring_invoices: + invoice_line_ids = [] + for x in template.recurring_invoice_line_ids: + invoice_line_ids.append((0, 0, { + 'product_id': x.product_id.id, + 'uom_id': x.uom_id.id, + 'name': x.name, + 'quantity': x.quantity, + 'price_unit': x.price_unit, + 'analytic_account_id': x.analytic_account_id and x.analytic_account_id.id or False, + })) + res['value']['recurring_invoices'] = template.recurring_invoices + res['value']['recurring_interval'] = template.recurring_interval + res['value']['recurring_rule_type'] = template.recurring_rule_type + res['value']['recurring_invoice_line_ids'] = invoice_line_ids return res def onchange_recurring_invoices(self, cr, uid, ids, recurring_invoices, date_start=False, context=None): diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index f5b89db7089..d99be3db355 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -38,6 +38,9 @@ {'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]} + + on_change_template(template_id, date_start, fix_price_invoices, invoice_on_timesheets, recurring_invoices) + diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 894a2a2d6c5..c1ea1f655d2 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -203,7 +203,7 @@ class account_analytic_account(osv.osv): }, string='Currency', type='many2one', relation='res.currency'), } - def on_change_template(self, cr, uid, ids, template_id, context=None): + def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): if not template_id: return {} res = {'value':{}} @@ -213,7 +213,8 @@ class account_analytic_account(osv.osv): to_dt = datetime.strptime(template.date, tools.DEFAULT_SERVER_DATE_FORMAT) timedelta = to_dt - from_dt res['value']['date'] = datetime.strftime(datetime.now() + timedelta, tools.DEFAULT_SERVER_DATE_FORMAT) - res['value']['date_start'] = fields.date.today() + if not date_start: + res['value']['date_start'] = fields.date.today() res['value']['quantity_max'] = template.quantity_max res['value']['parent_id'] = template.parent_id and template.parent_id.id or False res['value']['description'] = template.description diff --git a/addons/analytic/analytic_view.xml b/addons/analytic/analytic_view.xml index 9a99552be13..5e65874a1d9 100644 --- a/addons/analytic/analytic_view.xml +++ b/addons/analytic/analytic_view.xml @@ -27,7 +27,7 @@ - + diff --git a/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py b/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py index a1bf43714ce..3682755b9c4 100644 --- a/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py +++ b/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py @@ -115,8 +115,8 @@ class account_analytic_account(osv.osv): digits_compute=dp.get_precision('Account')), } - def on_change_template(self, cr, uid, id, template_id, context=None): - res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, context=context) + def on_change_template(self, cr, uid, id, template_id, date_start=False, context=None): + res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, date_start=date_start, context=context) if template_id and 'value' in res: template = self.browse(cr, uid, template_id, context=context) res['value']['charge_expenses'] = template.charge_expenses diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 5baf8ec262b..7aa7cbaba08 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -207,8 +207,8 @@ class account_analytic_account(osv.osv): 'use_timesheets': fields.boolean('Timesheets', help="Check this field if this project manages timesheets"), } - def on_change_template(self, cr, uid, ids, template_id, context=None): - res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context) + def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): + res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) if template_id and 'value' in res: template = self.browse(cr, uid, template_id, context=context) res['value']['use_timesheets'] = template.use_timesheets From 07ae370d90043806724d2ce4139c8f1ccdb5ab2d Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 1 Apr 2014 16:42:05 +0200 Subject: [PATCH 13/16] [FIX] project, project_issue: overwritten method on_change template, wrong signature, following commit 9277 revid:dle@openerp.com-20140401123657-ozh4ycx36jojpg51 bzr revid: dle@openerp.com-20140401144205-cmm5vfzlpsro0f7j --- addons/project/project.py | 4 ++-- addons/project_issue/project_issue.py | 4 ++-- addons/project_long_term/project_long_term.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index f6bd55c2fb6..96b1c84b94c 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1202,8 +1202,8 @@ class account_analytic_account(osv.osv): 'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'), } - def on_change_template(self, cr, uid, ids, template_id, context=None): - res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context) + def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): + res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) if template_id and 'value' in res: template = self.browse(cr, uid, template_id, context=context) res['value']['use_tasks'] = template.use_tasks diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 6f072f5abd1..84abc33a7e6 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -530,8 +530,8 @@ class account_analytic_account(osv.Model): 'use_issues': fields.boolean('Issues', help="Check this field if this project manages issues"), } - def on_change_template(self, cr, uid, ids, template_id, context=None): - res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context) + def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): + res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) if template_id and 'value' in res: template = self.browse(cr, uid, template_id, context=context) res['value']['use_issues'] = template.use_issues diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index a950907fb69..29e94591094 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -273,8 +273,8 @@ class account_analytic_account(osv.osv): 'use_phases': fields.boolean('Phases', help="Check this field if you plan to use phase-based scheduling"), } - def on_change_template(self, cr, uid, ids, template_id, context=None): - res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context) + def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): + res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) if template_id and 'value' in res: template = self.browse(cr, uid, template_id, context=context) res['value']['use_phases'] = template.use_phases From 0b539587b89c9e67bcec51a1ab8683afd75f7ba2 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 1 Apr 2014 18:43:22 +0200 Subject: [PATCH 14/16] [IMP] kanban view for ir.attachments bzr revid: fp@tinyerp.com-20140401164322-fq3r0pt6idkoobxx --- addons/document/__openerp__.py | 2 +- addons/document/document_view.xml | 2 +- addons/mail/mail_message_view.xml | 30 ++++++++++++++++++++++++++++- addons/mail/static/src/css/mail.css | 18 ++++++++--------- addons/project/project.py | 2 +- 5 files changed, 41 insertions(+), 13 deletions(-) diff --git a/addons/document/__openerp__.py b/addons/document/__openerp__.py index 501e5566e60..5cc674fcf45 100644 --- a/addons/document/__openerp__.py +++ b/addons/document/__openerp__.py @@ -37,7 +37,7 @@ This is a complete document management system. """, 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', - 'depends': ['knowledge'], + 'depends': ['knowledge', 'mail'], 'data': [ 'security/document_security.xml', 'document_view.xml', diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml index c0edf0dc9b8..b735d2ce4a4 100644 --- a/addons/document/document_view.xml +++ b/addons/document/document_view.xml @@ -235,7 +235,6 @@ - @@ -244,6 +243,7 @@ ir.actions.act_window ir.attachment form + kanban,form

Click to create a new document. diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index e2d1deb028b..2ed5f338825 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -89,5 +89,33 @@ + + ir.attachment kanban + ir.attachment + + + + + + + +

+
+ +
bb
+
+
+ +
aa
+
+
+ + + +
+ + + + - \ No newline at end of file + diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 614077b65a2..5a51bce04d9 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -318,7 +318,7 @@ .openerp .oe_mail .oe_msg_composer .oe_recipients input{ vertical-align: middle; } -.openerp .oe_mail .oe_attachment{ +.oe_attachment{ display: inline-block; width: 100px; margin: 4px 2px; @@ -328,7 +328,7 @@ text-align: center; vertical-align: top; } -.openerp .oe_mail .oe_attachment .oe_name{ +.oe_attachment .oe_name{ display: inline-block; max-width: 100%; padding: 1px 3px; @@ -341,10 +341,10 @@ border-radius: 3px; } -.openerp .oe_mail .oe_attachment.oe_preview{ +.oe_attachment.oe_preview{ background: url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAJ0lEQVQYV2MsLS39z4AGLCws0IUYGIeCwrVr12J45sSJE5ieGQIKAbuZKf/EMCs7AAAAAElFTkSuQmCC ); } -.openerp .oe_mail .oe_attachment .oe_progress_bar{ +.oe_attachment .oe_progress_bar{ display: none; position: absolute; top: 18px; @@ -364,7 +364,7 @@ -o-animation: oe_mail_attach_loading_anim 0.75s infinite linear; animation: oe_mail_attach_loading_anim 0.75s infinite linear; } -.openerp .oe_mail .oe_attachment.oe_uploading .oe_progress_bar{ +.oe_attachment.oe_uploading .oe_progress_bar{ display: block; } @-webkit-keyframes oe_mail_attach_loading_anim{ @@ -387,7 +387,7 @@ 50% { background: #009123 } 100% { background: #4BBD00 } } -.openerp .oe_mail .oe_attachment.oe_preview .oe_name{ +.oe_attachment.oe_preview .oe_name{ position: absolute; bottom: 0px; margin: 3px; @@ -405,14 +405,14 @@ -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } -.openerp .oe_mail .oe_attachment.oe_preview:hover .oe_name{ +.oe_attachment.oe_preview:hover .oe_name{ opacity: 1; -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } -.openerp .oe_mail .oe_attachment img{ +.oe_attachment img{ position: absolute; width: 48px; height: 48px; @@ -420,7 +420,7 @@ left: 50%; margin-left: -24px; } -.openerp .oe_mail .oe_attachment.oe_preview img{ +.oe_attachment.oe_preview img{ display: block; position: relative; margin:0px; diff --git a/addons/project/project.py b/addons/project/project.py index 96b1c84b94c..9dcf069a856 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -223,7 +223,7 @@ class project(osv.osv): 'res_model': 'ir.attachment', 'type': 'ir.actions.act_window', 'view_id': False, - 'view_mode': 'tree,form', + 'view_mode': 'kanban,form', 'view_type': 'form', 'limit': 80, 'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id) From 6a9379429cea71120c9422596c5dfa0a794e2acb Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 1 Apr 2014 18:47:00 +0200 Subject: [PATCH 15/16] [IMP] kanban of documents for recruitement attachments bzr revid: fp@tinyerp.com-20140401164700-xj1d5hn9zv8morfu --- addons/mail/mail_message_view.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index 2ed5f338825..1c4a7f55c10 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -114,6 +114,9 @@
+ + kanban,form + From 4afeee59d10485b84740faf4182678a733f24b03 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 2 Apr 2014 10:37:17 +0200 Subject: [PATCH 16/16] [FIX] fixes an alignment issue in the template definitions (addon web) bzr revid: ged@openerp.com-20140402083717-y3p22u2e47d60bbt --- addons/web/static/src/xml/base.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 1a5721d28f8..23cad2098dc 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1373,7 +1373,8 @@
- + +