Changing an SO comment line doesn't make SO 'Dirty'
Posted:
Mon Oct 19, 2020 8:31 pm
by pricerc
I have a JiwaSales.SalesOrder loaded from the database, and it has a comment line. If I change the comment, it seems that it doesn't set SalesOrder's ChangeFlag.
It seems to be the same if I just change the quantity on a stocked line.
Have I missed something, or do I need to separately check the lines separately in my 'need to save' check ?
(I feel like I must have asked this before, but I efforts to find it have been fruitless so far)
Re: Changing an SO comment line doesn't make SO 'Dirty'
Posted:
Mon Oct 19, 2020 9:49 pm
by Mike.Sheen
pricerc wrote:Have I missed something, or do I need to separately check the lines separately in my 'need to save' check ?
No, you've not missed anything.
If anything changes, the ChangeFlag property of the sales order will be set to true - even if a comment line.
I'm going to need some steps and maybe some code to repro what you're describing.
Re: Changing an SO comment line doesn't make SO 'Dirty'
Posted:
Wed Oct 21, 2020 7:16 am
by pricerc
I think I found my problem.
Originally, the project was a POS that was even simpler than the standard Plug-In example one. So, create an order, take a payment, process and close. So instead of just using the Jiwa business objects, I rolled my own, much simpler ones to use within the simplified UI, generating the Jiwa objects just before posting them.
However, the requirements have changed along the way, and I ended up having to reload the order and allow modifications. It also means that I save the order much more frequently than I was expecting.
And of course, after each 'Save', you have to 'Read' the SO again to refresh it with any changes made by the database. I was doing this, but then I forgot to also refresh the lines in my simplified sales order lines wrapper (I keep a reference to the relevant JiwaSales.SalesOrderLine within in my wrapper), which I think was leaving them in a 'funny' state.
In any case, it's working now, so I'm not going to pursue it further.