Invoicing Analytic Account Entries Crash
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Released
|
Undecided
|
qdp (OpenERP) |
Bug Description
When invoicing entries from an analytical account via:
Financial Management / Periodical Processing / Entries to Invoice / Uninvoiced Entries
If more than one entry is selected to generate an invoice, the traceback below is generated.
Steps to reproduce:
1) Create partner, product, analytical journal, analytical account, account
2) In Hours Encoding, make entries against the client for the product, in the analytical account, in the analytical journal, for the product, in the account.
3) Go to Uninvoiced Entries, select more than one entry, select Action, Invoice (leave default or select options)
4) Click "Create Invoices"
Traceback created:
[code]
Traceback (most recent call last):
File "/usr/lib/
result = LocalService(
File "/usr/lib/
return getattr(self, method)(*params)
File "/usr/lib/
return self._execute(db, uid, wiz_id, datas, action, context)
File "/usr/lib/
return wiz.execute(db, uid, self.wiz_
File "/usr/lib/
res = self.execute_cr(cr, uid, data, state, context)
File "/usr/lib/
res['action'] = result_
File "/usr/lib/
cr.
File "/usr/lib/
return f(self, *args, **kwargs)
File "/usr/lib/
res = self._obj.
ProgrammingError: invalid input syntax for integer: "34,33,
[/code]
Related branches
Changed in openobject-server: | |
assignee: | nobody → qdp |
status: | New → In Progress |
Changed in openobject-server: | |
status: | In Progress → Fix Released |
Thanks for the quick response - this didn't actually fix it though. With the same data, the error is the same, but the id list is now split so that each id has a comma inserted between the first and second digit of the id:
ProgrammingError: invalid input syntax for integer: "3,43,33, 52,92,12, 21,2"
(should be: "34,33, 35,29,21, 22,12")
The original error is reported later on, as the query is passed to the object, and it looks correct - if you took it straight to SQL it would be managed fine:
SELECT * FROM account_ analytic_ line WHERE account_id = 2 and id IN (34,33, 35,29,21, 22,12) AND product_id=3 and to_invoice=1
I think the problem is that the query parameter gets quoted:
SELECT * FROM account_ analytic_ line WHERE account_id = 2 and id IN ('3,43, 33,52,92, 12,21,2' ) AND product_id=3 and to_invoice=1
(ignoring that the fix has caused the id list to be created incorrectly).
I think the problem must be further along, perhaps in the cursor code itself - it is quoting input perhaps where it shouldn't, perhaps as an injection protection mechanism?
If I de-parameterise it:
# for x in data['ids']:
# str_ids += ','.join(str(x))
The invoice gets created (though without any pricing, which I suspect is a different problem).