This question has been flagged
1 Reply
1879 Views

I am currently working on some custom module related to sale order.


Everything seems fine until I try to delete the sale_order_line and click save. 

The error message shows as below and I was not able to delete the order line:


Record does not exist or has been deleted.

(Records: [48], User: 2)

I tried to find the real error in log, but no error or warning was shown in the log. 

Then I checked the database, the sale_order_line record 48 does exist in the database.

I am not sure what else I can look into.


One thing I would like to mention is that my custom module only inherit sale_order, however, some fields in sale_order_line was looped through to make some necessary calculations for my custom module.


I am not sure which part of the code I should provide here as I could not even get any error in the log. 


If anyone has encountered some similar issue please help me or maybe give me some hint on where the issue might be, thank you.


Avatar
Discard
Author Best Answer

I found the reason, it was in the overridden write() function. The deleted values was still in the dictionary when I use the super().write() the second time.

Avatar
Discard

Can you elaborate give some example please ?

I have created a parent / child (Many2one) relationship between order lines (meaning that I am creating some lines connected to others)

I have configured the `ondelete` to be cascade but as soon as I am deleting the parent line it raises the same error and doesn't delete any line actually