Context error in module l10n_it_partially_deductible_vat on ocb6.1

Bug #1249237 reported by Roberto Onnis
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenERP Italia
New
Undecided
Unassigned

Bug Description

Revision addons ocb:
revision 6812 of branch http://bazaar.launchpad.net/~ocb/ocb-addons/6.1

Revision addons openerp italia 240 branch lp:openobject-italia/6.1

The error in Compute Tax and Totals of an Invoice
Error
compute_all() got an unexpected keyword argument 'context'

How to reproduce the error:
 - Create a new db without demo data and with the italian language
 - Install module l10n_it_partially_deductible_vat
 - At the and of the process chose Italy Chart Of Accounts from the menu
 - Save the default configuration and exit
 - Create a supplier with address and default account configuration
 - Create a stockable product with account configuration: Iva al 22% (credito) e Iva al 22% (debito)
 - Create a Supplier Invoice with the supplier and product created
 - Select Compute Taxes and Totals

Solution

in account.py di l10n_it_partially_deductible_vat substitue rows 77-78 with:

    def compute_all(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None, force_excluded=False, context=None):
        res = super(account_tax, self).compute_all(cr, uid, taxes, price_unit, quantity, address_id, product, partner, force_excluded, context)

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Ciao Roberto,
can you attach the traceback of the error too?
Thanks!

Revision history for this message
Roberto Onnis (onnis-roberto) wrote :

Here it is:

2013-11-15 12:18:45,972 19850 ERROR ? openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
  File "/home/roberto/Progetti/OpenErpOCB6.1/server/openerp/osv/osv.py", line 129, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/roberto/Progetti/OpenErpOCB6.1/server/openerp/osv/osv.py", line 195, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/roberto/Progetti/OpenErpOCB6.1/server/openerp/osv/osv.py", line 183, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/roberto/Progetti/OpenErpOCB6.1/addons/account/account_invoice.py", line 697, in button_reset_taxes
    for taxe in ait_obj.compute(cr, uid, id, context=ctx).values():
  File "/home/roberto/Progetti/OpenErpOCB6.1/addons_ita/l10n_it_partially_deductible_vat/account.py", line 170, in compute
    tax_grouped = super(account_invoice_tax, self).compute(cr, uid, invoice_id, context)
  File "/home/roberto/Progetti/OpenErpOCB6.1/addons/account/account_invoice.py", line 1742, in compute
    inv.partner_id, context=local_context)['taxes']:
TypeError: compute_all() got an unexpected keyword argument 'context'
2013-11-15 12:18:46,071 19850 ERROR ? openerp.netsvc: compute_all() got an unexpected keyword argument 'context'

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Roberto, the problem with your proposed change is that if you use 'l10n_it_partially_deductible_vat' with standard addons, the call to
super(account_tax, self).compute_all(cr, uid, taxes, price_unit, quantity, address_id, product, partner, force_excluded, context)
will raise the same exception we are having here, because standard compute_all
http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/7274/account/account.py#L2072
does not accept context argument.

This
https://code.launchpad.net/~therp-nl/therp-backports/addons-6.1_lp1107889_supplier_invoice_rounding/+merge/145490
is the MP that added context to compute_all arguments.
I'm going to ask there.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

The only solution I can think of is to use **args instead of explicit keyword arguments.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.