Skip to content

Commit

Permalink
restores group buy checkbox as default option
Browse files Browse the repository at this point in the history
  • Loading branch information
smirolo committed Apr 24, 2024
1 parent 01f58fc commit a7647df
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions saas/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ def __init__(self, *args, **kwargs):
self.fields['is_bulk_buyer'] = forms.BooleanField(required=False,
initial=initial,
label=mark_safe(_("Enable GroupBuy (<a href=\""\
"https://djaodjin.com/docs/#group-billing\" target=\"_blank\">what is it?</a>)"
)))
"https://www.djaodjin.com/docs/faq/#group-billing\" target=\"_blank\">"\
"what is it?</a>)")))
if 'is_provider' in self.initial:
initial = self.initial['is_provider']
if self.instance:
Expand Down
2 changes: 1 addition & 1 deletion saas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class AbstractOrganization(models.Model):

is_bulk_buyer = models.BooleanField(default=False,
help_text=mark_safe(_("Enable GroupBuy ("\
"<a href=\"https://djaodjin.com/docs/#group-billing\""\
"<a href=\"https://www.djaodjin.com/docs/faq/#group-billing\""\
" target=\"_blank\">what is it?</a>)")))
is_provider = models.BooleanField(default=False,
help_text=_("The profile can fulfill the provider side"\
Expand Down
2 changes: 1 addition & 1 deletion saas/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
'CSV_CUSTOMER_CONTACTS_INCLUDED': True,
'DEFAULT_UNIT': 'usd',
'DISABLE_UPDATES': False,
'DISPLAY_BULK_BUYER_TOGGLE': False,
'DISPLAY_BULK_BUYER_TOGGLE': True,
'EXPIRE_NOTICE_DAYS': [15],
'EXTRA_MIXIN': object,
'EXTRA_FIELD': None,
Expand Down
8 changes: 5 additions & 3 deletions saas/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,12 @@ def get_form_class(self):

def get_initial(self):
kwargs = super(OrganizationProfileView, self).get_initial()
if Plan.objects.exists() and settings.DISPLAY_BULK_BUYER_TOGGLE:
# Do not display the bulk buying option if there are no plans.
kwargs.update({'is_bulk_buyer': self.object.is_bulk_buyer})
if _valid_manager(self.request, [get_broker()]):
# Shows checkbox for `is_bulk_buyer` and `is_provider` only
# to brokers.
if Plan.objects.exists() and settings.DISPLAY_BULK_BUYER_TOGGLE:
# Do not display the bulk buying option if there are no plans.
kwargs.update({'is_bulk_buyer': self.object.is_bulk_buyer})
kwargs.update({
'is_provider': self.object.is_provider,
'extra': self.object.extra})
Expand Down

0 comments on commit a7647df

Please sign in to comment.