تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6444 أدوات العرض

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:

https://gist.github.com/lukebranch/6109989e6048ad313f63

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

https://www.odoo.com/forum/help-1/question/8-0-how-can-i-install-the-official-aeroo-reports-alistek-for-odoo-version-8-solved-76044

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

https://github.com/aeroo/aeroo_reports/issues/51

الصورة الرمزية
إهمال
أفضل إجابة

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()

with

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

الكاتب

@Temur,

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

الكاتب

@Temur,

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:

https://gist.github.com/lukebranch/ac1fa483f608ce5cb9fd

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.

regarding the error, replacing this line:

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

with
r.write({'note':note})
may help

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

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.

الكاتب

@Temur,

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.

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 15
6768
1
سبتمبر 17
5569
2
سبتمبر 17
6261
1
نوفمبر 16
4499
0
مارس 15
3517