[IMP] web: customize the save/close button of a FormViewDialog

Purpose
=======
In Social, we want to be able to change the "Save" button into a "Add"
button when we add a new stream. For that purpose, we need to be able to
customize the text of the `FormViewDialog` buttons.

Task-2234580
See odoo/enterprise/pull/9933

closes odoo/odoo#49622

Related: odoo/enterprise#9933
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
std-odoo
2020-05-27 08:56:35 +00:00
committed by Thibault Delavallée
parent 0d569c8117
commit 4e1399dc0d
@@ -110,7 +110,7 @@ var FormViewDialog = ViewDialog.extend({
if (!options.buttons) {
options.buttons = [{
text: (readonly ? _t("Close") : _t("Discard")),
text: options.close_text || (readonly ? _t("Close") : _t("Discard")),
classes: "btn-secondary o_form_button_cancel",
close: true,
click: function () {
@@ -124,7 +124,7 @@ var FormViewDialog = ViewDialog.extend({
if (!readonly) {
options.buttons.unshift({
text: (multi_select ? _t("Save & Close") : _t("Save")),
text: options.save_text || (multi_select ? _t("Save & Close") : _t("Save")),
classes: "btn-primary",
click: function () {
self._save().then(self.close.bind(self));