SaleOrder pdf is created before the sequence

Hello,
So I’m bit of an issue, I created a sequence for my Sales, the thing is when I finalize the sale,
it uses an arbitrary number (maybe the number of previous Sale Order created)
image
But when I do a version 2, it is the right thing
image
I don’t want to do a 2 version each time to have my sequence number right, is it a bug ?

Thank you !

Hello,

As long as the file is in the « Draft quotation » status, the sequence number is not assigned : the number # 4 which appears is the unique identifier of the object in the database.devis-liste-draft

In the « Draft quotation » status, there is no PDF report stored in the Documents area (see paper clip)
You must change the status of the file, by clicking on the « Finalize » buttondevis-form-draft

In the « Finalized quotation » state, there is at least one PDF report stored in the Documents area (see paper clip)devis-form-Finalize

When making a new version, another document appears in the Documents area (see paper clip)devis-form-Finalize-new-version

When you click on paper clip, you get the two official PDF documents which both carry the official sequence SO0011.devis-documents

There was only one record in database with the id n ° 4

Best Regards,
PakMax

Hello, thank you for your answer.
But when i click finalize like you, the pdf doesn’t follow the sequence and only the second version creates with the right sequence


When I click on the attachments, i have, like you, two PDFs with the right sequence

But when i clicked on the first one

It still follows the database id, which I for the moment put so it follows the same number, but it will not work if I want the number to reset every years.

The second version tho follows the right sequence.

Is it intended to work like that ?, I don’t want to make two versions of the same file every time.

Hello,
I’m not sure I understood the duplicate versions correctly? PDF? quote numbers? Other ?

However you are right, I had not seen this point: on the action of « Finalize », the name of the file contains the sequence number. While the quote number, of the attached PDF, contains the identifier in the database.
It doesn’t seem right.

In the finalizeQuotation method of the SaleOrderWorkflowServiceImpl class, the saleOrderRepo.save (saleOrder) statement seems misplaced.

saleOrder.setStatusSelect (SaleOrderRepository.STATUS_FINALIZED_QUOTATION);
if (appSaleService.getAppSale (). getPrintingOnSOFinalization ())
this.saveSaleOrderPDFAsAttachment (saleOrder); }
saleOrderRepo.save (saleOrder);

By placing this instruction (saleOrderRepo.save (saleOrder), 2 instructions above, the quote number, of the attached PDF, is displayed with the sequence number, during the Finalize action

saleOrder.setStatusSelect (SaleOrderRepository.STATUS_FINALIZED_QUOTATION);
saleOrderRepo.save (saleOrder);
if (appSaleService.getAppSale (). getPrintingOnSOFinalization ())
this.saveSaleOrderPDFAsAttachment (saleOrder); }

Either an internal developer in your organization can correct this point for you, or you must report this point to Axelor.

In the short term, a temporary method would consist in not generating the PDF when finalizing by adjusting the application management indicators / Configure Sales

Disabling the two yellow indicators below prevents automatic generation of the PDF with attachment, during the Finalize action.

You could edit the reports, store them locally, and then attach them manually.

Regards,