Files
YMS/yms/model/equipment.py
T

27 lines
727 B
Python

# SPDX-License-Identifier: WTFPL
from .dbrecord import DbRecord
from yms.lookup import Table
class Equipment(DbRecord):
table = "equipment"
pk_field = "eid"
fields = ('eid', 'vid', 'ename', 'shortname', 'model', 'ecat', 'serial',
'supplier', 'manufacturer', 'purchdate', 'price', 'weight', 'remarks',
'econd', 'flags')
def __init__(self, db, eid=None):
super().__init__(db, eid)
self.title = _("Equipment({})")
def save(self, commit=True):
if not super().save(Table.EQUIPMENT):
return False
if commit:
try:
self.conn.commit()
except mariadb.Error as e:
return False
return True