3

我在其中一间 odoo | 工作 openerp 模块。但是在我的模块评论部分显示页面上的所有评论。所以我想添加显示更多评论按钮

以下是我的观点内容:

<button class="btn mt8 oe_button">Show more...</button>

我的模型:py文件

class Comment(models.Model):

_name = 'page.comment'
_comments_per_list = 10

我的模型中的相关评论字段是:

website_message_ids = fields.One2many(
    'mail.message', 'res_id',
    domain=lambda self: [('model', '=', self._name), ('type', '=', 'comment')],
    string='Website Messages', help="Website communication history")

相关方法是:

@api.multi
def get_comment_detail(self):
    try:
        comments = self.website_message_ids
        values.update({
            'channel': self.channel_id,
            'user': user,
            'comments': comments,
        })
        return values

简要描述;简介:

如果一个页面获得 N 条评论而不是默认显示所有评论。但我想在“显示更多评论”下控制我的流程。那么,如何在我的model.py中完成,我不知道如何处理它。

每次点击时,应加载 10 条评论。

感谢您的帮助 | 提前提出建议

4

1 回答 1

0
$('.load_comments').on('click', function () {

openerp.jsonRpc("/slides/expand_comment", + $(this).attr('slide-id'), 'call', {
    'values': comments,
}).then(function (data) {
        $(data.target).closest('.list_comment').html($('<div class="media"</div>'));
        // slides: data
});

});

试试上面的jsonrpc方法

于 2015-01-17T20:10:11.140 回答