28 lines
749 B
Python
28 lines
749 B
Python
# SPDX-License-Identifier: WTFPL
|
|
|
|
from .dbrecord import DbRecord
|
|
from yms.lookup import Table
|
|
|
|
class Equipment(DbRecord):
|
|
|
|
table = "equipment"
|
|
pk_field = "eid"
|
|
pk_is_auto = True
|
|
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
|