PageRenderTime 67ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/core/promogest/modules/SchedaLavorazione/ui/AnagraficaSchedeOrdinazioniEdit.py

http://promogest.googlecode.com/
Python | 1144 lines | 1090 code | 21 blank | 33 comment | 0 complexity | b18ed5845029508c0e23d3f9196c4364 MD5 | raw file
Possible License(s): GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2005, 2006, 2007 2008, 2009, 2010, 2011 by Promotux
  3. # di Francesco Meloni snc - http://www.promotux.it/
  4. # Author: JJDaNiMoTh <jjdanimoth@gmail.com>
  5. # Author: Dr astico (Marco Pinna)<marco@promotux.it>
  6. # Author: Francesco Meloni <francesco@promotux.it>
  7. # Author: Francesco Marella <francesco.marella@gmail.com>
  8. # This file is part of Promogest.
  9. # Promogest is free software: you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation, either version 2 of the License, or
  12. # (at your option) any later version.
  13. # Promogest is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. # You should have received a copy of the GNU General Public License
  18. # along with Promogest. If not, see <http://www.gnu.org/licenses/>.
  19. import datetime
  20. from decimal import *
  21. import string
  22. from random import Random
  23. import threading
  24. from promogest import Environment
  25. from promogest.ui.AnagraficaComplessaEdit import AnagraficaEdit
  26. from promogest.dao.Operazione import Operazione
  27. from promogest.modules.SchedaLavorazione.ui.AnagraficaCaratteriStampa import AnagraficaCaratteriStampa
  28. from promogest.modules.SchedaLavorazione.ui.AnagraficaColoriStampa import AnagraficaColoriStampa
  29. from promogest.modules.SchedaLavorazione.dao import SchedaOrdinazione
  30. from promogest.modules.SchedaLavorazione.dao.SchedaOrdinazione import SchedaOrdinazione
  31. from promogest.modules.SchedaLavorazione.dao.RigaSchedaOrdinazione import RigaSchedaOrdinazione
  32. from promogest.modules.SchedaLavorazione.dao.ScontoSchedaOrdinazione import ScontoSchedaOrdinazione
  33. from promogest.modules.SchedaLavorazione.dao.ColoreStampa import ColoreStampa
  34. from promogest.modules.SchedaLavorazione.dao.CarattereStampa import CarattereStampa
  35. from promogest.modules.SchedaLavorazione.dao.Datario import Datario
  36. from promogest.ui.AnagraficaClienti import AnagraficaClienti
  37. from promogest.dao.Listino import Listino
  38. from promogest.dao.ListinoArticolo import ListinoArticolo
  39. from promogest.dao.Magazzino import Magazzino
  40. from promogest.dao.DaoUtils import giacenzaArticolo
  41. from promogest.dao.Riga import Riga
  42. from promogest.modules.SchedaLavorazione.dao.ScontoRigaScheda import ScontoRigaScheda
  43. from promogest.modules.DistintaBase.dao.AssociazioneArticolo import AssociazioneArticolo
  44. from promogest.dao.Articolo import Articolo
  45. from promogest.dao.UnitaBase import UnitaBase
  46. from promogest.dao.Cliente import Cliente
  47. from promogest.modules.SchedaLavorazione.dao.PromemoriaSchedaOrdinazione import PromemoriaSchedaOrdinazione
  48. from promogest.dao.TestataDocumento import TestataDocumento
  49. from promogest.ui.GladeWidget import GladeWidget
  50. from promogest.ui.utils import *
  51. from promogest.ui.utilsCombobox import *
  52. from promogest.ui.gtk_compat import *
  53. from SchedaLavorazioneUtils import *
  54. from widgets.SchedeOrdinazioniEditWidget import SchedeOrdinazioniEditWidget
  55. from DuplicaInFattura import DuplicaInFattura
  56. class AnagraficaSchedeOrdinazioniEdit(SchedeOrdinazioniEditWidget,AnagraficaEdit):
  57. """
  58. Modifica i dati relativi ad una scheda lavorazione
  59. """
  60. def __init__(self, anagrafica):
  61. #SchedeOrdinazioniEditWidget.__init__(self)
  62. AnagraficaEdit.__init__(self,
  63. anagrafica,
  64. 'anagrafica_schede_ordinazioni_detail_vbox',
  65. 'Dettagli scheda lavorazione',
  66. gladeFile='SchedaLavorazione/gui/SchedaLavorazione.glade',
  67. module=True)
  68. self._prepareWindowPlacement()
  69. self._anagrafica = anagrafica
  70. self._widgetFirstFocus = self.nomi_sposi_entry
  71. self.rimuovi_articolo_button.set_sensitive(False)
  72. self._loading = False
  73. self._tabPressed = False
  74. self._id_listino = None
  75. self.daoListino = None
  76. self.daoCarattereStampa = None
  77. self.daoPagamento = None
  78. self.daoColoreStampa = None
  79. self._sconti = None
  80. self.daoCliente = None
  81. self._tipoPersonaGiuridica = 'cliente'
  82. self._parzialeLordo = Decimal(str(0))
  83. self._parzialeNetto = Decimal(str(0))
  84. self.righeTEMP = []
  85. self.scontiTEMP = []
  86. self.scontiSuTotale = []
  87. def draw(self,cplx=False):
  88. """
  89. popola le combobox della gui e imposta le colonne degli articoli nella treeview articoli
  90. """
  91. fillComboboxListini(self.listino_combobox)
  92. fillComboboxMagazzini(self.magazzino_combobox)
  93. fillComboboxAssociazioneArticoli(self.associazione_articoli_comboboxentry)
  94. self.id_cliente_customcombobox.setSingleValue()
  95. self.id_cliente_customcombobox.setOnChangedCall(self.on_cliente_changed)
  96. self.id_cliente_customcombobox.setType(self._tipoPersonaGiuridica)
  97. fillComboboxCarattereStampa(self.carattere_stampa_combobox)
  98. fillComboboxColoreStampa(self.colore_stampa_combobox)
  99. treeview = self.articoli_treeview
  100. renderer = gtk.CellRendererText()
  101. renderer.set_data('column', 0)
  102. renderer.set_data('min_length', 150)
  103. column = gtk.TreeViewColumn('Codice articolo', renderer, text=2)
  104. column.set_sizing(GTK_COLUMN_FIXED)
  105. column.set_clickable(False)
  106. column.set_resizable(False)
  107. column.set_expand(False)
  108. column.set_alignment(0.5)
  109. column.set_fixed_width(150)
  110. treeview.append_column(column)
  111. renderer = gtk.CellRendererText()
  112. renderer.set_property('editable', True)
  113. renderer.set_property('xalign', 0)
  114. renderer.connect('edited', self.on_column_edited, treeview, False)
  115. renderer.set_data('max_length', 200)
  116. renderer.set_data('column', 1)
  117. column = gtk.TreeViewColumn('Descrizione', renderer, text=3)
  118. column.set_sizing(GTK_COLUMN_FIXED)
  119. column.set_clickable(False)
  120. column.set_resizable(True)
  121. column.set_expand(True)
  122. column.set_alignment(0.5)
  123. column.set_min_width(300)
  124. treeview.append_column(column)
  125. renderer = gtk.CellRendererText()
  126. renderer.set_data('column', 2)
  127. renderer.set_property('xalign', 0.5)
  128. renderer.set_data('min_length', 50)
  129. column = gtk.TreeViewColumn('U.M.', renderer, text=4)
  130. column.set_sizing(GTK_COLUMN_FIXED)
  131. column.set_clickable(False)
  132. column.set_resizable(False)
  133. column.set_expand(False)
  134. column.set_alignment(0.5)
  135. column.set_fixed_width(50)
  136. treeview.append_column(column)
  137. renderer = gtk.CellRendererSpin()
  138. renderer.set_property('editable', True)
  139. renderer.set_property('xalign', 0.5)
  140. adjustment = gtk.Adjustment(1, 1, 1000,1,2)
  141. renderer.set_property("adjustment", adjustment)
  142. renderer.set_property("digits",2)
  143. renderer.set_property("climb-rate",3)
  144. renderer.connect('edited', self.on_column_quantita_edited, treeview, False)
  145. column = gtk.TreeViewColumn('Q.ta', renderer, text=5)
  146. column.set_sizing(GTK_COLUMN_FIXED)
  147. column.set_clickable(False)
  148. column.set_resizable(False)
  149. column.set_expand(False)
  150. column.set_alignment(0.5)
  151. column.set_fixed_width(80)
  152. treeview.append_column(column)
  153. renderer = gtk.CellRendererText()
  154. renderer.set_property('editable', True)
  155. renderer.set_property('xalign', 1)
  156. renderer.connect('edited', self.on_column_edited, treeview, False)
  157. renderer.set_data('column', 4)
  158. renderer.set_data('max_length', 200)
  159. column = gtk.TreeViewColumn('Prezzo lordo', renderer, text=6)
  160. column.set_sizing(GTK_COLUMN_FIXED)
  161. column.set_clickable(False)
  162. column.set_resizable(False)
  163. column.set_expand(False)
  164. column.set_alignment(0.5)
  165. column.set_fixed_width(100)
  166. treeview.append_column(column)
  167. renderer = gtk.CellRendererText()
  168. renderer.set_property('xalign', 1)
  169. renderer.set_data('column', 5)
  170. renderer.set_data('max_length', 200)
  171. column = gtk.TreeViewColumn('Prezzo netto', renderer, text=7)
  172. column.set_sizing(GTK_COLUMN_FIXED)
  173. column.set_clickable(False)
  174. column.set_resizable(False)
  175. column.set_expand(False)
  176. column.set_alignment(0.5)
  177. column.set_fixed_width(100)
  178. treeview.append_column(column)
  179. renderer = gtk.CellRendererText()
  180. renderer.set_data('column', 6)
  181. renderer.set_property('xalign', 1)
  182. column = gtk.TreeViewColumn('Totale', renderer, text=8)
  183. column.set_sizing(GTK_COLUMN_FIXED)
  184. column.set_clickable(False)
  185. column.set_resizable(False)
  186. column.set_expand(False)
  187. column.set_alignment(0.5)
  188. column.set_fixed_width(100)
  189. treeview.append_column(column)
  190. # fillComboboxOperazioni(self.id_operazione_combobox, 'movimento')
  191. res = Operazione().select(segno="-",tipoPersonaGiuridica="", tipoOperazione="movimento")
  192. model = gtk.ListStore(object, str, str)
  193. for o in res:
  194. model.append((o, o.denominazione, (o.denominazione or '')[0:30]))
  195. self.fattura_toggle.set_active(True)
  196. self.id_operazione_combobox.set_sensitive(False)
  197. self.id_operazione_combobox.clear()
  198. renderer = gtk.CellRendererText()
  199. self.id_operazione_combobox.pack_start(renderer, True)
  200. self.id_operazione_combobox.add_attribute(renderer, 'text', 2)
  201. self.id_operazione_combobox.set_model(model)
  202. self._articoliTreeviewModel = gtk.ListStore(object, str, str, str, str, str, str,str,str)
  203. self.articoli_treeview.set_model(self._articoliTreeviewModel)
  204. self.sconti_scheda_widget.button.connect('toggled',self.on_sconti_scheda_widget_button_toggled)
  205. def on_fattura_toggle_toggled(self, button):
  206. if self.fattura_toggle.get_active():
  207. self.id_operazione_combobox.set_sensitive(False)
  208. else:
  209. self.id_operazione_combobox.set_sensitive(True)
  210. def on_duplica_button_clicked(self, button):
  211. if self.fattura_toggle.get_active():
  212. print "DUPLICHIAMO IN FATTURA"
  213. DuplicaInFattura(dao=self.dao, ui = self).checkField(tipo="fattura")
  214. else:
  215. print "DEVO FARE UN MOVIMENTO"
  216. self._operazione = findIdFromCombobox(self.id_operazione_combobox)
  217. operazione = leggiOperazione(self._operazione)
  218. DuplicaInFattura(dao=self.dao, ui = self).checkField(tipo="movimento",operazione=self._operazione)
  219. def setDao(self, dao):
  220. self.righeTEMP = []
  221. if not dao:
  222. self.dao = SchedaOrdinazione()
  223. self.dao.data_presa_in_carico = datetime.datetime.today()
  224. self._dataScheda = dateToString(self.dao.data_presa_in_carico)
  225. self._numeroScheda = 0
  226. self._articoliTreeviewModel.clear()
  227. self._clear()
  228. self.scontiTEMP = []
  229. self._refresh()
  230. else:
  231. self._dataScheda = dateToString(dao.data_presa_in_carico)
  232. self._numeroScheda=dao.numero
  233. self.dao = dao
  234. self.dettagli_scheda_notebook.set_current_page(0)
  235. self._refresh(firstLoad=True)
  236. def _refresh(self, firstLoad=False):
  237. """
  238. Riempie tutti i form della scheda con i relativi valori del dao (se impostati)
  239. """
  240. self._loading = True
  241. self._parzialeLordo = int(0)
  242. self._parzialeNetto = int(0)
  243. # controlliamo se č il dao č fresco o no
  244. if not firstLoad:
  245. self._getStrings()
  246. else:
  247. if self.dao.colore_stampa:
  248. self.daoColoreStampa = self.dao.colore_stampa
  249. if self.dao.carattere_stampa:
  250. self.daoCarattereStampa = self.dao.carattere_stampa
  251. if self.dao.id_cliente:
  252. self.daoCliente = Cliente().getRecord(id=self.dao.id_cliente)
  253. if self.dao.righe:
  254. self._id_listino = self.dao.righe[0].id_listino
  255. self.daoListino = Listino().select(id=self._id_listino)[0]
  256. #assegno alla variabile temporanea il valore di righe
  257. self.righeTEMP = self.dao.righe
  258. self.scontiTEMP = self.dao.sconti
  259. # il dao č fresco per cui mi prendo le righe e le metto
  260. self._articoliTreeviewModel.clear()
  261. model = self.articoli_treeview.get_model()
  262. for m in model:
  263. self.setRigaTreeview(m)
  264. #pulisco tutto
  265. self._clear()
  266. if self._id_listino is None and self.righeTEMP:
  267. self._id_listino = self.righeTEMP[0].id_listino
  268. self.daoListino = Listino().select(id=self._id_listino)
  269. #mi occupo delle righe articolo nella treeview pulendo
  270. self._articoliTreeviewModel.clear()
  271. #ciclo per riempire la treeview
  272. for row in self.righeTEMP:
  273. articoloRiga = Articolo().getRecord(id=row.id_articolo)
  274. if not articoloRiga:
  275. unitaBaseRiga = "pz"
  276. codice = ""
  277. idArticolo = None
  278. else:
  279. unitaBaseRigaobgj = UnitaBase().getRecord(id=articoloRiga.id_unita_base)
  280. unitaBaseRiga = unitaBaseRigaobgj.denominazione_breve
  281. codice = articoloRiga.codice
  282. idArticolo = articoloRiga.id
  283. self.setScontiRiga(row)
  284. try:
  285. row.scontiRiga
  286. except:
  287. row.scontiRiga = []
  288. row = getPrezzoNetto(row)
  289. self._parzialeLordo = self._parzialeLordo + mN(float(row.valore_unitario_lordo)*float(row.quantita))
  290. self._parzialeNetto = self._parzialeNetto + row.valore_unitario_netto * row.quantita
  291. #findComboboxRowFromId(self.listino_combobox, row.id_listino)
  292. if row.descrizione == "Contrassegno":
  293. row.quantita = 1
  294. self._articoliTreeviewModel.append([row,
  295. idArticolo,
  296. codice,
  297. row.descrizione,
  298. unitaBaseRiga,
  299. row.quantita,
  300. row.valore_unitario_lordo,
  301. row.valore_unitario_netto,
  302. row.totaleRiga])
  303. # questi dati sono a posto,
  304. self.data_matrimonio_entry.set_text(dateToString(self.dao.data_matrimonio))
  305. self.data_ordine_al_fornitore_entry.set_text(dateToString(self.dao.data_ordine_al_fornitore))
  306. self.data_consegna_entry.set_text(dateToString(self.dao.data_consegna))
  307. self.data_spedizione_entry.set_text(dateToString(self.dao.data_spedizione))
  308. self.data_consegna_bozza_entry.set_text(dateToString(self.dao.data_consegna_bozza))
  309. self.data_presa_in_carico_entry.set_text(dateToString(self.dao.data_presa_in_carico or ""))
  310. self.provenienza_entry.set_text(self.dao.provenienza or '')
  311. self.materiale_disponibile_si_checkbutton.set_active(self.dao.disp_materiale or False)
  312. if self.dao.disp_materiale is not None:
  313. self.materiale_disponibile_no_checkbutton.set_active( not self.dao.disp_materiale)
  314. else:
  315. self.materiale_disponibile_no_checkbutton.set_active(False)
  316. self.nomi_sposi_entry.set_text(self.dao.nomi_sposi or '')
  317. self.numero_scheda_entry.set_text(str(self.dao.numero or 0))
  318. self.bomba_si_checkbutton.set_active(self.dao.bomba_in_cliche or False)
  319. if self.dao.bomba_in_cliche is not None:
  320. self.bomba_no_checkbutton.set_active(not self.dao.bomba_in_cliche)
  321. else:
  322. self.bomba_no_checkbutton.set_active(False)
  323. self.mezzo_ordinazione_entry.set_text(self.dao.mezzo_ordinazione or '')
  324. self.mezzo_spedizione_entry.set_text(self.dao.mezzo_spedizione or '')
  325. self.codice_spedizione_entry.set_text(self.dao.codice_spedizione or '')
  326. self.saldato_checkbutton.set_active(self.dao.documento_saldato or False)
  327. if self.dao.fattura is None:
  328. self.dao.fattura = False
  329. self.fattura_checkbutton.set_active(self.dao.fattura)
  330. self.ricevuta_checkbutton.set_active(not self.dao.fattura)
  331. self.n_documento_entry.set_text(self.dao.ricevuta_associata or '')
  332. self.data_ricevuta_entry.set_text(dateToString(self.dao.data_ricevuta))
  333. self.referente_entry.set_text(self.dao.referente or '')
  334. self.presso_entry.set_text(self.dao.presso or '')
  335. self.via_piazza_entry.set_text(self.dao.via_piazza or '')
  336. self.num_civ_entry.set_text(self.dao.num_civ or '')
  337. self.zip_entry.set_text(self.dao.zip or '')
  338. self.localita_entry.set_text(self.dao.localita or '')
  339. self.provincia_entry.set_text(self.dao.provincia or '')
  340. self.stato_entry.set_text(self.dao.stato or '')
  341. self.prima_email_entry.set_text(self.dao.prima_email or '')
  342. self.seconda_email_entry.set_text(self.dao.seconda_email or '')
  343. self.telefono_entry.set_text(self.dao.telefono or '')
  344. self.cellulare_entry.set_text(self.dao.cellulare or '')
  345. self.skype_entry.set_text(self.dao.skype or '')
  346. self.nome_contatto_entry.set_text(self.dao.operatore or '')
  347. buffer = self.note_text_textview.get_buffer()
  348. buffer.set_text(self.dao.note_text or '')
  349. self.note_final_entry.set_text(self.dao.note_final or '')
  350. self.note_fornitore_entry.set_text(self.dao.note_fornitore or '')
  351. self.note_spedizione_entry.set_text(self.dao.note_spedizione or '')
  352. self.user_id_entry.set_text(self.dao.userid_cliente or '')
  353. self.lui_e_lei_entry.set_text(self.dao.lui_e_lei or '')
  354. self.password_sito_entry.set_text(self.dao.password_sito or "")
  355. self.password_user_entry.set_text(self.dao.passwd_cliente or '')
  356. self.password_amici_entry.set_text(self.dao.password_amici or "")
  357. if self.dao.id_colore_stampa is not None:
  358. findComboboxRowFromId(self.colore_stampa_combobox, self.dao.id_colore_stampa)
  359. if self.dao.id_carattere_stampa is not None:
  360. findComboboxRowFromId(self.carattere_stampa_combobox, self.dao.id_carattere_stampa)
  361. if self.dao.id_magazzino is not None:
  362. findComboboxRowFromId(self.magazzino_combobox, self.dao.id_magazzino)
  363. self.associazione_articoli_comboboxentry.set_active(-1)
  364. self.sconti_scheda_widget.setValues(self.scontiTEMP, self.dao.applicazione_sconti)
  365. self.id_cliente_customcombobox.setId(self.dao.id_cliente)
  366. self.calcolaTotaleScheda()
  367. findComboboxRowFromId(self.listino_combobox, self._id_listino)
  368. self._loading=False
  369. #return True
  370. def fillquantita(self,codice=None):
  371. #print "CODICEEEEEE", codice
  372. quantita=0
  373. if codice == self.altriDati["codBombo"]:
  374. quantita= self.altriDati["quantitaBombo"]
  375. elif codice == self.altriDati["codInvito"]:
  376. quantita= self.altriDati["quantitaInvito"]
  377. elif codice == self.altriDati["codParte"]:
  378. quantita= self.altriDati["quantitaParte"]
  379. elif codice == "Stampa":
  380. quantita= "1"
  381. return quantita
  382. def setRigaTreeview(self,modelRow=None,rowArticolo=None ):
  383. if rowArticolo:
  384. idArticolo = rowArticolo[0].id
  385. denArticolo = rowArticolo[0].denominazione
  386. try:
  387. quantita = Decimal(self.fillquantita(codice= rowArticolo[0].codice))
  388. except:
  389. quantita = 1
  390. elif modelRow:
  391. idArticolo = modelRow[1]
  392. denArticolo = modelRow[3]
  393. quantita = modelRow[5]
  394. valore_unitario_lordo = mN(modelRow[6])
  395. valore_unitario_netto = mN(modelRow[7])
  396. totaleRiga = modelRow[8]
  397. listinoSel = ListinoArticolo().select(idListino=self._id_listino,
  398. idArticolo=idArticolo,
  399. listinoAttuale=True,
  400. batchSize=None)
  401. if listinoSel:
  402. listino = listinoSel[0]
  403. else:
  404. msg = 'Nessun listino associato all\'articolo %s' % denArticolo
  405. obligatoryField(None, self.listino_combobox, msg)
  406. lettura_articolo = leggiArticolo(idArticolo)
  407. daoRiga = RigaSchedaOrdinazione()
  408. #daoRiga.id_scheda = self.dao.id
  409. daoRiga.id_articolo = idArticolo
  410. daoRiga.id_magazzino = self.dao.id_magazzino
  411. daoRiga.descrizione = denArticolo
  412. daoRiga.codiceArticoloFornitore = None
  413. daoRiga.id_listino = self._id_listino
  414. daoRiga.percentuale_iva = lettura_articolo['percentualeAliquotaIva']
  415. self.setScontiRiga(daoRiga)
  416. try:
  417. daoRiga.scontiRiga
  418. except:
  419. daoRiga.scontiRiga = []
  420. daoRiga.quantita = quantita
  421. daoRiga.id_multiplo = None
  422. daoRiga.moltiplicatore = 1
  423. if rowArticolo:
  424. daoRiga.valore_unitario_lordo = listino.prezzo_dettaglio
  425. daoRiga = getPrezzoNetto(daoRiga)
  426. elif modelRow:
  427. daoRiga.valore_unitario_lordo = valore_unitario_lordo
  428. daoRiga.valore_unitario_netto = valore_unitario_netto
  429. self.righeTEMP.append(daoRiga)
  430. #self.dao.righe.append(daoRiga)
  431. def setScontiRiga(self, daoRiga, tipo=None):
  432. scontiRiga = []
  433. _descrizione = daoRiga.descrizione[0:6]
  434. _descrizione1 = daoRiga.descrizione[0:12]
  435. if (_descrizione.lower() == 'stampa') or (_descrizione1.lower() == 'contrassegno'):
  436. daoRiga.applicazione_sconti = 'scalare'
  437. daoRiga.scontiRiga = []
  438. #print "1111111111111111111111"
  439. else:
  440. daoRiga.applicazione_sconti = self.dao.applicazione_sconti
  441. #for sconto in self.dao.sconti:
  442. #print "5555555555555555555555555555555", self.scontiTEMP
  443. #if not self.scontiTEMP:
  444. #self.scontiTEMP.append(self.altriDati["percentualeSconto"])
  445. for sconto in self.scontiTEMP:
  446. #print "TIPOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", tipo
  447. if tipo == 'documento':
  448. from promogest.dao.ScontoRigaDocumento import ScontoRigaDocumento
  449. scontoRiga = ScontoRigaDocumento()
  450. elif tipo == "movimento":
  451. from promogest.dao.ScontoRigaMovimento import ScontoRigaMovimento
  452. scontoRiga = ScontoRigaMovimento()
  453. else:
  454. scontoRiga = ScontoRigaScheda()
  455. scontoRiga.valore = sconto.valore
  456. scontoRiga.tipo_sconto = sconto.tipo_sconto
  457. scontiRiga.append(scontoRiga)
  458. daoRiga.scontiRiga = scontiRiga
  459. return daoRiga
  460. def saveDao(self, tipo=None):
  461. """
  462. Recupera tutte le inforamzioni necessarie al salvataggio del Dao
  463. """
  464. self._getStrings()
  465. if self.dao.id is not None:
  466. inizio,fine = getDateRange(self.data_presa_in_carico_entry.get_text())
  467. if self.numero_scheda_entry.get_text() != str(self._numeroScheda) or dateToString(self.dao.data_presa_in_carico) != self._dataScheda:
  468. result = SchedaOrdinazione().select(daNumero=int(self.numero_scheda_entry.get_text()),
  469. aNumero=str(self.numero_scheda_entry.get_text()),
  470. daDataScheda=inizio,
  471. aDataScheda=fine,
  472. offset=None,
  473. batchSize=None)
  474. if result:
  475. if len(result) == 1 and result[0].id != self.dao.id:
  476. response = self.advertise("E' gia' presente una scheda con questo numero. Continuare comunque?")
  477. elif len(result) > 1:
  478. response = self.advertise("Attenzione! sono state individuate piu' schede lavorazione con questo numero.\nSi consiglia una verifica della situazione. Continuare comunque?")
  479. else:
  480. response = GTK_RESPONSE_YES
  481. if response != GTK_RESPONSE_YES:
  482. return
  483. else:
  484. self.dao.numero = int(self.numero_scheda_entry.get_text())
  485. if self.dao.referente == '':
  486. obligatoryField(None, self.referente_entry,
  487. msg='Indicare un referente per la lavorazione')
  488. if not self.dao.data_matrimonio:
  489. obligatoryField(None, self.data_matrimonio_entry,
  490. msg='Inserire la data del matrimonio.')
  491. if not self.dao.data_presa_in_carico:
  492. obligatoryField(None, self.data_presa_in_carico_entry,
  493. msg='Inserire la data dell\'ordine.')
  494. if not self.dao.data_consegna_bozza:
  495. obligatoryField(None, self.data_consegna_bozza_entry,
  496. msg='Inserire la data prevista di consegna bozza.')
  497. if self.dao.nomi_sposi == '':
  498. obligatoryField(None, self.nomi_sposi_entry,
  499. msg='Inserire i nomi degli sposi.')
  500. if self.dao.prima_email == '':
  501. obligatoryField(None, self.prima_email_entry,
  502. msg="Inserire almeno un'indirizzo email di riferimento.")
  503. if self.dao.id_colore_stampa is None:
  504. obligatoryField(None, self.colore_stampa_combobox,\
  505. msg='Scegliere un colore per la stampa.')
  506. if self.dao.id_carattere_stampa is None:
  507. obligatoryField(None, self.carattere_stampa_combobox, \
  508. msg='Scegliere un carattere per la stampa.')
  509. if not self.dao.disp_materiale:
  510. if not self.materiale_disponibile_no_checkbutton.get_active():
  511. obligatoryField(None, msg='Disponibiltŕ materiale? ')
  512. if not self.dao.bomba_in_cliche :
  513. if not self.bomba_no_checkbutton.get_active():
  514. obligatoryField(None, msg='Bomboniera nel cliché?')
  515. if not self.dao.righe and not self.righeTEMP:
  516. obligatoryField(None, msg='Si sta cercando di creare un documento vuoto.\nInserire le righe della scheda.')
  517. pbar(self.dialog.pbar,parziale=1, totale=4)
  518. allarmi = []
  519. if self.dao.numero is None:
  520. date = time.strftime("%Y")
  521. numeroSEL = SchedaOrdinazione().select(complexFilter=(and_(SchedaOrdinazione.id==Datario.id_scheda, Datario.presa_in_carico.between(datetime.date(int(date), 1, 1), datetime.date(int(date) + 1, 1, 1)) ,
  522. )), batchSize=None)
  523. if numeroSEL:
  524. rif_num_scheda = max([p.numero for p in numeroSEL]) +1
  525. else:
  526. rif_num_scheda = 1
  527. print "NUMEROPPPPPPPPPPPPPPPPPPPPPPPPPPPP", rif_num_scheda
  528. # return
  529. # queryString = Environment.params['session'].query(SchedaOrdinazione.numero).order_by(desc("numero")).all()
  530. # if queryString:
  531. # rif_num_scheda = queryString[0][0]+1
  532. # else:
  533. # rif_num_scheda = 1
  534. else:
  535. rif_num_scheda = self.dao.numero
  536. if hasattr(Environment.conf.SchedaLavorazione,''):
  537. def setPromemoriaSchedaData():
  538. allarme.data_inserimento = datetime.datetime.today()
  539. allarme.incaricato = self.dao.operatore
  540. allarme.autore = 'Partecipazioni Nozze'
  541. allarme.in_scadenza = False
  542. allarme.scaduto=False
  543. allarme.completato=False
  544. target1 = getattr(Environment.conf.SchedaLavorazione,'target1')
  545. target2 = getattr(Environment.conf.SchedaLavorazione,'target2')
  546. target3 = getattr(Environment.conf.SchedaLavorazione,'target3')
  547. soglia1 = getattr(Environment.conf.SchedaLavorazione,'soglia1')
  548. soglia2 = getattr(Environment.conf.SchedaLavorazione,'soglia2')
  549. soglia3 = getattr(Environment.conf.SchedaLavorazione,'soglia3')
  550. targets = [(target1,soglia1), (target2,soglia2), (target3,soglia3)]
  551. if self.dao.data_spedizione is None:
  552. for target in targets:
  553. if target[0] == 'data_spedizione' and self.dao.data_spedizione is not None:
  554. allarme = PromemoriaSchedaOrdinazione()
  555. allarme.data_scadenza = self.dao.data_spedizione
  556. allarme.descrizione = u'Scheda Lavorazione numero '+str(rif_num_scheda)+u' per promemoria impostato sulla data spedizione'
  557. allarme.oggetto = 'Spedizione'
  558. allarme.giorni_preavviso = int(target[1])
  559. setPromemoriaSchedaData()
  560. allarmi.append(allarme)
  561. elif target == 'data_ordine_al_fornitore'and self.dao.data_ordine_al_fornitore is not None :
  562. allarme = PromemoriaSchedaOrdinazione()
  563. allarme.data_scadenza = self.dao.data_ordine_al_fornitore
  564. allarme.descrizione = 'Scheda Lavorazione numero '+str(rif_num_scheda)+' per promemoria impostato sulla data ordine al fornitore'
  565. allarme.oggetto = 'Ordine al Fornitore'
  566. allarme.giorni_preavviso = int(target[1])
  567. setPromemoriaSchedaData()
  568. allarmi.append(allarme)
  569. else:
  570. if self.dao.data_consegna is not None:
  571. delta = datetime.timedelta(int(Environment.conf.SchedaLavorazione.intervallo_spedizione))
  572. allarme = PromemoriaSchedaOrdinazione()
  573. allarme.data_scadenza = self.dao.data_spedizione + delta
  574. allarme.descrizione = "Spedizione: codice "+self.dao.codice_spedizione+" Del "+dateToString(self.dao.data_spedizione)+" numero scheda: "+str(rif_num_scheda)+". Attenzione: la consegna non e' ancora avvenuta o non e' stata aggiornata la scheda"
  575. allarme.oggetto = 'Consegna Partecipazione in sospeso'
  576. allarme.giorni_preavviso = int(getattr(Environment.conf.SchedaLavorazione, 'soglia4'))
  577. setPromemoriaSchedaData()
  578. allarmi.append(allarme)
  579. self.dao.promemoria = allarmi
  580. pbar(self.dialog.pbar,parziale=2, totale=4)
  581. self.righeTEMP = []
  582. scontiSuTotale = []#{}
  583. res = self.sconti_scheda_widget.getSconti()
  584. #res = []
  585. if res:
  586. for sc in res:
  587. daoSconto = ScontoSchedaOrdinazione()
  588. daoSconto.valore = mN(sc["valore"])
  589. daoSconto.tipo_sconto = sc["tipo"]
  590. #scontiSuTotale[self.dao]=daoSconto
  591. scontiSuTotale.append(daoSconto)
  592. else:
  593. messageInfo(msg="ATTENZIONE!! NESSUNO SCONTO INSERITO", transient=None)
  594. self.dao.scontiSuTotale = scontiSuTotale
  595. self.scontiTEMP = scontiSuTotale
  596. pbar(self.dialog.pbar,parziale=3, totale=4)
  597. model = self.articoli_treeview.get_model()
  598. for m in model:
  599. self.setRigaTreeview(modelRow = m)
  600. self.dao.numero = rif_num_scheda
  601. self._numeroScheda = rif_num_scheda
  602. self._dataScheda = dateToString(self.dao.data_presa_in_carico)
  603. self.dao.righe = self.righeTEMP
  604. self.dao.sconti = self.scontiSuTotale
  605. #self.dao.scontiSuTotale = self.scontiSuTotale
  606. self.dao.persist()
  607. pbar(self.dialog.pbar,parziale=4, totale=4)
  608. #self._refresh()
  609. pbar(self.dialog.pbar,stop=True)
  610. def on_associazione_articoli_comboboxentry_changed(self, combobox=None, codart=None):
  611. if self._loading:
  612. return
  613. #this combobox has been filled with "articolo" data such as "denominazione", "id"
  614. if self._id_listino is None:
  615. obligatoryField(None, self.listino_combobox,\
  616. msg='Selezionare prima un listino.')
  617. if codart:
  618. search_string=codart
  619. else:
  620. search_string = combobox.child.get_text()
  621. model = combobox.get_model()
  622. selected = combobox.get_active()
  623. if selected < 0:
  624. fillComboboxAssociazioneArticoli(self.associazione_articoli_comboboxentry, search_string)
  625. else:
  626. row = model[selected]
  627. if row[0]:
  628. #this call will return a list of "AssociazioneArticoli" (In the future: "Distinta Base") Dao objects
  629. #self.setRigaTreeview(modelRow=[],rowArticolo=row)
  630. #articoli = AssociazioneArticolo().select(idPadre= row[0].id)
  631. articoli = row[0].articoliAss
  632. for art in articoli:
  633. if self._id_listino is not None:
  634. a = Articolo().getRecord(id=art.id_figlio)
  635. row[0] = a
  636. row[1] = a.codice
  637. row[2] = a.denominazione
  638. self.setRigaTreeview(modelRow=[],rowArticolo=row)
  639. self._refresh()
  640. return
  641. else:
  642. messageInfo(msg="Nessuna Associazione di articoli e' stata ancora inserita", transient=None)
  643. if self.associazione_articoli_comboboxentry.get_property("can-focus"):
  644. self.associazione_articoli_comboboxentry.grab_focus()
  645. def on_rimuovi_articolo_button_clicked(self, button):
  646. selection = self.articoli_treeview.get_selection()
  647. model, iter = selection.get_selected()
  648. index = model.get_path(iter)[0]
  649. del self.righeTEMP[index]
  650. button.set_sensitive(False)
  651. self._refresh()
  652. def impegnatoSuSchedaLavorazione(self, idArticolo=None):
  653. year = "2009"
  654. t=0
  655. part= Environment.params["session"]\
  656. .query(Riga)\
  657. .filter(and_(SchedaOrdinazione.fattura!=True,
  658. Riga.id==RigaSchedaOrdinazione.id,
  659. RigaSchedaOrdinazione.id_scheda == SchedaOrdinazione.id,
  660. Riga.id_articolo==idArticolo,
  661. Articolo.id==idArticolo)).all()
  662. for r in part:
  663. t +=r.quantita
  664. return t
  665. def on_articoli_treeview_cursor_changed(self, treeview):
  666. """
  667. Aggiungo a questa funzione anche il riempimento delle info
  668. sull'articolo come giacenza e impegnato su scheda lavorazione
  669. """
  670. self.rimuovi_articolo_button.set_sensitive(True)
  671. selection = self.articoli_treeview.get_selection()
  672. model, iter = selection.get_selected()
  673. if iter:
  674. index = model.get_path(iter)[0]
  675. value = model[index][1]
  676. if "Stampa" != model[index][2]:
  677. giace =giacenzaArticolo(year=Environment.workingYear,
  678. idMagazzino=self.dao.id_magazzino,
  679. idArticolo=value)
  680. imp= self.impegnatoSuSchedaLavorazione(idArticolo=value)
  681. else:
  682. giace = "0"
  683. imp = "0"
  684. residuo = int(giace)-int(imp) or 0
  685. valore= mN(residuo) *Decimal(str(model[index][6]))
  686. self.giacenza_label.set_text(str(giace))
  687. self.impegnato_label.set_text(str(imp))
  688. self.residuo_label.set_text(str(residuo))
  689. self.valore_label.set_text(str(mN(valore)))
  690. def on_articoli_treeview_key_press_event(self, treeview, event):
  691. """ Gestisce la pressione del tab su una cella """
  692. if event.keyval == 65289:
  693. self._tabPressed = True
  694. def on_column_quantita_edited(self, cell, path, value, treeview, editNext=True):
  695. """ Function ti set the value quantita edit in the cell """
  696. model = treeview.get_model()
  697. value=value.replace(",",".")
  698. value = mN(value)
  699. model[path][5] = value
  700. model[path][0].quantita = value
  701. self._refresh()
  702. def on_column_edited(self, cell, path, value, treeview, editNext=True):
  703. """ Gestisce l'immagazzinamento dei valori nelle celle """
  704. model = treeview.get_model()
  705. iterator = model.get_iter(path)
  706. column = cell.get_data('column')
  707. row = model[iterator]
  708. if cell.__class__ is gtk.CellRendererText:
  709. try:
  710. length = cell.get_data('max_length')
  711. model.set_value(iterator, column+2, value[:length])
  712. except:
  713. model.set_value(iterator, column+2, value)
  714. dao = row[0]
  715. dao.descrizione = model.get_value(iterator, 3)
  716. dao.quantita = Decimal(model.get_value(iterator, 5))
  717. valore_unitario_lordo = model.get_value(iterator, 6)
  718. dao.valore_unitario_lordo = mN(str(valore_unitario_lordo))
  719. dao = getPrezzoNetto(dao)
  720. columns = treeview.get_columns()
  721. newColumn = column+1
  722. if newColumn <= columns:
  723. if self._tabPressed:
  724. self._tabPressed = False
  725. treeColumn = treeview.get_column(column+1)
  726. gobject.timeout_add(1, treeview.set_cursor, path, treeColumn, editNext)
  727. self._refresh()
  728. def on_sconti_scheda_widget_button_toggled(self, button):
  729. if button.get_property('active') is True:
  730. return
  731. self.dao.applicazione_sconti = self.sconti_scheda_widget.getApplicazione()
  732. scontiSuTotale = []
  733. res = self.sconti_scheda_widget.getSconti()
  734. if res:
  735. for sc in res:
  736. daoSconto = ScontoSchedaOrdinazione()
  737. daoSconto.valore = float(sc["valore"])
  738. daoSconto.tipo_sconto = sc["tipo"]
  739. scontiSuTotale.append(daoSconto)
  740. self.dao.sconti = scontiSuTotale
  741. self.scontiSuTotale = scontiSuTotale
  742. self.scontiTEMP=scontiSuTotale
  743. self._refresh()
  744. def on_aggiungi_articolo_button_clicked(self, button):
  745. self.ricercaArticolo()
  746. def ricercaArticolo(self):
  747. """
  748. apre una finestra di ricerca avanzata degli articoli
  749. """
  750. def on_ricerca_articolo_hide(anagWindow, anag):
  751. if anag.dao is None:
  752. anagWindow.destroy()
  753. return
  754. anagWindow.destroy()
  755. self.mostraArticolo(anag.dao)
  756. codice = None
  757. codiceABarre = None
  758. denominazione = None
  759. codiceArticoloFornitore = None
  760. orderBy = "denominazione"
  761. from promogest.ui.RicercaComplessaArticoli import RicercaComplessaArticoli
  762. anag = RicercaComplessaArticoli(denominazione=denominazione,
  763. codice=codice,
  764. codiceABarre=codiceABarre,
  765. codiceArticoloFornitore=codiceArticoloFornitore)
  766. anag.setTreeViewSelectionType(GTK_SELECTIONMODE_SINGLE)
  767. anagWindow = anag.getTopLevel()
  768. anagWindow.connect("hide",
  769. on_ricerca_articolo_hide,
  770. anag)
  771. anagWindow.set_transient_for(self.dialogTopLevel)
  772. anag.show_all()
  773. def mostraArticolo(self, id):
  774. if self.daoListino:
  775. self.setRigaTreeview(rowArticolo=[id])
  776. self._refresh()
  777. def on_generazione_fattura_button_clicked(self, button):
  778. print "DUPLICHIAMO IN FATTURA"
  779. DuplicaInFattura(dao=self.dao, ui = self).checkField()
  780. def calcolaTotaleScheda(self):
  781. """
  782. Calcola il totale della scheda
  783. """
  784. totaleImponibile = calcolaPrezzoIva(self._parzialeNetto, (-1*20))
  785. totaleImposta = self._parzialeNetto* Decimal( str(0.20))
  786. totaleNonScontato = self._parzialeLordo
  787. totaleScontato = self._parzialeNetto
  788. self.tot_lordo_entry.set_text(str(mN(str(totaleNonScontato),2) or 0))
  789. self.tot_scontato_entry.set_text(str(mN(str(totaleScontato),2) or 0))
  790. self.dao.totale_lordo = mN(totaleScontato,2) or 0
  791. def on_listino_combobox_changed(self, combobox):
  792. if self._loading:
  793. return
  794. self._id_listino = findIdFromCombobox(combobox)
  795. self.daoListino = Listino().select(id=self._id_listino)[0]
  796. for riga in self.righeTEMP:
  797. riga.id_listino = self._id_listino
  798. self._refresh()
  799. def on_magazzino_combobox_changed(self, combobox):
  800. if self._loading:
  801. return
  802. self.dao.id_magazzino = findIdFromCombobox(combobox)
  803. def on_colore_stampa_combobox_changed(self, combobox):
  804. if self._loading:
  805. return
  806. self.dao.id_colore_stampa = findIdFromCombobox(self.colore_stampa_combobox)
  807. self.daoColoreStampa = ColoreStampa().getRecord(id=self.dao.id_colore_stampa)
  808. #self._refresh()
  809. def on_carattere_stampa_combobox_changed(self, combobox):
  810. if self._loading:
  811. return
  812. self.dao.id_carattere_stampa = findIdFromCombobox(self.carattere_stampa_combobox)
  813. self.daoCarattereStampa = CarattereStampa().getRecord(id=self.dao.id_carattere_stampa)
  814. #self._refresh()
  815. def on_ricevuta_checkbutton_toggled(self, checkbutton):
  816. if self._loading:
  817. return
  818. #se a true allora fattura_checkbutton a false e viceversa
  819. status = checkbutton.get_active()
  820. self.dao.fattura = not status
  821. #self._refresh()
  822. def on_fattura_checkbutton_toggled(self, checkbutton):
  823. if self._loading:
  824. return
  825. status = checkbutton.get_active()
  826. self.dao.fattura = status
  827. #self._refresh()
  828. def on_bomba_si_checkbutton_toggled(self, checkbutton):
  829. if self._loading:
  830. return
  831. status = checkbutton.get_active()
  832. self.dao.bomba_in_cliche = status
  833. #self._refresh()
  834. def on_bomba_no_checkbutton_toggled(self, checkbutton):
  835. if self._loading:
  836. return
  837. status = checkbutton.get_active()
  838. self.dao.bomba_in_cliche = not status
  839. #self._refresh()
  840. def on_saldato_checkbutton_toggled(self, checkbutton):
  841. if self._loading:
  842. return
  843. status = checkbutton.get_active()
  844. self.dao.documento_saldato = status
  845. def on_materiale_disponibile_si_checkbutton_toggled(self, checkbutton):
  846. if self._loading:
  847. return
  848. status = checkbutton.get_active()
  849. self.dao.disp_materiale = status
  850. #self._refresh()
  851. def on_materiale_disponibile_no_checkbutton_toggled(self, checkbutton):
  852. if self._loading:
  853. return
  854. status = checkbutton.get_active()
  855. self.dao.disp_materiale = not status
  856. #self._refresh()
  857. def _getStrings(self):
  858. """
  859. recupera i dati inseriti nelle entry dell'interfaccia e setta gli attributi del dao di conseguenza.
  860. Questo metodo viene chiamato per primo in refresh() per evitare di resettare tutte le modifiche
  861. apportate alla scheda quando viene generato un qualunque altro segnale da un widget che modifica il dao.
  862. """
  863. buffer = self.note_text_textview.get_buffer()
  864. start, end = buffer.get_bounds()
  865. self.dao.note_text = buffer.get_text(start, end)
  866. self.dao.note_final = self.note_final_entry.get_text()
  867. self.dao.note_fornitore = self.note_fornitore_entry.get_text()
  868. self.dao.note_spedizione = self.note_spedizione_entry.get_text()
  869. self.dao.referente = self.referente_entry.get_text()
  870. self.dao.via_piazza = self.via_piazza_entry.get_text()
  871. self.dao.presso = self.presso_entry.get_text()
  872. self.dao.zip = self.zip_entry.get_text()
  873. self.dao.stato = self.stato_entry.get_text()
  874. self.dao.localita = self.localita_entry.get_text()
  875. self.dao.num_civ = self.num_civ_entry.get_text()
  876. self.dao.provincia = self.provincia_entry.get_text()
  877. self.dao.prima_email = self.prima_email_entry.get_text()
  878. self.dao.seconda_email = self.seconda_email_entry.get_text()
  879. self.dao.telefono = self.telefono_entry.get_text()
  880. self.dao.cellulare = self.cellulare_entry.get_text()
  881. self.dao.skype = self.skype_entry.get_text()
  882. self.dao.operatore = self.nome_contatto_entry.get_text()
  883. self.dao.data_matrimonio = stringToDate(self.data_matrimonio_entry.get_text())
  884. self.dao.data_consegna_bozza = stringToDate(self.data_consegna_bozza_entry.get_text())
  885. self.dao.data_consegna = stringToDate(self.data_consegna_entry.get_text())
  886. self.dao.data_ordine_al_fornitore = stringToDate(self.data_ordine_al_fornitore_entry.get_text())
  887. self.dao.data_presa_in_carico = stringToDate(self.data_presa_in_carico_entry.get_text())
  888. self.dao.data_spedizione = stringToDate(self.data_spedizione_entry.get_text())
  889. self.dao.data_ricevuta = stringToDate(self.data_ricevuta_entry.get_text())
  890. self.dao.nomi_sposi = self.nomi_sposi_entry.get_text()
  891. self.dao.provenienza = self.provenienza_entry.get_text()
  892. self.dao.ricevuta_associata = self.n_documento_entry.get_text()
  893. self.dao.mezzo_ordinazione = self.mezzo_ordinazione_entry.get_text()
  894. self.dao.mezzo_spedizione = self.mezzo_spedizione_entry.get_text()
  895. self.dao.codice_spedizione = self.codice_spedizione_entry.get_text()
  896. self.dao.userid_cliente = self.user_id_entry.get_text()
  897. self.dao.passwd_cliente = self.password_user_entry.get_text()
  898. self.dao.lui_e_lei = self.lui_e_lei_entry.get_text()
  899. self.dao.password_sito = self.password_sito_entry.get_text()
  900. self.dao.password_amici = self.password_amici_entry.get_text()
  901. def _clear(self):
  902. buffer = self.note_text_textview.get_buffer()
  903. start,end = buffer.get_bounds()
  904. buffer.delete(start,end)
  905. if self._loading:
  906. self.associazione_articoli_comboboxentry.set_active(-1)
  907. self.listino_combobox.set_active(-1)
  908. self.magazzino_combobox.set_active(-1)
  909. self.numero_scheda_entry.set_text(str(0))
  910. self.note_final_entry.set_text('')
  911. self.note_fornitore_entry.set_text('')
  912. self.note_spedizione_entry.set_text('')
  913. self.referente_entry.set_text('')
  914. self.via_piazza_entry.set_text('')
  915. self.presso_entry.set_text('')
  916. self.zip_entry.set_text('')
  917. self.stato_entry.set_text('')
  918. self.localita_entry.set_text('')
  919. self.num_civ_entry.set_text('')
  920. self.provincia_entry.set_text('')
  921. self.prima_email_entry.set_text('')
  922. self.seconda_email_entry.set_text('')
  923. self.telefono_entry.set_text('')
  924. self.cellulare_entry.set_text('')
  925. self.skype_entry.set_text('')
  926. self.nome_contatto_entry.set_text('')
  927. self.data_matrimonio_entry.set_text('')
  928. self.data_consegna_bozza_entry.set_text('')
  929. self.data_consegna_entry.set_text('')
  930. self.data_ordine_al_fornitore_entry.set_text('')
  931. self.data_presa_in_carico_entry.set_text('')
  932. self.data_spedizione_entry.set_text('')
  933. self.data_ricevuta_entry.set_text('')
  934. self.nomi_sposi_entry.set_text('')
  935. self.provenienza_entry.set_text('')
  936. self.n_documento_entry.set_text('')
  937. self.mezzo_ordinazione_entry.set_text('')
  938. self.mezzo_spedizione_entry.set_text('')
  939. self.user_id_entry.set_text('')
  940. self.lui_e_lei_entry.set_text('')
  941. self.password_user_entry.set_text('')
  942. self.password_sito_entry.set_text('')
  943. self.password_amici_entry.set_text('')
  944. self.colore_stampa_combobox.set_active(-1)
  945. self.carattere_stampa_combobox.set_active(-1)
  946. def on_anagrafica_colori_button_clicked(self, button):
  947. anag = AnagraficaColoriStampa()
  948. anagWindow = anag.getTopLevel()
  949. showAnagraficaRichiamata(None, anagWindow, button, self._refresh)
  950. def on_anagrafica_caratteri_button_clicked(self, button):
  951. anag = AnagraficaCaratteriStampa()
  952. anagWindow = anag.getTopLevel()
  953. showAnagraficaRichiamata(None, anagWindow, button, self._refresh)
  954. def advertise(self, msg):
  955. return YesNoDialog(msg=msg, transient=self.dialogTopLevel)
  956. def on_anag_clienti_button_clicked(self, button):
  957. anag = AnagraficaClienti()
  958. anagWindow = anag.getTopLevel()
  959. showAnagraficaRichiamata(None, anagWindow, self._refresh)
  960. def on_cliente_changed(self):
  961. if self._loading:
  962. return
  963. from promogest.dao.Cliente import Cliente
  964. self.dao.id_cliente = self.id_cliente_customcombobox.getId()
  965. self.daoCliente = Cliente().getRecord(id=self.dao.id_cliente)
  966. def on_email_import_button_clicked(self, button):
  967. print "FILL THE DATA FROM EMAIL"
  968. if self.dao:
  969. altriDati= fillSchedaLavorazioneFromEmail(self)
  970. self.altriDati = altriDati
  971. else:
  972. print "mettici un dialogo che avvisa"
  973. self.nome_contatto_entry.set_text("ANTO")
  974. self.stato_entry.set_text("Italia")
  975. idColore = ColoreStampa().select(denominazione = altriDati["colore_stampa"])
  976. if idColore:
  977. findCombobox

Large files files are truncated, but you can click here to view the full file