Show links to claiming rows for truck dump parent row
This commit is contained in:
parent
5e879a2d92
commit
21740ea2fd
|
@ -234,6 +234,7 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
'invoice_unit_cost',
|
'invoice_unit_cost',
|
||||||
'invoice_total',
|
'invoice_total',
|
||||||
'status_code',
|
'status_code',
|
||||||
|
'claims',
|
||||||
'credits',
|
'credits',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -679,12 +680,30 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
|
|
||||||
def configure_row_form(self, f):
|
def configure_row_form(self, f):
|
||||||
super(ReceivingBatchView, self).configure_row_form(f)
|
super(ReceivingBatchView, self).configure_row_form(f)
|
||||||
|
batch = self.get_instance()
|
||||||
|
|
||||||
f.set_readonly('cases_ordered')
|
f.set_readonly('cases_ordered')
|
||||||
f.set_readonly('units_ordered')
|
f.set_readonly('units_ordered')
|
||||||
f.set_readonly('po_unit_cost')
|
f.set_readonly('po_unit_cost')
|
||||||
f.set_readonly('po_total')
|
f.set_readonly('po_total')
|
||||||
f.set_readonly('invoice_total')
|
f.set_readonly('invoice_total')
|
||||||
|
|
||||||
|
# claims
|
||||||
|
if batch.is_truck_dump_parent():
|
||||||
|
f.set_renderer('claims', self.render_row_claims)
|
||||||
|
else:
|
||||||
|
f.remove_field('claims')
|
||||||
|
|
||||||
|
def render_row_claims(self, row, field):
|
||||||
|
items = []
|
||||||
|
for claim in row.claims:
|
||||||
|
child_row = claim.claiming_row
|
||||||
|
child_batch = child_row.batch
|
||||||
|
text = child_batch.id_str
|
||||||
|
url = self.get_row_action_url('view', child_row)
|
||||||
|
items.append(HTML.tag('li', c=[tags.link_to(text, url)]))
|
||||||
|
return HTML.tag('ul', c=items)
|
||||||
|
|
||||||
def validate_row_form(self, form):
|
def validate_row_form(self, form):
|
||||||
|
|
||||||
# if normal validation fails, stop there
|
# if normal validation fails, stop there
|
||||||
|
|
Loading…
Reference in a new issue