[MERGE] forward port branch saas-15 up to 653bbbc733
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -947,9 +947,12 @@ class UsersView(models.Model):
|
||||
# add reified groups fields
|
||||
for app, kind, gs in self.env['res.groups'].sudo().get_groups_by_application():
|
||||
if kind == 'selection':
|
||||
field_name = name_selection_groups(gs.ids)
|
||||
if allfields and field_name not in allfields:
|
||||
continue
|
||||
# selection group field
|
||||
tips = ['%s: %s' % (g.name, g.comment) for g in gs if g.comment]
|
||||
res[name_selection_groups(gs.ids)] = {
|
||||
res[field_name] = {
|
||||
'type': 'selection',
|
||||
'string': app.name or _('Other'),
|
||||
'selection': [(False, '')] + [(g.id, g.name) for g in gs],
|
||||
@@ -960,7 +963,10 @@ class UsersView(models.Model):
|
||||
else:
|
||||
# boolean group fields
|
||||
for g in gs:
|
||||
res[name_boolean_group(g.id)] = {
|
||||
field_name = name_boolean_group(g.id)
|
||||
if allfields and field_name not in allfields:
|
||||
continue
|
||||
res[field_name] = {
|
||||
'type': 'boolean',
|
||||
'string': g.name,
|
||||
'help': g.comment,
|
||||
|
||||
Reference in New Issue
Block a user