Add payable filter to sales invoices and enhance invoice status handling
- Introduced a new `payable` filter in the `ListSalesInvoicesFilters` and `ListSalesInvoicesQuery` types to allow querying of invoices based on their payable status. - Updated the `SalesInvoicesRepository` to incorporate logic for filtering invoices that are payable, checking both status and balance. - Enhanced the `SalesInvoicesService` to support the new `payable` filter in query handling. - Modified the `SalesInvoiceDto` to include the `payable` property for better API response representation. - Added unit tests to validate the new filter functionality and ensure proper handling of invoice statuses during updates. - Updated e2e tests to cover scenarios involving the new payable filter and status transitions for invoices.
This commit is contained in:
@@ -77,14 +77,14 @@ describe('sales fields', () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('limits invoice user transitions to cancelled', () => {
|
||||
it('allows invoice user transitions from draft to processed or cancelled', () => {
|
||||
expect(
|
||||
isAllowedStatusTransition(
|
||||
'draft',
|
||||
'processed',
|
||||
SALES_INVOICE_USER_TRANSITIONS,
|
||||
),
|
||||
).toBe(false);
|
||||
).toBe(true);
|
||||
expect(
|
||||
isAllowedStatusTransition(
|
||||
'draft',
|
||||
@@ -92,6 +92,13 @@ describe('sales fields', () => {
|
||||
SALES_INVOICE_USER_TRANSITIONS,
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isAllowedStatusTransition(
|
||||
'processed',
|
||||
'completed',
|
||||
SALES_INVOICE_USER_TRANSITIONS,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('allows payment pending to approved, rejected, or draft', () => {
|
||||
|
||||
Reference in New Issue
Block a user