25 lines
804 B
Python
25 lines
804 B
Python
# -*- coding: utf-8 -*-
|
|
from odoo import http
|
|
from odoo.addons.ospp_base.tools.cloud_auth import verified, RESPONSE
|
|
|
|
|
|
class OsppBase(http.Controller):
|
|
|
|
@verified(permission="Cloud Resources#read")
|
|
@http.route('/instance/info', type='json', methods=['POST'], auth='public')
|
|
def instance_info(self, *args, **kwargs):
|
|
user_count = http.request.env['res.users'].sudo().search_count([('share', '!=', True)])
|
|
sku_count = http.request.env['product.product'].sudo().search_count([]) if http.request.env.get('product.product') else 0
|
|
data ={
|
|
'user_count': user_count,
|
|
'sku_count': sku_count
|
|
}
|
|
|
|
response = RESPONSE.copy()
|
|
response.update(
|
|
{
|
|
"data": data
|
|
}
|
|
)
|
|
return response
|