Пример #1
0
    def btnOkWithInformation_clicked(self, oActionEvent):
        if self.win.getListBoxSelectedItem("lstResourceType") == "":
            ErrorDialog("You have to select a resource type.", "",
                        "Selection Error.")
            return

        if self.win.getListBoxSelectedItem(
                "lstResource") == "" or self.win.getListBoxSelectedItem(
                    "lstmodel") == "":
            ErrorDialog("You have to select Model and Resource.", "",
                        "Selection Error.")
            return

        resourceid = None
        for s in self.aSearchResult:
            if s[1] == self.win.getListBoxSelectedItem("lstResource"):
                resourceid = s[0]
                break

        if resourceid == None:
            ErrorDialog("No resource is selected.", "", "Resource Error.")
            return

        res = self.send_attachment(
            self.dModel[self.win.getListBoxSelectedItem('lstmodel')],
            resourceid)
        self.win.endExecute()
Пример #2
0
    def btnOk_clicked(self, oActionEvent):

        sLogin = self.win.getEditText("txtLoginName")
        sPassword = self.win.getEditText("txtPassword")
        global url
        global result
        if result == -1:
            sDatabase = self.win.getEditText("lstDatabase")
        else:
            sDatabase = self.win.getListBoxSelectedItem("lstDatabase")
        self.sock = RPCSession(url)
        UID = self.sock.login(sDatabase, sLogin, sPassword)
        if not UID or UID == -1:
            ErrorDialog("Connection Refuse...",
                        "Please enter valid Login/Password")
        #  self.win.endExecute()
        ids_module = self.sock.execute(sDatabase, UID, sPassword,
                                       'ir.module.module', 'search',
                                       [('name', '=', 'base_report_designer'),
                                        ('state', '=', 'installed')])
        if not len(ids_module):
            ErrorDialog("Please Install base_report_designer module", "",
                        "Module Uninstalled Error")
            self.logobj.log_write(
                'Module Not Found', LOG_WARNING,
                ':base_report_designer not install in  database %s' %
                (sDatabase))
            #self.win.endExecute()
        else:
            desktop = getDesktop()
            doc = desktop.getCurrentComponent()
            docinfo = doc.getDocumentInfo()
            docinfo.setUserFieldValue(0, self.win.getEditText("txtHost"))
            docinfo.setUserFieldValue(1, self.win.getEditText("txtLoginName"))
            global passwd
            passwd = self.win.getEditText("txtPassword")
            global loginstatus
            loginstatus = True
            global database
            database = sDatabase
            global uid
            uid = UID
            #docinfo.setUserFieldValue(2,self.win.getListBoxSelectedItem("lstDatabase"))
            #docinfo.setUserFieldValue(3,"")

            ErrorDialog(
                " You can start creating your report in \n  \t the current document.",
                "After Creating  sending to the server.", "Message")
            self.logobj.log_write(
                'successful login', LOG_INFO,
                ':successful login from %s  using database %s' %
                (sLogin, sDatabase))
            self.win.endExecute()
Пример #3
0
 def btnNext_clicked(self, oActionEvent):
     global url
     aVal = ''
     #aVal= Fetature used
     try:
         url = self.protocol[self.win.getListBoxSelectedItem(
             "lstProtocol")] + self.win.getEditText(
                 "txtHost") + ":" + self.win.getEditText("txtPort")
         self.sock = RPCSession(url)
         desktop = getDesktop()
         doc = desktop.getCurrentComponent()
         docinfo = doc.getDocumentInfo()
         docinfo.setUserFieldValue(0, url)
         res = self.sock.listdb()
         self.win.endExecute()
         ServerParameter(aVal, url)
     except:
         import traceback, sys
         info = reduce(
             lambda x, y: x + y,
             traceback.format_exception(sys.exc_type, sys.exc_value,
                                        sys.exc_traceback))
         self.logobj.log_write('ServerParameter', LOG_ERROR, info)
         ErrorDialog(
             "Connection to server is fail. Please check your Server Parameter.",
             "", "Error!")
         self.win.endExecute()
