Sélectionner une révision Git
scop_membership_out_wizard.py
data_export.js 2,14 Kio
odoo.define("afac_partner.DataExport", function (require) {
"use strict";
var core = require("web.core");
var DataExport = require("web.DataExport");
var framework = require("web.framework");
var pyUtils = require("web.py_utils");
var Dialog = require("web.Dialog");
var _t = core._t;
DataExport.include({
/*
Overwritten Object responsible for the standard export.
A flag (checkbox) afac is checked
*/
_exportData(exportedFields, exportFormat, idsToExport) {
let afac = null;
if (this.$el) {
afac = this.$("#o-export-afac-project");
}
if (afac && afac.is(":checked")) {
if (_.isEmpty(exportedFields)) {
Dialog.alert(this, _t("Please select fields to export..."));
return;
}
if (this.isCompatibleMode) {
exportedFields.unshift({name: "id", label: _t("External ID")});
}
framework.blockUI();
this.getSession().get_file({
url: "/web/export/" + exportFormat,
data: {
data: JSON.stringify({
model: this.record.model,
fields: exportedFields,
ids: idsToExport,
domain: this.domain,
groupby: this.groupby,
context: pyUtils.eval("contexts", [
this.record.getContext(),
]),
import_compat: this.isCompatibleMode,
afac: true,
}),
},
complete: framework.unblockUI,
error: (error) => this.call("crash_manager", "rpc_error", error),
});
} else {
/*
Call the standard method if afac is not checked
*/
this._super.apply(this, arguments);
}
},
});
});