34 lines
867 B
Python
34 lines
867 B
Python
# SPDX-License-Identifier: WTFPL
|
|
|
|
from .dbrecord import DbRecord
|
|
from yms.lookup import Table
|
|
|
|
# names for fixed dropdown values
|
|
SUPPLIER = 1
|
|
MANUFACTURER = 2
|
|
SHIPYARD = 3
|
|
MISC = 9
|
|
|
|
class Company(DbRecord):
|
|
|
|
table = "company"
|
|
pk_field = "compid"
|
|
pk_is_auto = True
|
|
fields = ('compid', 'compname', 'comptype', 'comptype2',
|
|
'shortname', 'street', 'zip', 'city', 'country', 'contact', 'phone',
|
|
'email', 'web', 'customerno', 'contractno', 'remarks', 'flags')
|
|
|
|
def __init__(self, db, compid=None):
|
|
super().__init__(db, compid)
|
|
self.title = _("Company({})")
|
|
|
|
def save(self, commit=True):
|
|
if not super().save(Table.COMPANIES):
|
|
return False
|
|
if commit:
|
|
try:
|
|
self.conn.commit()
|
|
except mariadb.Error as e:
|
|
return False
|
|
return True
|