fix: refs #7498 Download invoice out error
This commit is contained in:
parent
961ff02053
commit
bcbbee411f
|
@ -3,30 +3,17 @@ import './style.scss';
|
||||||
export default new Class({
|
export default new Class({
|
||||||
Extends: Hedera.Form,
|
Extends: Hedera.Form,
|
||||||
Template: require('./ui.xml'),
|
Template: require('./ui.xml'),
|
||||||
|
|
||||||
donwloadRenderer(column, invoice) {
|
|
||||||
var invoiceId = invoice.$.id;
|
|
||||||
|
|
||||||
if (invoice.$.hasPdf && invoiceId) {
|
onDownloadClick(column, value, row) {
|
||||||
var params = {
|
var model = this.$.invoices;
|
||||||
srv: 'rest:dms/invoice',
|
var hasPdf = model.get(row, 'hasPdf');
|
||||||
invoice: invoiceId,
|
var id = model.get(row, 'id');
|
||||||
access_token: this.conn.token
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.assign(column, {
|
if (hasPdf && id) {
|
||||||
tip: _('Download PDF'),
|
let params = Vn.Url.makeUri({ access_token: this.conn.token });
|
||||||
disabled: false,
|
window.open(`/api/InvoiceOuts/${id}/download?${params}`);
|
||||||
icon: 'download',
|
|
||||||
href: '?'+ Vn.Url.makeUri(params)
|
|
||||||
});
|
|
||||||
} else
|
} else
|
||||||
Object.assign(column, {
|
Htk.Toast.showWarning(_('Request the invoice to your salesperson'));
|
||||||
tip: _('Request the invoice to your salesperson'),
|
|
||||||
disabled: true,
|
|
||||||
icon: 'warning',
|
|
||||||
href: null
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<htk-grid
|
<htk-grid
|
||||||
class="box vn-w-sm"
|
class="box vn-w-sm"
|
||||||
show-header="false">
|
show-header="false">
|
||||||
<db-model property="model" id="tickets">
|
<db-model property="model" id="invoices">
|
||||||
SELECT id, ref, issued, amount, hasPdf
|
SELECT id, ref, issued, amount, hasPdf
|
||||||
FROM myInvoice
|
FROM myInvoice
|
||||||
ORDER BY issued DESC
|
ORDER BY issued DESC
|
||||||
|
@ -16,8 +16,9 @@
|
||||||
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>
|
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>
|
||||||
<htk-column-spin title="_Import" column="amount" unit="€" digits="2"/>
|
<htk-column-spin title="_Import" column="amount" unit="€" digits="2"/>
|
||||||
<htk-column-button
|
<htk-column-button
|
||||||
renderer="donwloadRenderer"
|
icon="download"
|
||||||
target="_blank"/>
|
tip="_Download PDF"
|
||||||
|
on-clicked="onDownloadClick"/>
|
||||||
</htk-grid>
|
</htk-grid>
|
||||||
</div>
|
</div>
|
||||||
</vn>
|
</vn>
|
||||||
|
|
Loading…
Reference in New Issue