I have a big problem, like in the title "Saving Form Header triggers firstly saving Lines", but let me explain...
I'm creating new record in SalesQuotationTable and fill it with one line. Values is not importatant, everything can be random untill it validate correct.
So here comes my problem:
(Everything happen on Lines View)
1. I change "Product Name" string (or any value) on added line. (That is the most importat step)
2. I click on Header. (Line write triggers, and saves the line)
3. I change any value on Header (I choose a value that is visible on Lines Details, so for example "Adress" or "Delivery date")
4. I click Ctrl+S.
And here is my problem, because after step 4. the Line write triggers first (Not header), the code saves lines and header values, and after this the header write method triggers and starts looking for any typed changes (xRecord.Field != xRecord.orig().Field). He find nothing, because the line's write method updated the Orig a second ago.
What I discoveded is that after changing something on line and next on the Header, then Ctrl+S triggers leaveRecord method, and the super method calls ValidateWrite/Write on the lines.
When I change only Header valuses and click Ctrl+S, then leaveRecord calls ValidateWrite/Write on Table(Header) first.
Anyone can have any idea what happens, and why Lines are updated before header that updates the header?
PS I know this explanation can be complicated, so ask me everything. I lost 2 days on this issue