mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-05 04:31:49 +02:00
added an archive field
This commit is contained in:
parent
294042e812
commit
677fda6002
1 changed files with 7 additions and 1 deletions
|
@ -678,7 +678,8 @@ class Bill(db.Model):
|
||||||
original_currency = db.Column(db.String(3))
|
original_currency = db.Column(db.String(3))
|
||||||
converted_amount = db.Column(db.Float)
|
converted_amount = db.Column(db.Float)
|
||||||
|
|
||||||
archive = db.Column(db.Integer, db.ForeignKey("archive.id"))
|
# archive = db.Column(db.Integer, db.ForeignKey("archive.id"))
|
||||||
|
archive = db.Column(db.Boolean)
|
||||||
|
|
||||||
currency_helper = CurrencyConverter()
|
currency_helper = CurrencyConverter()
|
||||||
|
|
||||||
|
@ -692,6 +693,7 @@ class Bill(db.Model):
|
||||||
payer_id: int = None,
|
payer_id: int = None,
|
||||||
project_default_currency: str = "",
|
project_default_currency: str = "",
|
||||||
what: str = "",
|
what: str = "",
|
||||||
|
archive: bool = False
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.amount = amount
|
self.amount = amount
|
||||||
|
@ -704,6 +706,7 @@ class Bill(db.Model):
|
||||||
self.converted_amount = self.currency_helper.exchange_currency(
|
self.converted_amount = self.currency_helper.exchange_currency(
|
||||||
self.amount, self.original_currency, project_default_currency
|
self.amount, self.original_currency, project_default_currency
|
||||||
)
|
)
|
||||||
|
self.archive = archive
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _to_serialize(self):
|
def _to_serialize(self):
|
||||||
|
@ -750,6 +753,9 @@ class Bill(db.Model):
|
||||||
f"{', '.join([o.name for o in self.owers])}>"
|
f"{', '.join([o.name for o in self.owers])}>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def set_archived(self):
|
||||||
|
self.archive = True
|
||||||
|
|
||||||
|
|
||||||
class Archive(db.Model):
|
class Archive(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
|
Loading…
Reference in a new issue