Пример #4
0
    def lstbox_selected(self, oItemEvent):
        try:

            desktop = getDesktop()
            doc = desktop.getCurrentComponent()
            docinfo = doc.getDocumentInfo()
            sItem = self.win.getComboBoxText("cmbVariable")
            for var in self.aVariableList:
                if var[:var.find("(") + 1] == sItem[:sItem.find("(") + 1]:
                    sItem = var
            sMain = self.aListFields[self.win.getListBoxSelectedItemPos(
                "lstFields")]
            t = sMain.rfind('/lang')
            if t != -1:
                sObject = self.getRes(self.sock, sItem[sItem.find("(") + 1:-1],
                                      sMain[1:])
                ids = self.sock.execute(database, uid, self.password, sObject,
                                        'search', [])
                res = self.sock.execute(database, uid, self.password, sObject,
                                        'read', [ids[0]])
                self.win.setEditText("txtUName",
                                     res[0][sMain[sMain.rfind("/") + 1:]])
            else:
                ErrorDialog("Please select the Language Field")

        except:
            import traceback
            traceback.print_exc()
            self.win.setEditText("txtUName", "TTT")
        if self.bModify:
            self.win.setEditText("txtUName", self.sGDisplayName)
Пример #5
0
 def btnOk_clicked(self, oActionEvent):
     desktop = getDesktop()
     doc = desktop.getCurrentComponent()
     text = doc.Text
     cursor = doc.getCurrentController().getViewCursor()
     if self.bModify == True:
         oCurObj = cursor.TextField
         sKey = u"" + self.win.getEditText("txtName")
         sValue = u"[[ " + self.win.getEditText("txtExpression") + " ]]"
         oCurObj.Items = (sKey, sValue)
         oCurObj.update()
         self.win.endExecute()
     else:
         oInputList = doc.createInstance(
             "com.sun.star.text.TextField.DropDown")
         if self.win.getEditText("txtName") != "" and self.win.getEditText(
                 "txtExpression") != "":
             sKey = u"" + self.win.getEditText("txtName")
             sValue = u"[[ " + self.win.getEditText("txtExpression") + " ]]"
             if cursor.TextTable == None:
                 oInputList.Items = (sKey, sValue)
                 text.insertTextContent(cursor, oInputList, False)
             else:
                 oTable = cursor.TextTable
                 oCurCell = cursor.Cell
                 tableText = oTable.getCellByName(oCurCell.CellName)
                 oInputList.Items = (sKey, sValue)
                 tableText.insertTextContent(cursor, oInputList, False)
             self.win.endExecute()
         else:
             ErrorDialog(
                 "Please Fill appropriate data in Name field or \nExpression field"
             )
Пример #6
0
    def btnOk_clicked(self, oActionEvent):
        self.bOkay = True
        desktop=getDesktop()
        doc = desktop.getCurrentComponent()
        cursor = doc.getCurrentController().getViewCursor()

        itemSelected = self.win.getListBoxSelectedItem( "lstFields" )
        itemSelectedPos = self.win.getListBoxSelectedItemPos( "lstFields" )
        txtUName = self.win.getEditText("txtUName")
        sKey=u""+ txtUName

        if itemSelected != "" and txtUName != "" and self.bModify==True :
            oCurObj=cursor.TextField
            sObjName=self.insVariable.getText()
            sObjName=sObjName[:sObjName.find("(")]
            sValue=u"[[ setLang" + sObjName + self.aListFields[itemSelectedPos].replace("/",".") + ")" " ]]"
            oCurObj.Items = (sKey,sValue)
            oCurObj.update()
            self.win.endExecute()
        elif itemSelected != "" and txtUName != "" :
            oInputList = doc.createInstance("com.sun.star.text.TextField.DropDown")
            sObjName=self.win.getComboBoxText("cmbVariable")
            sObjName=sObjName[:sObjName.find("(")]

            widget = ( cursor.TextTable and cursor.TextTable.getCellByName( cursor.Cell.CellName ) or doc.Text )

            sValue = u"[[setLang" + "(" + sObjName + self.aListFields[itemSelectedPos].replace("/",".") +")" " ]]"
            oInputList.Items = (sKey,sValue)
            widget.insertTextContent(cursor,oInputList,False)

            self.win.endExecute()
        else:
            ErrorDialog("Please fill appropriate data in name field \nor select particular value from the list of fields.")
Пример #7
0
    def btnOkWithoutInformation_clicked(self, oActionEvent):
        desktop = getDesktop()
        oDoc2 = desktop.getCurrentComponent()
        docinfo = oDoc2.getDocumentInfo()

        if self.win.getListBoxSelectedItem("lstResourceType") == "":
            ErrorDialog("You have to select a resource type.", "", "Selection Error." )
            return

        res = self.send_attachment( docinfo.getUserFieldValue(3), docinfo.getUserFieldValue(2) )
        self.win.endExecute()
