From 6da7628b868faae6e37f0b12a8749341668f0ab0 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 7 Nov 2016 14:34:29 +0100 Subject: [PATCH 01/20] [FIX] web_editor: split h5,h3,...p... node to insert table opw-686393 --- addons/web_editor/static/src/js/summernote.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index 00cd04ac16b..e08f0680663 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -936,12 +936,19 @@ $.summernote.pluginEvents.insertTable = function (event, editor, layoutInfo, sDi var dimension = sDim.split('x'); var r = range.create(); if (!r) return; - r = r.deleteContents(); + r = r.deleteContents(true); - var isBodyContainer = dom.isBodyContainer; - dom.isBodyContainer = dom.isNotBreakable; - r.insertNode(editor.table.createTable(dimension[0], dimension[1])); - dom.isBodyContainer = isBodyContainer; + var table = editor.table.createTable(dimension[0], dimension[1]); + var parent = r.sc; + while (dom.isText(parent.parentNode) || dom.isRemovableEmptyNode(parent.parentNode)) { + parent = parent.parentNode; + } + var node = dom.splitTree(parent, {'node': r.sc, 'offset': r.so}) || r.sc; + node.parentNode.insertBefore(table, node); + + if ($(node).text() === '' || node.textContent === '\u00A0') { + node.parentNode.removeChild(node); + } editor.afterCommand($editable); event.preventDefault(); From f8c8715188846896e26245d8e952ec9c26727c50 Mon Sep 17 00:00:00 2001 From: Wolfgang Taferner Date: Sun, 6 Nov 2016 13:55:06 +0100 Subject: [PATCH 02/20] [FIX] account: partner of account move The partner of an account move is defined as a related on the partner of the move lines. This kind of relation implies that the partner of the account move is the partner of the first account move line. This is arbitrary and doesn't make much sense. Closes #14167 opw-693289 --- addons/account/models/account_move.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 034b412a35d..51f7ebd181f 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -70,6 +70,13 @@ class AccountMove(models.Model): if self.env.context.get('default_journal_type'): return self.env['account.journal'].search([('type', '=', self.env.context['default_journal_type'])], limit=1).id + @api.multi + @api.depends('line_ids.partner_id') + def _compute_partner_id(self): + for move in self: + partner = move.line_ids.mapped('partner_id') + move.partner_id = partner.id if len(partner) == 1 else False + name = fields.Char(string='Number', required=True, copy=False, default='/') ref = fields.Char(string='Reference', copy=False) date = fields.Date(required=True, states={'posted': [('readonly', True)]}, index=True, default=fields.Date.context_today) @@ -85,7 +92,7 @@ class AccountMove(models.Model): 'in \'Posted\' status.') line_ids = fields.One2many('account.move.line', 'move_id', string='Journal Items', states={'posted': [('readonly', True)]}, copy=True) - partner_id = fields.Many2one('res.partner', related='line_ids.partner_id', string="Partner", store=True, readonly=True) + partner_id = fields.Many2one('res.partner', compute='_compute_partner_id', string="Partner", store=True, readonly=True) amount = fields.Monetary(compute='_amount_compute', store=True) narration = fields.Text(string='Internal Note') company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', store=True, readonly=True, From 231090c0e6080f5e4eebe97c947bbc4e64041bd8 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Mon, 7 Nov 2016 17:15:19 +0100 Subject: [PATCH 03/20] [FIX] stock: '_move_quants_by_lot' bad 'false_quants' values Hypothesis: - We have a product 'pa' managed by lot. - We don't create lots, when we receive products. - We create lots when we deliver products. - We don't have any units of product 'pa' in stock. - We recieve 4 units of product 'pa' in one picking. - We create a picking to deliver 3 products 'pa' (stock.move). - We actually deliver 4 units of product 'pa' (1 in 'LOT1', 1 in 'LOT2' and 2 in 'LOT3'). - The problem also occurs when you just have 2 products in and 2 out in different lots, but we based the example on the tests defined in 'test_stock_flow.py' Thesis: - We don't have anymore quants of product 'pa' in stock after delivering the 4 units Problem: - We actually have 3 quants of product 'pa' in stock, two having the 'lot_id' corresponding to 'LOT3' and 'qty=-1', and one having no 'lot_id' and 'qty=2'. Origin: - This problem is caused by a bad condition in the function '_move_quants_by_lot' defined in the model 'stock.move'. Explanation: When we reserve the 3 units of product 'pa' in the picking out, the quant in stock having 'qty=4' is splitted in 2 quants, one having 'qty=3' and a 'reservation_id' equals to the id of the move in the picking out. And one with 'qty=1', having not reservation id. So once the products are reserved, we will complete the pack operation present in the picking. We will add 4 units of product 'pa' dispatched in Lot as 1 in 'LOT1', 1 in 'LOT2' and 2 in 'LOT3' to the pack operation. Then when we validate the picking, the quants with references to 'lot_id' must be created, and then moved to the client. Because we have set 4 units of the product 'pa' in the pack operation, an extra move of 1 unit of product 'pa' is added to the picking to have a total of 4 untis of 'pa' moved to the customer location. When the function '_move_quants_by_lot' is called, it gets in parameter 'false_quants' which contains the quant reserved by the first move, it means the quant in stock with the reservation_id to the first move, and 'qty=3'. The function, will now split this quant in 2 different quants: - one with 'lot_id' corresponding to 'LOT1' and moved to customer location. - one with no 'lot_id' staying in stock location still reserved to the first move. Then, the function should reset the 'false_quants' with the quant containing the 2 last units reserved in the quant from the last split in order to complete the next operation (create a quant with lot_id 'LOT2'). But the condition to find this new reserved quant contains (x.package_id.id != ops.package_id.id) where x is a quant which is wrong, because when we don't manage package, x.package_id.id is 'False' and ops.package_id.id is 'False' too. So it doesn't find the remaining quant. So to fix it, we changed this part of the condition as the quant package_id should be equal to the pack operation package_id (if no packages, False = False) --- 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 beac1dcaf3b..0cc4fb637e4 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2633,7 +2633,7 @@ class stock_move(osv.osv): if redo_false_quants: move_rec = self.pool['stock.move'].browse(cr, uid, move, context=context) false_quants_move = [x for x in move_rec.reserved_quant_ids if (not x.lot_id) and (x.owner_id.id == ops.owner_id.id) \ - and (x.location_id.id == ops.location_id.id) and (x.package_id.id != ops.package_id.id)] + and (x.location_id.id == ops.location_id.id) and (x.package_id.id == ops.package_id.id)] def action_done(self, cr, uid, ids, context=None): """ Process completely the moves given as ids and if all moves are done, it will finish the picking. From 11e834a4c1f6fc1c5fa11cee36ce06a976d6f9cc Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 8 Nov 2016 16:29:31 +0100 Subject: [PATCH 04/20] [FIX] account_asset: account labels The labels do not correspond to the purpose of the account. opw-691623 --- addons/account_asset/views/account_asset_view.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/views/account_asset_view.xml b/addons/account_asset/views/account_asset_view.xml index 97bfb4af899..a67f4e1bd9c 100644 --- a/addons/account_asset/views/account_asset_view.xml +++ b/addons/account_asset/views/account_asset_view.xml @@ -25,12 +25,13 @@
From 2738ad6ef5c0811d38d15be0b5df1ff7c97bc634 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 9 Nov 2016 09:59:36 +0100 Subject: [PATCH 05/20] [FIX] account_asset: account labels The labels do not correspond to the purpose of the account. opw-691623 --- addons/account_asset/views/account_asset_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/views/account_asset_view.xml b/addons/account_asset/views/account_asset_view.xml index 2c3ef85bf3b..2cba8ae5a58 100644 --- a/addons/account_asset/views/account_asset_view.xml +++ b/addons/account_asset/views/account_asset_view.xml @@ -30,12 +30,12 @@
From 6f807c5057c75168da6e7fa0cce138d3364f3969 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 9 Nov 2016 10:51:55 +0100 Subject: [PATCH 06/20] [FIX] account_asset: account labels Partial backport of 6e9d174330 opw-692155 --- addons/account_asset/views/account_asset_view.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_asset/views/account_asset_view.xml b/addons/account_asset/views/account_asset_view.xml index 2cba8ae5a58..29aa41a037f 100644 --- a/addons/account_asset/views/account_asset_view.xml +++ b/addons/account_asset/views/account_asset_view.xml @@ -24,17 +24,17 @@
-
-
-
From df34168177919d27c573c478ae4e998aa1ddc389 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 9 Nov 2016 10:38:31 +0100 Subject: [PATCH 07/20] [FIX] delivery: onchange_carrier with non integrated carrier The price set for the non integrated carrier must be the same either when you set it on the SO with button "set_price" or when you set it on the stock picking. The field "carrier_price" must be in readonly when the state of the picking is done. opw:691224 --- addons/delivery/models/stock_picking.py | 6 +++++- addons/delivery/views/delivery_view.xml | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index dda4edfaa15..11028118b10 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -66,7 +66,11 @@ class StockPicking(models.Model): @api.onchange('carrier_id') def onchange_carrier(self): if self.carrier_id.delivery_type in ['fixed', 'base_on_rule']: - self.carrier_price = self.carrier_id.price + order = self.sale_id + if order: + self.carrier_price = self.carrier_id.get_price_available(order) + else: + self.carrier_price = self.carrier_id.price @api.depends('product_id', 'move_lines') def _cal_weight(self): diff --git a/addons/delivery/views/delivery_view.xml b/addons/delivery/views/delivery_view.xml index a581f187419..671d96d390e 100644 --- a/addons/delivery/views/delivery_view.xml +++ b/addons/delivery/views/delivery_view.xml @@ -181,7 +181,7 @@