Auto-filter hyperlinks for PO vs. invoice breakdown in Receiving
This commit is contained in:
parent
4d404cb20b
commit
8ae1b87a1e
|
@ -158,7 +158,7 @@
|
|||
<div class="object-helper">
|
||||
<h3>Row Status Breakdown</h3>
|
||||
<div class="object-helper-content">
|
||||
${status_breakdown_grid|n}
|
||||
${status_breakdown_grid}
|
||||
</div>
|
||||
</div>
|
||||
% elif status_breakdown is not Undefined and status_breakdown is not None:
|
||||
|
|
|
@ -288,7 +288,7 @@
|
|||
<div class="object-helper">
|
||||
<h3>PO vs. Invoice</h3>
|
||||
<div class="object-helper-content">
|
||||
${po_vs_invoice_breakdown_grid.render_buefy_table_element(data_prop='poVsInvoiceBreakdownData', empty_labels=True)|n}
|
||||
${po_vs_invoice_breakdown_grid}
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
||||
|
@ -371,8 +371,51 @@
|
|||
ThisPageData.autoReceiveShowDialog = false
|
||||
ThisPageData.autoReceiveSubmitting = false
|
||||
|
||||
% if po_vs_invoice_breakdown_grid is not Undefined:
|
||||
ThisPageData.poVsInvoiceBreakdownData = ${json.dumps(po_vs_invoice_breakdown_grid.get_buefy_data()['data'])|n}
|
||||
% if po_vs_invoice_breakdown_data is not Undefined:
|
||||
ThisPageData.poVsInvoiceBreakdownData = ${json.dumps(po_vs_invoice_breakdown_data)|n}
|
||||
|
||||
ThisPage.methods.autoFilterPoVsInvoice = function(row) {
|
||||
let filters = []
|
||||
if (row.key == 'both') {
|
||||
filters = [
|
||||
{key: 'po_line_number',
|
||||
verb: 'is_not_null'},
|
||||
{key: 'invoice_line_number',
|
||||
verb: 'is_not_null'},
|
||||
]
|
||||
} else if (row.key == 'po_not_invoice') {
|
||||
filters = [
|
||||
{key: 'po_line_number',
|
||||
verb: 'is_not_null'},
|
||||
{key: 'invoice_line_number',
|
||||
verb: 'is_null'},
|
||||
]
|
||||
} else if (row.key == 'invoice_not_po') {
|
||||
filters = [
|
||||
{key: 'po_line_number',
|
||||
verb: 'is_null'},
|
||||
{key: 'invoice_line_number',
|
||||
verb: 'is_not_null'},
|
||||
]
|
||||
} else if (row.key == 'neither') {
|
||||
filters = [
|
||||
{key: 'po_line_number',
|
||||
verb: 'is_null'},
|
||||
{key: 'invoice_line_number',
|
||||
verb: 'is_null'},
|
||||
]
|
||||
}
|
||||
|
||||
if (!filters.length) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$refs.rowGrid.setFilters(filters)
|
||||
document.getElementById('rowGrid').scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
|
||||
% endif
|
||||
|
||||
</script>
|
||||
|
|
|
@ -674,6 +674,7 @@ class ReceivingBatchView(PurchasingBatchView):
|
|||
for key, label in labels.items():
|
||||
if key in grouped:
|
||||
breakdown.append({
|
||||
'key': key,
|
||||
'title': label,
|
||||
'count': len(grouped[key]),
|
||||
})
|
||||
|
@ -683,11 +684,22 @@ class ReceivingBatchView(PurchasingBatchView):
|
|||
def template_kwargs_view(self, **kwargs):
|
||||
kwargs = super(ReceivingBatchView, self).template_kwargs_view(**kwargs)
|
||||
batch = kwargs['instance']
|
||||
use_buefy = self.get_use_buefy()
|
||||
|
||||
if self.handler.has_purchase_order(batch) and self.handler.has_invoice_file(batch):
|
||||
breakdown = self.make_po_vs_invoice_breakdown(batch)
|
||||
|
||||
factory = self.get_grid_factory()
|
||||
if use_buefy:
|
||||
|
||||
g = factory('batch_po_vs_invoice_breakdown', [],
|
||||
columns=['title', 'count'])
|
||||
g.set_click_handler('title', "autoFilterPoVsInvoice(props.row)")
|
||||
kwargs['po_vs_invoice_breakdown_data'] = breakdown
|
||||
kwargs['po_vs_invoice_breakdown_grid'] = HTML.literal(
|
||||
g.render_buefy_table_element(data_prop='poVsInvoiceBreakdownData',
|
||||
empty_labels=True))
|
||||
|
||||
else:
|
||||
kwargs['po_vs_invoice_breakdown_grid'] = factory(
|
||||
'batch_po_vs_invoice_breakdown',
|
||||
data=breakdown,
|
||||
|
|
Loading…
Reference in a new issue