[IMP] web: better display of redirection warnings ('Go to Config' or Cancel, like other
wizards in odoo)
if not ids:
if exception:
model, action_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'action_account_fiscalyear')
- msg = _('There is no period defined for this date: %s.\nPlease go to Configuration/Periods and configure a fiscal year.') % dt
- raise openerp.exceptions.RedirectWarning(msg, action_id, _('Go to the configuration panel'))
+ msg = _('No accounting period is covering this date: %s.') % dt
+ raise openerp.exceptions.RedirectWarning(msg, action_id, _(' Configure Fiscal Year Now'))
else:
return []
return ids
result = self.search(cr, uid, args, context=context)
if not result:
model, action_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'action_account_period')
- msg = _('There is no period defined for this date: %s.\nPlease go to Configuration/Periods.') % dt
- raise openerp.exceptions.RedirectWarning(msg, action_id, _('Go to the configuration panel'))
+ msg = _('No accounting period is covering this date: %s.') % dt
+ raise openerp.exceptions.RedirectWarning(msg, action_id, _('Configure Periods Now'))
return result
def action_draft(self, cr, uid, ids, context=None):
var $customButons = this.$buttons.find('.oe_dialog_custom_buttons').empty();
_.each(buttons, function(fn, text) {
// buttons can be object or array
+ var pre_text = fn.pre_text || "";
+ var post_text = fn.post_text || "";
var oe_link_class = fn.oe_link_class;
if (!_.isFunction(fn)) {
text = fn.text;
fn = fn.click;
}
- var $but = $(QWeb.render('WidgetButton', { widget : { string: text, node: { attrs: {'class': oe_link_class} }}}));
+ var $but = $(QWeb.render('WidgetButton', { widget : { pre_text: pre_text, post_text: post_text, string: text, node: { attrs: {'class': oe_link_class} }}}));
$customButons.append($but);
- $but.on('click', function(ev) {
+ $but.filter('button').on('click', function(ev) {
fn.call(self.$el, ev);
});
});
delete(options.buttons);
}
this.renderElement();
-
this.$dialog_box = $(QWeb.render('Dialog', options)).appendTo("body");
this.$el.modal({
'backdrop': false,
size: 'medium',
title: "Odoo " + (_.str.capitalize(error.type) || "Warning"),
buttons: [
- {text: _t("Ok"), click: function() { self.$el.parents('.modal').modal('hide'); self.destroy();}},
- {text: error.data.arguments[2],
- oe_link_class: 'oe_link',
- click: function() {
- window.location.href='#action='+error.data.arguments[1];
- self.destroy();
- }}
+ {text: error.data.arguments[2],
+ oe_link_class : 'oe_highlight',
+ post_text : _t("or"),
+ click: function() {
+ window.location.href='#action='+error.data.arguments[1]
+ self.destroy();
+ }},
+ {text: _t("Cancel"), oe_link_class: 'oe_link', click: function() { self.$el.parents('.modal').modal('hide'); self.destroy();}}
],
}, QWeb.render('CrashManager.warning', {error: error})).open();
}
<t t-name="CrashManager.warning">
<table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning">
<tr>
- <td class="oe_dialog_icon"><img t-att-src='_s + "/web/static/src/img/warning.png"'/></td>
<td>
<p>
<t t-js="d">
</div>
</t>
<t t-name="WidgetButton">
+ <span t-if="widget.pre_text"> <t t-esc="widget.pre_text"/> </span>
<button type="button" t-att-class="widget.is_stat_button ? 'oe_stat_button btn btn-default' : 'oe_button oe_form_button ' + (widget.node.attrs.class ? widget.node.attrs.class : '')"
t-att-style="widget.node.attrs.style"
t-att-tabindex="widget.node.attrs.tabindex"
<span t-if="widget.string and !widget.is_stat_button"><t t-esc="widget.string"/></span>
<div t-if="widget.string and widget.is_stat_button"><t t-esc="widget.string"/></div>
</button>
+ <span t-if="widget.post_text"> <t t-esc="widget.post_text"/> </span>
</t>
<t t-name="WidgetButton.tooltip" t-extend="WidgetLabel.tooltip">
<t t-jquery="div.oe_tooltip_string" t-operation="replace">