We also had the same problem with a clients site.
The wee_discount table stores a discount to be applied to each product. If you look at the table, it includes a reference to the product, the website, the customer group and a value that will alter the catalog price displayed to the user.
In my case, the rule was
”give a 10% discount to all customers in the ‘preferred customer group’ on all products”.
So, because this rule is to be applied to ‘ALL’ products, when you add a new product, it adds an entry into this table. However, when you save the product, the forign key or product reference used to apply the discount is not the actual product key for the newly added product. It is instead an auto increment.
So when we Iooked at the database, the last few catalog_product_entity.entity_id’s were:
and the product I was inserting was to have an id of 1710. Why? because the client had deleted some products ; namely 1706-1709.
Meanwhile the weee_discount table’s last few entries were:
and what does it try to do? it tries to add a new record with an entity_id of 1706 which is the cause of the error. the catalog_product_entity record with an id of 1706 has been deleted and the foreign key constraint requires there be a product there.
To fix the issue, I removed the rule and advised the client not to use that feature until we can apply a fix.
Hope that helps!