From 5f7030fc446c30f7996b32c9ffed006882a31d42 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 22 Aug 2017 14:37:50 +0200 Subject: [PATCH 1/8] [FIX] stock: move name length - Create a stockable product with a long description (> 3000 characters) - Validate the SO An error is raised because the stock move name is too long. The stock move name is taken from the procurement name, which is itself taken from the SO line description. However, the stock move name is an indexed field and therefore its length is limited (to 2712 characters by default). We truncate the move name to 2000 characters. Actually, there is no real point to so many characters, nor its indexing. opw-767040 --- addons/stock/models/procurement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/procurement.py b/addons/stock/models/procurement.py index c1ea59f239a..4d3e78aa75c 100644 --- a/addons/stock/models/procurement.py +++ b/addons/stock/models/procurement.py @@ -151,7 +151,7 @@ class ProcurementOrder(models.Model): qty_done = sum(self.move_ids.filtered(lambda move: move.state == 'done').mapped('product_uom_qty')) qty_left = max(self.product_qty - qty_done, 0) return { - 'name': self.name, + 'name': self.name[:2000], 'company_id': self.rule_id.company_id.id or self.rule_id.location_src_id.company_id.id or self.rule_id.location_id.company_id.id or self.company_id.id, 'product_id': self.product_id.id, 'product_uom': self.product_uom.id, From 388e258ce8c2a4fbd5e2ec5ec746bb91ca48d97f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 21 Dec 2016 16:35:09 +0100 Subject: [PATCH 2/8] [FIX] web: rotate graph label When there are too many labels to display on the x-axis, they overlap and it simply becomes unreadable. By slightly rotating them, this can be avoided in most cases. opw-697625 opw-697626 --- addons/web/static/src/js/views/graph_widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views/graph_widget.js b/addons/web/static/src/js/views/graph_widget.js index db6418fd15a..2aa98965329 100644 --- a/addons/web/static/src/js/views/graph_widget.js +++ b/addons/web/static/src/js/views/graph_widget.js @@ -166,7 +166,7 @@ return Widget.extend({ var chart = nv.models.multiBarChart(); var maxVal = _.max(values, function(v) {return v.y}) chart.options({ - margin: {left: 12 * String(maxVal && maxVal.y || 10000000).length}, + margin: {left: 12 * String(maxVal && maxVal.y || 10000000).length, bottom: 60}, delay: 250, transition: 10, showLegend: _.size(data) <= MAX_LEGEND_LENGTH, @@ -175,7 +175,7 @@ return Widget.extend({ rightAlignYAxis: false, stacked: this.stacked, reduceXTicks: false, - // rotateLabels: 40, + rotateLabels: -20, showControls: (this.groupbys.length > 1) }); chart.yAxis.tickFormat(function(d) { return formats.format_value(d, { type : 'float' });}); From ffd43386393f493cd098339c9cb3f812dea1dd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 23 Aug 2017 10:56:57 +0200 Subject: [PATCH 3/8] [FIX] web_kanban: allow special chaaracters in kanban tooltip --- addons/web_kanban/static/src/js/kanban_column.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban_column.js b/addons/web_kanban/static/src/js/kanban_column.js index f848c266944..b4fa2e8d010 100644 --- a/addons/web_kanban/static/src/js/kanban_column.js +++ b/addons/web_kanban/static/src/js/kanban_column.js @@ -65,9 +65,10 @@ var KanbanColumn = Widget.extend({ }); var self = this; - if (group_data.options && group_data.options.group_by_tooltip) { - this.tooltip_info = _.map(group_data.options.group_by_tooltip, function (key, value, list) { - return (self.values && self.values[value] && "
" +key + "
" + self.values[value] + "
") || ''; + if (group_data.options && group_data.options.group_by_tooltip && this.values) { + this.tooltip_info = _.map(group_data.options.group_by_tooltip, function (key, value) { + if (!self.values[value]) { return ''; } + return $('
').text(key + '
' + self.values[value]).text(); }).join(''); } else { this.tooltip_info = ""; From 6797d6a7c639c22f9987207481accee9b9b5b486 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 22 Aug 2017 13:41:12 +0200 Subject: [PATCH 4/8] [FIX] web: don't save empty required x2manys Before this commit, the same function was called at the rendering and at the writing of a field. It caused a field that should be displayed all the time (field is never false) to ignore its required attribute, in particular with one2many's. After this commit, we differentiate between the rendering function and the validate to write function, making a type of field both requirable and always displayed even if empty OPW 766002 Closes odoo/enterprise#1306 Cherry-pick odoo/enterprise@be8e5709918b42e6c60fe0327329f855a29f5a99 --- addons/web/static/src/js/views/form_common.js | 13 ++++++++++++- .../static/src/js/views/form_relational_widgets.js | 12 ++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/views/form_common.js b/addons/web/static/src/js/views/form_common.js index 6752885f372..3ed2e77e695 100644 --- a/addons/web/static/src/js/views/form_common.js +++ b/addons/web/static/src/js/views/form_common.js @@ -716,7 +716,7 @@ var AbstractField = FormWidget.extend(FieldInterface, { } }, _toggle_label: function() { - var empty = this.get('effective_readonly') && this.is_false(); + var empty = this.get('effective_readonly') && !this.is_set(); this.$label.toggleClass('o_form_label_empty', empty).toggleClass('o_form_label_false', this.get('effective_readonly') && this.get('value') === false); this.$el.toggleClass('o_form_field_empty', empty); }, @@ -755,10 +755,21 @@ var AbstractField = FormWidget.extend(FieldInterface, { /** * Method useful to implement to ease validity testing. Must return true if the current * value is similar to false in OpenERP. + * Used at write time, in particular when the field is required */ is_false: function() { return this.get('value') === false; }, + + /** + * Method called at rendering time to determine if the field should be + * displayed (non-empty) or not (empty) + * We test the same thing as is_false but with different semantics + */ + is_set: function() { + return !this.is_false(); + }, + _check_css_flags: function() { var show_translate = (!this.get('effective_readonly') && this.field_manager.get('actual_mode') !== "create"); this.$translate.toggleClass('o_translate_active', !!show_translate); diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 9a24eef6ae5..722ef2f4932 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -345,8 +345,8 @@ var FieldMany2One = common.AbstractField.extend(common.CompletionFieldMixin, com if (!this.get("effective_readonly")) { this.$input.val(noValue ? "" : (str.split("\n")[0].trim() || $(data.noDisplayContent).text())); this.current_display = this.$input.val(); - this.$follow_button.toggle(!this.is_false()); - this.$el.toggleClass('o_with_button', !!this.$follow_button && this.$follow_button.length > 0 && !this.is_false()); + this.$follow_button.toggle(this.is_set()); + this.$el.toggleClass('o_with_button', !!this.$follow_button && this.$follow_button.length > 0 && this.is_set()); } else { this.$el.html(noValue ? "" : (_.escape(str.trim()).split("\n").join("
") || data.noDisplayContent)); // Define callback to perform when clicking on the field @@ -871,6 +871,10 @@ var FieldX2Many = AbstractManyField.extend({ is_false: function () { return _(this.dataset.ids).isEmpty(); }, + is_set: function() { + // always consider that field is "set" hence displayed + return true; + }, }); var X2ManyDataSet = data.BufferedDataSet.extend({ @@ -1697,6 +1701,10 @@ var FieldMany2ManyCheckBoxes = AbstractManyField.extend(common.ReinitializeField is_false: function() { return false; }, + is_set: function() { + // always consider that field is "set" hence displayed + return true; + }, }); core.form_widget_registry From 9214d7815267d6bdad954f7e94a4bf187cea35bc Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 23 Aug 2017 17:59:04 +0200 Subject: [PATCH 5/8] [FIX] board: height of graph When a graph is added to the dashboard, it doesn't have a minimum height set, so only the label and the axis are displayed, not the content. opw-766454 --- addons/board/static/src/less/dashboard.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/board/static/src/less/dashboard.less b/addons/board/static/src/less/dashboard.less index 36f0727c0ac..855da1d2acc 100644 --- a/addons/board/static/src/less/dashboard.less +++ b/addons/board/static/src/less/dashboard.less @@ -114,6 +114,11 @@ .o_kanban_view .o_kanban_record .oe_kanban_list_many2many .o_form_field_many2manytags { border: none; } + + // Override height of graph. min-height doesn't do the trick + .o_graph { + height: 500px; + } } } } From 11c523f69357b850cabf6c238d9d4f40d43b3d77 Mon Sep 17 00:00:00 2001 From: Do Vuong Tien Date: Thu, 24 Aug 2017 12:28:03 +0700 Subject: [PATCH 6/8] [CLA] Signature for vuongtien2411 Done at #19025 --- doc/cla/individual/vuongtien2411.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/vuongtien2411.md diff --git a/doc/cla/individual/vuongtien2411.md b/doc/cla/individual/vuongtien2411.md new file mode 100644 index 00000000000..821a9881a43 --- /dev/null +++ b/doc/cla/individual/vuongtien2411.md @@ -0,0 +1,11 @@ +Vietnam, 2017-08-24 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Do Vuong Tien tiendv@trobz.com https://github.com/vuongtien2411 From dedff1842b7ea3ae3f2b0935ab0684201cc4aac0 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 2 Dec 2016 14:19:30 +0100 Subject: [PATCH 7/8] [FIX] account: account domain in reconciliation In the reconciliation widget, create a counterpart line. No domain is applied on the "Account" field regarding the company, meaning that we can select an account from any company. opw-694149 --- addons/account/models/account_journal_dashboard.py | 4 ++-- .../account/static/src/js/account_reconciliation_widgets.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 505442c36dd..edb2e5a01ff 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -264,11 +264,11 @@ class account_journal(models.Model): return { 'type': 'ir.actions.client', 'tag': 'bank_statement_reconciliation_view', - 'context': {'statement_ids': bank_stmt.ids}, + 'context': {'statement_ids': bank_stmt.ids, 'company_ids': self.mapped('company_id').ids}, } else: # Open reconciliation view for customers/suppliers - action_context = {'show_mode_selector': False} + action_context = {'show_mode_selector': False, 'company_ids': self.mapped('company_id').ids} if self.type == 'sale': action_context.update({'mode': 'customers'}) elif self.type == 'purchase': diff --git a/addons/account/static/src/js/account_reconciliation_widgets.js b/addons/account/static/src/js/account_reconciliation_widgets.js index dbbb55bddb1..6aacbb24c68 100644 --- a/addons/account/static/src/js/account_reconciliation_widgets.js +++ b/addons/account/static/src/js/account_reconciliation_widgets.js @@ -91,6 +91,10 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, { // NB : for presets to work correctly, a field id must be the same string as a preset field this.presets = {}; // Description of the fields to initialize in the "create new line" form + var domain_account_id = [['deprecated', '=', false]]; + if (context && context.context && context.context.company_ids) { + domain_account_id.push(['company_id', 'in', context.context.company_ids]); + } this.create_form_fields = { account_id: { id: "account_id", @@ -103,7 +107,7 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, { relation: "account.account", string: _t("Account"), type: "many2one", - domain: [['deprecated', '=', false]], + domain: domain_account_id, }, }, label: { From b5aaf0d527cdab794058ccbbf3cd5d215fd9a5af Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Mon, 21 Aug 2017 18:34:56 -0700 Subject: [PATCH 8/8] [FIX] point_of_sale: handle fiscal positions that remove taxes A tax can be mapped to nothing, so first check if _map_tax_fiscal_position actually returned something. Fixes #17963 --- addons/point_of_sale/static/src/js/models.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 5d7d96b5178..31c678e107c 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1360,6 +1360,9 @@ exports.Orderline = Backbone.Model.extend({ if (!no_map_tax){ tax = self._map_tax_fiscal_position(tax); } + if (!tax){ + return; + } if (tax.amount_type === 'group'){ var ret = self.compute_all(tax.children_tax_ids, price_unit, quantity, currency_rounding); total_excluded = ret.total_excluded;