hello, i already download modul (report_qweb_txt) for odoo 10 and the module works in odoo 10..
but i need to use this module for odoo 8, i already change the code but when i click button "CSV List", it gives me error 'list' object has no attributes 'ids'
models/ir_actions_report_xml.py
from openerp import api, fields, models
class IrActionsReportXml(models.Model):
_inherit = 'ir.actions.report.xml'
report_type = fields.Selection(selection_add=[
('qweb-txt', 'Text'),
('qweb-txt-csv', 'CSV'),
])
@api.model
def render_report(self, res_ids, name, data):
if (
data.get('report_type') and
data.get('report_type').startswith('qweb-txt')):
ext = data['report_type'].split('-')[-1]
# That way, you can easily add qweb-txt-zpl' or others
# without inheriting this method (you just need to do the
# selection_add on the field 'report_type')
return self.env['report'].get_html(res_ids, name, data=data), ext
else:
return super(IrActionsReportXml, self).render_report(
res_ids, name, data)
models/report.py
from openerp import api, models
class Report(models.Model):
_inherit = "report"
@api.model
def _get_report_from_name(self, report_name):
res = super(Report, self)._get_report_from_name(report_name)
if not res:
res = self.env['ir.actions.report.xml'].search([
('report_type', '!=', False),
('report_name', '=', report_name)], limit=1)
return res
i change the top from .py file
from odoo import api, fields, models --> from openerp import api, fields, models
can someone help me where is my fault?