sub init_all_warehouses { SL::DB::Manager::Warehouse->get_all_sorted }
sub init_all_languages { SL::DB::Manager::Language->get_all_sorted }
sub init_all_currencies { SL::DB::Manager::Currency->get_all_sorted }
-sub init_all_weightunits { SL::DB::Manager::Unit->find_by(name => 'g')->convertible_units }
+sub init_all_weightunits { my $unit = SL::DB::Manager::Unit->find_by(name => 'g'); $unit ? $unit->convertible_units : [] }
sub init_all_templates { +{ SL::Template->available_templates } }
sub init_posting_options {
<td align="center">[% L.radio_button_tag('defaults.currency_id', value=-1, id='defaults.currency_id__1', checked=(SELF.defaults.currency_id == -1)) %]</td>
</tr>
+[% IF SELF.all_weightunits.size %]
<tr><td class="listheading" colspan="4">[% LxERP.t8("Weight") %]</td></tr>
<tr>
<td>[% L.yes_no_tag('defaults.show_weight', SELF.defaults.show_weight, style=style) %]</td>
<td colspan="2">[% LxERP.t8('Show the weights of articles and the total weight in orders, invoices and delivery notes?') %]</td>
</tr>
+[% END %]
</table>
</div>
</div>