Explicitly disable cascade_backrefs
for all backrefs
https://docs.sqlalchemy.org/en/20/changelog/migration_14.html#cascade-backrefs-behavior-deprecated-for-removal-in-2-0
This commit is contained in:
parent
bfd9f43080
commit
71f6ac0ef9
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,8 +24,6 @@
|
|||
Models for customer order batches
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
@ -68,6 +66,7 @@ class CustomerOrderBatch(BatchMixin, CustomerOrderBase, Base):
|
|||
backref=orm.backref(
|
||||
'batches',
|
||||
order_by='CustomerOrderBatch.id',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of batches associated with the customer order.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,8 +24,6 @@
|
|||
Model for inventory batches
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
@ -57,7 +55,11 @@ class InventoryBatch(BatchMixin, Base):
|
|||
doc="""
|
||||
Reference to the handheld batch from which this inventory batch originated.
|
||||
""",
|
||||
backref=orm.backref('inventory_batch', uselist=False, doc="""
|
||||
backref=orm.backref(
|
||||
'inventory_batch',
|
||||
uselist=False,
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the inventory batch to which this handheld batch was converted.
|
||||
"""))
|
||||
|
||||
|
@ -103,6 +105,7 @@ class InventoryBatchFromHandheld(Base):
|
|||
collection_class=ordering_list('ordinal', count_from=1),
|
||||
order_by=ordinal,
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of raw inventory / handheld batch associations.
|
||||
"""))
|
||||
|
@ -117,6 +120,7 @@ class InventoryBatchFromHandheld(Base):
|
|||
'_inventory_batch',
|
||||
uselist=False,
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Indirect reference to the inventory batch to which this handheld batch was converted.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,8 +24,6 @@
|
|||
Data model for label batches
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
@ -65,6 +63,7 @@ class LabelBatch(BatchMixin, Base):
|
|||
backref=orm.backref(
|
||||
'label_batch',
|
||||
uselist=False,
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the label batch to which this handheld batch was converted.
|
||||
"""))
|
||||
|
@ -117,6 +116,7 @@ class LabelBatchFromHandheld(Base):
|
|||
collection_class=ordering_list('ordinal', count_from=1),
|
||||
order_by=ordinal,
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of raw label / handheld batch associations.
|
||||
"""))
|
||||
|
@ -131,6 +131,7 @@ class LabelBatchFromHandheld(Base):
|
|||
'_label_batch',
|
||||
uselist=False,
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Indirect reference to the label batch to which this handheld batch was converted.
|
||||
"""))
|
||||
|
@ -185,7 +186,10 @@ class LabelBatchRow(ProductBatchRowMixin, Base):
|
|||
doc="""
|
||||
Reference to the :class:`LabelProfile` with which the row is associated.
|
||||
""",
|
||||
backref=orm.backref('_print_labels_rows', cascade='all'))
|
||||
backref=orm.backref(
|
||||
'_print_labels_rows',
|
||||
cascade='all',
|
||||
cascade_backrefs=False))
|
||||
|
||||
label_quantity = sa.Column(sa.Integer(), nullable=False, default=1, doc="""
|
||||
Number of labels to print for this row/product.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,9 +24,6 @@
|
|||
Models for purchase order batches
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
@ -81,6 +78,7 @@ class PurchaseBatch(BatchMixin, PurchaseBase, Base):
|
|||
backref=orm.backref(
|
||||
'batches',
|
||||
order_by='PurchaseBatch.id',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of batches associated with the purchase.
|
||||
"""))
|
||||
|
@ -155,6 +153,7 @@ class PurchaseBatch(BatchMixin, PurchaseBase, Base):
|
|||
backref=orm.backref(
|
||||
'truck_dump_children',
|
||||
order_by='PurchaseBatch.id',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of batches which are "children" of the current batch, which is
|
||||
assumed to be a truck dump.
|
||||
|
@ -312,6 +311,7 @@ class PurchaseBatchRowClaim(Base):
|
|||
backref=orm.backref(
|
||||
'truck_dump_claims',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of claims which this "child" row makes against rows within a
|
||||
truck dump batch.
|
||||
|
@ -327,6 +327,7 @@ class PurchaseBatchRowClaim(Base):
|
|||
backref=orm.backref(
|
||||
'claims',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of claims made by "child" rows against this truck dump batch row.
|
||||
"""))
|
||||
|
@ -405,6 +406,7 @@ class PurchaseBatchCredit(PurchaseCreditBase, Base):
|
|||
backref=orm.backref(
|
||||
'credits',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of :class:`PurchaseBatchCredit` instances for the row.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,8 +24,6 @@
|
|||
Models for vendor catalog batches
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
@ -126,7 +124,9 @@ class VendorCatalogBatchRow(ProductBatchRowMixin, Base):
|
|||
associated, if any.
|
||||
""",
|
||||
backref=orm.backref(
|
||||
'_vendor_catalog_batch_rows', doc="""
|
||||
'_vendor_catalog_batch_rows',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of vendor catalog batch rows which associate directly with
|
||||
this cost record.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,11 +24,8 @@
|
|||
Data Models for Customers
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.associationproxy import association_proxy
|
||||
|
@ -86,12 +83,6 @@ class Customer(ContactMixin, Base):
|
|||
""")
|
||||
|
||||
def __str__(self):
|
||||
if six.PY2:
|
||||
return unicode(self).encode('utf8')
|
||||
return self.name or ""
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return self.name or ""
|
||||
|
||||
def add_email_address(self, address, type='Home'):
|
||||
|
@ -254,12 +245,12 @@ class CustomerNote(Note):
|
|||
foreign_keys='CustomerNote.parent_uuid',
|
||||
order_by='CustomerNote.created',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of notes which belong to the customer.
|
||||
"""))
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class CustomerGroup(Base):
|
||||
"""
|
||||
Represents an arbitrary group to which customers may belong.
|
||||
|
@ -295,7 +286,8 @@ class CustomerGroupAssignment(Base):
|
|||
CustomerGroup,
|
||||
backref=orm.backref(
|
||||
'_customers',
|
||||
cascade='all, delete-orphan'))
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
|
||||
Customer._groups = orm.relationship(
|
||||
|
@ -421,10 +413,4 @@ class PendingCustomer(Base):
|
|||
""")
|
||||
|
||||
def __str__(self):
|
||||
if six.PY2:
|
||||
return (self.display_name or "").encode('utf_8')
|
||||
return self.display_name or ""
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return self.display_name or ""
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,11 +24,8 @@
|
|||
Data Models for Customer Orders
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.orderinglist import ordering_list
|
||||
|
@ -123,7 +120,6 @@ class CustomerOrderBase(object):
|
|||
""")
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class CustomerOrder(CustomerOrderBase, Base):
|
||||
"""
|
||||
Represents an order placed by the customer.
|
||||
|
@ -171,7 +167,6 @@ class CustomerOrder(CustomerOrderBase, Base):
|
|||
return "(pending)"
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class CustomerOrderItemBase(object):
|
||||
"""
|
||||
Base class for customer order line items.
|
||||
|
@ -407,7 +402,8 @@ class CustomerOrderItemEvent(Base):
|
|||
backref=orm.backref(
|
||||
'events',
|
||||
order_by='CustomerOrderItemEvent.occurred',
|
||||
cascade='all, delete-orphan'))
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
type_code = sa.Column(sa.Integer, nullable=False)
|
||||
|
||||
|
@ -445,6 +441,7 @@ CustomerOrderItem.notes = orm.relationship(
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'person',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the order item to which the note is attached.
|
||||
"""))
|
||||
|
|
|
@ -213,12 +213,18 @@ class EmployeeStore(Base):
|
|||
|
||||
employee = orm.relationship(
|
||||
Employee,
|
||||
backref=orm.backref('_stores', cascade='all, delete-orphan'))
|
||||
backref=orm.backref(
|
||||
'_stores',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
store = orm.relationship(
|
||||
Store,
|
||||
order_by=Store.name,
|
||||
backref=orm.backref('_employees', cascade='all, delete-orphan'))
|
||||
backref=orm.backref(
|
||||
'_employees',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
Employee.stores = association_proxy(
|
||||
'_stores', 'store',
|
||||
|
@ -248,12 +254,18 @@ class EmployeeDepartment(Base):
|
|||
|
||||
employee = orm.relationship(
|
||||
Employee,
|
||||
backref=orm.backref('_departments', cascade='all, delete-orphan'))
|
||||
backref=orm.backref(
|
||||
'_departments',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
department = orm.relationship(
|
||||
Department,
|
||||
order_by=Department.name,
|
||||
backref=orm.backref('_employees', cascade='all, delete-orphan'))
|
||||
backref=orm.backref(
|
||||
'_employees',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
Employee.departments = association_proxy(
|
||||
'_departments', 'department',
|
||||
|
@ -286,6 +298,7 @@ class EmployeeHistory(Base):
|
|||
backref=orm.backref(
|
||||
'history',
|
||||
order_by='EmployeeHistory.start_date',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of history records for the employee.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,9 +24,6 @@
|
|||
Data Models for Members
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.orderinglist import ordering_list
|
||||
|
@ -69,6 +66,7 @@ class Member(ContactMixin, Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'members',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of member records with which this person is associated.
|
||||
"""),
|
||||
|
@ -82,6 +80,7 @@ class Member(ContactMixin, Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'members',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of member records with which this customer is associated.
|
||||
"""),
|
||||
|
@ -126,14 +125,8 @@ class Member(ContactMixin, Base):
|
|||
""")
|
||||
|
||||
def __str__(self):
|
||||
if six.PY2:
|
||||
return unicode(self).encode('utf_8')
|
||||
return str(self.person or self.customer or "")
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return unicode(self.person or self.customer or "")
|
||||
|
||||
# TODO: deprecate / remove this
|
||||
def add_email_address(self, address, type='Home'):
|
||||
email = MemberEmailAddress(address=address, type=type)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2018 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,11 +24,8 @@
|
|||
Data Models for User Messages
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
|
@ -52,7 +49,11 @@ class Message(Base):
|
|||
User, doc="""
|
||||
Reference to the user who sent the message.
|
||||
""",
|
||||
backref=orm.backref('sent_messages', cascade='all, delete-orphan', doc="""
|
||||
backref=orm.backref(
|
||||
'sent_messages',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of all messages which have ever been sent by the user.
|
||||
"""))
|
||||
|
||||
|
@ -69,12 +70,6 @@ class Message(Base):
|
|||
""")
|
||||
|
||||
def __str__(self):
|
||||
if six.PY2:
|
||||
return (self.subject or '').encode('utf8')
|
||||
return (self.subject or '')
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return (self.subject or '')
|
||||
|
||||
def add_recipient(self, user, **kwargs):
|
||||
|
@ -97,7 +92,6 @@ class Message(Base):
|
|||
return False
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class MessageRecipient(Base):
|
||||
"""
|
||||
Represents the combination of a single message and a single recipient.
|
||||
|
@ -123,16 +117,21 @@ class MessageRecipient(Base):
|
|||
Message, doc="""
|
||||
Reference to the message which has been "received".
|
||||
""",
|
||||
backref=orm.backref('recipients', cascade='all, delete-orphan', doc="""
|
||||
backref=orm.backref(
|
||||
'recipients',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of recipients for the message.
|
||||
""",
|
||||
))
|
||||
"""))
|
||||
|
||||
recipient = orm.relationship(
|
||||
User, doc="""
|
||||
Reference to the user who "received" the message.
|
||||
""",
|
||||
backref=orm.backref('_messages'))
|
||||
backref=orm.backref(
|
||||
'_messages',
|
||||
cascade_backrefs=False))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.recipient)
|
||||
|
|
|
@ -158,6 +158,7 @@ Person.phones = orm.relationship(
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'person',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the :class:`Person` instance to which the phone number
|
||||
belongs.
|
||||
|
@ -197,6 +198,7 @@ Person.emails = orm.relationship(
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'person',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the :class:`Person` instance to which the email address
|
||||
belongs.
|
||||
|
@ -261,6 +263,7 @@ Person.notes = orm.relationship(
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'person',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the person to which the note is attached.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,12 +24,9 @@
|
|||
Data Models for Products
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.orderinglist import ordering_list
|
||||
|
@ -47,7 +44,6 @@ from rattail.util import pretty_quantity
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class UnitOfMeasure(Base):
|
||||
"""
|
||||
Maps a UOM abbreviation used by the organization, to the proper UOM code
|
||||
|
@ -106,16 +102,8 @@ class Brand(Base):
|
|||
|
||||
def __str__(self):
|
||||
text = self.name or ''
|
||||
if six.PY2:
|
||||
return text.encode('utf8')
|
||||
return text
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return self.name or ''
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class Tax(Base):
|
||||
"""
|
||||
Represents a sales tax rate to be applied to products.
|
||||
|
@ -267,6 +255,7 @@ class Product(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'packs',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of products which reference the current product as their unit.
|
||||
"""))
|
||||
|
@ -392,11 +381,15 @@ class Product(Base):
|
|||
subdepartment = orm.relationship(
|
||||
Subdepartment,
|
||||
order_by=Subdepartment.name,
|
||||
backref=orm.backref('products'))
|
||||
backref=orm.backref(
|
||||
'products',
|
||||
cascade_backrefs=False))
|
||||
|
||||
category = orm.relationship(
|
||||
Category,
|
||||
backref=orm.backref('products'))
|
||||
backref=orm.backref(
|
||||
'products',
|
||||
cascade_backrefs=False))
|
||||
|
||||
brand = orm.relationship(
|
||||
Brand,
|
||||
|
@ -405,6 +398,7 @@ class Product(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'products',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of products for the brand.
|
||||
"""))
|
||||
|
@ -417,6 +411,7 @@ class Product(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'products',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of :class:`Product` objects which belong to this family.
|
||||
"""))
|
||||
|
@ -429,17 +424,12 @@ class Product(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'products',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of :class:`Product` objects which associate with this report code.
|
||||
"""))
|
||||
|
||||
def __str__(self):
|
||||
if six.PY2:
|
||||
return self.full_description.encode('utf8')
|
||||
return self.full_description
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return self.full_description
|
||||
|
||||
@property
|
||||
|
@ -552,6 +542,7 @@ class ProductImage(Base):
|
|||
backref=orm.backref(
|
||||
'image',
|
||||
uselist=False,
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the product's image, if any.
|
||||
"""))
|
||||
|
@ -559,7 +550,6 @@ class ProductImage(Base):
|
|||
bytes = sa.Column(sa.LargeBinary(), nullable=False)
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class ProductCode(Base):
|
||||
"""
|
||||
Represents an arbitrary "code" for a product.
|
||||
|
@ -681,7 +671,10 @@ class ProductCost(Base):
|
|||
|
||||
vendor = orm.relationship(
|
||||
Vendor,
|
||||
backref=orm.backref('product_costs', cascade='all'))
|
||||
backref=orm.backref(
|
||||
'product_costs',
|
||||
cascade='all',
|
||||
cascade_backrefs=False))
|
||||
|
||||
|
||||
Product.costs = orm.relationship(
|
||||
|
@ -738,7 +731,9 @@ class ProductFutureCost(Base):
|
|||
will be applied (when the time comes), if applicable. If this is
|
||||
``None``, then a new "current" cost record would be created instead.
|
||||
""",
|
||||
backref=orm.backref('futures'))
|
||||
backref=orm.backref(
|
||||
'futures',
|
||||
cascade_backrefs=False))
|
||||
|
||||
product_uuid = sa.Column(sa.String(length=32), nullable=False)
|
||||
product = orm.relationship(
|
||||
|
@ -748,6 +743,7 @@ class ProductFutureCost(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'future_costs',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of future cost records for the product, i.e. which have
|
||||
yet to become "current" costs.
|
||||
|
@ -761,6 +757,7 @@ class ProductFutureCost(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'future_costs',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of future cost records for the vendor, i.e. which have yet
|
||||
to become "current" costs.
|
||||
|
@ -888,6 +885,7 @@ class ProductInventory(Base):
|
|||
'inventory',
|
||||
uselist=False,
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Inventory data for the product, if any.
|
||||
"""))
|
||||
|
@ -923,6 +921,7 @@ class ProductStoreInfo(Base):
|
|||
'store_infos',
|
||||
collection_class=attribute_mapped_collection('store_uuid'),
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of store-specific info records for the product.
|
||||
"""))
|
||||
|
@ -969,6 +968,7 @@ class ProductVolatile(Base):
|
|||
'volatile',
|
||||
uselist=False,
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
"Volatile" data record for the product, if any.
|
||||
"""))
|
||||
|
@ -1057,16 +1057,9 @@ class PendingProduct(Base):
|
|||
self.size)
|
||||
|
||||
def __str__(self):
|
||||
if six.PY2:
|
||||
return self.full_description.encode('utf8')
|
||||
return self.full_description
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return self.full_description
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class InventoryAdjustmentReason(Base):
|
||||
"""
|
||||
Reasons for adjusting product inventory.
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
Data model for purchase orders
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
@ -38,7 +35,6 @@ from rattail.db.types import GPCType
|
|||
from rattail.util import pretty_quantity
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class PurchaseBase(object):
|
||||
"""
|
||||
Base class for purchases; defines common fields.
|
||||
|
@ -321,7 +317,6 @@ class PurchaseItemBase(object):
|
|||
""")
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class PurchaseCreditBase(object):
|
||||
"""
|
||||
Base class for purchase credits.
|
||||
|
@ -584,6 +579,7 @@ class PurchaseItem(PurchaseItemBase, Base):
|
|||
backref=orm.backref(
|
||||
'items',
|
||||
cascade='all',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of :class:`PurchaseItem` instances for the purchase.
|
||||
"""))
|
||||
|
@ -618,6 +614,7 @@ class PurchaseCredit(PurchaseCreditBase, Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'credits',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of :class:`PurchaseCredit` instances for the purchase.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2017 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,10 +24,6 @@
|
|||
Data models for employee work shifts
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import six
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
|
@ -90,7 +86,10 @@ class ScheduledShift(Base, ShiftMixin):
|
|||
Reference to the :class:`rattail.db.model.Employee` instance whose
|
||||
shift this is.
|
||||
""",
|
||||
backref=orm.backref('scheduled_shifts', doc="""
|
||||
backref=orm.backref(
|
||||
'scheduled_shifts',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of :class:`rattail.db.model.ScheduledShift` instances for the
|
||||
employee.
|
||||
"""))
|
||||
|
@ -113,7 +112,6 @@ class ScheduledShift(Base, ShiftMixin):
|
|||
""")
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class WorkedShift(Base, ShiftMixin):
|
||||
"""
|
||||
Represents a shift actually *worked* by an employee. (Either ``punch_in``
|
||||
|
@ -136,7 +134,10 @@ class WorkedShift(Base, ShiftMixin):
|
|||
Reference to the :class:`rattail.db.model.Employee` instance whose
|
||||
shift this is.
|
||||
""",
|
||||
backref=orm.backref('worked_shifts', doc="""
|
||||
backref=orm.backref(
|
||||
'worked_shifts',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of :class:`rattail.db.model.WorkedShift` instances for the
|
||||
employee.
|
||||
"""))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,9 +24,6 @@
|
|||
Base data model for "shopfoo" pattern
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
@ -68,12 +65,12 @@ class ShopfooProductBase(object):
|
|||
backref=orm.backref(
|
||||
backref_name,
|
||||
uselist=False,
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Reference to the local/cached {} record for this product.
|
||||
""".format(backref_name)))
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class ShopfooProductExportBase(model.ExportMixin):
|
||||
"""
|
||||
Product export table, specific to the target system. Each record in this
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2018 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,18 +24,14 @@
|
|||
Data models for tempmon
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
from rattail.db.model import Base, uuid_column
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class TempmonClient(Base):
|
||||
"""
|
||||
Represents a tempmon client.
|
||||
|
@ -60,7 +56,6 @@ class TempmonClient(Base):
|
|||
return [probe for probe in self.probes if probe.enabled]
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class TempmonProbe(Base):
|
||||
"""
|
||||
Represents a probe connected to a tempmon client.
|
||||
|
@ -82,6 +77,7 @@ class TempmonProbe(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'probes',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of probes connected to this client.
|
||||
"""))
|
||||
|
@ -107,7 +103,6 @@ class TempmonProbe(Base):
|
|||
return str(self.description or '')
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class TempmonReading(Base):
|
||||
"""
|
||||
Represents a single tempurate reading from a tempmon probe.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,18 +24,14 @@
|
|||
Data models for scheduled app upgrades
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
from rattail.db.model import Base, uuid_column, User
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class Upgrade(Base):
|
||||
"""
|
||||
Represents a scheduled app upgrade.
|
||||
|
@ -125,7 +121,8 @@ class UpgradeRequirement(Base):
|
|||
upgrade = orm.relationship(
|
||||
Upgrade,
|
||||
backref=orm.backref(
|
||||
'requirements'))
|
||||
'requirements',
|
||||
cascade_backrefs=False))
|
||||
|
||||
package = sa.Column(sa.String(length=255), nullable=False, doc="""
|
||||
Package name as found on PyPI (or at least interpretable by pip).
|
||||
|
|
|
@ -181,6 +181,7 @@ class User(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'users',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
List of user accounts for the person. Typically there is
|
||||
only one user account per person, but technically multiple
|
||||
|
@ -347,6 +348,7 @@ class UserEvent(Base):
|
|||
backref=orm.backref(
|
||||
'events',
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of events for the user.
|
||||
"""))
|
||||
|
|
|
@ -176,7 +176,8 @@ class VendorContact(Base):
|
|||
Person,
|
||||
backref=orm.backref(
|
||||
'_vendor_contacts',
|
||||
cascade='all, delete-orphan'))
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.person)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -24,8 +24,6 @@
|
|||
Data Models for Work Orders
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
|
@ -57,6 +55,7 @@ class WorkOrder(Base):
|
|||
""",
|
||||
backref=orm.backref(
|
||||
'workorders',
|
||||
cascade_backrefs=False,
|
||||
doc="""
|
||||
Sequence of all work orders for this customer.
|
||||
"""))
|
||||
|
@ -131,7 +130,8 @@ class WorkOrderEvent(Base):
|
|||
backref=orm.backref(
|
||||
'events',
|
||||
order_by='WorkOrderEvent.occurred',
|
||||
cascade='all, delete-orphan'))
|
||||
cascade='all, delete-orphan',
|
||||
cascade_backrefs=False))
|
||||
|
||||
type_code = sa.Column(sa.Integer, nullable=False, doc="""
|
||||
Code specifying the type of event this is.
|
||||
|
|
Loading…
Reference in a new issue