rattail.db.model.batch.purchase
¶
Models for purchase order batches
- class rattail.db.model.batch.purchase.PurchaseBatch(**kwargs)[source]¶
Hopefully generic batch used for entering new purchases into the system, etc.?
- buyer¶
Reference to the
Employee
who placed the order with the vendor, if applicable/known.
- buyer_uuid¶
- cognized¶
Date and time when the batch data was last cognized.
- cognized_by¶
Reference to the
User
who last cognized the batch data.
- cognized_by_uuid¶
- complete¶
Flag to indicate whether the batch is complete. This may be used to assist with workflow when entering/executing new batches.
- created¶
Date and time when the batch was first created.
- created_by¶
Reference to the
User
who first created the batch.
- created_by_uuid¶
- data_rows¶
Collection of data rows for the batch.
Note
I would prefer for this attribute to simply be named “rows” instead of “data_rows”, but unfortunately (as of this writing) “rows” is essentially a reserved word in FormAlchemy.
- date_ordered¶
Date on which the purchase order was first submitted to the vendor.
- date_received¶
Date on which the order was received at the store.
- date_shipped¶
Date on which the order was shipped from the vendor.
- department¶
Reference to the primary
Department
for which the purchase was made.
- department_uuid¶
- description¶
Basic (loosely identifying) description for the batch.
- executed¶
Date and time when the batch was (last) executed.
- executed_by¶
Reference to the
User
who (last) executed the batch.
- executed_by_uuid¶
- extra_data¶
Extra field for arbitrary data, useful to the batch handler etc. Note that there is no structure assumed here, it can be JSON or whatever is needed.
- id¶
Numeric ID for the batch, unique across all “new-style” batches within the Rattail database.
- invoice_date¶
Invoice date, if applicable.
- invoice_file¶
Base name for the associated invoice file, if any.
- invoice_number¶
Invoice number, e.g. for cross-reference with another system.
- invoice_parser_key¶
The key of the parser used to read the contents of the invoice file.
- invoice_total¶
Total cost according to the invoice.
- invoice_total_calculated¶
Calculated total for the invoice, per quantity received thus far. See also
invoice_total
.
- is_truck_dump_child()[source]¶
Returns boolean indicating whether or not the batch is a “truck dump” child.
- is_truck_dump_parent()[source]¶
Returns boolean indicating whether or not the batch is a “truck dump” parent.
Returns boolean indicating whether or not the batch is associated with a “truck dump” in any way, i.e. is a parent or child of such.
- mode¶
Numeric “mode” for the purchase batch, to indicate new/receiving etc.
- notes¶
Any arbitrary notes for the batch.
- notes_to_vendor¶
Any arbitrary notes to the vendor, regarding the purchase.
- order_file¶
Base name for the associated order file, if any.
- order_parser_key¶
The key of the parser used to read the contents of the order file, if applicable.
- order_quantities_known¶
Flag indicating whether the order quantities were known at time of batch creation / population. Really this is only used for batches of ‘receiving’ mode, to present a slightly different UI if order quantities were (not) known.
- params¶
Extra parameters for the batch, encoded as JSON. This hopefully can be useful for “many” batches, to avoid needing to add extra flags to the schema etc.
- po_number¶
Purchase order number, e.g. for cross-reference with another system.
- po_total¶
Total cost according to the initial purchase order.
- po_total_calculated¶
Calculated total for the purchase, per quantity ordered thus far. See also
po_total
.
- purchase¶
Reference to the purchase with which the batch is associated. May be null, e.g. in the case of a “new purchase” batch.
- purge¶
Date after which the batch may be purged.
- receiving_complete¶
Flag to indicate whether the “receiving” process is complete for the batch. Not applicable to all batches of course; depends on handler logic etc.
- row_class¶
alias of
PurchaseBatchRow
- rowcount¶
Cached row count for the batch. No guarantees perhaps, but should be accurate.
- ship_method¶
Code representing the shipping method.
- status_code¶
Status code for the batch as a whole. This indicates whether the batch is “okay” and ready to execute, or (why) not etc.
- status_text¶
Text which may briefly explain the batch status code, if needed.
- store¶
Reference to the
Store
for which the purchase was made.
- store_uuid¶
- truck_dump¶
Flag indicating whether a “receiving” batch is of the “truck dump” persuasion, i.e. it does not correspond to a single purchase order but rather is assumed to represent multiple orders.
- truck_dump_batch¶
Reference to the “truck dump” receiving batch, for which the current batch represents a single invoice which partially “consumes” the truck dump.
- truck_dump_children¶
List of batches which are “children” of the current batch, which is assumed to be a truck dump.
- truck_dump_children_first¶
If batch is a “truck dump parent”, this flag indicates whether its “children” are to be attached first as opposed to last. If the flag is true, all children must be attached prior to the receiving process. If flag is false, receiving must happen first, and then all children attached at the end.
- truck_dump_ready¶
If batch is a “truck dump parent”, this flag indicates whether it is “ready” for the actual receiving process. If children are to be attached first, this flag should not be set until all children are attached. If children are last, this flag should be set immediately upon batch creation.
- truck_dump_status¶
Truck dump status code for the batch. Only relevant for truck dump parent batches. Indicates whether this parent has been fully claimed by children yet, etc.
- uuid¶
- vendor¶
Reference to the
Vendor
to which the purchase was made.
- vendor_uuid¶
- class rattail.db.model.batch.purchase.PurchaseBatchCredit(**kwargs)[source]¶
Represents a working copy of purchase credit tied to a batch row.
- brand_name¶
Brand name for the credit item.
- case_quantity¶
Number of units in a single case of product.
- cases_shorted¶
Number of cases of product which were ordered but not received.
- credit_total¶
Actual total cost for credit, i.e. value of missing/damaged product.
- credit_type¶
Type of the credit, i.e. damaged/expired/mispick/missing
- date_ordered¶
Date on which the purchase order was first submitted to the vendor.
- date_received¶
Date on which the order was received at the store.
- date_shipped¶
Date on which the order was shipped from the vendor.
- department_name¶
Name of the department to which the product belongs.
- department_number¶
Number of the department to which the product belongs.
- description¶
Product description for the credit item.
- expiration_date¶
Expiration date marked on expired product, if applicable.
- invoice_case_cost¶
Actual cost per case of product, per invoice.
- invoice_date¶
Invoice date, if applicable.
- invoice_line_number¶
Line number from the invoice if known, for cross-reference.
- invoice_number¶
Invoice number, e.g. for cross-reference with another system.
- invoice_total¶
Actual total cost for line item, per invoice.
- invoice_unit_cost¶
Actual cost per single unit of product, per invoice.
- mispick_brand_name¶
Brand name for the mispick item.
- mispick_description¶
Product description for the mispick item.
- mispick_product¶
Reference to the
Product
which was shipped in place of the one which was ordered.
- mispick_product_uuid¶
- mispick_size¶
Product size for the mispick item.
- mispick_upc¶
Product UPC for the mispick item.
- product¶
Reference to the
Product
with which the credit is associated.
- product_discarded¶
Indicates the associated product was discarded, and cannot be returned to vendor.
- product_uuid¶
- row¶
Reference to the batch row with which the credit is associated.
- size¶
Product size for the credit item.
- store¶
Reference to the
Store
for which the purchase was made.
- store_uuid¶
- units_shorted¶
Number of cases of product which were ordered but not received.
- upc¶
Product UPC for the credit item.
- vendor¶
Reference to the
Vendor
to which the purchase was made.
- vendor_item_code¶
Vendor-specific code for the credit item.
- vendor_uuid¶
- class rattail.db.model.batch.purchase.PurchaseBatchRow(**kwargs)[source]¶
Row of data within a purchase batch.
- batch¶
Reference to the parent batch to which the row belongs.
- batch_uuid¶
- brand_name¶
Brand name for the line item.
- case_quantity¶
Number of units in a single case of product.
- cases_damaged¶
Number of cases of product which were shipped damaged.
- cases_expired¶
Number of cases of product which were shipped expired.
- cases_mispick¶
Number of cases of product for which mispick was shipped.
- cases_missing¶
Number of cases of product which were ultimately missing.
- cases_ordered¶
Number of cases of product which were initially ordered.
- cases_received¶
Number of cases of product which were ultimately received.
- cases_shipped¶
Number of cases of product which were supposedly shipped by/from the vendor.
- catalog_cost_confirmed¶
Flag indicating that the “catalog” cost for this row has been confirmed, e.g. by a user.
- catalog_unit_cost¶
This corresponds to the
ProductCost.unit_cost
(aka. “catalog” or wholesale cost) amount for the product/vendor, if applicable.
- claims¶
List of claims made by “child” rows against this truck dump batch row.
- credits¶
List of
PurchaseBatchCredit
instances for the row.
- department_name¶
Name of the department to which the product belongs.
- department_number¶
Number of the department to which the product belongs.
- description¶
Product description for the line item.
- invoice_case_cost¶
Actual cost per case of product, per invoice.
- invoice_case_size¶
Number of units in a single case of product, according to invoice.
- invoice_cost_confirmed¶
Flag indicating that the invoice cost for this row has been “confirmed”, e.g. by a user.
- invoice_date¶
Invoice date, if applicable.
- invoice_line_number¶
Line number from the invoice if known, for cross-reference.
- invoice_number¶
Invoice number, e.g. for cross-reference with another system.
- invoice_total¶
Total cost for the line item, according to the invoice.
- invoice_total_calculated¶
Calculated total cost for line item, per quantity received thus far. See also
invoice_total
.
- invoice_unit_cost¶
Actual cost per single unit of product, per invoice.
- item¶
Reference to the purchase item with which the batch row is associated. May be null, e.g. in the case of a “new purchase” batch.
- item_entry¶
Raw entry value, as obtained from the initial data source, and which is used to locate the product within the system. This raw value is preserved in case the initial lookup fails and a refresh must attempt further lookup(s) later. Only used by certain batch handlers in practice.
- item_id¶
Generic ID string for the item.
- modified¶
Last modification time of the row. This should be automatically set when the row is first created, as well as anytime it’s updated thereafter.
- out_of_stock¶
Flag indicating whether the item was known to be “out of stock” per the vendor invoice.
- po_case_size¶
Number of units in a single case of product, according to PO.
- po_line_number¶
Line number from the PO if known, for cross-reference.
- po_total¶
Total cost for the line item, according to the initial purchase order.
- po_total_calculated¶
Calculated total cost for line item, per quantity ordered thus far. See also
po_total
.
- po_unit_cost¶
Expected cost per single unit of product, as of initial order placement.
- product¶
Reference to the
Product
which the line item contains / represents.
- product_uuid¶
- removed¶
Flag to indicate a row has been removed from the batch.
- sequence¶
Sequence number of the row within the batch. This number should be from 1 to the actual number of rows in the batch.
- size¶
Product size for the line item.
- status_code¶
Status code for the data row. This indicates whether the row’s product could be found in the system, etc. Ultimately the meaning of this is defined by each particular batch type.
- status_text¶
Short description of row status. Ultimately the meaning and use of this is defined by each particular batch type.
- truck_dump_claims¶
List of claims which this “child” row makes against rows within a truck dump batch.
- truck_dump_status¶
Truck dump status code for the row. Only relevant for truck dump parent batches. Indicates whether this parent row has been fully claimed by children yet, etc.
- units_damaged¶
Number of units of product which were shipped damaged.
- units_expired¶
Number of units of product which were shipped expired.
- units_mispick¶
Number of units of product for which mispick was shipped.
- units_missing¶
Number of units of product which were ultimately missing.
- units_ordered¶
Number of units of product which were initially ordered.
- units_received¶
Number of units of product which were ultimately received.
- units_shipped¶
Number of units of product which were supposedly shipped by/from the vendor.
- upc¶
Product UPC for the line item.
- uuid¶
- vendor_code¶
Vendor item code for the product.
- class rattail.db.model.batch.purchase.PurchaseBatchRowClaim(**kwargs)[source]¶
Represents the connection between a row(s) from a truck dump batch, and the corresponding “child” batch row which claims it, as well as the claimed quantities etc.
- cases_damaged¶
Number of cases of product which were shipped damaged, and are involved in the claim.
- cases_expired¶
Number of cases of product which were shipped expired, and are involved in the claim.
- cases_received¶
Number of cases of product which were ultimately received, and are involved in the claim.
- claimed_row¶
Reference to the truck dump batch row which is claimed by the “child” row.
- claiming_row¶
Reference to the “child” row which is claiming some row from a truck dump batch.
- is_empty()[source]¶
Returns boolean indicating whether the claim is “empty” - i.e. if it has zero or null for all of its quantity fields.
- units_damaged¶
Number of units of product which were shipped damaged, and are involved in the claim.
- units_expired¶
Number of units of product which were shipped expired, and are involved in the claim.
- units_received¶
Number of units of product which were ultimately received, and are involved in the claim.