I 'm currently creating a widget in Odoo 10. It has a button and an user can click on this button and then, a dialog will appear, allow user to choose multiple records and add them to a corresponding One2Many field. For example, I can choose multiple products and add them to a new sale order, the corresponding order lines will be added to the sale order as if you use the original Many2One widget, and add these products one by one. Furthermore, The added order lines will only be saved when you press save button.
My widget currently can allow user to choose multiple records, but I don't know how to temporarily add them to the One2Many tree using Javascript. I noticed that every One2Many field has an dataset property, but I have no idea what to do with it. Can any one suggest me what should I do to achieve this feature? Thank you in advance !