[MERGE] use new report API.
bzr revid: vmt@openerp.com-20130328121009-r3n63gmhfkv0dnby
This commit is contained in:
commit
5639a52431
|
@ -24,7 +24,6 @@ from datetime import datetime
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
from openerp import netsvc
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
import openerp.addons.decimal_precision as dp
|
import openerp.addons.decimal_precision as dp
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<report auto="False" id="account_general_journal" model="account.journal.period" name="account.general.journal" rml="account/report/account_general_journal.rml" string="General Journal" header="False"/>
|
<report auto="False" id="account_general_journal" model="account.journal.period" name="account.general.journal" rml="account/report/account_general_journal.rml" string="General Journal" header="False"/>
|
||||||
<report auto="False" id="account_journal" model="account.journal.period" name="account.journal.period.print" rml="account/report/account_journal.rml" string="Journal" header="False"/>
|
<report auto="False" id="account_journal" model="account.journal.period" name="account.journal.period.print" rml="account/report/account_journal.rml" string="Journal" header="False"/>
|
||||||
<report auto="False" id="account_journal_sale_purchase" model="account.journal.period" name="account.journal.period.print.sale.purchase" rml="account/report/account_journal_sale_purchase.rml" string="Sale/Purchase Journal" header="False"/>
|
<report auto="False" id="account_journal_sale_purchase" model="account.journal.period" name="account.journal.period.print.sale.purchase" rml="account/report/account_journal_sale_purchase.rml" string="Sale/Purchase Journal" header="False"/>
|
||||||
<report auto="False" id="account_overdue" model="res.partner" name="account.overdue" rml="account/report/account_print_overdue.rml" string="Overdue Payments"/>
|
<report id="account_overdue" model="res.partner" name="account.overdue" rml="account/report/account_print_overdue.rml" string="Overdue Payments" parser="account.report.account_print_overdue.Overdue"/>
|
||||||
<report
|
<report
|
||||||
auto="False"
|
auto="False"
|
||||||
id="account_invoices"
|
id="account_invoices"
|
||||||
|
|
|
@ -26,7 +26,7 @@ from operator import itemgetter
|
||||||
from os.path import join as opj
|
from os.path import join as opj
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from openerp import netsvc, tools
|
from openerp import tools
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,6 @@ class Overdue(report_sxw.rml_parse):
|
||||||
message = company_pool.browse(self.cr, self.uid, company.id, {'lang':obj.lang}).overdue_msg
|
message = company_pool.browse(self.cr, self.uid, company.id, {'lang':obj.lang}).overdue_msg
|
||||||
return message.split('\n')
|
return message.split('\n')
|
||||||
|
|
||||||
report_sxw.report_sxw('report.account.overdue', 'res.partner',
|
|
||||||
'addons/account/report/account_print_overdue.rml', parser=Overdue)
|
|
||||||
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,9 @@
|
||||||
-
|
-
|
||||||
!python {model: account.invoice}: |
|
!python {model: account.invoice}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.account_invoice_customer0')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('account.account_invoice_customer0')], 'account.invoice', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
@ -24,8 +25,9 @@
|
||||||
-
|
-
|
||||||
!python {model: res.partner}: |
|
!python {model: res.partner}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.account.overdue').create(cr, uid, [ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')], 'account.overdue', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from openerp.osv import osv
|
from openerp.osv import osv
|
||||||
|
|
||||||
from openerp import netsvc
|
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
class account_state_open(osv.osv_memory):
|
class account_state_open(osv.osv_memory):
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
-
|
-
|
||||||
!python {model: account.analytic.account}: |
|
!python {model: account.analytic.account}: |
|
||||||
import os, time
|
import os, time
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
|
from openerp import tools
|
||||||
data_dict = {'model': 'account.analytic.account', 'form': {'date1':time.strftime("%Y-01-01"),'date2':time.strftime('%Y-%m-%d'),'journal_ids':[6,0,(ref('account.cose_journal_sale'))],'ref':ref('account.analytic_root'),'empty_line':True,'id':ref('account.analytic_root'),'context':{}}}
|
data_dict = {'model': 'account.analytic.account', 'form': {'date1':time.strftime("%Y-01-01"),'date2':time.strftime('%Y-%m-%d'),'journal_ids':[6,0,(ref('account.cose_journal_sale'))],'ref':ref('account.analytic_root'),'empty_line':True,'id':ref('account.analytic_root'),'context':{}}}
|
||||||
(data, format) = netsvc.LocalService('report.account.analytic.account.crossovered.analytic').create(cr, uid, [ref('account.analytic_root')], data_dict, {})
|
data, format = openerp.report.render_report(cr, uid, [ref('account.analytic_root')], 'account.analytic.account.crossovered.analytic', data_dict, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'account_analytic_plans-crossovered_analyitic.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'account_analytic_plans-crossovered_analyitic.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -5,8 +5,6 @@ import datetime
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
from openerp.tests.common import TransactionCase
|
from openerp.tests.common import TransactionCase
|
||||||
|
|
||||||
from openerp import netsvc
|
|
||||||
|
|
||||||
class TestAccountFollowup(TransactionCase):
|
class TestAccountFollowup(TransactionCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
""" setUp ***"""
|
""" setUp ***"""
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
-
|
-
|
||||||
!python {model: payment.order}: |
|
!python {model: payment.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.payment.order').create(cr, uid, [ref('payment_order_1')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('payment_order_1')], 'payment.order', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
-
|
-
|
||||||
!python {model: account.voucher}: |
|
!python {model: account.voucher}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher_voucheraxelor0again")], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref("account_voucher_voucheraxelor0again")], 'voucher.cash_receipt.drcr', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -125,7 +125,6 @@
|
||||||
-
|
-
|
||||||
!python {model: account.voucher}: |
|
!python {model: account.voucher}: |
|
||||||
import time
|
import time
|
||||||
from openerp import netsvc
|
|
||||||
vals = {}
|
vals = {}
|
||||||
voucher_id = self.browse(cr, uid, ref('account_voucher_case_5_supplier_flow'))
|
voucher_id = self.browse(cr, uid, ref('account_voucher_case_5_supplier_flow'))
|
||||||
for item in voucher_id.line_dr_ids:
|
for item in voucher_id.line_dr_ids:
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
I will create and post an account voucher of amount 450.0 for the partner Seagate.
|
I will create and post an account voucher of amount 450.0 for the partner Seagate.
|
||||||
-
|
-
|
||||||
!python {model: account.voucher}: |
|
!python {model: account.voucher}: |
|
||||||
from openerp import netsvc
|
|
||||||
vals = {}
|
vals = {}
|
||||||
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
|
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
|
||||||
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)
|
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
I create and post a voucher payment of amount 30000.0 for the partner Seagate
|
I create and post a voucher payment of amount 30000.0 for the partner Seagate
|
||||||
-
|
-
|
||||||
!python {model: account.voucher}: |
|
!python {model: account.voucher}: |
|
||||||
from openerp import netsvc
|
|
||||||
vals = {}
|
vals = {}
|
||||||
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
|
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
|
||||||
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)
|
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)
|
||||||
|
|
|
@ -55,11 +55,6 @@ class report_xml(osv.osv):
|
||||||
'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())),
|
'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())),
|
||||||
})
|
})
|
||||||
|
|
||||||
# FIXME: this should be moved to an override of the ir.actions.report_xml.create() method
|
|
||||||
cr.commit()
|
|
||||||
self.pool['ir.actions.report.xml'].register_all(cr)
|
|
||||||
openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def report_get(self, cr, uid, report_id, context=None):
|
def report_get(self, cr, uid, report_id, context=None):
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import os, time
|
import os, time
|
||||||
from openerp import netsvc
|
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import StringIO
|
import StringIO
|
||||||
|
|
|
@ -32,11 +32,12 @@
|
||||||
-
|
-
|
||||||
!python {model: stock.picking}: |
|
!python {model: stock.picking}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
|
from openerp import tools
|
||||||
sale = self.pool.get('sale.order')
|
sale = self.pool.get('sale.order')
|
||||||
sale_order = sale.browse(cr, uid, ref("sale.sale_order_6"))
|
sale_order = sale.browse(cr, uid, ref("sale.sale_order_6"))
|
||||||
ship_ids = [x.id for x in sale_order.picking_ids]
|
ship_ids = [x.id for x in sale_order.picking_ids]
|
||||||
(data, format) = netsvc.LocalService('report.sale.shipping').create(cr, uid, ship_ids, {}, {})
|
data, format = openerp.report.render_report(cr, uid, ship_ids, 'sale.shipping', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'delivery-shipping'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'delivery-shipping'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
|
|
@ -37,7 +37,7 @@ except ImportError:
|
||||||
from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree
|
from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree
|
||||||
|
|
||||||
import openerp
|
import openerp
|
||||||
from openerp import sql_db, netsvc
|
from openerp import sql_db
|
||||||
import openerp.service
|
import openerp.service
|
||||||
from openerp.tools import misc
|
from openerp.tools import misc
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import openerp
|
import openerp
|
||||||
from openerp import netsvc
|
|
||||||
from dav_fs import openerp_dav_handler
|
from dav_fs import openerp_dav_handler
|
||||||
from openerp.tools.config import config
|
from openerp.tools.config import config
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -29,7 +29,6 @@ import urllib2
|
||||||
|
|
||||||
import openerp
|
import openerp
|
||||||
import openerp.release as release
|
import openerp.release as release
|
||||||
import openerp.netsvc as netsvc
|
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.tools.safe_eval import safe_eval as eval
|
from openerp.tools.safe_eval import safe_eval as eval
|
||||||
|
@ -418,9 +417,7 @@ class EDIMixin(object):
|
||||||
('usage','=','default')])
|
('usage','=','default')])
|
||||||
if matching_reports:
|
if matching_reports:
|
||||||
report = ir_actions_report.browse(cr, uid, matching_reports[0])
|
report = ir_actions_report.browse(cr, uid, matching_reports[0])
|
||||||
report_service = 'report.' + report.report_name
|
result, format = openerp.report.render_report(cr, uid, [record.id], report.report_name, {'model': self._name}, context=context)
|
||||||
service = netsvc.LocalService(report_service)
|
|
||||||
(result, format) = service.create(cr, uid, [record.id], {'model': self._name}, context=context)
|
|
||||||
eval_context = {'time': time, 'object': record}
|
eval_context = {'time': time, 'object': record}
|
||||||
if not report.attachment or not eval(report.attachment, eval_context):
|
if not report.attachment or not eval(report.attachment, eval_context):
|
||||||
# no auto-saving of report as attachment, need to do it manually
|
# no auto-saving of report as attachment, need to do it manually
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
import base64
|
import base64
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openerp import netsvc
|
import openerp
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
from openerp.osv import fields
|
from openerp.osv import fields
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
|
@ -336,16 +336,15 @@ class email_template(osv.osv):
|
||||||
# Add report in attachments
|
# Add report in attachments
|
||||||
if template.report_template:
|
if template.report_template:
|
||||||
report_name = self.render_template(cr, uid, template.report_name, template.model, res_id, context=context)
|
report_name = self.render_template(cr, uid, template.report_name, template.model, res_id, context=context)
|
||||||
report_service = 'report.' + report_xml_pool.browse(cr, uid, template.report_template.id, context).report_name
|
report_service = report_xml_pool.browse(cr, uid, template.report_template.id, context).report_name
|
||||||
# Ensure report is rendered using template's language
|
# Ensure report is rendered using template's language
|
||||||
ctx = context.copy()
|
ctx = context.copy()
|
||||||
if template.lang:
|
if template.lang:
|
||||||
ctx['lang'] = self.render_template(cr, uid, template.lang, template.model, res_id, context)
|
ctx['lang'] = self.render_template(cr, uid, template.lang, template.model, res_id, context)
|
||||||
service = netsvc.LocalService(report_service)
|
result, format = openerp.report.render_report(cr, uid, [res_id], report_service, {'model': template.model}, ctx)
|
||||||
(result, format) = service.create(cr, uid, [res_id], {'model': template.model}, ctx)
|
|
||||||
result = base64.b64encode(result)
|
result = base64.b64encode(result)
|
||||||
if not report_name:
|
if not report_name:
|
||||||
report_name = report_service
|
report_name = 'report.' + report_service
|
||||||
ext = "." + format
|
ext = "." + format
|
||||||
if not report_name.endswith(ext):
|
if not report_name.endswith(ext):
|
||||||
report_name += ext
|
report_name += ext
|
||||||
|
|
|
@ -34,7 +34,6 @@ import zipfile
|
||||||
import base64
|
import base64
|
||||||
from openerp import addons
|
from openerp import addons
|
||||||
|
|
||||||
from openerp import netsvc
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
|
@ -101,8 +101,8 @@
|
||||||
-
|
-
|
||||||
!python {model: hr.evaluation.report}: |
|
!python {model: hr.evaluation.report}: |
|
||||||
import os, time
|
import os, time
|
||||||
from openerp import netsvc, tools
|
from openerp import tools
|
||||||
ctx={}
|
ctx={}
|
||||||
data_dict={'state': 'done', 'rating': 2, 'employee_id': ref("hr.employee_fp")}
|
data_dict={'state': 'done', 'rating': 2, 'employee_id': ref("hr.employee_fp")}
|
||||||
from openerp.tools import test_reports
|
from openerp.tools import test_reports
|
||||||
test_reports.try_report_action(cr, uid, 'hr_evaluation_evaluation_0',wiz_data=data_dict, context=ctx, our_module='hr_evaluation')
|
test_reports.try_report_action(cr, uid, 'hr_evaluation_evaluation_0',wiz_data=data_dict, context=ctx, our_module='hr_evaluation')
|
||||||
|
|
|
@ -36,8 +36,7 @@
|
||||||
I print a report of the expenses.
|
I print a report of the expenses.
|
||||||
-
|
-
|
||||||
!python {model: hr.expense.expense}: |
|
!python {model: hr.expense.expense}: |
|
||||||
import os
|
data, format = self.print_report(cr, uid, [ref('hr_expense.sep_expenses')], 'hr.expense', {}, {})
|
||||||
from openerp import netsvc, tools
|
if openerp.tools.config['test_report_directory']:
|
||||||
(data, format) = netsvc.LocalService('report.hr.expense').create(cr, uid, [ref('hr_expense.sep_expenses')], {}, {})
|
import os
|
||||||
if tools.config['test_report_directory']:
|
file(os.path.join(openerp.tools.config['test_report_directory'], 'hr_expense-report.'+format), 'wb+').write(data)
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'hr_expense-report.'+format), 'wb+').write(data)
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
-
|
-
|
||||||
!python {model: hr.payslip}: |
|
!python {model: hr.payslip}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.payslip.pdf').create(cr, uid, [ref('hr_payroll.hr_payslip_salaryslipofbonamyforjune0')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('hr_payroll.hr_payslip_salaryslipofbonamyforjune0')], 'payslip.pdf', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payslip_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payslip_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import time
|
import time
|
||||||
from openerp import netsvc
|
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
-
|
-
|
||||||
!python {model: account.analytic.line}: |
|
!python {model: account.analytic.line}: |
|
||||||
import os, time
|
import os, time
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
|
from openerp import tools
|
||||||
data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'employee_ids': [[6,0,[ref('hr.employee_fp'), ref('hr.employee_qdp'),ref('hr.employee_al')]]], 'journal_ids': [[6,0,[ref('hr_timesheet.analytic_journal')]]], 'date_to': time.strftime('%Y-%m-%d')}}
|
data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'employee_ids': [[6,0,[ref('hr.employee_fp'), ref('hr.employee_qdp'),ref('hr.employee_al')]]], 'journal_ids': [[6,0,[ref('hr_timesheet.analytic_journal')]]], 'date_to': time.strftime('%Y-%m-%d')}}
|
||||||
(data, format) = netsvc.LocalService('report.account.analytic.profit').create(cr, uid, [], data_dict, {})
|
data, format = openerp.report.render_report(cr, uid, [], 'account.analytic.profit', data_dict, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-account_analytic_profit_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-account_analytic_profit_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
-
|
-
|
||||||
!python {model: hr_timesheet_sheet.sheet}: |
|
!python {model: hr_timesheet_sheet.sheet}: |
|
||||||
uid = ref('base.user_root')
|
uid = ref('base.user_root')
|
||||||
from openerp import netsvc
|
|
||||||
try:
|
try:
|
||||||
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"active_ids":
|
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"active_ids":
|
||||||
[ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")],"active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
|
[ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")],"active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
-
|
-
|
||||||
!python {model: account.move.line}: |
|
!python {model: account.move.line}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.l10n.fr.bilan').create(cr, uid, [], {'model':'account.move.line', 'form':{'fiscalyear_id': ref('account.data_fiscalyear')}}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [], 'l10n.fr.bilan', {'model':'account.move.line', 'form':{'fiscalyear_id': ref('account.data_fiscalyear')}}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-bilan_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-bilan_report.'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
@ -13,7 +14,8 @@
|
||||||
-
|
-
|
||||||
!python {model: account.move.line}: |
|
!python {model: account.move.line}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.l10n.fr.compute_resultant').create(cr, uid, [], {'model':'account.move.line', 'form':{'fiscalyear_id': ref('account.data_fiscalyear')}}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [], 'l10n.fr.compute_resultant', {'model':'account.move.line', 'form':{'fiscalyear_id': ref('account.data_fiscalyear')}}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-compute_resultant_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-compute_resultant_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp import netsvc
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
-
|
-
|
||||||
!python {model: hr.payroll.advice}: |
|
!python {model: hr.payroll.advice}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.payroll.advice').create(cr, uid, [ref('l10n_in_hr_payroll.payment_advice_1')], {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('l10n_in_hr_payroll.payment_advice_1')], 'payroll.advice', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'l10n_in_hr_payroll_summary report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'l10n_in_hr_payroll_summary report'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
-
|
-
|
||||||
!python {model: res.partner}: |
|
!python {model: res.partner}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.l10n_lu.tax.report.print').create(cr, uid, [], {'model':'ir.ui.menu', 'form':{'tax_code_id': ref('account_tax_code_id_r1'), 'period_id': ref('account.period_1')}}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [], 'l10n_lu.tax.report.print', {'model':'ir.ui.menu', 'form':{'tax_code_id': ref('account_tax_code_id_r1'), 'period_id': ref('account.period_1')}}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'l10n_lu-vat_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'l10n_lu-vat_report.'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import re
|
||||||
from openerp.addons.decimal_precision import decimal_precision as dp
|
from openerp.addons.decimal_precision import decimal_precision as dp
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp import netsvc
|
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
_intervalTypes = {
|
_intervalTypes = {
|
||||||
|
|
|
@ -215,9 +215,10 @@
|
||||||
-
|
-
|
||||||
!python {model: mrp.production}: |
|
!python {model: mrp.production}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
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) = netsvc.LocalService('report.bom.structure').create(cr, uid, [order.bom_id.id], {}, {})
|
data, format = openerp.report.render_report(cr, uid, [order.bom_id.id], 'bom.structure', {}, {})
|
||||||
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)
|
||||||
-
|
-
|
||||||
|
@ -225,8 +226,9 @@
|
||||||
-
|
-
|
||||||
!python {model: mrp.production}: |
|
!python {model: mrp.production}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
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)
|
||||||
-
|
-
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
from openerp.osv import fields
|
from openerp.osv import fields
|
||||||
from openerp.osv import osv
|
from openerp.osv import osv
|
||||||
from openerp import netsvc
|
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
-
|
-
|
||||||
!python {model: mrp.repair}: |
|
!python {model: mrp.repair}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.repair.order').create(cr, uid, [ref('mrp_repair.mrp_repair_rmrp0')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('mrp_repair.mrp_repair_rmrp0')], 'repair.order', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'mrp_repair-order_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'mrp_repair-order_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
import time
|
import time
|
||||||
from openerp import netsvc
|
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
|
|
||||||
class report_transaction_pos(osv.osv):
|
class report_transaction_pos(osv.osv):
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
-
|
-
|
||||||
!python {model: pos.order}: |
|
!python {model: pos.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.pos.details_summary').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.details_summary', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-details_summary report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-details_summary report'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
@ -13,8 +14,9 @@
|
||||||
-
|
-
|
||||||
!python {model: pos.order}: |
|
!python {model: pos.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.pos.invoice').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.invoice', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice report'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
@ -23,8 +25,9 @@
|
||||||
-
|
-
|
||||||
!python {model: pos.order}: |
|
!python {model: pos.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.pos.lines').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.lines', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines report'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
@ -33,8 +36,9 @@
|
||||||
-
|
-
|
||||||
!python {model: pos.order}: |
|
!python {model: pos.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.pos.receipt').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.receipt', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
@ -54,9 +58,10 @@
|
||||||
-
|
-
|
||||||
!python {model: pos.order}: |
|
!python {model: pos.order}: |
|
||||||
import os, time
|
import os, time
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
|
from openerp import tools
|
||||||
data_dict = {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'),'user_id':[ref('base.user_root')] }}
|
data_dict = {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'),'user_id':[ref('base.user_root')] }}
|
||||||
(data, format) = netsvc.LocalService('report.pos.sales.user').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], data_dict, {})
|
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.sales.user', data_dict, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_user_report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_user_report'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
@ -64,8 +69,9 @@
|
||||||
-
|
-
|
||||||
!python {model: pos.order}: |
|
!python {model: pos.order}: |
|
||||||
import os, time
|
import os, time
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.pos.payment.report').create(cr, uid, [ref('point_of_sale.pos_order_pos0')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos0')], 'pos.payment.report', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_report'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
@ -73,8 +79,9 @@
|
||||||
-
|
-
|
||||||
!python {model: pos.order}: |
|
!python {model: pos.order}: |
|
||||||
import os, time
|
import os, time
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
|
from openerp import tools
|
||||||
data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root'),ref('base.user_demo')] }}
|
data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root'),ref('base.user_demo')] }}
|
||||||
(data, format) = netsvc.LocalService('report.pos.payment.report.user').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], data_dict, {})
|
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.payment.report.user', data_dict, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_user_report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_user_report'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
name="product.pricelist"
|
name="product.pricelist"
|
||||||
rml="product/report/product_pricelist.rml"
|
rml="product/report/product_pricelist.rml"
|
||||||
menu="False"
|
menu="False"
|
||||||
auto="False"/>
|
parser="product.report.product_pricelist.product_pricelist"
|
||||||
|
/>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -120,6 +120,4 @@ class product_pricelist(report_sxw.rml_parse):
|
||||||
price = self.formatLang(res[0]['list_price'], digits=sale_price_digits, currency_obj=pricelist.currency_id)
|
price = self.formatLang(res[0]['list_price'], digits=sale_price_digits, currency_obj=pricelist.currency_id)
|
||||||
return price
|
return price
|
||||||
|
|
||||||
report_sxw.report_sxw('report.product.pricelist','product.product','addons/product/report/product_pricelist.rml',parser=product_pricelist)
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
-
|
-
|
||||||
!python {model: purchase.order}: |
|
!python {model: purchase.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.purchase.quotation').create(cr, uid, [ref('purchase.purchase_order_1'),ref('purchase.purchase_order_2')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('purchase.purchase_order_1'), ref('purchase.purchase_order_2')], 'purchase.quotation', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'purchase-request_quotation'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'purchase-request_quotation'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.osv.orm import browse_record, browse_null
|
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
class purchase_order_group(osv.osv_memory):
|
class purchase_order_group(osv.osv_memory):
|
||||||
|
|
|
@ -84,7 +84,8 @@
|
||||||
-
|
-
|
||||||
!python {model: purchase.requisition}: |
|
!python {model: purchase.requisition}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.purchase.requisition').create(cr, uid, [ref('purchase_requisition.requisition1')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('purchase_requisition.requisition1')], 'purchase.requisition', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'purchase_requisition-purchase_requisition_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'purchase_requisition-purchase_requisition_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
-
|
-
|
||||||
!python {model: account.invoice}: |
|
!python {model: account.invoice}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.account.invoice.intrastat').create(cr, uid, [ref('test_invoice_1')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('test_invoice_1')], 'account.invoice.intrastat', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'report_intrastat-intrastat_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'report_intrastat-intrastat_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -29,113 +29,61 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
import openerp
|
||||||
import openerp.report.interface
|
from openerp.osv import fields, orm
|
||||||
from openerp.report.report_sxw import rml_parse
|
|
||||||
|
|
||||||
from webkit_report import WebKitParser
|
from webkit_report import WebKitParser
|
||||||
|
|
||||||
def register_report(name, model, tmpl_path, parser=rml_parse):
|
class ir_actions_report_xml(orm.Model):
|
||||||
"""Register the report into the services"""
|
|
||||||
name = 'report.%s' % name
|
|
||||||
if name in openerp.report.interface.report_int._reports:
|
|
||||||
service = openerp.report.interface.report_int._reports[name]
|
|
||||||
if isinstance(service, WebKitParser):
|
|
||||||
#already instantiated properly, skip it
|
|
||||||
return
|
|
||||||
if hasattr(service, 'parser'):
|
|
||||||
parser = service.parser
|
|
||||||
del openerp.report.interface.report_int._reports[name]
|
|
||||||
WebKitParser(name, model, tmpl_path, parser=parser)
|
|
||||||
|
|
||||||
|
|
||||||
class ReportXML(osv.osv):
|
|
||||||
|
|
||||||
def __init__(self, pool, cr):
|
|
||||||
super(ReportXML, self).__init__(pool, cr)
|
|
||||||
|
|
||||||
def register_all(self,cursor):
|
|
||||||
value = super(ReportXML, self).register_all(cursor)
|
|
||||||
cursor.execute("SELECT * FROM ir_act_report_xml WHERE report_type = 'webkit'")
|
|
||||||
records = cursor.dictfetchall()
|
|
||||||
for record in records:
|
|
||||||
register_report(record['report_name'], record['model'], record['report_rml'])
|
|
||||||
return value
|
|
||||||
|
|
||||||
def unlink(self, cursor, user, ids, context=None):
|
|
||||||
"""Delete report and unregister it"""
|
|
||||||
trans_obj = self.pool.get('ir.translation')
|
|
||||||
trans_ids = trans_obj.search(
|
|
||||||
cursor,
|
|
||||||
user,
|
|
||||||
[('type', '=', 'report'), ('res_id', 'in', ids)]
|
|
||||||
)
|
|
||||||
trans_obj.unlink(cursor, user, trans_ids)
|
|
||||||
|
|
||||||
# Warning: we cannot unregister the services at the moment
|
|
||||||
# because they are shared across databases. Calling a deleted
|
|
||||||
# report will fail so it's ok.
|
|
||||||
|
|
||||||
res = super(ReportXML, self).unlink(
|
|
||||||
cursor,
|
|
||||||
user,
|
|
||||||
ids,
|
|
||||||
context
|
|
||||||
)
|
|
||||||
return res
|
|
||||||
|
|
||||||
def create(self, cursor, user, vals, context=None):
|
|
||||||
"Create report and register it"
|
|
||||||
res = super(ReportXML, self).create(cursor, user, vals, context)
|
|
||||||
if vals.get('report_type','') == 'webkit':
|
|
||||||
# I really look forward to virtual functions :S
|
|
||||||
register_report(
|
|
||||||
vals['report_name'],
|
|
||||||
vals['model'],
|
|
||||||
vals.get('report_rml', False)
|
|
||||||
)
|
|
||||||
return res
|
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None):
|
|
||||||
"Edit report and manage it registration"
|
|
||||||
if isinstance(ids, (int, long)):
|
|
||||||
ids = [ids,]
|
|
||||||
for rep in self.browse(cr, uid, ids, context=context):
|
|
||||||
if rep.report_type != 'webkit':
|
|
||||||
continue
|
|
||||||
if vals.get('report_name', False) and \
|
|
||||||
vals['report_name'] != rep.report_name:
|
|
||||||
report_name = vals['report_name']
|
|
||||||
else:
|
|
||||||
report_name = rep.report_name
|
|
||||||
|
|
||||||
register_report(
|
|
||||||
report_name,
|
|
||||||
vals.get('model', rep.model),
|
|
||||||
vals.get('report_rml', rep.report_rml)
|
|
||||||
)
|
|
||||||
res = super(ReportXML, self).write(cr, uid, ids, vals, context)
|
|
||||||
return res
|
|
||||||
|
|
||||||
_name = 'ir.actions.report.xml'
|
|
||||||
_inherit = 'ir.actions.report.xml'
|
_inherit = 'ir.actions.report.xml'
|
||||||
_columns = {
|
_columns = {
|
||||||
'webkit_header': fields.property(
|
'webkit_header': fields.property('ir.header_webkit',
|
||||||
'ir.header_webkit',
|
type='many2one', relation='ir.header_webkit',
|
||||||
type='many2one',
|
string='Webkit Header', help="The header linked to the report",
|
||||||
relation='ir.header_webkit',
|
view_load=True, required=True),
|
||||||
string='Webkit Header',
|
'webkit_debug': fields.boolean('Webkit debug',
|
||||||
help="The header linked to the report",
|
help="Enable the webkit engine debugger"),
|
||||||
view_load=True,
|
'report_webkit_data': fields.text('Webkit Template',
|
||||||
required=True
|
help="This template will be used if the main report file is not found"),
|
||||||
),
|
'precise_mode': fields.boolean('Precise Mode',
|
||||||
'webkit_debug' : fields.boolean('Webkit debug', help="Enable the webkit engine debugger"),
|
help="This mode allow more precise element position as each object"
|
||||||
'report_webkit_data': fields.text('Webkit Template', help="This template will be used if the main report file is not found"),
|
" is printed on a separate HTML but memory and disk usage are wider.")
|
||||||
'precise_mode':fields.boolean('Precise Mode', help='This mode allow more precise element \
|
|
||||||
position as each object is printed on a separate HTML.\
|
|
||||||
but memory and disk usage is wider')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportXML()
|
def _lookup_report(self, cr, name):
|
||||||
|
"""
|
||||||
|
Look up a report definition.
|
||||||
|
"""
|
||||||
|
import operator
|
||||||
|
import os
|
||||||
|
opj = os.path.join
|
||||||
|
|
||||||
|
# First lookup in the deprecated place, because if the report definition
|
||||||
|
# has not been updated, it is more likely the correct definition is there.
|
||||||
|
# Only reports with custom parser specified in Python are still there.
|
||||||
|
if 'report.' + name in openerp.report.interface.report_int._reports:
|
||||||
|
new_report = openerp.report.interface.report_int._reports['report.' + name]
|
||||||
|
if not isinstance(new_report, WebKitParser):
|
||||||
|
new_report = None
|
||||||
|
else:
|
||||||
|
cr.execute("SELECT * FROM ir_act_report_xml WHERE report_name=%s and report_type=%s", (name, 'webkit'))
|
||||||
|
r = cr.dictfetchone()
|
||||||
|
if r:
|
||||||
|
if r['parser']:
|
||||||
|
parser = operator.attrgetter(r['parser'])(openerp.addons)
|
||||||
|
kwargs = { 'parser': parser }
|
||||||
|
else:
|
||||||
|
kwargs = {}
|
||||||
|
|
||||||
|
new_report = WebKitParser('report.'+r['report_name'],
|
||||||
|
r['model'], opj('addons',r['report_rml'] or '/'),
|
||||||
|
header=r['header'], register=False, **kwargs)
|
||||||
|
else:
|
||||||
|
new_report = None
|
||||||
|
|
||||||
|
if new_report:
|
||||||
|
return new_report
|
||||||
|
else:
|
||||||
|
return super(ir_actions_report_xml, self)._lookup_report(cr, name)
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -38,8 +38,8 @@ import tempfile
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openerp import netsvc
|
|
||||||
from report_helper import WebKitHelper
|
from report_helper import WebKitHelper
|
||||||
|
import openerp
|
||||||
from openerp.report.report_sxw import *
|
from openerp.report.report_sxw import *
|
||||||
from openerp import addons
|
from openerp import addons
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
|
@ -116,12 +116,12 @@ class WebKitParser(report_sxw):
|
||||||
"""Custom class that use webkit to render HTML reports
|
"""Custom class that use webkit to render HTML reports
|
||||||
Code partially taken from report openoffice. Thanks guys :)
|
Code partially taken from report openoffice. Thanks guys :)
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, table, rml=False, parser=False,
|
def __init__(self, name, table, rml=False, parser=rml_parse,
|
||||||
header=True, store=False):
|
header=True, store=False, register=True):
|
||||||
self.parser_instance = False
|
self.parser_instance = False
|
||||||
self.localcontext = {}
|
self.localcontext = {}
|
||||||
report_sxw.__init__(self, name, table, rml, parser,
|
report_sxw.__init__(self, name, table, rml, parser,
|
||||||
header, store)
|
header, store, register=register)
|
||||||
|
|
||||||
def get_lib(self, cursor, uid):
|
def get_lib(self, cursor, uid):
|
||||||
"""Return the lib wkhtml path"""
|
"""Return the lib wkhtml path"""
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp import netsvc
|
|
||||||
|
|
||||||
class sale_order_line_make_invoice(osv.osv_memory):
|
class sale_order_line_make_invoice(osv.osv_memory):
|
||||||
_name = "sale.order.line.make.invoice"
|
_name = "sale.order.line.make.invoice"
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp import netsvc
|
|
||||||
|
|
||||||
class sale_make_invoice(osv.osv_memory):
|
class sale_make_invoice(osv.osv_memory):
|
||||||
_name = "sale.make.invoice"
|
_name = "sale.make.invoice"
|
||||||
|
|
|
@ -162,8 +162,9 @@
|
||||||
-
|
-
|
||||||
!python {model: sale.order}: |
|
!python {model: sale.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.sale.order').create(cr, uid, [ref('sale.sale_order_6')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('sale.sale_order_6')], 'sale.order', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
-
|
-
|
||||||
!python {model: stock.location}: |
|
!python {model: stock.location}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.lot.stock.overview').create(cr, uid, [ref('location_refrigerator')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('location_refrigerator')], 'lot.stock.overview', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'stock-overview'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'stock-overview'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
@ -12,8 +13,9 @@
|
||||||
-
|
-
|
||||||
!python {model: stock.location}: |
|
!python {model: stock.location}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.lot.stock.overview_all').create(cr, uid, [ref('location_refrigerator')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('location_refrigerator')], 'lot.stock.overview_all', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'stock-overviewall'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'stock-overviewall'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
@ -21,8 +23,9 @@
|
||||||
-
|
-
|
||||||
!python {model: stock.inventory}: |
|
!python {model: stock.inventory}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.stock.inventory.move').create(cr, uid, [ref('stock_inventory_icecream')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('stock_inventory_icecream')], 'stock.inventory.move', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'stock-stock_inventory_move.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'stock-stock_inventory_move.'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
@ -30,8 +33,9 @@
|
||||||
-
|
-
|
||||||
!python {model: stock.picking}: |
|
!python {model: stock.picking}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.stock.picking.list').create(cr, uid, [ref('outgoing_shipment')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('outgoing_shipment')], 'stock.picking.list', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'stock-picking_list'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'stock-picking_list'+format), 'wb+').write(data)
|
||||||
-
|
-
|
||||||
|
@ -39,8 +43,9 @@
|
||||||
-
|
-
|
||||||
!python {model: product.product}: |
|
!python {model: product.product}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
import openerp.report
|
||||||
(data, format) = netsvc.LocalService('report.stock.product.history').create(cr, uid, [ref('product_icecream')], {}, {})
|
from openerp import tools
|
||||||
|
data, format = openerp.report.render_report(cr, uid, [ref('product_icecream')], 'stock.product.history', {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'stock-product_stock_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'stock-product_stock_report.'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp import netsvc
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from openerp.osv import osv,fields
|
from openerp.osv import osv,fields
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp.osv import osv
|
from openerp.osv import osv
|
||||||
from openerp import netsvc
|
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
class procurement_order(osv.osv):
|
class procurement_order(osv.osv):
|
||||||
|
|
|
@ -25,7 +25,7 @@ from dateutil.relativedelta import relativedelta
|
||||||
from time import strftime
|
from time import strftime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from openerp import netsvc, tools
|
from openerp import tools
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,9 @@ from lxml import etree
|
||||||
import os
|
import os
|
||||||
from time import strftime
|
from time import strftime
|
||||||
|
|
||||||
from openerp import addons, netsvc, tools
|
from openerp import addons, tools
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
|
import openerp.report
|
||||||
from openerp.tools import to_xml
|
from openerp.tools import to_xml
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.tools.safe_eval import safe_eval
|
from openerp.tools.safe_eval import safe_eval
|
||||||
|
@ -463,8 +464,7 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
return (False, Exception('Report name and Resources ids are required !!!'))
|
return (False, Exception('Report name and Resources ids are required !!!'))
|
||||||
try:
|
try:
|
||||||
uid = 1
|
uid = 1
|
||||||
service = netsvc.LocalService(report_name);
|
result, format = openerp.report.render_report(cr, uid, res_ids, report_name[len('report.'):], {}, context)
|
||||||
(result, format) = service.create(cr, uid, res_ids, {}, context)
|
|
||||||
ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf'
|
ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf'
|
||||||
fp = open(ret_file_name, 'wb+');
|
fp = open(ret_file_name, 'wb+');
|
||||||
fp.write(result);
|
fp.write(result);
|
||||||
|
|
|
@ -26,8 +26,9 @@ import os
|
||||||
import datetime
|
import datetime
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
from openerp import addons, netsvc, tools
|
from openerp import addons, tools
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
|
import openerp.report
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,8 +86,7 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we
|
||||||
return (False, Exception('Report name and Resources ids are required !!!'))
|
return (False, Exception('Report name and Resources ids are required !!!'))
|
||||||
try:
|
try:
|
||||||
ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf'
|
ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf'
|
||||||
service = netsvc.LocalService(report_name);
|
result, format = openerp.report.render_report(cr, uid, res_ids, report_name[len('report.'):], {}, {})
|
||||||
(result, format) = service.create(cr, uid, res_ids, {}, {})
|
|
||||||
fp = open(ret_file_name, 'wb+');
|
fp = open(ret_file_name, 'wb+');
|
||||||
fp.write(result);
|
fp.write(result);
|
||||||
fp.close();
|
fp.close();
|
||||||
|
|
Loading…
Reference in New Issue