Skip to content

Commit

Permalink
💣 Added show 'buy now' button option in 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 28, 2020
1 parent da04c05 commit 0dbe77d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion saas_apps/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def user_page(self, **kw):
'apps': apps.search([('allow_to_sell', '=', True)]),
'packages': packages.search([('set_as_package', '=', True)]),
'show_apps': bool(res['show_apps']),
'show_packages': bool(res['show_packages'])
'show_packages': bool(res['show_packages']),
'show_buy_now_button':bool(res['show_buy_now_button'])
})

@route(['/refresh'], type='json', auth='public')
Expand Down
6 changes: 5 additions & 1 deletion saas_apps/models/saas_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,19 @@ class ResConfigSettings(models.TransientModel):
config_parameter='saas_apps.show_packages')
show_apps = fields.Boolean('Show apps',
config_parameter='saas_apps.show_apps')
show_buy_now_button = fields.Boolean("Show 'Buy now' button",
config_parameter='saas_apps.show_buy_now_button')

@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')
buy_now_button = select_type.get_param('saas_apps.show_buy_now_button')
res.update({
'show_packages' : packages,
'show_apps' : apps
'show_apps' : apps,
'show_buy_now_button' : buy_now_button
})
return res
4 changes: 3 additions & 1 deletion saas_apps/views/calculator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@
<h4 id="price" class="card-title pricing-card-title">10 <t t-esc="apps[0].currency_id.symbol"/> / </h4>
<small id="box-period" class="text-muted period fnt-24">year</small>
<button id="get-started" type="button" class="btn btn-lg btn-block btn-primary fnt-larger">Try trial</button>
<button id="buy-now" type="button" class="btn btn-lg btn-block btn-primary fnt-larger">Buy now</button>
<t t-if="show_buy_now_button">
<button id="buy-now" type="button" class="btn btn-lg btn-block btn-primary fnt-larger">Buy now</button>
</t>
</div>
</span>
</div>
Expand Down
8 changes: 8 additions & 0 deletions saas_apps/views/manage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@
</div>
</div>
</div>
<div class="col-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="show_buy_now_button"/>
</div>
<div class="o_setting_right_pane">
<label for="show_buy_now_button" string="Show 'Buy now' button"/>
</div>
</div>
</div>
</xpath>
</field>
Expand Down

0 comments on commit 0dbe77d

Please sign in to comment.