tailbone.views.purchasing.ordering

Views for ‘ordering’ (purchasing) batches

class tailbone.views.purchasing.ordering.OrderingBatchView(request)[source]

Master view for “ordering” batches.

model_class = <class 'rattail.db.model.batch.purchase.PurchaseBatch'>
default_handler_spec = 'rattail.batch.purchase:PurchaseBatchHandler'
configure_row_form(f)[source]

Supplements the default logic as follows:

When editing, only these fields allow changes; all others are made read-only:

  • cases_ordered

  • units_ordered

worksheet_update()[source]

Handles AJAX requests to update the order quantities for some row within the current batch, from the worksheet view. POST data should include:

  • product_uuid

  • cases_ordered

  • units_ordered

If a row already exists for the given product, it will be updated; otherwise a new row is created for the product and then that is updated. The handler’s update_row_quantity() method is invoked to update the row.

However, if both of the quantities given are empty, and a row exists for the given product, then that row is removed from the batch, instead of being updated. If a matching row is not found, it will not be created.