I did a report using RML. I created the next reports.xml
file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report auto="False"
id="event_extended_meeting_attendance_checking"
model="event.meeting.registration"
name="event_extended.meeting_attendance_checking"
rml="event_extended/report/event_meeting_attendance_checking.rml"
string="Meeting attendance list" />
</data>
</openerp>
Now, when I open an event.meeting.registration
view (tree or form), the option Print > Meeting attendance list appears there. The problem is that I don't want to print the report from the form view, and even more, this model has two different tree views, and I'd like to print only from one of them.
How can I achieve that? If it wasn't possible, how can I show an ORM exception message when the user clicks on the option and stop the process?
Any help will be appreciated. Thank you!
When we are creating a report for a model than it will link to that particular model, not for only specific view. It doesn't matter tree view or form view printing a report.
Now in your case, you can achieve in a one way as per my suggestion.
On Print button click, need to call method and logic like
if len(context.get(active_ids)) > 1:
raise osv.except_osv(_('Error!'),_('You are not allowed print report.'))
else:
#return report_name, type, datas, etc
Note: When it's breakdown, if any user select only one record from the tree view than it will also fire a exception. Hope you got basic idea what to do on these.