Skip to content

Commit

Permalink
💣 Added apps and packages visibility properties in website settings
Browse files Browse the repository at this point in the history
Signed-off-by: Vildan Safin <[email protected]>
  • Loading branch information
Enigma228322 committed May 11, 2020
1 parent 540cb72 commit c2210a4
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 170 deletions.
5 changes: 4 additions & 1 deletion saas_apps/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ class SaaSAppsController(Controller):

@route('/price', type='http', auth='public', website=True)
def user_page(self, **kw):
res = request.env['res.config.settings'].get_values()
apps = request.env['saas.line'].sudo()
packages = request.env['saas.template'].sudo()
if not apps.search_count([]):
apps.refresh_lines()
return request.render('saas_apps.index', {
'apps': apps.search([('allow_to_sell', '=', True)]),
'packages': packages.search([('set_as_package', '=', True)])
'packages': packages.search([('set_as_package', '=', True)]),
'show_apps': bool(res['show_apps']),
'show_packages': bool(res['show_packages'])
})

@route(['/refresh'], type='json', auth='public')
Expand Down
21 changes: 21 additions & 0 deletions saas_apps/models/saas_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,24 @@ class SAASProduct(models.Model):

application = fields.Many2many('saas.line')
package = fields.Many2many('saas.template')


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

show_packages = fields.Boolean('Show packages',
config_parameter='saas_apps.show_packages')
show_apps = fields.Boolean('Show apps',
config_parameter='saas_apps.show_apps')

@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()
select_type = self.env['ir.config_parameter'].sudo()
packages = select_type.get_param('saas_apps.show_packages')
apps = select_type.get_param('saas_apps.show_apps')
res.update({
'show_packages' : packages,
'show_apps' : apps
})
return res
1 change: 1 addition & 0 deletions saas_apps/static/src/css/calculator.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
max-height: 70px;
display: flex;
margin-bottom: 10px;
min-width: 174px;
}

.app-data{
Expand Down
Loading

0 comments on commit c2210a4

Please sign in to comment.