28 lines
721 B
Python
28 lines
721 B
Python
# SPDX-License-Identifier: WTFPL
|
|
|
|
from .dbrecord import DbRecord
|
|
from yms.lookup import Table
|
|
|
|
class Box(DbRecord):
|
|
|
|
table = "box"
|
|
pk_field = "boxid"
|
|
pk_is_auto = True
|
|
fields = ('boxid', 'sid', 'boxtype', 'parent', 'label', 'color',
|
|
'content', 'wx', 'wy', 'wz', 'weight', 'weight_net', 'price',
|
|
'remarks')
|
|
|
|
def __init__(self, db, boxid=None):
|
|
super().__init__(db, boxid)
|
|
self.title = _("Box({})")
|
|
|
|
def save(self, commit=True):
|
|
if not super().save(Table.BOXES):
|
|
return False
|
|
if commit:
|
|
try:
|
|
self.conn.commit()
|
|
except mariadb.Error as e:
|
|
return False
|
|
return True
|