Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>
Always create a balance when product is being created
src/types/product.py | 6 ++++++
diff --git a/src/types/product.py b/src/types/product.py index 35f8241cdcba0fdf3e30bbdc98a17661309573bc..f14d35bfc1e5a9944f6526991586a867b05acc42 100644 --- a/src/types/product.py +++ b/src/types/product.py @@ -1,4 +1,5 @@ from . import db +from .balance import Balance from datetime import datetime as dt class Product(db.Model): @@ -21,6 +22,11 @@ def create(self): db.session.add(self) db.session.commit() + + Balance(0.0, self.id).create() + + return self + def to_json(self): return {