I have found a weird issue in in v6.1:
If I modify 'quantity' field by inheriting class 'account_invoice_lines' from 'account' module to modify its decimal precision seems to break account_invoice_report view whenever I start OpenERP with --update=all.
The actual line that triggers the issue is modifying 'quantity' with:
digits_compute=dp.get_precision('Product UoS')),
Facts I have checked:
- That digits_compute works fine in other fields.
- Yes, 'Product UoS' decimal precision is defined and set to 3 or 6, doesn't matter.
- I have cloned account_invoice_report with some added fields... and works fine with such decimal precision change.
- It looks like account_invoice_report view should be deleted and rebuilt on every --update=all, but with this (naive) change, something breaks in the middle and prevents its creation. Such creation error leaves no log.
The issue happens when:
- Go to 'Settings > Reporting > Statistic Reports > Invoices Analysis'
- or eneter in Sales main board with "Monthly turnover" graph.
So... Any clue???
Error trace raised when trying to load account_invoice_report view:
Client Traceback (most recent call last):
File "/opt/openerp/openerp_61_ocb_devel/all-addons/web/common/http.py", line 180, in dispatch
response["result"] = method(controller, self, **self.params)
File "/opt/openerp/openerp_61_ocb_devel/all-addons/web/controllers/main.py", line 1082, in read
dict(context, group_by=group_by_fields), sort or False)
File "/opt/openerp/openerp_61_ocb_devel/all-addons/web/common/openerplib/main.py", line 250, in proxy
args, kw)
File "/opt/openerp/openerp_61_ocb_devel/all-addons/web/common/openerplib/main.py", line 117, in proxy
result = self.connector.send(self.service_name, method, *args)
File "/opt/openerp/openerp_61_ocb_devel/all-addons/web/common/http.py", line 608, in send
raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)
Server Traceback (most recent call last):
File "/opt/openerp/openerp_61_ocb_devel/all-addons/web/common/http.py", line 593, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/netsvc.py", line 360, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/service/web_services.py", line 586, in dispatch
res = fn(db, uid, *params)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/osv/osv.py", line 186, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/osv/osv.py", line 129, in wrapper
return f(self, dbname, *args, **kwargs)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/osv/osv.py", line 195, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/osv/osv.py", line 183, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/osv/orm.py", line 2562, in read_group
cr.execute('SELECT min(%s.id) AS id, count(%s.id) AS %s_count' % (self._table, self._table, group_count) + (flist and ',') + flist + ' FROM ' + from_clause + where_clause + gb + limit_str + offset_str, where_clause_params)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/sql_db.py", line 152, in wrapper
return f(self, *args, **kwargs)
File "/mnt/workZone/openerp/openerp_61_ocb_devel/ocb-server/openerp/sql_db.py", line 212, in execute
res = self._obj.execute(query, params)
ProgrammingError: relation "account_invoice_report" does not exist
LINE 1: ...nvoice_report"."price_total") AS price_total FROM "account_i...
^
Simplest example (without license headers to save space) that triggers the issue when running with --update=all:
MODULE NAME: test_account_invoice
__init__.py
# -*- coding: utf-8 -*-
from . import account_invoice
__openerp__.py
# -*- encoding: utf-8 -*-
{
"name": "test for decimal precision in account.invoice quantity",
"version": "0.1",
"depends": ["account",
"decimal_precision"
],
"author": "my_name",
"category": "Accounting",
"description": """
This module aims to :
* test if decimal precision in account.invoice quantity breaks
account_invoice_report
""",
"init_xml": [],
'update_xml': [],
'demo_xml': [],
'installable': True,
'active': False,
#'certificate': 'certificate',
}
account_invoice.py
# -*- coding: utf-8 -*-
import time
from lxml import etree
import decimal_precision as dp
import netsvc
import pooler
from osv import fields, osv, orm
from tools.translate import _
class account_invoice_line(osv.osv):
_inherit = "account.invoice.line"_columns = {
'quantity': fields.float(
'Quantity',
required=True,
digits_compute=dp.get_precision('Product UoS')),
}account_invoice_line()