21 lines
634 B
Python
21 lines
634 B
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Extend blog.post to add reverse relationship to itsulu.blog.post.social.
|
|
"""
|
|
from odoo import fields, models
|
|
|
|
|
|
class BlogPost(models.Model):
|
|
_inherit = 'blog.post'
|
|
|
|
itsulu_social_id = fields.One2many(
|
|
comodel_name='itsulu.blog.post.social',
|
|
inverse_name='blog_post_id',
|
|
string='Social Media Copy',
|
|
help='Social media copy generated for this post.',
|
|
)
|
|
|
|
def get_social_copy(self):
|
|
"""Return the single social copy record, or False if none exists."""
|
|
self.ensure_one()
|
|
return self.itsulu_social_id[0] if self.itsulu_social_id else False
|