Create new widget to add new records after select

I built new 2 modules Production Plan and relationship one-to-many with Goods Issue, how to create new widget to select AOS_Products and then create new records in Goods Issue, have any suggestion?


Why not just do it from the subpanel that is generated automatically when you create the one-to-many relationship? You can create items from there.

Thanks for your reply, I need create many items in subpanel so if I create one by one it take me time, so I want to select items list and then system will create multi record in subpanel.

If you want that automatic behavior to happen on-screen, as soon as the user selects the product, then you need to inject some javascript into the view to work on that.

But it’s simpler if you are ok with selecting, then hitting save, and you would do the rest server-side, in an after_save logic hook that iterates the related records and creates the new ones.

Yes, I wrote after_relationship_add logic hooks to create new records after selected, and it worked but it in difference screen so it is not good :smiley:

Look for examples on how to inject Javascript into the view, like this one

That one is for validation, but you can adapt it to be whatever you need. You can do everything from Javascript and change the relevant parts of the screen displayed to the user.

Thanks, I will try with this solution