Compare commits

..

3 Commits

Author SHA1 Message Date
Mira Weller
d4246cf752 Fix required-if references as well 2025-01-24 16:25:37 +01:00
Mira Weller
f3022ddca9 Remove duplicate attribute 2025-01-24 12:13:40 +01:00
Mira Weller
939a591061 Fix company & vat_id dependencies on is_business 2025-01-24 11:36:21 +01:00
3 changed files with 9 additions and 16 deletions

View File

@@ -1025,10 +1025,9 @@ class BaseInvoiceAddressForm(forms.ModelForm):
'autocomplete': 'address-level2',
}),
'company': forms.TextInput(attrs={
'data-display-dependency': '#id_is_business_1',
'autocomplete': 'organization',
}),
'vat_id': forms.TextInput(attrs={'data-display-dependency': '#id_is_business_1'}),
'vat_id': forms.TextInput(),
'internal_reference': forms.TextInput,
}
labels = {
@@ -1059,10 +1058,8 @@ class BaseInvoiceAddressForm(forms.ModelForm):
super().__init__(*args, **kwargs)
# If an individual or company address is acceptable, #id_is_business_0 == individual, _1 == company.
# However, if only company addresses are acceptable, #id_is_business_0 == company and is the only choice
self.fields["company"].widget.attrs["data-display-dependency"] = f'#id_{self.add_prefix("is_business")}_{int(not self.company_required)}'
self.fields["vat_id"].widget.attrs["data-display-dependency"] = f'#id_{self.add_prefix("is_business")}_{int(not self.company_required)}'
self.fields["company"].widget.attrs["data-display-dependency"] = f'input[name="{self.add_prefix("is_business")}"][value="business"]'
self.fields["vat_id"].widget.attrs["data-display-dependency"] = f'input[name="{self.add_prefix("is_business")}"][value="business"]'
if not self.ask_vat_id:
del self.fields['vat_id']
@@ -1143,9 +1140,9 @@ class BaseInvoiceAddressForm(forms.ModelForm):
)
if self.address_required and not self.company_required and not self.all_optional:
if not event.settings.invoice_name_required:
self.fields['name_parts'].widget.attrs['data-required-if'] = f'#id_{self.add_prefix("is_business")}_0'
self.fields['name_parts'].widget.attrs['data-required-if'] = f'input[name="{self.add_prefix("is_business")}"][value="individual"]'
self.fields['name_parts'].widget.attrs['data-no-required-attr'] = '1'
self.fields['company'].widget.attrs['data-required-if'] = f'#id_{self.add_prefix("is_business")}_1'
self.fields['company'].widget.attrs['data-required-if'] = f'input[name="{self.add_prefix("is_business")}"][value="business"]'
if not event.settings.invoice_address_beneficiary:
del self.fields['beneficiary']

View File

@@ -338,7 +338,7 @@ class CheckinErrorLogEntryType(OrderLogEntryType):
else:
data['list'] = _("(unknown)")
data['barcode'] = data.get('barcode', '')[:16]
data['barcode'] = data.get('barcode')[:16]
data['posid'] = logentry.parsed_data.get('positionid', '?')
if 'datetime' in data:
@@ -351,7 +351,6 @@ class CheckinErrorLogEntryType(OrderLogEntryType):
return str(plain_without_dt).format_map(data)
@log_entry_types.new('pretix.event.checkin')
class CheckinLogEntryType(CheckinErrorLogEntryType):
def display(self, logentry: LogEntry, data):
if data.get('type') == Checkin.TYPE_EXIT:
@@ -378,7 +377,6 @@ class CheckinLogEntryType(CheckinErrorLogEntryType):
)
@log_entry_types.new()
class OrderConsentLogEntryType(OrderLogEntryType):
action_type = 'pretix.event.order.consent'
@@ -388,7 +386,6 @@ class OrderConsentLogEntryType(OrderLogEntryType):
)
@log_entry_types.new()
class OrderCanceledLogEntryType(OrderLogEntryType):
action_type = 'pretix.event.order.canceled'
@@ -400,7 +397,6 @@ class OrderCanceledLogEntryType(OrderLogEntryType):
return _('The order has been canceled.')
@log_entry_types.new()
class OrderPrintLogEntryType(OrderLogEntryType):
action_type = 'pretix.event.order.print'
@@ -533,7 +529,7 @@ class VoucherRedeemedLogEntryType(VoucherLogEntryType):
})
return format_html(
self.plain,
order_code=format_html('<a href="{}">{}</a>', url, data.get('order_code', '?')),
order_code=format_html('<a href="{}">{}</a>', url, data('order_code', '?')),
)

View File

@@ -51,8 +51,8 @@ def register_payment_provider(sender, **kwargs):
class PaypalEventLogEntryType(EventLogEntryType):
action_type = 'pretix.plugins.paypal.event'
def display(self, logentry, data):
event_type = data.get('event_type')
def display(self, logentry):
event_type = logentry.parsed_data.get('event_type')
text = None
plains = {
'PAYMENT.SALE.COMPLETED': _('Payment completed.'),