salix/print/templates/reports/invoice-incoterms/invoice-incoterms.js

24 lines
826 B
JavaScript
Raw Normal View History

2023-01-23 12:15:30 +00:00
const vnReport = require('../../../core/mixins/vn-report.js');
const UserError = require('vn-loopback/util/user-error');
2021-03-01 10:25:37 +00:00
module.exports = {
name: 'invoice-incoterms',
2023-01-23 12:15:30 +00:00
mixins: [vnReport],
2021-03-01 10:25:37 +00:00
async serverPrefetch() {
2023-01-23 12:15:30 +00:00
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
this.checkMainEntity(this.invoice);
this.client = await this.findOneFromDef('client', [this.reference]);
this.incoterms =
2024-06-20 11:45:38 +00:00
await this.findOneFromDef('incoterms', [this.reference]);
if (!this.incoterms)
throw new UserError(`The address of the customer must have information about Incoterms and Customs Agent`);
2021-03-01 10:25:37 +00:00
},
props: {
2022-09-29 05:35:20 +00:00
reference: {
2023-04-20 08:43:35 +00:00
type: String,
2022-09-26 11:33:27 +00:00
required: true,
description: 'The invoice ref'
2021-03-01 10:25:37 +00:00
}
}
};