#! /usr/bin/python # Copyright (C) 2006 Aldo Nicolas Bruno # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import os from module import * from util.ui import simpledbmodule class handler(simpledbmodule): def __init__(self,name,be,version=0.1): ##attenzione il primo elemento verra usato come riferimento fisso x la modifica fields=[ {'name':'n_ddt', 'title':'Numero', 'type':'int', 'defvalue':"", 'maxlen':15, 'optional':False, 'tooltip':'Numero progressivo', 'autokey':True }, {'name':'cliente', 'title':'Cliente', 'type':'str', 'defvalue':"", 'maxlen':15, 'optional':False, 'tooltip':'Cliente', 'ref':'persone/clienti', 'refname':'codice', 'fkey':'persone(codice)' }, {'name':'data', 'title':'Data', 'type':'date', 'defvalue':be['dbutil'].oggi(), 'maxlen':0, 'optional':False, 'tooltip':'Data DDT' }, {'name':'note', 'title':'Note aggiuntive', 'type':'str', 'defvalue':"", 'maxlen':0, 'optional':True, 'multiline':True, 'tooltip':'Note aggiuntive' } ] simpledbmodule.__init__(self,name,"DDT",be,fields,delete=False,table="ddt",menu="Vendite/DDT") def gen(self): simpledbmodule.gen(self) x=self.be['uiutil'].adddialog('Registra fattura','Registra fattura',self.name+'/regfatt-db') x.addfield('n','Numero','int','0',fwvalue='n_ddt',readonly='true') x.addfield('data','Data','date',self.be['dbutil'].oggi()) # ecc... self.addhandler("creafattura",x.handle) self.addhandler("regfatt-db",self.regfatt_db) def regfatt_db(self,d,e): values=self.be['dbutil'].cleanup_field_params(e,['n','data']) print 'ecco gli sporchi dati:' + str(values) #qua fai il cavolo che vuoi ## ricordarsi di eventualmente usare il msg di conferma def gen_commands(self,x): simpledbmodule.gen_commands(self,x) x.addcommand(self.name+"/creafattura","Crea fattura",None,fwsel=self.key,update="true") def add_db_complete(self,d,e,values): simpledbmodule.add_db_complete(self,d,e,values) d._push() d.redirect(action="ddtpos/list").attrib(n_ddt=values['n_ddt']) d._pop()