Enhance sales document flow with new service and related functionalities
- Introduced `SalesDocumentFlowService` to manage the lifecycle of sales documents, including packing slips and invoices. - Implemented methods for processing orders, generating invoices, and handling packing slips based on order status. - Updated `SalesOrdersService`, `PackingSlipsService`, and `SalesInvoicesService` to integrate with the new document flow service. - Added new methods for marking drafts processed and checking if invoices are on sales plans. - Enhanced existing services and repositories to support new functionalities, including status transitions and related document management. - Updated DTOs to include new fields for packing slip and invoice IDs in sales order responses. - Added unit tests for the new service and updated existing tests to cover new functionalities.
This commit is contained in:
@@ -106,7 +106,10 @@ describe('SalesPaymentsService', () => {
|
||||
});
|
||||
|
||||
it('approving a payment recomputes referenced invoices', async () => {
|
||||
repository.findById.mockResolvedValue(sample);
|
||||
repository.findById.mockResolvedValue({
|
||||
...sample,
|
||||
status: Status.create('pending', SALES_PAYMENT_STATUSES),
|
||||
});
|
||||
salesInvoicesService.getTotals.mockResolvedValue({
|
||||
total: Decimal.create('25000'),
|
||||
paid: Decimal.create('0'),
|
||||
@@ -124,7 +127,10 @@ describe('SalesPaymentsService', () => {
|
||||
});
|
||||
|
||||
it('rejects approve when allocation would exceed the invoice total', async () => {
|
||||
repository.findById.mockResolvedValue(sample);
|
||||
repository.findById.mockResolvedValue({
|
||||
...sample,
|
||||
status: Status.create('pending', SALES_PAYMENT_STATUSES),
|
||||
});
|
||||
salesInvoicesService.getTotals.mockResolvedValue({
|
||||
total: Decimal.create('5000'),
|
||||
paid: Decimal.create('0'),
|
||||
|
||||
Reference in New Issue
Block a user