From b97578f689bb8be6e86de9885dd7613f37a0a7ac Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 16 Mar 2015 09:10:01 +0100 Subject: [PATCH 01/63] [FIX] view_form: sequence at item creation The sequence for new items in some models is simply set to a constant 10. Hence if 3 items had after reordering sequences 10, 11 and 12. If a new item is added, it would get after saving at the second position. This fix set the sequence of a new item to the maximum+1 or minimum-1 sequence of current items sequences (max if tree has editable="bottom", min if tree has editable="top"). opw-627830 --- addons/web/static/src/js/view_form.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 52065001693..83faa5e8626 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -855,6 +855,16 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } } } + // Heuristic to assign a proper sequence number for new records that + // are added in a dataset containing other lines with existing sequence numbers + if (!self.datarecord.id && self.fields.sequence && + !_.has(values, 'sequence') && !_.isEmpty(self.dataset.cache)) { + // Find current max or min sequence (editable top/bottom) + var current = _[prepend_on_create ? "min" : "max"]( + _.map(self.dataset.cache, function(o){return o.values.sequence}) + ); + values['sequence'] = prepend_on_create ? current - 1 : current + 1; + } if (form_invalid) { self.set({'display_invalid_fields': true}); first_invalid_field.focus(); From 52649934e33d8721db2632498f1c10e853ba9ce1 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 19 Mar 2015 11:33:04 +0100 Subject: [PATCH 02/63] [FIX] mrp: constraints capacity_per_cycle to be strictly positive A capacity per cycle only makes sense if it is strictly positive. This also prevents to divide by zero in _bom_explode. --- addons/mrp/mrp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index a5d57114c37..2167f04190e 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -73,6 +73,16 @@ class mrp_workcenter(osv.osv): value = {'costs_hour': cost.standard_price} return {'value': value} + def _check_capacity_per_cycle(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + if obj.capacity_per_cycle <= 0.0: + return False + return True + + _constraints = [ + (_check_capacity_per_cycle, 'The capacity per cycle must be strictly positive.', ['capacity_per_cycle']), + ] + mrp_workcenter() From d539be329e4469660270651ee1530eae8c1b9604 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 18 Mar 2015 15:32:54 +0100 Subject: [PATCH 03/63] [FIX] view_form: add context to search_count Currently, the view_form search_count doesn't propagate the context, so when searching on a translated field, the count can be different than the one we would expect and get with a search in a current language different than en_US. opw-628792 opw-630212 closes #5825 --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a1241288450..5b58594147a 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2574,7 +2574,7 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta var model = this.options.model || this.field_manager.get_field_value(this.options.model_field); var domain = instance.web.pyeval.eval('domain', this.get('value')); var ds = new instance.web.DataSetStatic(self, model, self.build_context()); - ds.call('search_count', [domain]).then(function (results) { + ds.call('search_count', [domain, self.build_context()]).then(function (results) { $('.oe_domain_count', self.$el).text(results + ' records selected'); if (self.get('effective_readonly')) { $('button span', self.$el).text(' See selection'); From accd3b472a1b0c01e62d47cb571a68dd88238d21 Mon Sep 17 00:00:00 2001 From: Nicolas Piganeau Date: Sun, 11 Jan 2015 16:02:07 +0100 Subject: [PATCH 04/63] Fix unwanted opening of stock.picking when scrapping from production --- addons/stock/wizard/stock_move.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py index 7016494572d..4e034be0510 100644 --- a/addons/stock/wizard/stock_move.py +++ b/addons/stock/wizard/stock_move.py @@ -88,16 +88,16 @@ class stock_move_scrap(osv.osv_memory): context=context) if context.get('active_id'): move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context) - return { - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'stock.picking', - 'type': 'ir.actions.act_window', - 'res_id': move.picking_id.id, - 'context': context - } - else: - return {'type': 'ir.actions.act_window_close'} + if move.picking_id: + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'stock.picking', + 'type': 'ir.actions.act_window', + 'res_id': move.picking_id.id, + 'context': context + } + return {'type': 'ir.actions.act_window_close'} From 1b2c400fc13d85318a71ae9cb49b46bfeccadf23 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 18 Mar 2015 13:33:47 +0100 Subject: [PATCH 05/63] [FIX] account_voucher: consistency between exchange rate account and company In the accounting settings, we prevent having gain and loss accounts that are linked to a different company than the one selected for the chart of account. opw: 630494 --- addons/account_voucher/account_voucher.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 25046a68ed6..66da370e2f7 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -70,13 +70,13 @@ class account_config_settings(osv.osv_memory): type='many2one', relation='account.account', string="Gain Exchange Rate Account", - domain="[('type', '=', 'other')]"), + domain="[('type', '=', 'other'), ('company_id', '=', company_id)]"), 'expense_currency_exchange_account_id': fields.related( 'company_id', 'expense_currency_exchange_account_id', type="many2one", relation='account.account', string="Loss Exchange Rate Account", - domain="[('type', '=', 'other')]"), + domain="[('type', '=', 'other'), ('company_id', '=', company_id)]"), } def onchange_company_id(self, cr, uid, ids, company_id, context=None): res = super(account_config_settings, self).onchange_company_id(cr, uid, ids, company_id, context=context) @@ -89,6 +89,23 @@ class account_config_settings(osv.osv_memory): 'expense_currency_exchange_account_id': False}) return res + def _check_account_gain(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + if obj.income_currency_exchange_account_id.company_id and obj.company_id != obj.income_currency_exchange_account_id.company_id: + return False + return True + + def _check_account_loss(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + if obj.expense_currency_exchange_account_id.company_id and obj.company_id != obj.expense_currency_exchange_account_id.company_id: + return False + return True + + _constraints = [ + (_check_account_gain, 'The company of the gain exchange rate account must be the same than the company selected.', ['income_currency_exchange_account_id']), + (_check_account_loss, 'The company of the loss exchange rate account must be the same than the company selected.', ['expense_currency_exchange_account_id']), + ] + class account_voucher(osv.osv): def _check_paid(self, cr, uid, ids, name, args, context=None): res = {} From efe8bfe5f17c0d60636d76e31852d64e8366e1ea Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 20 Mar 2015 16:09:29 +0100 Subject: [PATCH 06/63] [FIX] report_invoice: minor css fix to right align A field was not rightly aligned in a report, this fix add a class which fixes this. opw-630789 (fix by gab) --- addons/sale_layout/views/report_invoice_layouted.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_layout/views/report_invoice_layouted.xml b/addons/sale_layout/views/report_invoice_layouted.xml index 7dec3a0098c..592fe7de047 100644 --- a/addons/sale_layout/views/report_invoice_layouted.xml +++ b/addons/sale_layout/views/report_invoice_layouted.xml @@ -16,7 +16,7 @@ - + From 77a75d4e1f34832650c03f2cc46a8cd82d940478 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Sat, 21 Mar 2015 15:59:05 +0100 Subject: [PATCH 07/63] [FIX] web: remove leftover `future_display_name`. see 694fe1f --- addons/web/static/src/js/view_form.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5b58594147a..ca401a34179 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -961,10 +961,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM fields.push('display_name'); return self.dataset.read_index(fields, { - context: { - 'bin_size': true, - 'future_display_name': true - }, + context: { 'bin_size': true }, check_access_rule: true }).then(function(r) { self.trigger('load_record', r); From 374a016c6f53f445d8e7d7d72cc82403ce6f9218 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 23 Mar 2015 09:26:11 +0100 Subject: [PATCH 08/63] [IMP] event: confirm,attend,cancel buttons on registration tree view --- addons/event/event_view.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 189e75e018e..b109c7da6df 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -287,6 +287,9 @@ +