Пример #8
0
    def send_attachment(self, model, resource_id):
        desktop = getDesktop()
        oDoc2 = desktop.getCurrentComponent()
        docinfo = oDoc2.getDocumentInfo()

        if oDoc2.getURL() == "":
            ErrorDialog("You should save your file.", "", "Saving Error.")
            return None

        url = oDoc2.getURL()
        if self.Kind[self.win.getListBoxSelectedItem("lstResourceType")] == "pdf":
            url = self.doc2pdf(url[7:])

        if url == None:
            ErrorDialog( "Problem in creating PDF.", "", "PDF Error.")
            return None

        url = url[7:]
        data = read_data_from_file( get_absolute_file_path( url ) )
        return self._send_attachment( os.path.basename( url ), data, model, resource_id )
Пример #9
0
    def btnOk_clicked(self, oActionEvent):
        desktop = getDesktop()
        doc = desktop.getCurrentComponent()
        cursor = doc.getCurrentController().getViewCursor()
        selectedItem = self.win.getListBoxSelectedItem("lstFields")
        selectedItemPos = self.win.getListBoxSelectedItemPos("lstFields")
        txtName = self.win.getEditText("txtName")
        txtUName = self.win.getEditText("txtUName")
        if selectedItem != "" and txtName != "" and txtUName != "":
            sKey = u"" + txtUName
            if selectedItem == "objects":
                sValue = u"[[ repeatIn(" + selectedItem + ",'" + txtName + "') ]]"
            else:
                sObjName = self.win.getComboBoxText("cmbVariable")
                sObjName = sObjName[:sObjName.find("(")]
                sValue = u"[[ repeatIn(" + sObjName + self.aListRepeatIn[
                    selectedItemPos].replace("/",
                                             ".") + ",'" + txtName + "') ]]"

            if self.bModify == True:
                oCurObj = cursor.TextField
                oCurObj.Items = (sKey, sValue)
                oCurObj.update()
            else:
                oInputList = doc.createInstance(
                    "com.sun.star.text.TextField.DropDown")
                if self.win.getListBoxSelectedItem("lstFields") == "objects":
                    oInputList.Items = (sKey, sValue)
                    doc.Text.insertTextContent(cursor, oInputList, False)
                else:
                    sValue = u"[[ repeatIn(" + sObjName + self.aListRepeatIn[
                        selectedItemPos].replace(
                            "/", ".") + ",'" + txtName + "') ]]"
                    if cursor.TextTable == None:
                        oInputList.Items = (sKey, sValue)
                        doc.Text.insertTextContent(cursor, oInputList, False)
                    else:
                        oInputList.Items = (sKey, sValue)
                        widget = (cursor.TextTable or selectedItem <> 'objects'
                                  ) and cursor.TextTable.getCellByName(
                                      cursor.Cell.CellName) or doc.Text
                        widget.insertTextContent(cursor, oInputList, False)
                self.win.endExecute()
        else:
            ErrorDialog(
                "Please fill appropriate data in Object Field or Name field \nor select particular value from the list of fields."
            )
Пример #10
0
    def btnSearch_clicked(self, oActionEvent):
        modelSelectedItem = self.win.getListBoxSelectedItem("lstmodel")
        if modelSelectedItem == "":
            return

        desktop=getDesktop()
        oDoc2 = desktop.getCurrentComponent()
        docinfo=oDoc2.getDocumentInfo()


        self.aSearchResult =self.sock.execute( database, uid, self.password, self.dModel[modelSelectedItem], 'name_search', self.win.getEditText("txtSearchName"))
        self.win.removeListBoxItems("lstResource", 0, self.win.getListBoxItemCount("lstResource"))
        if self.aSearchResult == []:
            ErrorDialog("No search result found.", "", "Search Error.")
            return

        for result in self.aSearchResult:
            self.lstResource.addItem(result[1],result[0])
Пример #11
0
 def btnChange_clicked(self, oActionEvent):
     aVal = []
     url = self.win.getEditText("txtHost")
     Change(aVal, url)
     if aVal[1] == -1:
         self.win.getEditText("lstDatabase")
         self.win.removeListBoxItems(
             "lstDatabase", 0, self.win.getListBoxItemCount("lstDatabase"))
         self.win.setEditText("txtHost", aVal[0])
         for i in range(len(aVal[1])):
             self.lstDatabase.addItem(aVal[1][i], i)
     elif aVal[1] == 0:
         ErrorDialog(aVal[0], "")
     else:
         self.win.setEditText("txtHost", aVal[0])
         self.win.removeListBoxItems(
             "lstDatabase", 0, self.win.getListBoxItemCount("lstDatabase"))
         for i in range(len(aVal[1])):
             self.lstDatabase.addItem(aVal[1][i], i)
