rattail.db.model.customers

Data Models for Customers

class rattail.db.model.customers.Customer(**kwargs)[source]

Represents a customer account.

Customer accounts may consist of more than one person, in some cases.

account_holder

Reference to the account holder (person), if applicable.

active_in_pos

Whether or not the customer account should be “active” within the POS system, if applicable. Whether/how this field is populated and/or leveraged are up to your system.

active_in_pos_sticky

Whether or not the customer account should always be “active” within the POS system. This field may be useful if active_in_pos gets set dynamically.

property employee

DEPRECATED

Return the employee associated with the customer, if any. Assumes a certain “typical” relationship path.

first_person()[source]

DEPRECATED

Convenience method to retrieve the “first” Person record which is associated with this customer, or None.

id

String ID for the customer, if known/relevant. This may or may not correspond to the number, depending on your system.

invalid_address

Flag indicating the customer’s mailing address(es) on file are invalid.

members

Sequence of member records with which this customer is associated.

notes

Sequence of notes which belong to the customer.

number

Customer number, if known/relevant. This may or may not correspond to the id, depending on your system.

only_member(require=True)[source]

Convenience method to retrieve the one and only Member record which is associated with this customer. If require=True then an error will be raised if there is not exactly one member found.

only_person(require=True)[source]

DEPRECATED

Convenience method to retrieve the one and only Person record which is associated with this customer. An error will be raised if there is not exactly one person associated.

shoppers

List of all shoppers (past and present) for the customer.

wholesale

Flag indicating whether the customer is a “wholesale” account - whatever that happens to mean for your business logic.

workorders

Sequence of all work orders for this customer.

class rattail.db.model.customers.CustomerEmailAddress(**kwargs)[source]

Represents an email address associated with a Customer.

invalid

Flag indicating whether the email address is known to be invalid. Defaults to NULL, meaning the validity is “not known”.

class rattail.db.model.customers.CustomerGroup(**kwargs)[source]

Represents an arbitrary group to which customers may belong.

class rattail.db.model.customers.CustomerGroupAssignment(**kwargs)[source]

Represents the assignment of a customer to a group.

class rattail.db.model.customers.CustomerMailingAddress(**kwargs)[source]

Represents a mailing address for a customer

class rattail.db.model.customers.CustomerNote(**kwargs)[source]

Represents a note attached to a customer.

customer

Reference to the customer to which this note is attached.

class rattail.db.model.customers.CustomerPerson(**kwargs)[source]

Represents the association between a person and a customer account.

class rattail.db.model.customers.CustomerPhoneNumber(**kwargs)[source]

Represents a phone (or fax) number associated with a Customer.

class rattail.db.model.customers.CustomerShopper(**kwargs)[source]

Represents a “shopper” on a customer account. Most customer accounts will have at least one of these (shopper #1) who is the account holder.

active

Whether this shopper record is currently active for the customer.

customer

Reference to the customer account to which the shopper belongs.

get_current_history()[source]

Returns the “current” history record for the shopper, if applicable. Note that this history record is not necessarily “active” - it’s just the most recent.

history

Sequence of history records for the shopper.

person

Reference to the person who “is” this shopper.

shopper_number

Sequence number (starting with 1) for this shopper record, within the context of the customer account.

class rattail.db.model.customers.CustomerShopperHistory(**kwargs)[source]

History records for customer shoppers.

end_date

Date on which the shopper became inactive, if applicable.

shopper

Reference to the shopper record to which this history pertains.

start_date

Date on which the shopper became active for the customer.

class rattail.db.model.customers.PendingCustomer(**kwargs)[source]

A “pending” customer record, used for new customer entry workflow.

created

Timestamp when the record was first created.

status_code

Status indicator for the new customer record.

user

Referencef to the User who first entered the record.