Crash general ledger report when account_move_line debit or credit is null
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Camptocamp Financial Addons |
Opinion
|
High
|
Unassigned |
Bug Description
I am using OpenERP 6.1 with the module account_
I have experienced an issue when trying to print a Webkit General ledger report ; after a long debugging party, I eventually figured out that the root cause was some account_move_lines that had credit or debit = NULL instead of 0.00 in the SQL database. By the way, all the account move lines with debit or credit = NULL corresponded to payroll accout move lines which had been imported via extra-5.0/etl with a custom configuration developped by Tiny specifically for Anevia.
So, when you have such account move lines and you try to print a Webkit General ledger, you get this crash :
Traceback (most recent call last):
File "/opt/openerp_
**self.
File "/usr/lib/
return runtime.
File "/usr/lib/
_render_
File "/usr/lib/
_exec_
File "/usr/lib/
callable_
File "memory:
## balance cumulated
File "/opt/openerp_
res = self.lang_
File "/opt/openerp_
return attr(self._cr, self._uid, [self._id], *args, **kwargs)
File "/opt/openerp_
formatted = percent % value
TypeError: float argument required, not NoneType
After some analysis, here is the scenario in the cash :
in account_
${ formatLang(
${ formatLang(
When the debit or credit field in the account_move_line is NULL, you have :
line.get('debit', 0.0)=None.
So it calls the formatLang() function located in server/
In order to solve the issue, I applied the following SQL patch :
update account_move_line set debit=0.0 where debit is null;
update account_move_line set credit=0.0 where credit is null;
I don't know who is to blame for this issue :
1. should the report convert None value to 0.0 ?
2. should the server handle this ?
3. is it the fault of my bad data, i.e. the debit and credit fields of account_move_line should never contain NULL value ?
If you think that the culprit is 2 or 3, you can just mark my bug as invalid. At least, it will be referenced in Google and the users who face the same crash will be able to easily find the solution... it will avoid them a long debugging party !
Changed in c2c-financial-addons: | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in c2c-financial-addons: | |
status: | Confirmed → Opinion |
Hello,
OpenERP never puts null values in float fields, like debit or credit. So I'm not sure the reports have to cover this corner case.
Thanks Alexis for this detailed report.
Guewen