Fixing qml connection to save business with a new contact - some
database modifications
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
|
||||
from .BusinessDAO import BusinessDAO
|
||||
from ..PyqcrmFlags import PyqcrmFlags
|
||||
from ..ConfigLoader import ConfigLoader
|
||||
|
||||
# USERS TABLE
|
||||
# CUSTOMER_COLUMN_NAMES = \
|
||||
@@ -63,14 +64,19 @@ from ..PyqcrmFlags import PyqcrmFlags
|
||||
class BusinessModel(QAbstractTableModel):
|
||||
__visible_index = {}
|
||||
__col_name = ""
|
||||
__business_dao = None
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.__business_dao = BusinessDAO()
|
||||
self.__business_dao.newBusinessAdded.connect(self.__refreshView)
|
||||
self.__conf = ConfigLoader().getConfig()
|
||||
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
|
||||
self.__getData()
|
||||
|
||||
def __getData(self, criterion = "Alle"):
|
||||
self.beginResetModel()
|
||||
rows, self.__visible_columns = BusinessDAO().getBusiness(criterion)
|
||||
rows, self.__visible_columns = self.__business_dao.getBusiness(self.__key, criterion)
|
||||
self.__data = rows
|
||||
self.endResetModel()
|
||||
|
||||
@@ -116,7 +122,10 @@ class BusinessModel(QAbstractTableModel):
|
||||
|
||||
@Slot(dict, int)
|
||||
def addBusiness(self, business, contact_id):
|
||||
BusinessDAO().addBusiness(business, contact_id)
|
||||
self.__business_dao.addBusiness(business, contact_id)
|
||||
|
||||
@Slot()
|
||||
def __refreshView(self):
|
||||
self.__getData()
|
||||
|
||||
@Slot(dict)
|
||||
|
||||
Reference in New Issue
Block a user