sub available_discounts {
my ($self, %params) = @_;
+ return if $self->part->not_discountable;
return unless $self->record->is_sales;
return unless $self->record->customer;
return unless $self->record->customer->discount != 0;
);
}
-sub price_from_source {
+sub price_from_source { }
+
+sub discount_from_source {
my ($self, $source, $spec) = @_;
my $customer = SL::DB::Customer->load_cached($spec);
)
}
- if (!$self->record->customer) {
+ if (!$self->record->can('customer') || !$self->record->customer) {
return SL::PriceSource::Discount->new(
discount => $customer->discount,
spec => $customer->id,
spec => $customer->id,
description => t8('Customer Discount'),
price_source => $self,
- invalid => t8('This discount is only valid for customer #1', $customer->full_description),
+ invalid => t8('This discount is only valid for customer #1', $customer->displayable_name),
)
}