feat(sales): currency code associated from invoice customer.

feat(purchases): currency code associated from vendor customer.
This commit is contained in:
a.bouhuolia
2021-03-08 09:47:04 +02:00
parent 6ec4ee4f0f
commit 3a3d881f67
26 changed files with 292 additions and 196 deletions

View File

@@ -48,7 +48,7 @@ export default class BillsController extends BaseController {
);
router.post(
'/:id', [
...this.billValidationSchema,
...this.billEditValidationSchema,
...this.specificBillValidationSchema,
],
this.validationResult,
@@ -106,7 +106,6 @@ export default class BillsController extends BaseController {
check('entries').isArray({ min: 1 }),
check('entries.*.id').optional().isNumeric().toInt(),
check('entries.*.index').exists().isNumeric().toInt(),
check('entries.*.item_id').exists().isNumeric().toInt(),
check('entries.*.rate').exists().isNumeric().toFloat(),
@@ -121,7 +120,7 @@ export default class BillsController extends BaseController {
*/
get billEditValidationSchema() {
return [
check('bill_number').exists().trim().escape(),
check('bill_number').optional().trim().escape(),
check('reference_no').optional().trim().escape(),
check('bill_date').exists().isISO8601(),
check('due_date').optional().isISO8601(),

View File

@@ -407,6 +407,11 @@ export default class BillsPayments extends BaseController {
errors: [{ type: 'BILLS_NOT_FOUND', code: 1000 }],
});
}
if (error.errorType === 'PAYMENT_NUMBER_SHOULD_NOT_MODIFY') {
return res.status(400).send({
errors: [{ type: 'PAYMENT_NUMBER_SHOULD_NOT_MODIFY', code: 1100 }],
});
}
}
next(error);
}