Exemple #1
0
    def on_openInRedactor(self):
        index = self.currentIndex()
        if index.isValid():
            row = index.row()
            items = self.model().items()
            if 0 <= row < len(items):
                oldRecord, oldAction = items[row]
                oldRecord.setValue('event_id',
                                   toVariant(self._parent.eventEditor.itemId())
                                   )  # Необходимо для шаблонов печати.

                dialog = CActionEditDialog(self)
                dialog.save = lambda: True
                dialog.setForceClientId(self._parent.clientId())
                dialog.setRecord(QtSql.QSqlRecord(oldRecord))
                dialog.setReduced(True)

                CAction.copyAction(oldAction, dialog.action)

                if dialog.exec_():
                    record = dialog.getRecord()
                    items[row] = (record, dialog.action)
                    self._parent.onActionCurrentChanged()
Exemple #2
0
 def setRecordByNext(self, record):
     oldAction = self.action
     newAction = CAction(record=record)
     CAction.copyAction(oldAction, newAction, isCopyRecordData=False)
     self.setAction(newAction)