Пример #12
0
    def __init__(self,
                 sVariable="",
                 sFields="",
                 sDisplayName="",
                 bFromModify=False):
        LoginTest()
        if not loginstatus and __name__ == "package":
            exit(1)
        self.logobj = Logger()
        self.win = DBModalDialog(60, 50, 200, 225, "Field Builder")

        self.win.addFixedText("lblVariable", 27, 12, 60, 15, "Variable :")
        self.win.addComboBox("cmbVariable",
                             180 - 120 - 2,
                             10,
                             130,
                             15,
                             True,
                             itemListenerProc=self.cmbVariable_selected)
        self.insVariable = self.win.getControl("cmbVariable")

        self.win.addFixedText("lblFields", 10, 32, 60, 15, "Variable Fields :")
        self.win.addComboListBox("lstFields",
                                 180 - 120 - 2,
                                 30,
                                 130,
                                 150,
                                 False,
                                 True,
                                 itemListenerProc=self.lstbox_selected)
        self.insField = self.win.getControl("lstFields")

        self.win.addFixedText("lblUName", 8, 187, 60, 15, "Displayed name :")
        self.win.addEdit(
            "txtUName",
            180 - 120 - 2,
            185,
            130,
            15,
        )

        self.win.addButton('btnOK',
                           -5,
                           -5,
                           45,
                           15,
                           'Ok',
                           actionListenerProc=self.btnOk_clicked)
        self.win.addButton('btnCancel',
                           -5 - 45 - 5,
                           -5,
                           45,
                           15,
                           'Cancel',
                           actionListenerProc=self.btnCancel_clicked)

        global passwd
        self.password = passwd
        global url
        self.sock = RPCSession(url)

        self.sValue = None
        self.sObj = None
        self.aSectionList = []
        self.sGDisplayName = sDisplayName
        self.aItemList = []
        self.aComponentAdd = []
        self.aObjectList = []
        self.aListFields = []
        self.aVariableList = []
        EnumDocument(self.aItemList, self.aComponentAdd)
        desktop = getDesktop()
        doc = desktop.getCurrentComponent()
        docinfo = doc.getDocumentInfo()
        self.sMyHost = ""

        if not docinfo.getUserFieldValue(
                3) == "" and not docinfo.getUserFieldValue(0) == "":
            self.sMyHost = docinfo.getUserFieldValue(0)
            self.count = 0
            oParEnum = doc.getTextFields().createEnumeration()

            while oParEnum.hasMoreElements():
                oPar = oParEnum.nextElement()
                if oPar.supportsService(
                        "com.sun.star.text.TextField.DropDown"):
                    self.count += 1

            getList(self.aObjectList, self.sMyHost, self.count)
            cursor = doc.getCurrentController().getViewCursor()
            text = cursor.getText()
            tcur = text.createTextCursorByRange(cursor)

            self.aVariableList.extend(
                filter(lambda obj: obj[:obj.find("(")] == "Objects",
                       self.aObjectList))

            for i in range(len(self.aItemList)):
                try:
                    anItem = self.aItemList[i][1]
                    component = self.aComponentAdd[i]

                    if component == "Document":
                        sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
                        self.aVariableList.extend(
                            filter(lambda obj: obj[:obj.find("(")] == sLVal,
                                   self.aObjectList))

                    if tcur.TextSection:
                        getRecersiveSection(tcur.TextSection,
                                            self.aSectionList)
                        if component in self.aSectionList:
                            sLVal = anItem[anItem.find(",'") +
                                           2:anItem.find("')")]
                            self.aVariableList.extend(
                                filter(
                                    lambda obj: obj[:obj.find("(")] == sLVal,
                                    self.aObjectList))

                    if tcur.TextTable:
                        if not component == "Document" and component[
                                component.rfind(".") +
                                1:] == tcur.TextTable.Name:
                            VariableScope(tcur, self.aVariableList,
                                          self.aObjectList, self.aComponentAdd,
                                          self.aItemList, component)
                except:
                    import traceback, sys
                    info = reduce(
                        lambda x, y: x + y,
                        traceback.format_exception(sys.exc_type, sys.exc_value,
                                                   sys.exc_traceback))
                    self.logobj.log_write('Fields', LOG_ERROR, info)

            self.bModify = bFromModify
            if self.bModify == True:
                sItem = ""
                for anObject in self.aObjectList:
                    if anObject[:anObject.find("(")] == sVariable:
                        sItem = anObject
                        self.insVariable.setText(sItem)
                genTree(sItem[sItem.find("(") + 1:sItem.find(")")],
                        self.aListFields,
                        self.insField,
                        self.sMyHost,
                        2,
                        ending_excl=[
                            'one2many', 'many2one', 'many2many', 'reference'
                        ],
                        recur=['many2one'])
                self.sValue = self.win.getListBoxItem(
                    "lstFields", self.aListFields.index(sFields))
            for var in self.aVariableList:

                self.model_ids = self.sock.execute(
                    database, uid, self.password, 'ir.model', 'search',
                    [('model', '=', var[var.find("(") + 1:var.find(")")])])
                fields = ['name', 'model']
                self.model_res = self.sock.execute(database, uid,
                                                   self.password, 'ir.model',
                                                   'read', self.model_ids,
                                                   fields)
                if self.model_res <> []:
                    self.insVariable.addItem(
                        var[:var.find("(") + 1] + self.model_res[0]['name'] +
                        ")", self.insVariable.getItemCount())
                else:
                    self.insVariable.addItem(var,
                                             self.insVariable.getItemCount())

            self.win.doModalDialog("lstFields", self.sValue)
        else:
            ErrorDialog(
                "Please insert user define field Field-1 or Field-4",
                "Just go to File->Properties->User Define \nField-1 E.g. http://localhost:8069 \nOR \nField-4 E.g. account.invoice"
            )
            self.win.endExecute()
