This question has been flagged

What I'm trying to do:

1. Create a new record (for reference: record A)  in a new model (no inherit or whatsoever)

2. When a user selects a partner using a default Many2one field to res.partner, the data from that partner should be collected. The data I specifically need is stored in a many2one field containing a few records.

3. On record A, that has NOT been saved, I now need to replicate the data from the Many2one field so I use the "the_field_on_record_A.create({'...':...})"

4. The user interface should show the added records.


What really happens: 

On step 3 the records get created in the database. However since record A does not have an ID yet, the newly created records in the database do not get linked back. They exists, yes, but the field that contains the ID of record A is 'None'.

I guess there's a problem with creating a new record from a new record? When I print out the ID of record A it also shows me that it's a 'newID' and the newID is useless for storing data to the database.  The strange part is, how come the default functionality of adding records to that field I need to fill is preserved when doing it manually in the front end?

What would be the best way to solve this problem?


Avatar
Discard