summaryrefslogtreecommitdiff
path: root/addons/website_twitter/models
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2019-08-01 16:35:35 +0000
committerRomain Derie <rde@odoo.com>2019-08-13 10:02:32 +0000
commit2f361bec36dff09181b96d140d62c477cdf013a1 (patch)
tree296efcf83b79c2d0517e18cef7570d1219729890 /addons/website_twitter/models
parentcb3c2e64c367c5b46bb8d4e253473c162e4dbaca (diff)
[FIX] website(_*): better ondelete management on website_id
Before this commit, every model having website_id would have the default `set null` as ondelete value for that field. Exception for `ir.ui.view` and `website.redirect` which are set to `cascade`. This meant that deleting a website would basically transform all its specific records into generic ones. That would lead to unwanted behavior, such as multiple `ir.attachment` with same URL, when 2 websites had been theme-customized. Deleting one of the website would result in later crashes when trying to open theme customization in the remaining website(s), since those website would find their specific scss custom attachment as well as the generic one from the deleted website. Probably more behavior might be problematic when deleting a website before this commit. To summarize the choice of this commit implementation, every model not existing outside website module are set to `cascade` (website.redirect, website.menu, product.wishlist..). The rest should be in restrict, as we don't want to delete a whole forum, blog or job, which should probably be managed case by case to decide what to do. Thus, restrict is a good choice to notify user of what should be handled. Some exception remains, ir.ui.view should be delete on cascade while sale.order should be set to null. opw-2038414 opw-2035249 closes odoo/odoo#35398 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website_twitter/models')
-rw-r--r--addons/website_twitter/models/website_twitter_tweet.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website_twitter/models/website_twitter_tweet.py b/addons/website_twitter/models/website_twitter_tweet.py
index 4e80e439296..6fa6fb1564c 100644
--- a/addons/website_twitter/models/website_twitter_tweet.py
+++ b/addons/website_twitter/models/website_twitter_tweet.py
@@ -8,7 +8,7 @@ class WebsiteTwitterTweet(models.Model):
_name = 'website.twitter.tweet'
_description = 'Website Twitter'
- website_id = fields.Many2one('website', string='Website')
+ website_id = fields.Many2one('website', string='Website', ondelete='cascade')
screen_name = fields.Char(string='Screen Name')
tweet = fields.Text(string='Tweets')