Odoo Help


[8.0] Aeroo Reports: report_aeroo_direct_print error: NameError: global name 'context' is not defined

Luke Branch
on 4/1/15, 6:42 AM 1,985 views

I've managed to setup CUPS and have installed my HP CM1415 printer in the Aeroo Reports direct printing configuration wizard.

Using my own ODS (input template format) / XLS (output format) i've created a report for sale.order. The report is stored in the database, and all other settings are default.

When I tick the Report Wizard option I get the following error:

NameError: global name 'context' is not defined

The full traceback is here for reference:


I'm running on Ubuntu 14.04 with Odoo 8.0, using this installation method:


Any insight or suggestions would be very much appreciated. I've opened a github issue on the Official Aeroo Reports repository here:





| 6 5 7
Tbilisi, Georgia
On 4/1/15, 7:51 AM

most probably it's because  v7 code were not (or not completelly) ported to v8... in v8 context is replaced by recs.env.context (or recs._context as it's shortcut)

according the error log, you can try to replace following line:

ctx = context.copy()


ctx = recs.env.context.copy()

in File "/opt/odoo/custom/addons/report_aeroo_direct_print/report_aeroo_direct_print.py", line 289 

You'll need to restart the odoo server after this change, in order to get it worked

on 4/1/15, 9:06 AM


Thank you! I'll try this and report back here to let you know if it's worked.

Luke Branch
on 4/1/15, 9:44 AM


It worked, thanks for your help. I've just run into another issue. When going to: Settings >> Aeroo Reports >> Printers >> HP LaserJet CM1415fnw [Or Your Printer Model Here] > Switch to Form View > Click Refresh.

I've now run into the follow error message:

TypeError: write() got an unexpected keyword argument 'context'

The full traceback is here:


I think the line that is throwing the error is here:

File "/opt/odoo/custom/addons/report_aeroo_direct_print/report_aeroo_direct_print.py", line 163, in refresh r.write({'note':note}, context=context)

There have been a few other similar issues like this reported and they all seem to be quite similar. In your opinion, is this a good place to start to learn some of the changes between the old and new API: https://www.odoo.com/documentation/8.0/reference/orm.html Do you have a github account by the way? I'd like to submit a PR with your suggested changes to the official repository and want to make sure you're properly attributed in the commit messages.

Luke Branch
on 4/1/15, 10:39 AM

regarding the error, replacing this line:

r.write({'note':note}, context=context)

may help
on 4/1/15, 11:11 AM

yes, good place. but if you're familiar with old (v7) API, then you may find it interesting: http://fr.slideshare.net/openobject/odoo-from-v7-to-v8-the-new-api

on 4/1/15, 11:19 AM

yes, I have couple of accounts on github, but I grant you all rights if you like to contribute to that project. these are really minor fixes and based on error log, I have not read the code anyway, it's not necessary to mention me.

on 4/1/15, 11:25 AM


Thank you for all of your help. I will be submitting the PR's today, and will comment back here with the links and attribute yourself and this post in the commit notes.

Luke Branch
on 4/3/15, 10:22 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/1/15, 6:42 AM
Seen: 1985 times
Last updated: 4/1/15, 12:31 PM