invoice on delivery including service + taxes crashes: "ProgrammingError: can't adapt"

Bug #312673 reported by Raphaël Valyi - http://www.akretion.com
2
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

Hi,

Note: patch attached

take a fresh install on trunk with manufacturing profile and invoice on deliveries by default.

Create a new sale order with 2 order lines:
1) on the first order line: add a physical product like a PC1
2) on the second line, add a service like 'onsite intervention'
For that second line, ALSO ADD A TAX, like 19.6 (any tax)

Now validate the sale order
go in the stock > outgoing product: make the picking and create and invoice using the wizard button in the picking form view (choose sale journal for instance).

It will probably crash with the following message:
Traceback (most recent call last):
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/netsvc.py", line 421, in run
    result_from_method = method(*msg[2:])
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/service/web_services.py", line 429, in execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/service/web_services.py", line 409, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/wizard/__init__.py", line 177, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/wizard/__init__.py", line 82, in execute_cr
    res['action'] = result_def['action'](self, cr, uid, data, context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-addons/stock/wizard/wizard_invoice_onshipping.py", line 97, in _create_invoice
    type=type, context= context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-addons/delivery/stock.py", line 48, in action_invoice_create
    context=context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-addons/sale/stock.py", line 178, in action_invoice_create
    }, context=context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/osv/orm.py", line 2378, in create
    self._columns[field].set(cr, self, id_new, field, vals[field], user, context)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/osv/fields.py", line 539, in set
    cr.execute('insert into '+self._rel+' ('+self._id1+','+self._id2+') values (%s, %s)', (id, act_nbr))
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/sql_db.py", line 76, in wrapper
    return f(self, *args, **kwargs)
  File "/home/rvalyi/DEV/openobject_trunk/openobject-server/bin/sql_db.py", line 114, in execute
    res = self._obj.execute(query, params)
ProgrammingError: can't adapt

By observing how the tax is mapped in the other action_invoice_create methods, we deduced the attached patch.

Hope this helps and thanks to Alexis Deméaulte from Anevia for the report + patch.

Raphaël Valyi

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :
Changed in openobject-addons:
milestone: none → 5.0
status: New → Fix Released
Revision history for this message
Claude Brulé (claude-brule-syleam) wrote :

I already had this kind of bug only with debian etch, due the version of python's psycopg librairy
Ubuntu doesn't have this issue.
Is it the same for you ?

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.