Compare commits

..

No commits in common. "975b00bce9789e9202262aa2c0cd7c4fc8e1cb86" and "dde9c38bb8ebf15080431ffc504326f6354461a3" have entirely different histories.

2 changed files with 9 additions and 17 deletions

View File

@ -17,7 +17,7 @@
[metadata] [metadata]
name = mia-accounting-flask name = mia-accounting-flask
version = 0.1.1 version = 0.1.0
author = imacat author = imacat
author_email = imacat@mail.imacat.idv.tw author_email = imacat@mail.imacat.idv.tw
description = The Mia! Accounting Flask project. description = The Mia! Accounting Flask project.

View File

@ -69,9 +69,7 @@ class BaseAccountL10n(db.Model):
"""A localized base account title.""" """A localized base account title."""
__tablename__ = "accounting_base_accounts_l10n" __tablename__ = "accounting_base_accounts_l10n"
"""The table name.""" """The table name."""
account_code = db.Column(db.String, account_code = db.Column(db.String, db.ForeignKey(BaseAccount.code,
db.ForeignKey(BaseAccount.code,
onupdate="CASCADE",
ondelete="CASCADE"), ondelete="CASCADE"),
nullable=False, primary_key=True) nullable=False, primary_key=True)
"""The code of the account.""" """The code of the account."""
@ -90,8 +88,7 @@ class Account(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True, id = db.Column(db.Integer, nullable=False, primary_key=True,
autoincrement=False) autoincrement=False)
"""The account ID.""" """The account ID."""
base_code = db.Column(db.String, base_code = db.Column(db.String, db.ForeignKey(BaseAccount.code,
db.ForeignKey(BaseAccount.code, onupdate="CASCADE",
ondelete="CASCADE"), ondelete="CASCADE"),
nullable=False) nullable=False)
"""The code of the base account.""" """The code of the base account."""
@ -106,9 +103,7 @@ class Account(db.Model):
created_at = db.Column(db.DateTime(timezone=True), nullable=False, created_at = db.Column(db.DateTime(timezone=True), nullable=False,
server_default=db.func.now()) server_default=db.func.now())
"""The time of creation.""" """The time of creation."""
created_by_id = db.Column(db.Integer, created_by_id = db.Column(db.Integer, db.ForeignKey(user_pk_column),
db.ForeignKey(user_pk_column,
onupdate="CASCADE"),
nullable=False) nullable=False)
"""The ID of the creator.""" """The ID of the creator."""
created_by = db.relationship(user_cls, foreign_keys=created_by_id) created_by = db.relationship(user_cls, foreign_keys=created_by_id)
@ -116,9 +111,7 @@ class Account(db.Model):
updated_at = db.Column(db.DateTime(timezone=True), nullable=False, updated_at = db.Column(db.DateTime(timezone=True), nullable=False,
server_default=db.func.now()) server_default=db.func.now())
"""The time of last update.""" """The time of last update."""
updated_by_id = db.Column(db.Integer, updated_by_id = db.Column(db.Integer, db.ForeignKey(user_pk_column),
db.ForeignKey(user_pk_column,
onupdate="CASCADE"),
nullable=False) nullable=False)
"""The ID of the updator.""" """The ID of the updator."""
updated_by = db.relationship(user_cls, foreign_keys=updated_by_id) updated_by = db.relationship(user_cls, foreign_keys=updated_by_id)
@ -306,8 +299,7 @@ class Account(db.Model):
class AccountL10n(db.Model): class AccountL10n(db.Model):
"""A localized account title.""" """A localized account title."""
__tablename__ = "accounting_accounts_l10n" __tablename__ = "accounting_accounts_l10n"
account_id = db.Column(db.Integer, account_id = db.Column(db.Integer, db.ForeignKey(Account.id,
db.ForeignKey(Account.id, onupdate="CASCADE",
ondelete="CASCADE"), ondelete="CASCADE"),
nullable=False, primary_key=True) nullable=False, primary_key=True)
account = db.relationship(Account, back_populates="l10n") account = db.relationship(Account, back_populates="l10n")