Page 1 of 1

SalesOrder.SaveEnd event not quite end

PostPosted: Mon Mar 30, 2015 3:46 pm
by perry
Hi,

I'm coding an auto print function on creation (first save) of a new sales order (business logic only plugin).
I tried SOObject.Print(reports_collection) function inside the SaveEnd event and it is throwing an error which says sales order has to be saved first.

The work around is to use the ReadEnd event which gets called right after Save().

Will you log this as a bug fix or I should keep using my work around?
The trouble for us is if SO is created outside JIWA, we normally don't call SO.Read(id) after salesOrder.OnSaveEnd(). We will need to recompile those apps.

Regards,

Re: SalesOrder.SaveEnd event not quite end  Topic is solved

PostPosted: Mon Mar 30, 2015 9:09 pm
by Mike.Sheen
Hi Perry,

To print, the sales order must be saved - the report uses the table data, not the business logic data to report on - and this is by design to mitigate fraud (someone printing a delivery docket, then editing the order and thus allowing goods to leave the warehouse without an audit).

Your technique of using the ReadEnd event to print is fine, if that works for you then you should continue to use it. As you've probably worked out, a print will cause a save (we need to log who printed what), and thus another read event - it might seem inefficient, but we need to follow that sequence of events for audit and fraud prevention purposes.

Mike