flectra/addons/website_membership/models/membership.py
flectra-admin 769eafb483 [INIT] Inception of Flectra from Odoo
Flectra is Forked from Odoo v11 commit : (6135e82d73)
2018-01-16 11:45:59 +05:30

20 lines
720 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class MembershipLine(models.Model):
_inherit = 'membership.membership_line'
def get_published_companies(self, limit=None):
if not self.ids:
return []
limit_clause = '' if limit is None else ' LIMIT %d' % limit
self.env.cr.execute("""
SELECT DISTINCT p.id
FROM res_partner p INNER JOIN membership_membership_line m
ON p.id = m.partner
WHERE website_published AND is_company AND m.id IN %s """ + limit_clause, (tuple(self.ids),))
return [partner_id[0] for partner_id in self.env.cr.fetchall()]