[FIX] website_blog: post_date inverse function in blog post

before this commit, on clearing the value from
post_date field in the blog.post model is
not recalculating the post_date value
from the inverse function.

* open a blog post
* clear the post date value
* click go to website smart button
* traceback will be shown due to missing date

_write is not needed because it was done for
method _compute_ranking, which doesn't exist
in v16 https://github.com/odoo/odoo/commit/74e1d6940da7b5f0cc8fe4b2ba60d0bb81990ba5

post_date is computed method with inverse
 function which is handled in write, not in _write

after this commit, on clearing post_date value
the inverse function will set the post_date
value from create date as it was in the
previous versions.

closes odoo/odoo#120858

X-original-commit: f2f45cddede53d201e4efbe27a86e208ebf51ab1
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
This commit is contained in:
niyasraphy
2023-05-09 11:57:31 +02:00
parent 088b4b76c1
commit 4a71b51f59
+1 -1
View File
@@ -216,7 +216,7 @@ class BlogPost(models.Model):
for blog_post in self:
blog_post.published_date = blog_post.post_date
if not blog_post.published_date:
blog_post._write(dict(post_date=blog_post.create_date)) # dont trigger inverse function
blog_post.post_date = blog_post.create_date
def _check_for_publication(self, vals):
if vals.get('is_published'):