salix/modules/invoiceIn/back/models/invoice-in.js

21 lines
874 B
JavaScript
Raw Normal View History

2023-07-17 12:07:45 +00:00
const UserError = require('vn-loopback/util/user-error');
2021-02-10 14:03:11 +00:00
module.exports = Self => {
require('../methods/invoice-in/filter')(Self);
require('../methods/invoice-in/summary')(Self);
2021-07-23 12:06:48 +00:00
require('../methods/invoice-in/clone')(Self);
2021-09-24 06:24:34 +00:00
require('../methods/invoice-in/toBook')(Self);
2021-09-28 08:57:51 +00:00
require('../methods/invoice-in/getTotals')(Self);
2022-10-17 13:13:27 +00:00
require('../methods/invoice-in/invoiceInPdf')(Self);
2022-10-24 13:15:23 +00:00
require('../methods/invoice-in/invoiceInEmail')(Self);
2023-03-27 12:29:22 +00:00
require('../methods/invoice-in/getSerial')(Self);
2023-12-28 14:55:11 +00:00
require('../methods/invoice-in/corrective')(Self);
2024-04-22 09:45:58 +00:00
require('../methods/invoice-in/exchangeRateUpdate')(Self);
2023-12-28 14:55:11 +00:00
2023-07-17 12:07:45 +00:00
Self.rewriteDbError(function(err) {
2023-07-17 12:11:05 +00:00
if (err.code === 'ER_ROW_IS_REFERENCED_2' && err.sqlMessage.includes('vehicleInvoiceIn'))
2023-07-17 12:07:45 +00:00
return new UserError(`This invoice has a linked vehicle.`);
return err;
});
2021-02-10 14:03:11 +00:00
};