I was wondering if I have the correct approach for the following use case. When I can do this more efficient please let me know.
User is creating a work order and all in one screen the user is filling in some order generic data and the user is adding orderlines. When order is submitted the work order is saved and orderlines are linked to the work order.
I specifically want to know the best practice in adding orderlines to an order that not yet exists.
On the order entry screen I have a group that has a custom state (a list of order lines). A button " add order line" toggles a pop-up with required inputs. On save I create a orderline thing with a status of “concept” I also add this orderline to the custom state.
A repeating group is showing all the orderlines which are in the customer state.
On submitting the order itself. I create a work order thing. Then I want to make a change on a couple lists of things:
- Add the orderlines list from the custom state to the orderlines list of the work order
- Update status of all these orderlines from “Concept” to “Definite”. This to be able to cleanup all concept orderlines older than one day.
- Link the created work order as work order to each orderline (reverse relationship)
So is the the best approach to follow and is this possible? I tried to append the custom state without creating a thing for each orderline but that was not possible.