rattail.classes Module

rattail.classes - Rattail data classes

All classes defined in this module are imported to the root rattail namespace during rattail.init(). Others might also be available though, depending on which extensions are active in the current database. See Rattail Extensions for documentation on those.

Functions

rattail.classes.getset_factory(collection_class, proxy)

Helper function, useful for sqlalchemy.ext.associationproxy.association_proxy() configuration.

Meta Classes

class rattail.ClassBase(**kwargs)

Base class from which all other Rattail data classes inherit.

This class does provide some functionality; most of what it does is concerned with filtering (searching) and sorting. Applications may use this information to dynamically construct user interfaces.

classmethod create_filter(key, **kwargs)

Returns a rattail.filters.SearchFilter instance, initialized with values in kwargs.

classmethod get_available_filters()

Returns a list of rattail.filters.SearchFilter instances, one for each entry in the class’ filter_map.

classmethod get_base_query(session)

Returns a sqlalchemy.orm.Query instance which is configured to query the class and is joined to any extra classes referred to by the class’ filter_map.

plural_name

The plural display name for the class, e.g. “Products”.

singular_name

The singular display name for the class, e.g. “Product”.

classmethod sort_query(query, key, direction)

Returns a copy of query, sorted by key and direction.

Data Classes

class rattail.Brand(**kwargs)

Represents a product brand.

name

The brand name.

class rattail.Customer(**kwargs)

Represents a customer.

name

The customer’s name.

class rattail.Department(**kwargs)

Represents an organizational department.

name

The name of the department.

tax_rate

A reference to a rattail.TaxRate for the department.

class rattail.Employee(**kwargs)

Represents an employee within the organization.

id

An integer field which may contain a human-friendly ID for the employee.

person

Reference to a rattail.Person. It is assumed that an employee “is” a person.

pin

The employee’s “PIN number”; used for quick logins.

class rattail.Measure(**kwargs)

Represents a type of measuring unit to be applied to a rattail.Product (e.g. “EA” or “LB”).

name

The human-friendly (singular) name of the measure, e.g. “Unit” or “Pound”.

class rattail.Permission(**kwargs)

Represents a grantable permission within the access control system.

group

A reference to the rattail.PermissionGroup to which this permission belongs.

name

The “permission” part of the permission’s name, i.e. without the “group” part of the name.

display_name

The name of the permission as displayed in user interfaces.

class rattail.PermissionGroup(**kwargs)

Represents a logical grouping of permissions.

name

The group’s canonical name. This is used in combination with Permission.name to interpret “fully-qualified” permission names.

display_name

The name of the group as displayed in user interfaces.

permissions:

The list of rattail.Permission instances belonging to this group.

class rattail.Person(**kwargs)

Represents an actual human being.

first_name

The person’s first name.

middle_name

The person’s middle name.

last_name

The person’s last name.

suffix

The suffix of the person’s name.

display_name

The person’s name as it should be displayed in the user interface.

birth_year

The year in which the person was born.

birth_month

The month in which the person was born.

birth_day

The day (of the month) in which the person was born.

class rattail.Product(**kwargs)

Represents a product which is to be bought and/or sold by the organization.

plu

A 16-character string field which may contain a PLU for the product.

description

The description of the product. Note that by default, this field is only 25 characters long so that it may easily fit on a receipt.

department

A reference to the rattail.Department to which the product belongs.

tax_rate

A reference to a rattail.TaxRate for the product.

brand

A reference to a rattail.Brand for the product.

size

A string field which may contain size information for the product. The meaning of this field is left to each organization to determine.

measure

A reference to a rattail.Measure for the product.

base_product

A reference to a rattail.BaseProduct, where self is defined as a secondary demonination to the base_product.

base_product_quantity

Multiplier to use when translating values between self and base_product.

barcodes

A list of (20-char) barcode strings for the product.

barcode

Returns the first barcode in Product.barcodes, or None.

discountable

Boolean determining whether or not any discounts may be applied to the product when selling.

class rattail.Role(**kwargs)

Represents a user role for managing permissions.

name

The name of the role.

permissions

The list of rattail.Permission instances which are allowed for the role.

class rattail.Store(**kwargs)

Represents a physical store (or other location?) within the organization.

id

An integer field which may contain a human-friendly ID for the store.

name

A descriptive name for the store.

class rattail.TaxRate(**kwargs)

Represents a percentage tax rate, to be applied at the point of sale.

name

A descriptive name for the tax rate.

rate

The actual tax rate percentage in decimal, e.g. 4.20 (%).

class rattail.User(**kwargs)

Represents a user of the Rattail system.

username

The username with which the user may log in.

password

The user’s password. Note that the actual format of data in this field will depend on the “authenticator” in use.

salt

The salt to be used when hashing the user’s password, if the authenticator in use requires it.

person

Reference to a rattail.Person. It is mostly assumed that a user “is” a person, although some jobs (e.g. ETL) might require automation under a non-human user.

roles

A list of rattail.Role instances to which the user belongs.

Table Of Contents

Previous topic

rattail Module

Next topic

rattail.console Module

This Page