コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
2817 ビュー

Hello everyone, I am currently migrating a report module to odoo 16 but I am encountering an error not in the installation but when trying to view the report, the error is as follows: 

Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/models.py", line 5112, in ensure_one
    _id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/odoo/odoo-server/odoo/models.py", line 5112, in ensure_one
_id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 1579, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/odoo/odoo-server/odoo/service/model.py", line 134, in retrying
result = func()
File "/odoo/odoo-server/odoo/http.py", line 1608, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/odoo/odoo-server/odoo/http.py", line 1805, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 144, in _dispatch
result = endpoint(**request.params)
File "/odoo/odoo-server/odoo/http.py", line 698, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/odoo/odoo-server/addons/web/controllers/dataset.py", line 42, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/odoo/odoo-server/addons/web/controllers/dataset.py", line 33, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 461, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 448, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/odoo/enterprise/addons/account_reports/models/account_report.py", line 3427, in get_report_informations
self.ensure_one()
File "/odoo/odoo-server/odoo/models.py", line 5115, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: account.report()

The above server error caused the following client error:
null

and this is my code to generate the query: 
classAccountReportSar(models.Model):
_name='account.report.sar'
_description='Reporte de libros contables SAR'
_auto=False
fecha= fields.Date(readonly=True)
empresa= fields.Char(readonly=True)
rtn= fields.Char(readonly=True)
state= fields.Selection([       
('draft', 'Unposted'), ('posted', 'Posted'), ('cancel', 'Cancelled')], 'Status', readonly=True)
factura= fields.Char(readonly=True)
no_tax_def= fields.Monetary(readonly=True, string='Sin Ind. Impuesto', currency_field='company_currency_id')isvimp= fields.Monetary(readonly=True, string='isvimp', currency_field='company_currency_id')exeimp= fields.Monetary(readonly=True, string='', currency_field='company_currency_id')isvr10= fields.Monetary(readonly=True, string='', currency_field='company_currency_id')exento= fields.Monetary(readonly=True, string='Importe Exento', currency_field='company_currency_id')exonerado= fields.Monetary(readonly=True, string='Importe Exonerado', currency_field='company_currency_id')gravado= fields.Monetary(readonly=True, currency_field='company_currency_id')gravado15= fields.Monetary(readonly=True, string='Gravado 15%', currency_field='company_currency_id')gravado18= fields.Monetary(readonly=True, string='Gravado 18%', currency_field='company_currency_id')impuesto15= fields.Monetary(readonly=True, string='Impuesto 15%', currency_field='company_currency_id')impuesto18= fields.Monetary(readonly=True, string='Impuesto 18%', currency_field='company_currency_id')impuesto= fields.Monetary(readonly=True, string='Impuesto Total', currency_field='company_currency_id')total= fields.Monetary(readonly=True, currency_field='company_currency_id')type= fields.Char(readonly=True)journal_id= fields.Many2one('account.journal', readonly=True, auto_join=True)company_id= fields.Many2one('res.company', readonly=True, auto_join=True)company_currency_id= fields.Many2one(related='company_id.currency_id', readonly=True)move_id= fields.Many2one('account.move', string='Entry', auto_join=True)
_depends= {'account.move':['id','move_type','invoice_date','name','state','journal_id','company_id','amount_total_signed','amount_total','date','currency_id','partner_id','l10n_latam_document_type_id'],'res.currency':['currency_id'],
'res.partner':['name','vat'],
'account.move.line':['id','price_subtotal','account_id','move_id'],
'account.move.line.account.tax.rel':['account_move_line_id'],
'account.tax':['id','name'],
'res.currency.rate':['rate','currency_id','name'],
'res.company':['id'],
'account.journal':['id','name']    }
definit(self):
cr=self._cr       
tools.drop_view_if_exists(cr, self._table)
query="""my query"""
sql="""CREATE or REPLACE VIEW %s as (%s)"""% (self._table, query)
cr.execute(sql)


Could you tell me what I'm doing wrong?
the code is for version 16.

Thank you in advance for your help
アバター
破棄
最善の回答

Any solution ?  i have the same problem

アバター
破棄
最善の回答

Hi,

From the shared traceback it seems the error is coming from the module named:  iwesabe_account_reports , the issue is that, the code is expecting a recordset of account.report model, but it is coming as empty recordset and thus the error is raised.


You have to go through the code and analyze more about the issue.

Thanks

アバター
破棄
著作者

no, that application is not the problem, I uninstalled it and even so, the error continues when trying to generate the report

関連投稿 返信 ビュー 活動
5
9月 25
23053
3
8月 25
3416
1
5月 25
3325
1
4月 25
4241
1
4月 25
5051