add lots in list of erasures actions

This commit is contained in:
Cayo Puigdefabregas 2023-03-09 18:38:54 +01:00
parent 6d722bb19f
commit 20ccb385d8
2 changed files with 8 additions and 2 deletions

View File

@ -676,6 +676,12 @@ class Device(Thing):
return args
def get_lots_for_template(self):
if self.binding:
return self.binding.device.get_lots_for_template()
if not self.lots and hasattr(self, 'parent') and self.parent:
return self.parent.get_lots_for_template()
lots = []
for lot in self.lots:
if lot.is_incoming:

View File

@ -187,9 +187,9 @@
{% endif %}
{{ ac.device.serial_number.upper() }}
{% endif %}
{% if ac.device.my_partner.lots | length > 0 %}
{% if ac.device.get_lots_for_template() | length > 0 %}
<h6 class="d-inline">
{% for lot in ac.device.my_partner.get_lots_for_template() %}
{% for lot in ac.device.get_lots_for_template() %}
<span class="badge rounded-pill bg-light text-dark">{{ lot }}</span>
{% endfor %}
</h6>