WebVella/WebVella-ERP

Create a UI for manage 1:n

Closed this issue · 7 comments

Hi,

I created a simple data model for testing.
I have created entities (order, order_detail and items)

I want to build a UI that let me set in a "general" tab order infos while in a "details tab" a 1:N information where I can lookup an item and setup other information like "quantity", "special price", "discount", etc..
Of course I would let the user able to add how many order_detail he wants.

How can I achieve this? In my test I wouldn't able to set this type of UI.

Thanks a lot!

To review the related items to an order you need to:

  1. Have a relation defined between the two entities
  2. Create in "Item" the list or view you want to represent this item in the view. You may need to define also the QuickEdit and QuickCreate views for "Item" as they will be used when a view or list is embedded.

3.a. In the selected order view > Main Form, add the relation so it could add its elements (from Item) to the library for drag & drop. Than find the "Item" field, view or list you want to be included in the view and it will insert it in the place you drag and drop it.

3.b. In the selected order view > Sidebar Forms, add the relation so it can add its views or list from the "Item" entity, than drag and & drop and it will appear as a sidebar item of this view.

Hi,

I tried as described but I can't get it works.
I have a 1:N relation between entities and I created the "item" required view.
I drag&drop it into the Main Form of order view, but I can see just two textboxes (quantity, special price)...I cannot see the dropdownlist with the "item" lookup.

The order view also let me define just one "order_detail" row, even if I have configured the relation as 1:N.

Where am I doing wrong?

Thanks

I will prepare some screenshots tomorrow for you, I hope it will help.

Thanks a lot!

I checked and I think there is a bug there. Something from the latest changes. I will take a look on Monday and feedback.
By the way upon your example - The relation should be probably be N:N, not that this matters for the bug :)

Ok so the problems was that the action buttons for adding "items" to the order were not added by default to the recursive list or view that represented the items in the order.
This is fixed now but you will need to manage the list/view from relation you are adding to the order view to have proper action items.
To do that just navigate to the management screen for the selected list/view. Go to "Actions" tab. There just choose multiple times "Add from Template" for the following items, select them and press "Add" without the need to change anything in the form. The items are:
If you choose a list:
wv_recursive_list_add_existing
wv_recursive_list_add_new
wv_recursive_list_view
wv_recursive_list_edit
wv_recursive_list_unrelate

If you chose a view:
wv_recursive_view_add_existing
wv_recursive_view_add_new
wv_recursive_view_edit
wv_recursive_view_unrelate

when you save the view/list, it will will be able to now see two buttons in the order form "Add existing" and "Create & Add". This will allow you to either add existing items to the order or create new ones.
Just have in mind that if you are using "item" not "order_item", the relation should be N:N as you may add one item to multiple orders, and one order can have multiple items.

Hope this helps

It is important to get the new changes before hand as there was another bug fixed there too and also for this not to happen any more.
If you want to bypass the above action adding process you can just create (not clone) and use new list after the update