[FIX] revert to v7 report API

bzr revid: ls@numerigraphe.com-20140404124036-1vt0fkakfllj1qax
This commit is contained in:
Lionel Sausin 2014-04-04 14:40:36 +02:00
parent af64d6cc97
commit a386aea7d3
1 changed files with 5 additions and 9 deletions

View File

@ -231,21 +231,17 @@
uid: 'res_users_mrp_user' uid: 'res_users_mrp_user'
- -
!python {model: mrp.production}: | !python {model: mrp.production}: |
import os import netsvc, tools, os
import openerp.report
from openerp import tools
order = self.browse(cr, uid, ref("mrp_production_test1")) order = self.browse(cr, uid, ref("mrp_production_test1"))
data, format = openerp.report.render_report(cr, uid, [order.bom_id.id], 'bom.structure', {}, {}) (data, format) = netsvc.LocalService('report.bom.structure').create(cr, uid, [order.bom_id.id], {}, {})
if tools.config['test_report_directory']: if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'mrp-bom_structure_report.'+format), 'wb+').write(data) file(os.path.join(tools.config['test_report_directory'], 'mrp-bom_structure_report.'+format), 'wb+').write(data)
- -
I print "Production Order". I print "Production Order".
- -
!python {model: mrp.production}: | !python {model: mrp.production}: |
import os import netsvc, tools, os
import openerp.report (data, format) = netsvc.LocalService('report.mrp.production.order').create(cr, uid, [ref("mrp_production_test1")], {}, {})
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref("mrp_production_test1")], 'mrp.production.order', {}, {})
if tools.config['test_report_directory']: if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data) file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data)
- -
@ -255,6 +251,6 @@
ctx = context.copy() ctx = context.copy()
ctx.update({'model': 'mrp.workcenter','active_ids': [ref('mrp_workcenter_0'),ref('mrp_workcenter_1')]}) ctx.update({'model': 'mrp.workcenter','active_ids': [ref('mrp_workcenter_0'),ref('mrp_workcenter_1')]})
data_dict = {'time_unit': 'day', 'measure_unit': 'hours'} data_dict = {'time_unit': 'day', 'measure_unit': 'hours'}
from openerp.tools import test_reports from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_mrp_workcenter_load_wizard',wiz_data=data_dict, context=ctx, our_module='mrp') test_reports.try_report_action(cr, uid, 'action_mrp_workcenter_load_wizard',wiz_data=data_dict, context=ctx, our_module='mrp')