diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-09-04 17:02:36 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-09-04 17:02:36 +0200 |
| commit | 2a13863f4355eb84f620ce163d7a3ea2b4a28a29 (patch) | |
| tree | 3c3e27c6ad7ad58c3c1a74e8023e34adb09730c8 /addons | |
| parent | 54ed832cdbfd1cf84a12c532b0696d56aada2111 (diff) | |
| parent | 653bbbc73305bb21c89e1d7c10fd18f19e600317 (diff) | |
[MERGE] forward port branch saas-15 up to 653bbbc7330
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/sale/models/analytic.py | 11 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/editor/rte.js | 2 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/editor/summernote.js | 18 |
3 files changed, 25 insertions, 6 deletions
diff --git a/addons/sale/models/analytic.py b/addons/sale/models/analytic.py index eb6ffcf2ac2..e6c4dbc20af 100644 --- a/addons/sale/models/analytic.py +++ b/addons/sale/models/analytic.py @@ -126,7 +126,14 @@ class AccountAnalyticLine(models.Model): continue if sale_order.state != 'sale': - raise UserError(_('The Sales Order %s linked to the Analytic Account must be validated before registering expenses.') % sale_order.name) + message_unconfirmed = _('The Sales Order %s linked to the Analytic Account %s must be validated before registering expenses.') + messages = { + 'draft': message_unconfirmed, + 'sent': message_unconfirmed, + 'done': _('The Sales Order %s linked to the Analytic Account %s is currently locked. You cannot register an expense on a locked Sales Order. Please create a new SO linked to this Analytic Account.'), + 'cancel': _('The Sales Order %s linked to the Analytic Account %s is cancelled. You cannot register an expense on a cancelled Sales Order.'), + } + raise UserError(messages[sale_order.state] % (sale_order.name, analytic_line.account_id.name)) price = analytic_line._sale_get_invoice_price(sale_order) so_line = None @@ -139,8 +146,6 @@ class AccountAnalyticLine(models.Model): if not so_line: # generate a new SO line - if sale_order.state != 'sale': - raise UserError(_('The Sales Order %s linked to the Analytic Account must be validated before registering expenses.') % sale_order.name) so_line_values = analytic_line._sale_prepare_sale_order_line_values(sale_order, price) so_line = self.env['sale.order.line'].create(so_line_values) so_line._compute_tax_id() diff --git a/addons/web_editor/static/src/js/editor/rte.js b/addons/web_editor/static/src/js/editor/rte.js index c23cadd1f0f..341b42f93c6 100644 --- a/addons/web_editor/static/src/js/editor/rte.js +++ b/addons/web_editor/static/src/js/editor/rte.js @@ -157,7 +157,7 @@ var History = function History($editable) { if (aUndo[pos]) { pos = Math.min(pos, aUndo.length); - aUndo.splice(Math.max(pos,1), aUndo.length); + aUndo.splice(pos, aUndo.length); } // => make a snap when the user change editable zone (because: don't make snap for each keydown) diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js index e6bca5e1563..91a230a9518 100644 --- a/addons/web_editor/static/src/js/editor/summernote.js +++ b/addons/web_editor/static/src/js/editor/summernote.js @@ -1075,7 +1075,14 @@ $.summernote.pluginEvents.untab = function (event, editor, layoutInfo) { $.summernote.pluginEvents.up = function (event, editor, layoutInfo) { var r = range.create(); var node = dom.firstChild(r.sc.childNodes[r.so] || r.sc); - if (!r.isOnCell() || (!dom.isCell(node) && dom.hasContentBefore(node) && (!dom.isBR(dom.hasContentBefore(node)) || !dom.isText(node) || dom.isVisibleText(node) || dom.hasContentBefore(dom.hasContentBefore(node))))) { + if (!r.isOnCell()) { + return; + } + // check if an ancestor between node and cell has content before + var ancestor = dom.ancestor(node, function (ancestorNode) { + return dom.hasContentBefore(ancestorNode) || dom.isCell(ancestorNode); + }); + if (!dom.isCell(ancestor) && (!dom.isBR(dom.hasContentBefore(ancestor)) || !dom.isText(node) || dom.isVisibleText(node) || dom.hasContentBefore(dom.hasContentBefore(ancestor)))) { return; } event.preventDefault(); @@ -1092,7 +1099,14 @@ $.summernote.pluginEvents.up = function (event, editor, layoutInfo) { $.summernote.pluginEvents.down = function (event, editor, layoutInfo) { var r = range.create(); var node = dom.firstChild(r.sc.childNodes[r.so] || r.sc); - if (!r.isOnCell() || (!dom.isCell(node) && dom.hasContentAfter(node) && (!dom.isBR(dom.hasContentAfter(node)) || !dom.isText(node) || dom.isVisibleText(node) || dom.hasContentAfter(dom.hasContentAfter(node))))) { + if (!r.isOnCell()) { + return; + } + // check if an ancestor between node and cell has content after + var ancestor = dom.ancestor(node, function (ancestorNode) { + return dom.hasContentAfter(ancestorNode) || dom.isCell(ancestorNode); + }); + if (!dom.isCell(ancestor) && (!dom.isBR(dom.hasContentAfter(ancestor)) || !dom.isText(node) || dom.isVisibleText(node) || dom.hasContentAfter(dom.hasContentAfter(ancestor)))) { return; } event.preventDefault(); |
