26 lines
748 B
Python
26 lines
748 B
Python
from odoo import http
|
|
from odoo.http import request
|
|
|
|
|
|
class DirectoryController(http.Controller):
|
|
|
|
@http.route(["/observatorio"], type="http", auth="public", website=True)
|
|
def directory(self, **kwargs):
|
|
partners = (
|
|
request.env["res.partner"]
|
|
.sudo()
|
|
.search(
|
|
[
|
|
("is_company", "=", True),
|
|
("show_in_directory", "=", True),
|
|
("partner_latitude", "!=", False),
|
|
("partner_longitude", "!=", False),
|
|
]
|
|
)
|
|
)
|
|
return request.render(
|
|
"website_partner_directory.directory_page",
|
|
{
|
|
"partners": partners,
|
|
},
|
|
)
|