Hello,
i've got a very strange problem with a create in a loop !!
I create a model s_placement_of like this :
and i added the following field in mrp.production model :
in mrp.production, i added this function :
Note that i added a log function at the beginning of the loop to write in log the value of colum s_nom_placement read (key PLA:), and an other one at the end to see all values i will create (key pla:)
Here is the last MO for the product (CO115) i will use :
You can see i added a new tab "Placements" to display all placement of the MO
Every lines are identicals except in columns "Lettre" and "Nom Placement" (in red)
Note that (in blue), in column "Matiere", every values are identicals (very important for the problem, see later)
Now, if i create a manual MO and select the same product CO115
We can see in the log, that each value of the column "Nom Placement" (s_nom_placement) are different. That's ok!
But when i look in the tab "Placements" (in red), i can see that the 3 lines are identicals (and in the database too)
I don't understand why according to the log, i write the good values but after create, values are wrongs.
And other thing, if i select the same product again (without save the MO), values are good!
Last thing
In a previous screen above, we see (in blue) that values are identicals in the column "Matière" (s_matiere)
If i create a new MO and select an other product wich last MO had 3 lines of placements with differents "matière", there is no problem!!!!
Is anybody understand what's happen here because i search until days without solution?
Hope you can help me
Vincent