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

@@ -91,6 +91,7 @@ export default class PaymentReceivesController extends BaseController {
*/
get paymentReceiveSchema(): ValidationChain[] {
return [
check('customer_id').exists().isNumeric().toInt(),
check('payment_date').exists(),
check('reference_no').optional(),
check('deposit_account_id').exists().isNumeric().toInt(),
@@ -132,7 +133,6 @@ export default class PaymentReceivesController extends BaseController {
*/
get newPaymentReceiveValidation() {
return [
check('customer_id').exists().isNumeric().toInt(),
...this.paymentReceiveSchema,
];
}
@@ -449,6 +449,11 @@ export default class PaymentReceivesController extends BaseController {
errors: [{ type: 'PAYMENT_RECEIVE_NO_IS_REQUIRED', code: 1100 }],
});
}
if (error.errorType === 'PAYMENT_CUSTOMER_SHOULD_NOT_UPDATE') {
return res.boom.badRequest(null, {
errors: [{ type: 'PAYMENT_CUSTOMER_SHOULD_NOT_UPDATE', code: 1200 }],
});
}
}
next(error);
}