From f0e331e005d830d8b5aaa4cb5e2824d98bd75b2a Mon Sep 17 00:00:00 2001 From: Pierre Verkest Date: Thu, 6 Nov 2014 16:18:33 +0100 Subject: [PATCH 1/4] [FIX] correctly update many2many in listview (web client) Fixes the issue #1216 (follow the link for more information). The issue was caused by a hack in list view: the magical suffix __display is used in render_cell to determine if a many2many field should be updated. This commit simply makes sure that old many2many fields + __display keys are cleared. A better way would be to redesign/refactor the list view to avoid that hack in the first place. But this would be a much more complex task. --- addons/web/static/src/js/view_list.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 52124d5f896..f9c857c957c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -541,8 +541,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi self.records.remove(record); return; } - _(_.keys(values)).each(function(key){ - record.set(key, values[key], {silent: true}); + _.each(values, function (value, key) { + record.set(key + '__display', false, {silent: true}); + record.set(key, value, {silent: true}); }); record.trigger('change', record); }); From 2461baa0dda461792d5c3f5a72cb8a98bc3877a1 Mon Sep 17 00:00:00 2001 From: Mohammad Alhashash Date: Tue, 11 Nov 2014 14:48:48 +0200 Subject: [PATCH 2/4] [FIX] stock: prevent serial number deletion on stock.move prodlot_id field may be required due to constraint `_check_tracking`. When a stock.production.lot is deleted, the constraint on linked stock.move is not checked. To avoid inconsistency, restrict the suppression. To allow the modification of existing stock.move, remove the states attribute on the field definition. As removal of serial may impact the traceability, it makes sense on buisness point of view to force the modification of previous stock.move, even if the constraint would not have been violated. The list of linked stock.move is present on the serial form view making the operation easier. Fixes #3560, lp:1176912 --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index bd15c45e421..7dc39c150a2 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1641,7 +1641,7 @@ class stock_move(osv.osv): 'location_dest_id': fields.many2one('stock.location', 'Destination Location', required=True,states={'done': [('readonly', True)]}, select=True, help="Location where the system will stock the finished products."), 'partner_id': fields.many2one('res.partner', 'Destination Address ', states={'done': [('readonly', True)]}, help="Optional address where goods are to be delivered, specifically used for allotment"), - 'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number', states={'done': [('readonly', True)]}, help="Serial number is used to put a serial number on the production", select=True), + 'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number', help="Serial number is used to put a serial number on the production", select=True, ondelete='restrict'), 'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, states={'done': [('readonly', True)]}, help="Logistical shipping unit: pallet, box, pack ..."), 'auto_validate': fields.boolean('Auto Validate'), From 043f7b84b83ec0c40274af30e2731b1c05c3d520 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Wed, 12 Nov 2014 13:56:41 -0500 Subject: [PATCH 3/4] [FIX] base: avoid having 'False' in name of a bank The name_get of res.partner.bank uses the format_layout to generate the name of the bank. As every field is not required, we may get 'False' in the name. Replace these missing values by an empty string. Fixes #3590 --- openerp/addons/base/res/res_bank.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/addons/base/res/res_bank.py b/openerp/addons/base/res/res_bank.py index 00d18d08078..aa9fa861548 100644 --- a/openerp/addons/base/res/res_bank.py +++ b/openerp/addons/base/res/res_bank.py @@ -190,6 +190,7 @@ class res_partner_bank(osv.osv): try: if not data.get('bank_name'): data['bank_name'] = _('BANK') + data = dict((k, v or '') for (k, v) in data.iteritems()) name = bank_code_format[data['state']] % data except Exception: raise osv.except_osv(_("Formating Error"), _("Invalid Bank Account Type Name format.")) From 2080ea0f0acfb0e03372e8abd264a5fb72d7d431 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 27 Nov 2014 13:25:54 +0100 Subject: [PATCH 4/4] [FIX] stock: on stock picking invoicing, allow to pick a journal if no move line --- .../stock/wizard/stock_invoice_onshipping.py | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py index 7c960c5e617..ed559d1e341 100644 --- a/addons/stock/wizard/stock_invoice_onshipping.py +++ b/addons/stock/wizard/stock_invoice_onshipping.py @@ -46,23 +46,24 @@ class stock_invoice_onshipping(osv.osv_memory): browse_picking = model_pool.browse(cr, uid, res_ids, context=context) for pick in browse_picking: - if not pick.move_lines: - continue - src_usage = pick.move_lines[0].location_id.usage - dest_usage = pick.move_lines[0].location_dest_id.usage - type = pick.type - if type == 'out' and dest_usage == 'supplier': - journal_type = 'purchase_refund' - elif type == 'out' and dest_usage == 'customer': - journal_type = 'sale' - elif type == 'in' and src_usage == 'supplier': - journal_type = 'purchase' - elif type == 'in' and src_usage == 'customer': - journal_type = 'sale_refund' - else: - journal_type = 'sale' + domain = [('type', 'in', ['sale', 'sale_refund', 'purchase', 'purchase_refund'])] + if pick.move_lines: + src_usage = pick.move_lines[0].location_id.usage + dest_usage = pick.move_lines[0].location_dest_id.usage + type = pick.type + if type == 'out' and dest_usage == 'supplier': + journal_type = 'purchase_refund' + elif type == 'out' and dest_usage == 'customer': + journal_type = 'sale' + elif type == 'in' and src_usage == 'supplier': + journal_type = 'purchase' + elif type == 'in' and src_usage == 'customer': + journal_type = 'sale_refund' + else: + journal_type = 'sale' + domain = [('type', '=', journal_type)] - value = journal_obj.search(cr, uid, [('type', '=',journal_type )]) + value = journal_obj.search(cr, uid, domain) for jr_type in journal_obj.browse(cr, uid, value, context=context): t1 = jr_type.id,jr_type.name if t1 not in vals: