Ciao, sto dando un'occhiata al modulo account_ra.
1) l'implementazione di base è identica, tranne che per (**)
for line in invoice.tax_line:
** cr.execute("SELECT ra FROM account_tax where name='%s'" % (line.name))
** ra = False
** ra = cr.dictfetchall()
** if ra:
** ra = ra[0]['ra']
** if not ra:
res[invoice.id]['amount_tax'] += line.amount
res[invoice.id]['amount_total'] = res[invoice.id]['amount_tax'] + res[invoice.id]['amount_untaxed']
e la definizione _columns.
Lasciamo per il momento da parte '_columns' che provoca un errore (sparisce se lo si toglie dal codice).
Vorrei che mi dicessi se ho capito il significato del codice che ho segnato (**)
1) legge dal db il campo ra relativo alla tassa corrente (riga fattura)
2) se il campo NON è t => aggiunge la tassa corrente alla somma delle tasse.
Le definizioni _columns, però, provocano un errore... se ho capito bene, dovrebbero rappresentare i campi
presenti nella form... ecco il trace:
Environment Information :
System : Linux-2.6.32-22-generic-i686-with-Ubuntu-10.04-lucid
OS Name : posix
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch:cxx-3.0-ia32:cxx-3.0-noarch:cxx-3.1-ia32:cxx-3.1-noarch:cxx-3.2-ia32:cxx-3.2-noarch:cxx-4.0-ia32:cxx-4.0-noarch:desktop-3.1-ia32:desktop-3.1-noarch:desktop-3.2-ia32:desktop-3.2-noarch:desktop-4.0-ia32:desktop-4.0-noarch:graphics-2.0-ia32:graphics-2.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch:graphics-3.1-ia32:graphics-3.1-noarch:graphics-3.2-ia32:graphics-3.2-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-3.2-ia32:printing-3.2-noarch:printing-4.0-ia32:printing-4.0-noarch:qt4-3.1-ia32:qt4-3.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 10.04 LTS
Release: 10.04
Codename: lucid
Operating System Release : 2.6.32-22-generic
Operating System Version : #33-Ubuntu SMP Wed Apr 28 13:27:30 UTC 2010
Operating System Architecture : 32bit
Operating System Locale : it_IT.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 5.0.6
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "/usr/lib/openerp-server/netsvc.py", line 244, in dispatch
result = LocalService(service_name)(method, *params)
File "/usr/lib/openerp-server/netsvc.py", line 73, in __call__
return getattr(self, method)(*params)
File "/usr/lib/openerp-server/service/web_services.py", line 583, in execute
res = service.execute(db, uid, object, method, *args)
File "/usr/lib/openerp-server/osv/osv.py", line 59, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/openerp-server/osv/osv.py", line 118, in execute
res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/openerp-server/osv/osv.py", line 110, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/openerp-server/addons/account/invoice.py", line 436, in button_reset_taxes
ait_obj.create(cr, uid, taxe)
File "/usr/lib/openerp-server/osv/orm.py", line 2689, in create
self.pool.get(object)._store_set_values(cr, user, ids, fields2, context)
File "/usr/lib/openerp-server/osv/orm.py", line 2743, in _store_set_values
result = self._columns[val[0]].get(cr, self, ids, val, uid, context=context)
File "/usr/lib/openerp-server/osv/fields.py", line 646, in get
res = self._fnct(obj, cr, user, ids, name, self._arg, context)
File "/usr/lib/openerp-server/addons/account_ra/account_ra.py", line 21, in _amount_all
res = {}
File "/usr/lib/openerp-server/addons/account_ra/account_ra.py", line 21, in _amount_all
res = {}
File "/usr/lib/python2.6/bdb.py", line 46, in trace_dispatch
return self.dispatch_line(frame)
File "/usr/lib/python2.6/bdb.py", line 65, in dispatch_line
if self.quitting: raise BdbQuit
BdbQuit