def _saveSetup(self): """ Salviamo i dati modificati in interfaccia """ g = SetConf().select(key="cliente_struttura_codice", section="Clienti") g[0].value = str(self.clienti_struttura_codice_entry.get_text()) g[0].tipo = "str" Environment.session.add(g[0]) c = SetConf().select(key="cliente_codice_upper", section="Clienti") c[0].value = str(self.clienti_codice_upper_check.get_active()) c[0].tipo = "bool" Environment.session.add(c[0]) c = SetConf().select(key="cliente_insegna", section="Clienti") if c: c = c[0] else: c = SetConf() c.key = "cliente_insegna" c.section = "Clienti" c.value = str(self.clienti_insegna_check.get_active()) c.tipo = "bool" c.description = "visualizzare il campo per insegna" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="cliente_nome", section="Clienti") if c: c = c[0] else: c = SetConf() c.key = "cliente_nome" c.section = "Clienti" c.value = str(self.clienti_nomi_check.get_active()) c.tipo = "bool" c.description = "visualizzare il campo per nome" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="cliente_cognome", section="Clienti") if c: c = c[0] else: c = SetConf() c.key = "cliente_cognome" c.section = "Clienti" c.value = str(self.clienti_cognomi_check.get_active()) c.tipo = "bool" c.description = "visualizzare il campo per cognome" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c)
def _saveSetup(self): """ Salviamo i dati modificati in interfaccia """ d = SetConf().select(key="sistemarigafrontaline", section="Label") if d: d = d[0] else: d = SetConf() d.key = "sistemarigafrontaline" d.section = "Label" d.tipo = "int" if self.sistemarigafrontaline_entry.get_text() =="": valore = "1" else: valore = self.sistemarigafrontaline_entry.get_text() d.value = valore d.description = "parametro di allineamento riga in label" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d) d = SetConf().select(key="sistemacolonnafrontaline", section="Label") if d: d = d[0] else: d = SetConf() d.key = "sistemacolonnafrontaline" d.section = "Label" d.tipo = "int" if self.sistemarigafrontaline_entry.get_text() == "": valore = "1" else: valore = self.sistemarigafrontaline_entry.get_text() d.value = valore d.description = "parametro di allineamento colonna in label" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d)
def _saveSetup(self): """ Salviamo i dati modificati in interfaccia """ changed = (self.vecchia_data_cassa != self.data_cassa_DateWidget.get_text()) or \ (self.vecchio_valore_cassa != self.valore_cassa_SignedMoneyEntryField.get_text()) or \ (self.vecchia_data_banca != self.data_banca_DateWidget.get_text()) or \ (self.vecchio_valore_banca != self.valore_banca_SignedMoneyEntryField.get_text()) if changed and YesNoDialog(msg="Sei sicuro di voler modificare le date e i valori di Prima Nota?"): # CASSA c = SetConf().select(key="data_saldo_parziale_cassa_primanota", section="PrimaNota") if c: c = c[0] else: c = SetConf() c.key = "data_saldo_parziale_cassa_primanota" c.section = "PrimaNota" c.value = str(self.data_cassa_DateWidget.get_text()) c.tipo = "date" c.description = "Data saldo parziale di cassa per prima nota" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="valore_saldo_parziale_cassa_primanota", section="PrimaNota") if c: c = c[0] else: c = SetConf() c.key = "valore_saldo_parziale_cassa_primanota" c.section = "PrimaNota" c.value = str(self.valore_cassa_SignedMoneyEntryField.get_text()) c.tipo = "float" c.description = "Valore saldo parziale di cassa per prima nota" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) # BANCA c = SetConf().select(key="data_saldo_parziale_banca_primanota", section="PrimaNota") if c: c = c[0] else: c = SetConf() c.key = "data_saldo_parziale_banca_primanota" c.section = "PrimaNota" c.value = str(self.data_banca_DateWidget.get_text()) c.tipo = "date" c.description = "Data saldo parziale di banca per prima nota" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="valore_saldo_parziale_banca_primanota", section="PrimaNota") if c: c = c[0] else: c = SetConf() c.key = "valore_saldo_parziale_banca_primanota" c.section = "PrimaNota" c.value = str(self.valore_banca_SignedMoneyEntryField.get_text()) c.tipo = "float" c.description = "Valore saldo parziale di banca per prima nota" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) # Salvo i vecchi valori self.vecchia_data_cassa = str(self.data_cassa_DateWidget.get_text()).strip() self.vecchio_valore_cassa = str(self.valore_cassa_SignedMoneyEntryField.get_text()).strip() self.vecchia_data_banca = str(self.data_banca_DateWidget.get_text()).strip() self.vecchio_valore_banca = str(self.valore_banca_SignedMoneyEntryField.get_text()).strip() c = SetConf().select(key="aggiungi_partita_iva", section="PrimaNota") if c: c = c[0] else: c = SetConf() c.key = "aggiungi_partita_iva" c.section = "PrimaNota" c.value = str(self.aggiungi_partita_iva_check.get_active()) c.tipo = "bool" c.description = "Aggiungere la partita IVA di un cliente/fornitore e/o il codice fiscale di un cliente in descrizione operazione" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="inserisci_senza_data_pagamento", section="PrimaNota") if c: c = c[0] else: c = SetConf() c.key = "inserisci_senza_data_pagamento" c.section = "PrimaNota" c.value = str(self.inserisci_senza_data_pagamento_check.get_active()) c.tipo = "bool" c.description = "Inserire la prima nota senza data di scadenza" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="saldi_periodo", section="PrimaNota") if c: c = c[0] else: c = SetConf() c.key = "saldi_periodo" c.section = "PrimaNota" c.value = str(self.inserisci_totali_generali_in_report_check.get_active()) c.tipo = "bool" c.description = "Inserire i saldi per periodo nel report" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c)
def _saveSetup(self): """ Salviamo i dati modificati in interfaccia """ d = SetConf().select(key="multilinealimite", section="Multilinea") d[0].value = str(self.multilinea_entry.get_text()) d[0].tipo = "int" Environment.session.add(d[0]) d = SetConf().select(key="causale_vendita", section="Documenti") if d: d = d[0] else: d = SetConf() d.key = "causale_vendita" d.section = "Documenti" d.tipo = "str" d.value = str(self.causale_vendita_entry.get_text()) d.description = "causale vendita preferenziale da preimpostare" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d) d = SetConf().select(key="incaricato_predef", section="Documenti") if d: d = d[0] else: d = SetConf() d.key = "incaricato_predef" d.section = "Documenti" d.tipo = "str" d.value = findStrFromCombobox(self.incaricato_predef_combobox, 0) d.description = "incaricato trasporto preferenziale da preimpostare" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d) c = SetConf().select(key="primo_dest_merce", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "primo_dest_merce" c.section = "Documenti" c.tipo = "bool" c.value = str(self.primo_dest_merce_check.get_active()) c.description = "Seleziona primo destinatario merce in lista" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) d = SetConf().select(key="tipo_documento_predefinito", section="Documenti") if d: d = d[0] else: d = SetConf() d.key = "tipo_documento_predefinito" d.section = "Documenti" d.tipo = "str" d.value = findIdFromCombobox(self.tipo_documento_predefinito_combo) d.description = "eventuale tipo documento preferenziale da preimpostare" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d) d = SetConf().select(key="tipo_movimento_predefinito", section="Documenti") if d: d = d[0] else: d = SetConf() d.key = "tipo_movimento_predefinito" d.section = "Documenti" d.tipo = "str" d.value = findIdFromCombobox(self.tipo_movimento_predefinito_combo) d.description = "eventuale tipo movimento preferenziale da preimpostare" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d) d = SetConf().select(key="cliente_predefinito", section="Documenti") if d: d = d[0] else: d = SetConf() d.key = "cliente_predefinito" d.section = "Documenti" d.tipo = "int" d.value = findIdFromCombobox(self.cliente_predefinito_combo) d.description = "eventuale cliente preferenziale da preimpostare" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d) c = SetConf().select(key="lotto_temp", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "lotto_temp" c.section = "Documenti" c.tipo = "bool" c.value = str(self.lotto_temp_check.get_active()) c.description = "gestione lotti temporanei" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="add_quantita", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "add_quantita" c.section = "Documenti" c.tipo = "bool" c.value = str(self.add_quantita_check.get_active()) c.description = "Aggiugni quantita" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="lista_componenti_articolokit", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "lista_componenti_articolokit" c.section = "Documenti" c.tipo = "bool" c.value = str(self.lista_componenti_articolokit_check.get_active()) c.description = "visualizza in stampa la lista dei componenti articolo kit" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="no_ricerca_incrementale", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "no_ricerca_incrementale" c.section = "Documenti" c.tipo = "bool" c.value = str(self.lotto_temp_check.get_active()) c.description = "elimina la ricerca incrementale su codici a barre" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) d = SetConf().select(key="fornitore_predefinito", section="Documenti") if d: d = d[0] else: d = SetConf() d.key = "fornitore_predefinito" d.section = "Documenti" d.tipo = "int" d.value = findIdFromCombobox(self.fornitore_predefinito_combo) d.description = "eventuale fornitore preferenziale da preimpostare" d.tipo_section = "Generico" d.active = True d.visible = True d.date = datetime.datetime.now() Environment.session.add(d) d = SetConf().select(key="ricerca_per", section="Documenti") if self.codice_radio.get_active(): d[0].value = "codice" elif self.codice_a_barre_radio.get_active(): d[0].value = "codice_a_barre" elif self.descrizione_radio.get_active(): d[0].value = "descrizione" elif self.codice_articolo_fornitore_radio.get_active(): d[0].value = "codice_articolo_fornitore" d[0].tipo = "str" Environment.session.add(d[0]) c = SetConf().select(key="costi_ddt_riga", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "costi_ddt_riga" c.section = "Documenti" c.tipo = "bool" c.value = str(self.costi_ddt_riga_check.get_active()) c.description = "visualizza i costi in DDT riga" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="costi_ddt_totale", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "costi_ddt_totale" c.section = "Documenti" c.tipo = "bool" c.value = str(self.costi_ddt_totale_check.get_active()) c.description = "visualizza i costi in DDT totale" c.tipo_section = "Generico" c.active = True c.visible = True c.date = datetime.datetime.now() Environment.session.add(c) c = SetConf().select(key="save_new_doc", section="Documenti") if c: c=c[0] else: c = SetConf() c.key = "save_new_doc" c.section = "Documenti" c.tipo = "bool" c.value = str(self.save_new_doc_check.get_active()) c.description = "opzione per attivare l'inserimento del nuovo documento dopo il salvataggio" c.tipo_section = "Generico" c.active = False c.visible = True c.date = datetime.datetime.now() Environment.session.add(c)
def on_inserimento_codice_activate(self,widget): from promogest.dao.Setconf import SetConf dialog = gtk.MessageDialog(self.getTopLevel(), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_MESSAGE_INFO, GTK_BUTTON_OK) dialog.set_markup(_("""<b> CODICE ATTIVAZIONE PACCHETTO </b>""")) hbox = gtk.HBox() entry___ = gtk.Entry() label = gtk.Label() label.set_markup(_("<b> Inserisci codice </b>")) hbox.pack_start(label, True, True, 0) hbox.pack_start(entry___, True, True, 0) dialog.get_content_area().pack_start(hbox, True, True, 0) dialog.show_all() dialog.run() codice = entry___.get_text() # hascode = str(hashlib.sha224(codice+orda(codice)).hexdigest()) if "cl" and "|" in codice : d = codice.split("|") if d[1] == "azienda": if Environment.tipodb == "sqlite": from promogest.dao.Azienda import Azienda oldnomeazienda = d[2] newnameazienda = d[3] aa = Azienda().select(schemaa = oldnomeazienda) if aa: aa[0].schemaa = newnameazienda.strip() aa[0].persist() messageInfo(msg=_("NOME AZIENDA MODIFICATO")) dialog.destroy() return else: messageInfo(msg=_("VECCHIO NOME AZIENDA NON TROVATO")) dialog.destroy() return return else: messageInfo(msg=_("POSSIBILE SOLO CON LA VERSIONE ONE")) dialog.destroy() return elif d[1] == "modulo": tipo_section = d[2] # Modulo section = d[3] # Inventario description = str(d[4]) or "" # Gestione inventario tipo = d[5] or None # Niente o BOOLEAN o colore active = bool(d[6]) or True # bool visible = bool(d[7]) or True # bool key = d[8] # mod_enable value = d[9] # yes or no if section not in Environment.modules_folders: messageInfo(msg=_("ERRORE ATTIVAZIONE MODULO")) return dao = SetConf().select(key=key, section=section) if dao: d = dao[0] else: d = SetConf() d.key = key d.value =value d.section = section d.description = description d.tipo_section = tipo_section d.tipo = tipo d.active = active d.visible = visible d.date = datetime.now() d.persist() messageInfo(msg=_("MODULO O OPZIONE MODIFICATO attivato o disattivato")) dialog.destroy() return elif d[1] == "registro": operazione = d[2].strip()+".registro" registro_da_assegnare = d[3] from promogest.dao.Setting import Setting a = Setting().getRecord(id=operazione) if a: b = Setting().select(value=registro_da_assegnare) if b: a.value = registro_da_assegnare a.persist() messageInfo(msg=_("REGISTRO NUMERAZIONE MODIFICATO\n\nRIAVVIARE")) dialog.destroy() return True else: messageInfo(msg=_("REGISTRO DA ASSEGNARE NON TROVATO O CORRETTO\n\n RIPROVARE")) return False else: messageInfo(msg=_("OPERAZIONE NON CORRETTA E NON TROVATA\n\nRIPROVARE")) return False else: sets = SetConf().select(key="install_code",section="Master") if sets: sets[0].delete() if codice: k = SetConf() k.key = "install_code" k.value =str(hashlib.sha224(codice+orda(codice)).hexdigest()) k.section = "Master" k.description = "codice identificativo della propria installazione" k.tipo_section = "General" k.tipo = "ONE" k.active = True k.date = datetime.now() k.persist() messageInfo(msg=_("ATTIVAZIONE EFFETTUATA, RIAVVIARE IL PROMOGEST")) dialog.destroy()