|
|
@ -105,7 +105,8 @@ class Note_status(db.Model):
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
notes = db.relationship('Company_note', backref='company_note_status', lazy=True)
|
|
|
|
company_notes = db.relationship('Company_note', backref='company_note_status', lazy=True)
|
|
|
|
|
|
|
|
person_notes = db.relationship('Person_note', backref='person_note_status', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
def __repr__(self):
|
|
|
|
def __repr__(self):
|
|
|
@ -131,7 +132,7 @@ class Industry(db.Model):
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
companies = db.relationship('Company', backref='company_industry', lazy=True)
|
|
|
|
companies = db.relationship('Company', backref='company_industry', lazy=True)
|
|
|
|
#projects = db.relationship('Project', backref='project_industry', lazy=True)
|
|
|
|
projects = db.relationship('Project', backref='project_industry', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
def __repr__(self):
|
|
|
|
def __repr__(self):
|
|
|
@ -171,8 +172,8 @@ class Person(db.Model):
|
|
|
|
# One To Many relationships for a company having mutliple elements of the following indexes
|
|
|
|
# One To Many relationships for a company having mutliple elements of the following indexes
|
|
|
|
# Example : One company would/could have many eployees
|
|
|
|
# Example : One company would/could have many eployees
|
|
|
|
notes = db.relationship('Person_note', backref='person', lazy=True)
|
|
|
|
notes = db.relationship('Person_note', backref='person', lazy=True)
|
|
|
|
# projects = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True)
|
|
|
|
projects = db.relationship('Project', backref='project_responsible', lazy=True)
|
|
|
|
# elements = db.Column(db.Integer, db.ForeignKey('project_element.id'), nullable=True)
|
|
|
|
elements = db.relationship('Project', backref='element_responsible', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Person_role(db.Model):
|
|
|
|
class Person_role(db.Model):
|
|
|
@ -206,7 +207,7 @@ class Person_note(db.Model):
|
|
|
|
date_due = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
date_due = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
|
|
person_id = db.Column(db.Integer, db.ForeignKey('person.id'), nullable=False)
|
|
|
|
person_id = db.Column(db.Integer, db.ForeignKey('person.id'), nullable=False)
|
|
|
|
#status_id = db.Column(db.Integer, db.ForeignKey('note_status.id'), nullable=False)
|
|
|
|
status_id = db.Column(db.Integer, db.ForeignKey('note_status.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
def __repr__(self):
|
|
|
|
def __repr__(self):
|
|
|
@ -250,6 +251,7 @@ class Company(db.Model):
|
|
|
|
# One To Many relationships for a company having mutliple elements of the following indexes
|
|
|
|
# One To Many relationships for a company having mutliple elements of the following indexes
|
|
|
|
# Example : One company would/could have many eployees
|
|
|
|
# Example : One company would/could have many eployees
|
|
|
|
employees = db.relationship('Person', backref='employer', lazy=True)
|
|
|
|
employees = db.relationship('Person', backref='employer', lazy=True)
|
|
|
|
|
|
|
|
projects = db.relationship('Project', backref='belongs_to', lazy=True)
|
|
|
|
notes = db.relationship('Company_note', backref='company', lazy=True)
|
|
|
|
notes = db.relationship('Company_note', backref='company', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -301,31 +303,29 @@ class Company_note(db.Model):
|
|
|
|
###################################################################################################
|
|
|
|
###################################################################################################
|
|
|
|
# Project
|
|
|
|
# Project
|
|
|
|
###################################################################################################
|
|
|
|
###################################################################################################
|
|
|
|
'''
|
|
|
|
|
|
|
|
class Project(db.Model):
|
|
|
|
class Project(db.Model):
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
#elements = db.relationship('Project_element', backref='project_elements', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
|
|
|
|
|
|
|
|
#industry_id = db.Column(db.Integer, db.ForeignKey('industry.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
project_owner = db.relationship('Person', backref='project_owner', lazy=True)
|
|
|
|
|
|
|
|
#buyer = db.relationship('Person', backref='project_buyer', lazy=True)
|
|
|
|
|
|
|
|
#responsible = db.relationship('Person', backref='project_manager', lazy=True)
|
|
|
|
|
|
|
|
date_prototype = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
date_prototype = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
qte_prototype = db.Column(db.Integer, nullable=True)
|
|
|
|
qte_prototype = db.Column(db.Integer, nullable=False)
|
|
|
|
date_start = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
date_start = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
qte_start = db.Column(db.Integer, nullable=True)
|
|
|
|
qte_start = db.Column(db.Integer, nullable=False)
|
|
|
|
date_production = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
date_production = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
qte_production = db.Column(db.Integer, nullable=True)
|
|
|
|
qte_production = db.Column(db.Integer, nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
status = db.Column(db.String(100), nullable=True, default='')
|
|
|
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# One To Many relationships where indexes can point o mutiple companies.
|
|
|
|
|
|
|
|
company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
|
|
|
|
|
|
|
|
status_id = db.Column(db.Integer, db.ForeignKey('project_status.id'), nullable=False)
|
|
|
|
|
|
|
|
industry_id = db.Column(db.Integer, db.ForeignKey('industry.id'), nullable=False)
|
|
|
|
|
|
|
|
owner_id = db.Column(db.Integer, db.ForeignKey('person.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# One To Many relationships for a company having mutliple elements of the following indexes
|
|
|
|
|
|
|
|
# Example : One company would/could have many eployees
|
|
|
|
|
|
|
|
elements = db.relationship('Project_element', backref='project', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
def __repr__(self):
|
|
|
|
def __repr__(self):
|
|
|
|
return f"{self.name}"
|
|
|
|
return f"{self.name}"
|
|
|
@ -334,20 +334,125 @@ class Project_element(db.Model):
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
qte_per_project = db.Column(db.Integer, nullable=False, default='0')
|
|
|
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
|
|
project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True)
|
|
|
|
project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True)
|
|
|
|
industry_id = db.Column(db.Integer, db.ForeignKey('industry.id'), nullable=True)
|
|
|
|
owner_id = db.Column(db.Integer, db.ForeignKey('person.id'), nullable=False)
|
|
|
|
owner = db.relationship('Person', backref='element_owner', lazy=True)
|
|
|
|
status_id = db.Column(db.Integer, db.ForeignKey('project_status.id'), nullable=False)
|
|
|
|
buyer = db.relationship('Person', backref='element_buyer', lazy=True)
|
|
|
|
|
|
|
|
responsible = db.relationship('Person', backref='element_manager', lazy=True)
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Project_status(db.Model):
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
projects = db.relationship('Project', backref='status', lazy=True)
|
|
|
|
|
|
|
|
elements = db.relationship('Project', backref='element_status', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###################################################################################################
|
|
|
|
|
|
|
|
# Product
|
|
|
|
|
|
|
|
###################################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Product(db.Model):
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
|
|
|
buy_cost = db.Column(db.Float, nullable=False)
|
|
|
|
|
|
|
|
comment = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
comment_manufacturer = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
currency = db.Column(db.String(50), nullable=False)
|
|
|
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
last_time_buy_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
lead_time_days = db.Column(db.Integer, nullable=False)
|
|
|
|
|
|
|
|
minimum_awarding_quantity = db.Column(db.Integer, nullable=False)
|
|
|
|
|
|
|
|
minimum_order_quantity = db.Column(db.Integer, nullable=False)
|
|
|
|
|
|
|
|
minimum_quote_quantity = db.Column(db.Integer, nullable=False)
|
|
|
|
|
|
|
|
obsolete_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
ordering_code = db.Column(db.String(100), nullable=False)
|
|
|
|
|
|
|
|
pollution_level = db.Column(db.String(50), nullable=True)
|
|
|
|
|
|
|
|
price_change_flag = db.Column(db.Boolean, nullable=False, default='0')
|
|
|
|
|
|
|
|
pricing_scheme = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
proposed_margin = db.Column(db.Float, nullable=False)
|
|
|
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status_id = db.Column(db.Integer, db.ForeignKey('product_status.id'), nullable=False)
|
|
|
|
|
|
|
|
classification_id = db.Column(db.Integer, db.ForeignKey('product_classification.id'), nullable=False)
|
|
|
|
|
|
|
|
packaging_id = db.Column(db.Integer, db.ForeignKey('product_packaging.id'), nullable=False)
|
|
|
|
|
|
|
|
physical_id = db.Column(db.Integer, db.ForeignKey('product_physical.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
qte_per_project = db.Column(db.Integer, nullable=False, default='0')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status = db.Column(db.String(100), nullable=True, default='')
|
|
|
|
class Product_status(db.Model):
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
products = db.relationship('Product', backref='status', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Product_classification(db.Model):
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
products = db.relationship('Product', backref='classification', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Product_packaging(db.Model):
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
unit = db.Column(db.Integer)
|
|
|
|
|
|
|
|
quantity = db.Column(db.Integer)
|
|
|
|
|
|
|
|
total = db.Column(db.Integer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
products = db.relationship('Product', backref='packaging', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
def __repr__(self):
|
|
|
|
def __repr__(self):
|
|
|
|
return f"{self.name}"
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Product_physical(db.Model):
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
image_file = db.Column(db.String(20), nullable=False, default='default_company.jpg')
|
|
|
|
|
|
|
|
pitch_x = db.Column(db.Float, nullable=True)
|
|
|
|
|
|
|
|
pitch_y = db.Column(db.Float, nullable=True)
|
|
|
|
|
|
|
|
size_x = db.Column(db.Float, nullable=True)
|
|
|
|
|
|
|
|
size_y = db.Column(db.Float, nullable=True)
|
|
|
|
|
|
|
|
size_z = db.Column(db.Float, nullable=True)
|
|
|
|
|
|
|
|
type = db.Column(db.String(50), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
products = db.relationship('Product', backref='physical', lazy=True)
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
physical (MUL, int)
|
|
|
|
|
|
|
|
container (varchar)
|
|
|
|
|
|
|
|
favourite (tinyint, NULL, nullable)
|
|
|
|
|
|
|
|
manufacturer (varchar)
|
|
|
|
|
|
|
|
production_site (varchar)
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|