Пример #13
0
    def __init__(self,
                 sObject="",
                 sVariable="",
                 sFields="",
                 sDisplayName="",
                 bFromModify=False):
        # Interface Design
        LoginTest()
        self.logobj = Logger()
        if not loginstatus and __name__ == "package":
            exit(1)

        self.win = DBModalDialog(60, 50, 180, 250, "RepeatIn Builder")
        self.win.addFixedText("lblVariable", 2, 12, 60, 15,
                              "Objects to loop on :")
        self.win.addComboBox("cmbVariable",
                             180 - 120 - 2,
                             10,
                             120,
                             15,
                             True,
                             itemListenerProc=self.cmbVariable_selected)
        self.insVariable = self.win.getControl("cmbVariable")

        self.win.addFixedText("lblFields", 10, 32, 60, 15,
                              "Field to loop on :")
        self.win.addComboListBox("lstFields",
                                 180 - 120 - 2,
                                 30,
                                 120,
                                 150,
                                 False,
                                 itemListenerProc=self.lstbox_selected)
        self.insField = self.win.getControl("lstFields")

        self.win.addFixedText("lblName", 12, 187, 60, 15, "Variable name :")
        self.win.addEdit(
            "txtName",
            180 - 120 - 2,
            185,
            120,
            15,
        )

        self.win.addFixedText("lblUName", 8, 207, 60, 15, "Displayed name :")
        self.win.addEdit(
            "txtUName",
            180 - 120 - 2,
            205,
            120,
            15,
        )

        self.win.addButton('btnOK',
                           -2,
                           -10,
                           45,
                           15,
                           'Ok',
                           actionListenerProc=self.btnOk_clicked)

        self.win.addButton('btnCancel',
                           -2 - 45 - 5,
                           -10,
                           45,
                           15,
                           'Cancel',
                           actionListenerProc=self.btnCancel_clicked)

        global passwd
        self.password = passwd
        global url
        self.sock = RPCSession(url)
        # Variable Declaration
        self.sValue = None
        self.sObj = None
        self.aSectionList = []
        self.sGVariable = sVariable
        self.sGDisplayName = sDisplayName
        self.aItemList = []
        self.aComponentAdd = []
        self.aObjectList = []
        self.aListRepeatIn = []
        self.aVariableList = []
        # Call method to perform Enumration on Report Document
        EnumDocument(self.aItemList, self.aComponentAdd)
        # Perform checking that Field-1 and Field - 4 is available or not alos get Combobox
        # filled if condition is true
        desktop = getDesktop()
        doc = desktop.getCurrentComponent()
        docinfo = doc.getDocumentInfo()
        # Check weather Field-1 is available if not then exit from application
        self.sMyHost = ""

        if not docinfo.getUserFieldValue(
                3) == "" and not docinfo.getUserFieldValue(0) == "":
            self.sMyHost = docinfo.getUserFieldValue(0)
            self.count = 0
            oParEnum = doc.getTextFields().createEnumeration()

            while oParEnum.hasMoreElements():
                oPar = oParEnum.nextElement()
                if oPar.supportsService(
                        "com.sun.star.text.TextField.DropDown"):
                    self.count += 1

            getList(self.aObjectList, self.sMyHost, self.count)
            cursor = doc.getCurrentController().getViewCursor()
            text = cursor.getText()
            tcur = text.createTextCursorByRange(cursor)

            self.aVariableList.extend(
                filter(lambda obj: obj[:obj.find(" ")] == "List",
                       self.aObjectList))

            for i in range(len(self.aItemList)):
                try:
                    anItem = self.aItemList[i][1]
                    component = self.aComponentAdd[i]

                    if component == "Document":
                        sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
                        self.aVariableList.extend(
                            filter(lambda obj: obj[:obj.find("(")] == sLVal,
                                   self.aObjectList))

                    if tcur.TextSection:
                        getRecersiveSection(tcur.TextSection,
                                            self.aSectionList)
                        if component in self.aSectionList:
                            sLVal = anItem[anItem.find(",'") +
                                           2:anItem.find("')")]
                            self.aVariableList.extend(
                                filter(
                                    lambda obj: obj[:obj.find("(")] == sLVal,
                                    self.aObjectList))

                    if tcur.TextTable:
                        if not component == "Document" and component[
                                component.rfind(".") +
                                1:] == tcur.TextTable.Name:
                            VariableScope(tcur, self.aVariableList,
                                          self.aObjectList, self.aComponentAdd,
                                          self.aItemList, component)
                except:
                    import traceback, sys
                    info = reduce(
                        lambda x, y: x + y,
                        traceback.format_exception(sys.exc_type, sys.exc_value,
                                                   sys.exc_traceback))
                    self.logobj.log_write('RepeatIn', LOG_ERROR, info)
            self.bModify = bFromModify

            if self.bModify == True:

                if sObject == "":
                    self.insVariable.setText("List of " +
                                             docinfo.getUserFieldValue(3))
                    self.insField.addItem(
                        "objects", self.win.getListBoxItemCount("lstFields"))
                    self.win.setEditText("txtName", sVariable)
                    self.win.setEditText("txtUName", sDisplayName)
                    self.sValue = "objects"
                else:
                    sItem = ""
                    for anObject in self.aObjectList:
                        if anObject[:anObject.find("(")] == sObject:
                            sItem = anObject
                            self.insVariable.setText(sItem)

                    genTree(sItem[sItem.find("(") + 1:sItem.find(")")],
                            self.aListRepeatIn,
                            self.insField,
                            self.sMyHost,
                            2,
                            ending=['one2many', 'many2many'],
                            recur=['one2many', 'many2many'])

                    self.sValue = self.win.getListBoxItem(
                        "lstFields", self.aListRepeatIn.index(sFields))

            for var in self.aVariableList:

                if var[:8] <> 'List of ':
                    self.model_ids = self.sock.execute(
                        database, uid, self.password, 'ir.model', 'search',
                        [('model', '=', var[var.find("(") + 1:var.find(")")])])
                else:
                    self.model_ids = self.sock.execute(
                        database, uid, self.password, 'ir.model', 'search',
                        [('model', '=', var[8:])])
                fields = ['name', 'model']
                self.model_res = self.sock.execute(database, uid,
                                                   self.password, 'ir.model',
                                                   'read', self.model_ids,
                                                   fields)
                if self.model_res <> []:
                    if var[:8] <> 'List of ':
                        self.insVariable.addItem(
                            var[:var.find("(") + 1] +
                            self.model_res[0]['name'] + ")",
                            self.insVariable.getItemCount())
                    else:
                        self.insVariable.addItem(
                            'List of ' + self.model_res[0]['name'],
                            self.insVariable.getItemCount())
                else:
                    self.insVariable.addItem(var,
                                             self.insVariable.getItemCount())

            self.win.doModalDialog("lstFields", self.sValue)
        else:
            ErrorDialog(
                "Please Select Appropriate module",
                "Create new report from: \nTuniERP -> Open a New Report")
            self.win.endExecute()