This question has been flagged

Hello,

I created a custom module that's add one2many on sale.order.line. Instead of entering sale.order.line directly in the tree view on sale.order form, I open a new form (I removed editable="bottom" on tree). The form is a popup, because it's look like I can not open as "current" view on one2many as I see here (https://www.odoo.com/fr_FR/forum/aide-1/question/make-click-on-one2many-open-a-full-form-53011). So, on my new form, I can edit the sale.order.line. In that form I have a tree view to edit my new one2many. I can edit directly in treeview. When I save a new record all is working fine. When I edit only one record (sale.order.line), it's working fine too, BUT, when I edit more than one sale.order.line, the last order line I edited dupplicate the values of the new one2many field. I looked the values posted on write of the sale order and I see the problem.

My new one2many field is called order_line_child. I only created a new record on that fields and in addition to create my new record, it create my already exising record again. If you look following values, the first record is posted as creation using (0, 0, { values }). You can see that there is already and ID on second parameters ([0, 460, ).... This record wasn't modified...so I should only get the creation of the new record identified by [0, 'virtual_927'.... Why this happens?

        'order_line_child': [
            [0, 460, {'price_unit': 1.16, 'product_uom_qty': 1, 'currency_id': 5, 'st_received': False, 'st_description': False, 'product_id': 6170, 'product_uom': 20}],
            [0, 'virtual_927', {'price_unit': 23.900000000000002, 'product_id': 6404, 'order_line_id': False, 'st_received': False, 'currency_id': 5, 'product_uom_qty': 1, 'st_description': False, 'product_uom': 1}]
        ]}


Avatar
Discard

update your question with the code that you have tried and in better format