|
- [[ voucher.line_id and voucher.line_id.name and voucher.line_id.name[1] or removeParentNode('para') ]]
+ [[ voucher.line_id and voucher.line_id[0].name or removeParentNode('para') ]]
|
diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv
index b87f0e45cd3..11c83ff48fd 100644
--- a/addons/account/security/ir.model.access.csv
+++ b/addons/account/security/ir.model.access.csv
@@ -29,8 +29,6 @@
"access_account_chart_template","account.chart.template","model_account_chart_template","account.group_account_manager",1,1,1,1
"access_account_tax_template","account.tax.template","model_account_tax_template","account.group_account_manager",1,0,0,0
"access_account_bank_statement","account.bank.statement","model_account_bank_statement","account.group_account_user",1,0,0,0
-"access_account_bank_statement_reconcile","account.bank.statement.reconcile","model_account_bank_statement_reconcile","account.group_account_user",1,1,1,1
-"access_account_bank_statement_reconcile_line","account.bank.statement.reconcile.line","model_account_bank_statement_reconcile_line","account.group_account_user",1,1,1,1
"access_account_bank_statement_line","account.bank.statement.line","model_account_bank_statement_line","account.group_account_user",1,0,0,0
"access_account_analytic_line","account.analytic.line","model_account_analytic_line","account.group_account_user",1,1,1,1
"access_account_analytic_line_manager","account.analytic.line manager","model_account_analytic_line","account.group_account_manager",1,0,0,0
@@ -182,7 +180,6 @@
"access_account_tax_code_accounting_accountant","account.tax.code","model_account_tax_code","account.group_accounting_accountant",1,0,0,0
"access_account_bank_statement_accounting_accountant","account.bank.statement","model_account_bank_statement","account.group_accounting_accountant",1,1,1,1
"access_account_cashbox_line_accounting_accountant","account.cashbox.line","model_account_cashbox_line","account.group_accounting_accountant",1,1,1,1
-"access_account_bank_statement_reconcile_line","account.bank.statement.reconcile.line","model_account_bank_statement_reconcile_line","account.group_accounting_accountant",1,1,1,1
"access_account_bank_statement_line_accounting_accountant","account.bank.statement.line","model_account_bank_statement_line","account.group_accounting_accountant",1,1,1,1
"access_account_invoice_report_accounting_accountant","account.invoice.report","model_account_invoice_report","account.group_accounting_accountant",1,0,0,0
"access_report_account_receivable_accounting_accountant","report.account.receivable","model_report_account_receivable","account.group_accounting_accountant",1,0,0,0
@@ -197,7 +194,6 @@
"access_account_analytic_account_accounting_accountant","account.analytic.account","analytic.model_account_analytic_account","account.group_accounting_accountant",1,0,0,0
"access_account_analytic_line_accounting_accountant","account.analytic.line","analytic.model_account_analytic_line","account.group_accounting_accountant",1,0,0,0
"access_account_analytic_journal_accounting_accountant","account.analytic.journal","model_account_analytic_journal","account.group_accounting_accountant",1,0,0,0
-"access_account_bank_statement_reconcile_accounting_accountant","account.bank.statement.reconcile","model_account_bank_statement_reconcile","account.group_accounting_accountant",1,1,1,1
"access_account_analytic_journal_analytic_accounting","account.analytic.journal","model_account_analytic_journal","analytic.group_analytic_accounting",1,1,1,1
"access_account_account_analytic_accounting","account.account","model_account_account","analytic.group_analytic_accounting",1,0,0,0
"access_product_product_analytic_accounting","product.product","product.model_product_product","analytic.group_analytic_accounting",1,0,0,0
diff --git a/addons/account/test/account_fiscalyear_close.yml b/addons/account/test/account_fiscalyear_close.yml
index 3f99a66d719..59cbfdafc0b 100644
--- a/addons/account/test/account_fiscalyear_close.yml
+++ b/addons/account/test/account_fiscalyear_close.yml
@@ -21,16 +21,23 @@
-
I made modification in journal so it can move entries
-
- !record {model: account.journal, id: account.sales_journal}:
+ !record {model: account.journal, id: account.close_journal}:
+ name: End of Year
+ code: NEW
+ type: situation
+ sequence_id: sequence_journal
+ default_debit_account_id: cash
+ default_credit_account_id: cash
+ company_id: base.main_company
+ view_id: account_journal_bank_view
centralisation: 1
-
-
I called the Generate Fiscalyear Opening Entries wizard
-
!record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}:
fy2_id: account_fiscalyear_fiscalyear0
fy_id: account.data_fiscalyear
- journal_id: account.sales_journal
+ journal_id: account.close_journal
period_id: account_period_jan11
report_name: End of Fiscal Year Entry
-
diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml
new file mode 100644
index 00000000000..0048de7af46
--- /dev/null
+++ b/addons/account/test/account_report.yml
@@ -0,0 +1,386 @@
+-
+ In order to test the PDF reports defined on an invoice, we will print an invoice
+-
+ !python {model: account.invoice}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.test_invoice_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a partner, we will print the Overdue Report
+-
+ !python {model: res.partner}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.account.overdue').create(cr, uid, [ref('base.res_partner_asus'),ref('base.res_partner_agrolait'),ref('base.res_partner_c2c')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on Account Move, we will print the Voucher Report
+-
+ !python {model: account.move}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.account.move.voucher').create(cr, uid, [ref('account.account_move_0')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-voucher-report.'+format), 'wb+').write(data)
+
+-
+ Demo data for Account tax code
+-
+ !record {model: account.tax.code, id: account_tax_code_0}:
+ name : Tax Code Test
+-
+ Print Tax Code entries report
+-
+ !python {model: account.tax.code}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.account.tax.code.entries').create(cr, uid, [ref('account_tax_code_0')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-tax-code-entries.'+format), 'wb+').write(data)
+
+-
+ Print Vat Declaration Report
+-
+ !python {model: account.tax.code}: |
+ import netsvc, tools, os
+ data_dict = {'model': 'ir.ui.menu', 'form': {'based_on': 'invoices','company_id':ref('base.main_company'),'periods':[]}}
+ (data, format) = netsvc.LocalService('report.account.vat.declaration').create(cr, uid, [ref("account_tax_code_0")], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-vat-declaration.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on an invoice, we will print an invoice
+-
+ !python {model: account.invoice}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.test_invoice_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
+
+-
+ Print the Aged Partner Balance Report
+-
+ !python {model: res.partner}: |
+ import netsvc, tools, os, time
+ import datetime
+ from mx.DateTime import *
+ start = datetime.date.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
+ start = DateTime(int(start.year), int(start.month), int(start.day))
+ res = {}
+ for i in range(5)[::-1]:
+ stop = start - RelativeDateTime(days=30)
+ res[str(i)] = {
+ 'name': (i!=0 and (str((5-(i+1)) * 30) + '-' + str((5-i) * 30)) or ('+'+str(4 * 30))),
+ 'stop': start.strftime('%Y-%m-%d'),
+ 'start': (i!=0 and stop.strftime('%Y-%m-%d') or False),
+ }
+ start = stop - RelativeDateTime(days=1)
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+
+ data_dict = {'model': 'ir.ui.menu', 'form': {'chart_account_id':ref('account.chart0'),'initial_balance': 1, 'periods': period_list,'journal_ids':journal_ids, 'page_split': 0, 'date_from': time.strftime('%Y-%m-%d'), 'period_length': 30, 'amount_currency': 0,'query_line' : query_line, 'result_selection': 'customer','direction_selection': 'past','fiscalyear_id':fy_id}}
+ data_dict['form'].update(res)
+ (data, format) = netsvc.LocalService('report.account.aged_trial_balance').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-aged_partner_balance.'+format), 'wb+').write(data)
+
+-
+ Print the Compare Account Balance Report in Normal mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'account.account', 'form': {'id':ref('account.bal'),'chart_account_id':ref('account.chart0'),'select_account': False,'format_perc':0,'show_columns' :0, 'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear': [ref('account.data_fiscalyear')] ,'target_move': 'all','periods': [],'context':{'state':'all'}}}
+ (data, format) = netsvc.LocalService('report.account.balance.account.balance').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-compare-account_balance.'+format), 'wb+').write(data)
+
+-
+ Print the Compare Account Balance Report in Landscape mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'account.account', 'form': {'id':ref('account.bal'),'chart_account_id':ref('account.chart0'),'select_account': False,'format_perc':0,'show_columns' :0, 'compare_pattern': 'none','account_choice': 'moves','landscape':1,'period_manner': 'actual','fiscalyear': [ref('account.data_fiscalyear')] ,'target_move': 'all','periods': [],'context':{'state':'all'}}}
+ (data, format) = netsvc.LocalService('report.account.account.balance.landscape').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-compare-account_balance-landscape.'+format), 'wb+').write(data)
+
+
+-
+ Print the Account Balance Sheet in Horizontal mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'ir.ui.menu', 'form': {'reserve_account_id':ref('account.rsa') ,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 1,'journal_ids':[],'fiscalyear': ref('account.data_fiscalyear') ,'target_move': 'all'}}
+ (data, format) = netsvc.LocalService('report.account.balancesheet.horizontal').create(cr, uid, [], data_dict, {'periods': []})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-account_balance_sheet_horizontal.'+format), 'wb+').write(data)
+
+-
+ Print the Account Balance Sheet in Normal mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'ir.ui.menu', 'form': {'reserve_account_id':ref('account.rsa') ,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':[],'fiscalyear': ref('account.data_fiscalyear') ,'target_move': 'all'}}
+ (data, format) = netsvc.LocalService('report.account.balancesheet').create(cr, uid, [], data_dict, {'periods': []})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-account_balance_sheet.'+format), 'wb+').write(data)
+
+-
+ Print the Account Balance Report in Normal mode - From Account Chart
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'account.account', 'form': {'chart_account_id':ref('account.chart0'),'select_account': False,'display_account':'bal_all','format_perc':0,'filter': 'filter_no','show_columns' :0, 'account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': ref('account.data_fiscalyear') ,'target_move': 'all','periods': [],'id':ref('account.bal'),'context':{'state':'all'}}}
+ (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal.'+format), 'wb+').write(data)
+ print "Account Balance Report in Normal mode - From Menu"
+
+ data_dict.update({'model': 'ir.ui.menu'})
+ data_dict['form'].update({'active_ids':[ref('account.bal'),ref('account.gpf')]})
+
+ (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [], data_dict, {'periods': []})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal-menu.'+format), 'wb+').write(data)
+
+-
+ Print the Central Journal Report - From Account
+-
+ !python {model: account.journal.period}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+ journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+ data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
+ (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, journal_period_ids, data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-central_journal.'+format), 'wb+').write(data)
+
+ print "Central Journal Report - From Menu"
+ data_dict.update({'model': 'ir.ui.menu'})
+ data_dict['form'].update({'active_ids':journal_period_ids})
+
+ (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-central_journal-menu.'+format), 'wb+').write(data)
+-
+ Print the General Journal Report - From Journal
+-
+ !python {model: account.journal.period}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+ journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+ data_dict = {'model': 'ir.ui.menu','id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids, 'active_ids':journal_period_ids}}
+ (data, format) = netsvc.LocalService('report.account.general.journal').create(cr, uid, journal_period_ids, data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-general_journal.'+format), 'wb+').write(data)
+
+-
+ Print the General Ledger Report in Normal Mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+ acc_ids = [ref('account.bal'),ref('account.gpf')]
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+
+ data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query': query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
+ (data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, acc_ids, data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger.'+format), 'wb+').write(data)
+
+ print "GL report from menu"
+ data_dict.update({'model': 'ir.ui.menu'})
+ data_dict['form'].update({'active_ids': acc_ids})
+ (data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-menu.'+format), 'wb+').write(data)
+-
+ Print the General Ledger Report in Landscape Mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+ acc_ids = [ref('account.bal'),ref('account.gpf')]
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+
+ data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query':query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':1,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
+ (data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, acc_ids, data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-landscape.'+format), 'wb+').write(data)
+
+ print "GL report landscape mode from menu"
+ data_dict.update({'model': 'ir.ui.menu'})
+ data_dict['form'].update({'active_ids': acc_ids})
+ (data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-landscape-menu.'+format), 'wb+').write(data)
+
+-
+ Print Journal Report - From Model
+-
+ !python {model: account.journal.period}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+ journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+
+ data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'sort_selection': 'date','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
+ (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, journal_period_ids, data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-print_journal.'+format), 'wb+').write(data)
+
+ print "Journal Report - From Menu"
+ data_dict.update({'model': 'ir.ui.menu'})
+ data_dict['form'].update({'active_ids':journal_period_ids})
+
+ (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-print_journal-menu.'+format), 'wb+').write(data)
+
+-
+ Print the Partner Balance Report
+-
+ !python {model: res.partner}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+ data_dict = {'model': 'ir.ui.menu', 'form': {'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}}
+ (data, format) = netsvc.LocalService('report.account.partner.balance').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-partner_balance.'+format), 'wb+').write(data)
+
+-
+ Print the Partner Ledger Report
+-
+ !python {model: res.partner}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+
+ data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': True,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}}
+ (data, format) = netsvc.LocalService('report.account.third_party_ledger').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-partner_ledger.'+format), 'wb+').write(data)
+
+-
+ Print the Partner Ledger-Other Report
+-
+ !python {model: res.partner}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
+
+ obj_move = self.pool.get('account.move.line')
+ ctx = {}
+ ctx['fiscalyear'] = fy_id
+ ctx['journal_ids'] = journal_ids
+ ctx['chart_account_id'] = ref('account.chart0')
+
+ query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
+ data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': False,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}}
+ (data, format) = netsvc.LocalService('report.account.third_party_ledger_other').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-partner_ledger-other.'+format), 'wb+').write(data)
+
+-
+ Print the Profit-Loss Report in Normal Mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = []
+ acc_ids = [ref('account.bal'),ref('account.gpf')]
+ data_dict = {'model': 'ir.ui.menu', 'form': {'display_type': False,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':'True ','target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal'),'active_ids':acc_ids }}
+ (data, format) = netsvc.LocalService('report.pl.account').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-profit-loss.'+format), 'wb+').write(data)
+
+-
+ Print the Profit-Loss Report in Horizontal Mode
+-
+ !python {model: account.account}: |
+ import netsvc, tools, os, time
+ fy_id = ref('account.data_fiscalyear')
+ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
+ journal_ids = []
+ acc_ids = [ref('account.bal'),ref('account.gpf')]
+ data_dict = {'model': 'ir.ui.menu', 'form': {'display_type': True,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':'True ','target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal'),'active_ids':acc_ids }}
+ (data, format) = netsvc.LocalService('report.pl.account.horizontal').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account-profit-loss-horizontal.'+format), 'wb+').write(data)
diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py
index 84683d17b30..bf10838b9c8 100644
--- a/addons/account/wizard/account_chart.py
+++ b/addons/account/wizard/account_chart.py
@@ -54,14 +54,14 @@ class account_chart(osv.osv_memory):
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
res = {}
- res['value'] = {'period_from': False, 'period_to': False}
+ res['value'] = {}
if fiscalyear_id:
start_period = end_period = False
cr.execute('''
- SELECT * FROM (SELECT p.id
- FROM account_period p
- LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
- WHERE f.id = %s
+ SELECT * FROM (SELECT p.id
+ FROM account_period p
+ LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
+ WHERE f.id = %s
ORDER BY p.date_start ASC
LIMIT 1) AS period_start
UNION
diff --git a/addons/account/wizard/account_chart_view.xml b/addons/account/wizard/account_chart_view.xml
index eb662058f32..f35a2c5480c 100644
--- a/addons/account/wizard/account_chart_view.xml
+++ b/addons/account/wizard/account_chart_view.xml
@@ -9,11 +9,11 @@
|
- Note: [[ (a['note'] and format(a['note'])) or removeParentNode('tr') ]]
+ Note: [[ (a['note'] and format(a['note'] or '')) or removeParentNode('tr') ]]
@@ -337,7 +337,7 @@
|
- [[ a['type']=='text' and format(a['name']) or removeParentNode('blockTable') ]]
+ [[ a['type']=='text' and format(a['name'] or '') or removeParentNode('blockTable') ]]
|
[[ a['type']=='text' and '' ]]
@@ -467,7 +467,7 @@
|
- [[ format(o.comment or removeParentNode('blockTable')) ]]
+ [[ format(o.comment or '') or removeParentNode('blockTable') ]]
|
@@ -477,7 +477,7 @@
|
- [[ format((o.payment_term and o.payment_term.note) or removeParentNode('blockTable')) ]]
+ [[ format((o.payment_term and o.payment_term.note or '') or removeParentNode('blockTable')) ]]
|
diff --git a/addons/account_invoice_layout/test/account_invoice_layout_report.yml b/addons/account_invoice_layout/test/account_invoice_layout_report.yml
new file mode 100644
index 00000000000..b7b1c1e76cc
--- /dev/null
+++ b/addons/account_invoice_layout/test/account_invoice_layout_report.yml
@@ -0,0 +1,17 @@
+-
+ Print the Invoice layout report in Normal Mode
+-
+ !python {model: account.invoice}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.account.invoice.layout').create(cr, uid, [ref('account.test_invoice_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_invoice_layout.'+format), 'wb+').write(data)
+-
+ Print the Invoice Layout Report with Message in Normal mode
+-
+ !python {model: account.invoice}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'account.invoice', 'form': {'message':ref('account_invoice_layout.demo_message1'),'id':ref('account.test_invoice_1'),'context':{}}}
+ (data, format) = netsvc.LocalService('report.notify_account.invoice').create(cr, uid, [ref('account.test_invoice_1')], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_invoice_layout_message_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py
index f3e437face2..5114a576512 100644
--- a/addons/account_payment/__openerp__.py
+++ b/addons/account_payment/__openerp__.py
@@ -47,8 +47,11 @@
'account_invoice_view.xml',
'account_payment_report.xml',
],
- 'demo_xml': [],
- 'test': ['test/account_payment.yml'],
+ 'demo_xml': ['account_payment_demo.xml'],
+ 'test': [
+ 'test/account_payment.yml'
+ 'test/account_payment_report.yml'
+ ],
'installable': True,
'active': False,
'certificate': '0061703998541',
diff --git a/addons/account_payment/account_payment_demo.xml b/addons/account_payment/account_payment_demo.xml
new file mode 100644
index 00000000000..25fe4a2c55b
--- /dev/null
+++ b/addons/account_payment/account_payment_demo.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ Reserve Bank
+ 00987654321
+
+
+
+
+ Direct Payment
+
+
+
+
+
+ ORDER1
+
+
+ now
+ draft
+
+
+
diff --git a/addons/account_payment/test/account_payment_report.yml b/addons/account_payment/test/account_payment_report.yml
new file mode 100644
index 00000000000..45022e19a73
--- /dev/null
+++ b/addons/account_payment/test/account_payment_report.yml
@@ -0,0 +1,8 @@
+-
+ In order to test the PDF reports defined on Account Payment, Print a Payment Order
+-
+ !python {model: payment.order}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.payment.order').create(cr, uid, [ref('account_payment.payment_order_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/account_report/__openerp__.py b/addons/account_report/__openerp__.py
index 07afc6ed58f..b8029bf3563 100644
--- a/addons/account_report/__openerp__.py
+++ b/addons/account_report/__openerp__.py
@@ -42,7 +42,8 @@
'wizard/account_report_print_indicators_with_pdf_view.xml',
'board_account_report_view.xml',
],
- 'demo_xml': [],
+ 'demo_xml': ['account_report_demo.xml'],
+ 'test': ['test/account_report.yml'],
'installable': True,
'active': False,
'certificate': '0050976406925',
diff --git a/addons/account_report/account_report_demo.xml b/addons/account_report/account_report_demo.xml
new file mode 100644
index 00000000000..30f1318c592
--- /dev/null
+++ b/addons/account_report/account_report_demo.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ Account Demo Report
+ ADR
+ fiscal
+ debit>0.0
+
+
+
\ No newline at end of file
diff --git a/addons/account_report/report/print_indicator.rml b/addons/account_report/report/print_indicator.rml
index 52133cb894e..160cd435ada 100644
--- a/addons/account_report/report/print_indicator.rml
+++ b/addons/account_report/report/print_indicator.rml
@@ -119,7 +119,7 @@
- | [['..........'*(o['level']) ]] [[ format(o['note']) or removeParentNode('blockTable') ]] |
+ [['..........'*(o['level']) ]] [[ format(o['note'] or '') or removeParentNode('blockTable') ]] |
diff --git a/addons/account_report/test/account_report_report.yml b/addons/account_report/test/account_report_report.yml
new file mode 100644
index 00000000000..d94dce1f553
--- /dev/null
+++ b/addons/account_report/test/account_report_report.yml
@@ -0,0 +1,17 @@
+-
+ In order to test the PDF reports defined on Account, Print a Financial Statement Report
+-
+ !python {model: account.report.report}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.accounting.report').create(cr, uid, [ref('account_report.account_report_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_report-financial_statement_report.'+format), 'wb+').write(data)
+-
+ Print the Indicators Report in Normal mode
+-
+ !python {model: account.report.history }: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'ir.ui.menu', 'form': {'select_base':'year','base_selection':[ref('account.data_fiscalyear')],'context':{}}}
+ (data, format) = netsvc.LocalService('report.print.indicators').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_report-indicators_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/account_reporting/__openerp__.py b/addons/account_reporting/__openerp__.py
index 5ac93d17984..fb05e755ac2 100644
--- a/addons/account_reporting/__openerp__.py
+++ b/addons/account_reporting/__openerp__.py
@@ -36,7 +36,8 @@
'account_data.xml',
'wizard/account_reporting_balance_report_view.xml',
],
- 'demo_xml': [],
+ 'demo_xml': ['account_reporting_demo.xml'],
+ 'test': ['test/account_reporting_report.yml'],
'installable': True,
'active': False,
'certificate': '0072305016797',
diff --git a/addons/account_reporting/account_reporting_demo.xml b/addons/account_reporting/account_reporting_demo.xml
new file mode 100644
index 00000000000..880fa51deda
--- /dev/null
+++ b/addons/account_reporting/account_reporting_demo.xml
@@ -0,0 +1,9 @@
+
+
+
+
+ My Balance Sheet
+ MBS
+
+
+
\ No newline at end of file
diff --git a/addons/account_reporting/report/account_report_bs.rml b/addons/account_reporting/report/account_report_bs.rml
index 59caba5ab76..b33ebb4bcc8 100644
--- a/addons/account_reporting/report/account_report_bs.rml
+++ b/addons/account_reporting/report/account_report_bs.rml
@@ -10,14 +10,52 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -25,7 +63,7 @@
-
+
@@ -41,26 +79,32 @@
-
-
+
+
+
-
+
-
+
+
-
+
+
+
+
+
@@ -69,63 +113,49 @@
-
-
- |
- [[ company.name ]]
- |
-
-
-
-
- |
-
- Currency: [[ company.currency_id.name ]]
- |
-
-
- Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]
[[repeatIn(objects,'o') ]]
-
+
+
+
+
|
-
-
-
- |
-
- [[ setTag('font','font',{'face':o.font_style,'color':o.color_font.name,'backColor':o.color_back.name}) ]] [[o.name]]
- |
-
-
-
-
+ Account Balance
|
-
+
+
+
+
|
- Code
+ Company Name
|
- Account Name
+ Printing date
|
- Balance
+ Currency
+ |
+
+ Name
|
-
-
+
+
|
- [[ repeatIn(lines(data['form'],object=o), 'a') ]][[ setTag('font','font',{'face':o.font_style,'color':o.color_font.name,'backColor':o.color_back.name}) ]] [[ a['code'] ]]
+ [[ company.name ]]
|
- [[ '..'*(a['level']-1) ]][[ setTag('font','font',{'face':o.font_style,'color':o.color_font.name,'backColor':o.color_back.name}) ]] [[ a['name'] ]]
+ [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]]
|
- [[ setTag('font','font',{'face':o.font_style,'color':o.color_font.name,'backColor':o.color_back.name}) ]][[ '%.2f'% a['balance'] ]]
+ [[ company.currency_id.name ]]
+ |
+
+ [[ setTag('font','font',{'face':o.font_style,'color':o.color_font.name,'backColor':o.color_back.name}) ]] [[o.name]]
|
@@ -135,6 +165,27 @@
+
+
+ |
+ Code
+ |
+
+ Account Name
+ |
+
+ Balance([[company.currency_id.code]])
+ |
+
+
+ |
+ [[ repeatIn(lines(data['form']), 'a') ]][[ (a['level']>4 and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ a['code'] or removeParentNode('tr')]]
+ |
+ [[ (a['level']>4 and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ '..'*(a['level']-1) ]][[ a['name'] ]] |
+
+ [[ (a['level']>4 and setTag('para','para',{'fontName':"Helvetica"})) or removeParentNode('font') ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol]]
+ |
+
+
-
diff --git a/addons/account_reporting/test/account_reporting_report.yml b/addons/account_reporting/test/account_reporting_report.yml
new file mode 100644
index 00000000000..9754f53cc4d
--- /dev/null
+++ b/addons/account_reporting/test/account_reporting_report.yml
@@ -0,0 +1,9 @@
+-
+ Print the Balance Sheet Report in Normal mode
+-
+ !python {model: account.report.bs }: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'account.report.bs', 'form': {'fiscalyear':ref('account.data_fiscalyear'),'periods':[ref('account.period_1'),ref('account.period_2'),ref('account.period_3')],'context':{}}}
+ (data, format) = netsvc.LocalService('report.account.report.bs').create(cr, uid, [ref('account_reporting.account_balance_sheet_1')], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_reporting-balance_sheet_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index 824ca746f37..752bb74f90c 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -52,6 +52,7 @@
# "test/account_voucher.yml",
# "test/sales_receipt.yml",
# "test/sales_payment.yml",
+ "test/account_voucher_report.yml"
],
'certificate': '0037580727101',
"active": False,
diff --git a/addons/account_voucher/test/account_voucher_report.yml b/addons/account_voucher/test/account_voucher_report.yml
new file mode 100644
index 00000000000..eddb313c776
--- /dev/null
+++ b/addons/account_voucher/test/account_voucher_report.yml
@@ -0,0 +1,34 @@
+-
+ Demo for Account Voucher
+-
+ !record {model: account.voucher, id: account_voucher_voucheraxelor0}:
+ account_id: account.cash
+ company_id: base.main_company
+ currency_id: base.EUR
+ journal_id: account.bank_journal
+ name: Voucher Axelor
+ narration: Basic PC
+ amount: 1000.0
+ line_ids:
+ - account_id: account.cash
+ amount: 1000.0
+ name: Voucher Axelor
+ period_id: account.period_6
+
+-
+ In order to test the PDF reports defined on a account_voucher, we will print account voucher amount Report
+-
+ !python {model: account.voucher}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.voucher.cash_amount').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_voucher-amount.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a account_voucher, we will print account voucher Report
+-
+ !python {model: account.voucher}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index 57b74d948d8..ebc709e3ff6 100644
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -45,7 +45,7 @@ account_move_line()
class account_voucher(osv.osv):
def _get_type(self, cr, uid, ids, context={}):
- return context.get('type')
+ return context.get('type', False)
def _get_period(self, cr, uid, context={}):
if context.get('period_id', False):
@@ -101,7 +101,8 @@ class account_voucher(osv.osv):
def _get_narration(self, cr, uid, context={}):
return context.get('narration', False)
-
+
+
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "date desc, id desc"
@@ -308,7 +309,7 @@ class account_voucher(osv.osv):
tr_type = 'receipt'
default['value']['account_id'] = account_id
- default['value']['type'] = tr_type
+ default['value']['type'] = ttype or tr_type
vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context)
default['value'].update(vals.get('value'))
@@ -810,3 +811,43 @@ class account_voucher_line(osv.osv):
})
return values
account_voucher_line()
+
+class account_bank_statement(osv.osv):
+ _inherit = 'account.bank.statement'
+
+ def create_move_from_st_line(self, cr, uid, st_line, company_currency_id, next_number, context=None):
+ if st_line.voucher_id:
+ return self.pool.get('account.voucher').proforma_voucher(cr, uid, [st_line.voucher_id.id])
+ return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context)
+
+account_bank_statement()
+
+class account_bank_statement_line(osv.osv):
+ _inherit = 'account.bank.statement.line'
+
+ def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
+ if not ids:
+ return {}
+ res_currency_obj = self.pool.get('res.currency')
+ res = {}
+ company_currency_id = False
+
+ for line in self.browse(cursor, user, ids, context=context):
+ if not company_currency_id:
+ company_currency_id = line.company_id.id
+ if line.voucher_id:
+ res[line.id] = res_currency_obj.compute(cursor, user,
+ company_currency_id, line.statement_id.currency.id,
+ line.voucher_id.amount, context=context)
+ else:
+ res[line.id] = 0.0
+ return res
+
+ _columns = {
+ 'amount_reconciled': fields.function(_amount_reconciled,
+ string='Amount reconciled', method=True, type='float'),
+ 'voucher_id': fields.many2one('account.voucher', 'Payment'),
+
+ }
+
+account_bank_statement_line()
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index fd79598a286..6cca62c0d57 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -80,6 +80,72 @@
+
+ account.voucher.payment.low.priority.form
+ account.voucher
+ form
+ 1
+
+
+
+
account.voucher.payment.form
diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml
index 2034cf47bd4..4f9cdeeca80 100644
--- a/addons/account_voucher/voucher_sales_purchase_view.xml
+++ b/addons/account_voucher/voucher_sales_purchase_view.xml
@@ -102,6 +102,7 @@
+
@@ -133,7 +134,7 @@
-
+
@@ -211,6 +212,7 @@
+
@@ -235,7 +237,7 @@
-
+
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index 94b257775c1..449fefa2de5 100644
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -147,6 +147,17 @@
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
+
+ account.bank.statement.voucher.form.inherit
+ account.bank.statement
+ form
+
+
+
+
+
+
+
+
+
diff --git a/addons/association/profile_association.xml b/addons/association/profile_association.xml
index 4a5fb90cbd9..8460cfa6cc9 100644
--- a/addons/association/profile_association.xml
+++ b/addons/association/profile_association.xml
@@ -16,7 +16,7 @@
- Install more applications. A few applications are proposed according to the Association Profile you selected. You will be able to install them based on our requirements.
+ Here are specific applications related to the Association Profile you selected.
Configure
diff --git a/addons/auction/__openerp__.py b/addons/auction/__openerp__.py
index 69fef0748c4..7105102b385 100644
--- a/addons/auction/__openerp__.py
+++ b/addons/auction/__openerp__.py
@@ -59,7 +59,9 @@
],
'demo_xml': ['auction_demo.xml','board_auction_demo.xml'],
- 'test': ['test/auction.yml'],
+ 'test': ['test/auction.yml',
+ 'test/auction_report.yml',
+ ],
'installable': True,
'active': False,
diff --git a/addons/auction/test/auction_report.yml b/addons/auction/test/auction_report.yml
new file mode 100644
index 00000000000..0219af369b4
--- /dev/null
+++ b/addons/auction/test/auction_report.yml
@@ -0,0 +1,125 @@
+-
+ In order to test the PDF reports defined on auction, we will print a auction artist
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.auction.artists').create(cr, uid, [ref('auction.auction_deposit_1_lot_1'),ref('auction.auction_deposit_1_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_artist_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on auction, we will print a auction Bid
+-
+ !python {model: auction.bid}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.auction.bids').create(cr, uid, [ref('auction.auction_date_1_bid_3'),ref('auction.auction_date_1_bid_4')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_bid_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on auction, we will print a lots list Report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.lots.list').create(cr, uid, [ref('auction.auction_deposit_3_lot_1'),ref('auction.auction_deposit_3_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_lots_list_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on auction, we will print a lots inventory Report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.lots.list.inventory').create(cr, uid, [ref('auction.auction_deposit_4_lot_1'),ref('auction.auction_deposit_4_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_lots_inventory_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on auction, we will print a deposit seller Report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.deposit.seller').create(cr, uid, [ref('auction.auction_deposit_5_lot_1'),ref('auction.auction_deposit_5_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_deposit_seller_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on auction, we will print a catalog
+-
+ !python {model: auction.dates}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.auction.cat_flagy').create(cr, uid, [ref('auction.auction_date_1'),ref('auction.auction_date_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_catalog_list.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on auction, we will print buyer form report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.buyer_form_report').create(cr, uid, [ref('auction.auction_deposit_6_lot_1'),ref('auction.auction_deposit_6_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_buyer_form.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on auction, we will print bids phones report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.bids.phones.details').create(cr, uid, [ref('auction.auction_deposit_7_lot_1'),ref('auction.auction_deposit_7_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_bids_phones_details.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a auction, we will print a Auction Total
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.auction.total.rml').create(cr, uid, [ref('auction.auction_deposit_8_lot_1'),ref('auction.auction_deposit_8_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_total_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a auction, we will print a Auction Result
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.auction.result').create(cr, uid, [ref('auction.auction_deposit_9_lot_1'),ref('auction.auction_deposit_9_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_result_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a auction, we will print a Auction Lot
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.bids.lots').create(cr, uid, [ref('auction.auction_deposit_10_lot_1'),ref('auction.auction_deposit_10_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_lot_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a auction, we will print a Auction Buyer list report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.buyer.list').create(cr, uid, [ref('auction.auction_deposit_10_lot_1'),ref('auction.auction_deposit_10_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_buyer_list_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a auction, we will print a Auction Flagey Hussier report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.flagey.huissier').create(cr, uid, [ref('auction.auction_deposit_3_lot_1'),ref('auction.auction_deposit_10_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_flagey_hussier_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a auction, we will print Auction Seller Form report
+-
+ !python {model: auction.lots}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.seller_form_report').create(cr, uid, [ref('auction.auction_deposit_3_lot_1'),ref('auction.auction_deposit_10_lot_2')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'auction-auction_seller_form_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/base_contact/base_contact_installer_view.xml b/addons/base_contact/base_contact_installer_view.xml
index e7575ebd44f..672c43745fb 100644
--- a/addons/base_contact/base_contact_installer_view.xml
+++ b/addons/base_contact/base_contact_installer_view.xml
@@ -31,8 +31,7 @@
-
-
+
diff --git a/addons/base_module_doc_rst/__terp__.py b/addons/base_module_doc_rst/__openerp__.py
similarity index 100%
rename from addons/base_module_doc_rst/__terp__.py
rename to addons/base_module_doc_rst/__openerp__.py
diff --git a/addons/base_module_doc_rst/module_report.xml b/addons/base_module_doc_rst/module_report.xml
index d8bbe51bf46..e3d4e342472 100644
--- a/addons/base_module_doc_rst/module_report.xml
+++ b/addons/base_module_doc_rst/module_report.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/addons/base_report_designer/__init__.py b/addons/base_report_designer/__init__.py
index 46a0a1e2476..2a14d2821ae 100644
--- a/addons/base_report_designer/__init__.py
+++ b/addons/base_report_designer/__init__.py
@@ -18,8 +18,9 @@
# along with this program. If not, see .
#
##############################################################################
-
-import base_report_designer
import wizard
+import base_report_designer
+import installer
+import openerp_sxw2rml
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_report_designer/__openerp__.py b/addons/base_report_designer/__openerp__.py
index 50fe73f753f..9d39bba8a61 100644
--- a/addons/base_report_designer/__openerp__.py
+++ b/addons/base_report_designer/__openerp__.py
@@ -36,8 +36,9 @@ upload the report using the same wizard.
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
- 'init_xml': ['base_report_data.xml'],
- 'update_xml': ['base_report_designer_wizard.xml'],
+ 'init_xml': ['security/base_report_security.xml',
+ 'wizard/base_report_design_view.xml'],
+ 'update_xml': ['base_report_designer_installer.xml'],
'demo_xml': [],
'installable': True,
'active': False,
diff --git a/addons/base_report_designer/base_report_designer.py b/addons/base_report_designer/base_report_designer.py
index a4a135c4299..283c8ec7e23 100644
--- a/addons/base_report_designer/base_report_designer.py
+++ b/addons/base_report_designer/base_report_designer.py
@@ -20,13 +20,13 @@
##############################################################################
from osv import osv
-from wizard.tiny_sxw2rml import sxw2rml
+from openerp_sxw2rml import sxw2rml
from StringIO import StringIO
from report import interface
import base64
import pooler
import tools
-
+import addons
class report_xml(osv.osv):
_inherit = 'ir.actions.report.xml'
@@ -37,12 +37,9 @@ class report_xml(osv.osv):
'''
sxwval = StringIO(base64.decodestring(file_sxw))
if file_type=='sxw':
- fp = tools.file_open('normalized_oo2rml.xsl',
- subdir='addons/base_report_designer/wizard/tiny_sxw2rml')
+ fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
if file_type=='odt':
- fp = tools.file_open('normalized_odt2rml.xsl',
- subdir='addons/base_report_designer/wizard/tiny_sxw2rml')
-
+ fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
return {'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read()))}
def upload_report(self, cr, uid, report_id, file_sxw, file_type, context):
@@ -52,11 +49,9 @@ class report_xml(osv.osv):
pool = pooler.get_pool(cr.dbname)
sxwval = StringIO(base64.decodestring(file_sxw))
if file_type=='sxw':
- fp = tools.file_open('normalized_oo2rml.xsl',
- subdir='addons/base_report_designer/wizard/tiny_sxw2rml')
+ fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
if file_type=='odt':
- fp = tools.file_open('normalized_odt2rml.xsl',
- subdir='addons/base_report_designer/wizard/tiny_sxw2rml')
+ fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
report = pool.get('ir.actions.report.xml').write(cr, uid, [report_id], {
'report_sxw_content': base64.decodestring(file_sxw),
'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())),
diff --git a/addons/base_report_designer/base_report_designer_installer.xml b/addons/base_report_designer/base_report_designer_installer.xml
new file mode 100644
index 00000000000..21537d3d63c
--- /dev/null
+++ b/addons/base_report_designer/base_report_designer_installer.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+ Form View: OpenERP Report Designer Installation
+ base_report_designer.installer
+ form
+
+
+
+
+
+ OpenERP Report Designer
+
+
+ This plug-in allows you to create/modify OpenERP Reports into OpenOffice Writer.
+
+
+
+
+
+
+
+
+
+
+ 15
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OpenERP Report Designer Installation
+ ir.actions.act_window
+ base_report_designer.installer
+
+ form
+ form
+ new
+
+
+
+
+ 3
+
+
+
+
+
+ OpenERP Report Designer
+ ir.actions.act_window
+ base_report_designer.installer
+
+ form
+ form
+ new
+ {'menu':True}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/base_report_designer/base_report_designer_wizard.xml b/addons/base_report_designer/base_report_designer_wizard.xml
deleted file mode 100644
index c1bb7c35270..00000000000
--- a/addons/base_report_designer/base_report_designer_wizard.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/base_report_designer/installer.py b/addons/base_report_designer/installer.py
new file mode 100644
index 00000000000..082383bde8c
--- /dev/null
+++ b/addons/base_report_designer/installer.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields
+from osv import osv
+import base64
+from tools.translate import _
+import addons
+
+class base_report_designer_installer(osv.osv_memory):
+ _name = 'base_report_designer.installer'
+ _inherit = 'res.config.installer'
+
+ def default_get(self, cr, uid, fields, context={}):
+ data = super(base_report_designer_installer, self).default_get(cr, uid, fields, context)
+ plugin_file = open(addons.get_module_resource('base_report_designer','plugin', 'openerp_report_designer.zip'),'rb')
+ data['plugin_file'] = base64.encodestring(plugin_file.read())
+ return data
+
+ _columns = {
+ 'name':fields.char('File name', size=34),
+ 'plugin_file':fields.binary('OpenObject Report Designer Plug-in', readonly=True, help="OpenObject Report Designer plug-in file. Save as this file and install this plug-in in OpenOffice."),
+ 'description':fields.text('Description', readonly=True)
+ }
+
+ _defaults = {
+ 'name' : 'openerp_report_designer.zip',
+ 'description' : """
+ * Save the OpenERP Report Designer plug-in.
+ * Follow these steps to install plug-in.
+ 1. Open Extension Manager window from Menu Bar of Openoffice writer, Open Tools > Extension Menu.
+ 2. Click on "Add" button.
+ 3. Select path where the openerp_report_designer.zip is located.
+ 4. On the completion of adding package you will get your package under 'Extension Manager' and the status of your package become 'Enabled'.
+ 5. Restart openoffice writer.
+ * Follow the steps to configure OpenERP Report Designer plug-in in Openoffice writer.
+ 1. Connect OpenERP Server from Menu bar , OpenERP Report Designer > Server parameter.
+ 2. Select Server url, database and provide user name and password
+ 3. Click "Connect".
+ 4. if your connection success, A message appears like 'You can start creating your report in current document.'.
+ """
+ }
+base_report_designer_installer()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/base_report_designer/wizard/tiny_sxw2rml/__init__.py b/addons/base_report_designer/openerp_sxw2rml/__init__.py
similarity index 96%
rename from addons/base_report_designer/wizard/tiny_sxw2rml/__init__.py
rename to addons/base_report_designer/openerp_sxw2rml/__init__.py
index ce14b22af8f..797fa7f8ccf 100644
--- a/addons/base_report_designer/wizard/tiny_sxw2rml/__init__.py
+++ b/addons/base_report_designer/openerp_sxw2rml/__init__.py
@@ -19,6 +19,6 @@
#
##############################################################################
-from tiny_sxw2rml import sxw2rml
+from openerp_sxw2rml import sxw2rml
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_report_designer/wizard/tiny_sxw2rml/normalized_odt2rml.xsl b/addons/base_report_designer/openerp_sxw2rml/normalized_odt2rml.xsl
similarity index 100%
rename from addons/base_report_designer/wizard/tiny_sxw2rml/normalized_odt2rml.xsl
rename to addons/base_report_designer/openerp_sxw2rml/normalized_odt2rml.xsl
diff --git a/addons/base_report_designer/wizard/tiny_sxw2rml/normalized_oo2rml.xsl b/addons/base_report_designer/openerp_sxw2rml/normalized_oo2rml.xsl
similarity index 100%
rename from addons/base_report_designer/wizard/tiny_sxw2rml/normalized_oo2rml.xsl
rename to addons/base_report_designer/openerp_sxw2rml/normalized_oo2rml.xsl
diff --git a/addons/base_report_designer/wizard/tiny_sxw2rml/office.dtd b/addons/base_report_designer/openerp_sxw2rml/office.dtd
similarity index 100%
rename from addons/base_report_designer/wizard/tiny_sxw2rml/office.dtd
rename to addons/base_report_designer/openerp_sxw2rml/office.dtd
diff --git a/addons/base_report_designer/wizard/tiny_sxw2rml/tiny_sxw2rml.py b/addons/base_report_designer/openerp_sxw2rml/openerp_sxw2rml.py
similarity index 96%
rename from addons/base_report_designer/wizard/tiny_sxw2rml/tiny_sxw2rml.py
rename to addons/base_report_designer/openerp_sxw2rml/openerp_sxw2rml.py
index 1a29324fb83..c51602cd82d 100644
--- a/addons/base_report_designer/wizard/tiny_sxw2rml/tiny_sxw2rml.py
+++ b/addons/base_report_designer/openerp_sxw2rml/openerp_sxw2rml.py
@@ -22,17 +22,11 @@
##############################################################################
#!/usr/bin/python
"""
-Tiny SXW2RML - The OpenERP's report engine
+OpenERP SXW2RML - The OpenERP's report engine
-Tiny SXW2RMLis part of the Tiny report project.
-Tiny Report is a module that allows you to render high quality PDF document
+OpenERP SXW2RML is part of the OpenERP Report Project.
+OpenERP Report is a module that allows you to render high quality PDF document
from an OpenOffice template (.sxw) and any relationnal database.
-
-The whole source code is distributed under the terms of the
-GNU Public Licence.
-
-(c) 2005 pyopenoffice.py Martin Simon (http://www.bezirksreiter.de)
-(c) 2005-TODAY, Fabien Pinckaers - Tiny sprl
"""
__version__ = '0.9'
@@ -341,8 +335,8 @@ def sxw2rml(sxw_file, xsl, output='.', save_pict=False):
if __name__ == "__main__":
import optparse
parser = optparse.OptionParser(
- version="Tiny Report v%s" % __version__,
- usage = 'tiny_sxw2rml.py [options] file.sxw')
+ version="OpenERP Report v%s" % __version__,
+ usage = 'openerp_sxw2rml.py [options] file.sxw')
parser.add_option("-v", "--verbose", default=False, dest="verbose", help="enable basic debugging")
parser.add_option("-o", "--output", dest="output", default='.', help="directory of image output")
(opt, args) = parser.parse_args()
diff --git a/addons/base_report_designer/plugin/openerp_report_designer.zip b/addons/base_report_designer/plugin/openerp_report_designer.zip
new file mode 100644
index 00000000000..22c0b7768f2
Binary files /dev/null and b/addons/base_report_designer/plugin/openerp_report_designer.zip differ
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/README b/addons/base_report_designer/plugin/openerp_report_designer/README
new file mode 100644
index 00000000000..41e02733da1
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/README
@@ -0,0 +1,40 @@
+About OpenERP Report Designer Plugin
+===================================================================
+OpenERP Report Desinger Plugin is a Package of OpenOffice Writer.
+Using this Plugin , we can modify existing OpenERP Reports and also we can make new nice OpenERP Reports.
+
+
+How to Install OpenERP Report Designer Plugin into Openoffice 3.2 in Linux?
+=====================================================================
+- In Openoffice writer, Open Extension Manager window from Tools > Extension Menu
+
+- Click on "Add" button and select path where the openerp_report_designer.zip is located.
+
+- On the completion of adding package you will get your package
+ under 'Extension Manager' and the status of your package become 'Enabled'
+
+- Close openoffice writer.
+
+- Restart openoffice writer, Now you will find one new menu "OpenERP Report Designer" in Menubar.
+
+
+How to install the plugin with OpenOffice 2.4 on Windows
+========================================================
+
+If you get an error for the installation of the plugin, edit the pythonloader.py file
+in $(OPEN_OFFICE_DIR)\program\ and change the value of DEBUG to None.
+
+If you get an error for the uno.exe in window then just close the Quick starter
+ Openoffice.2.4.1 Too\Option\Openoffic.org in that select the Memory
+ in that Openoffice.org.QuickStarter
+ if checked mark is there then just remove it..
+
+If you are using OpenOffice 3.0 and install the Report Desinger with make all
+ command then change path in makefile
+
+ sh /opt/openoffice.org3/program/unopkg add or remove both
+
+ And for previous version of Openoffice used
+
+ sh /usr/lib/openoffice/program/unopkg add -v $(ZIP_FILE)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/Makefile b/addons/base_report_designer/plugin/openerp_report_designer/bin/Makefile
new file mode 100755
index 00000000000..d3a55804819
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/Makefile
@@ -0,0 +1,42 @@
+ZIP_FILE=../../openerp_report_designer.zip
+
+all: pack uninstall install
+
+create:
+ cat script/import \
+ script/lib/actions.py \
+ script/lib/error.py \
+ script/lib/functions.py \
+ script/lib/gui.py \
+ script/lib/tools.py \
+ script/lib/logreport.py\
+ script/lib/rpc.py\
+ script/lib/tiny_socket.py\
+ script/Repeatln.py \
+ script/Fields.py \
+ script/Expression.py \
+ script/modify.py \
+ script/ServerParameter.py \
+ script/Change.py \
+ script/NewReport.py \
+ script/LoginTest.py \
+ script/ModifyExistingReport.py \
+ script/SendToServer.py \
+ script/About.py \
+ script/ConvertBracesToField.py \
+ script/ConvertFieldsToBraces.py \
+ script/ExportToRML.py \
+ script/Translation.py \
+ script/AddAttachment.py > package/OpenERPReport.py
+
+pack: clean create
+ zip $(ZIP_FILE) `find package/ | grep -v svn`
+
+install:
+ sh /opt/openoffice.org3/program/unopkg add -v $(ZIP_FILE)
+
+uninstall:
+ sh /opt/openoffice.org3/program/unopkg remove -v $(ZIP_FILE)
+
+clean:
+ rm -f $(ZIP_FILE)
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/OOo_run.sh b/addons/base_report_designer/plugin/openerp_report_designer/bin/OOo_run.sh
new file mode 100755
index 00000000000..a22ff96cf53
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/OOo_run.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+ooffice "-accept=socket,host=localhost,port=2002;urp;"
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/package/Addons.xcu b/addons/base_report_designer/plugin/openerp_report_designer/bin/package/Addons.xcu
new file mode 100644
index 00000000000..121c49af167
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/package/Addons.xcu
@@ -0,0 +1,636 @@
+
+
+
+
+
+
+
+ OpenERP Report Designer
+ OpenERP Rapport Designer
+
+
+ _self
+
+
+
+
+
+
+
+ service:org.openoffice.openerp.report.serverparam?execute
+
+
+
+ Server parameters
+ Paramètres serveur
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ private:separator
+
+
+
+
+ service:org.openoffice.openerp.report.repeatln?execute
+
+
+
+ Add a loop
+ Ajouter une boucle
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.fields?execute
+
+
+
+ Add a field
+ Ajouter un champ
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+
+ service:org.openoffice.openerp.report.expression?execute
+
+
+
+ Add an expression
+ Ajouter une expression
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+
+ service:org.openoffice.openerp.report.langtag?execute
+
+
+
+ Add a lang tag
+ Ajouter un tag lang
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.modify?execute
+
+
+
+ Modify
+ Modifier
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ private:separator
+
+
+
+
+ service:org.openoffice.openerp.report.convertFB?execute
+
+
+
+ Conversion Fields -> Brackets
+ Conversion champs -> crochets
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.convertBF?execute
+
+
+
+ Conversion Brackets -> Fields
+ Conversion crochets -> champs
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.exporttorml?execute
+
+
+
+ Export to RML
+ Exporter en RML
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.addattachment?execute
+
+
+
+ Add Attachment
+ Envoyer comme attachement
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ private:separator
+
+
+
+
+ service:org.openoffice.openerp.report.sendtoserver?execute
+
+
+
+ Send to the server
+ Envoyer au serveur
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.opennewreport?execute
+
+
+
+ Open a new report
+ Nouveau rapport
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.modifyreport?execute
+
+
+
+ Modify Existing Report
+ Modifier un rapport
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ private:separator
+
+
+
+
+ service:org.openoffice.openerp.report.about?execute
+
+
+
+ About
+ À propos de
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+
+
+
+
+
+
+ service:org.openoffice.openerp.report.serverparam?execute
+
+
+
+
+
+
+ Server parameters
+ Paramètres serveur
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ private:separator
+
+
+
+
+ service:org.openoffice.openerp.report.repeatln?execute
+
+
+
+
+
+
+ Add a loop
+ Ajouter une boucle
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.fields?execute
+
+
+
+
+
+
+ Add a field
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+
+ service:org.openoffice.openerp.report.expression?execute
+
+
+
+
+
+
+ Add an expression
+ Ajouter une expression>
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.langtag?execute
+
+
+
+
+
+
+ Add a lang tag
+ Ajouter un tag lang
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.modify?execute
+
+
+
+
+
+
+ Modify
+ Modifier
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ private:separator
+
+
+
+
+ service:org.openoffice.openerp.report.convertFB?execute
+
+
+
+
+
+
+ Conversion Fields -> Brackets
+ Domaines de conversion -> Supports
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.convertBF?execute
+
+
+
+
+
+
+ Conversion Brackets -> Fields
+ Supports de conversion -> Domaines
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ service:org.openoffice.openerp.report.exporttorml?execute
+
+
+
+
+
+
+ Export to RML
+ RML à l'exportation
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+ com.sun.star.text.TextDocument
+
+
+ private:separator
+
+
+
+
+ service:org.openoffice.openerp.report.about?execute
+
+
+
+
+
+
+ About
+ À propos de
+
+
+ _self
+
+
+ com.sun.star.text.TextDocument
+
+
+
+
+
+
+
+ service:org.openoffice.openerp.report.expression?execute
+
+
+
+ %origin%/images/expression_s.png
+
+
+ %origin%/images/expression_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.repeatln?execute
+
+
+
+ %origin%/images/loop_s.png
+
+
+ %origin%/images/loop_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.fields?execute
+
+
+
+ %origin%/images/field_s.png
+
+
+ %origin%/images/field_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.exporttorml?execute
+
+
+
+ %origin%/images/export_rml_s.png
+
+
+ %origin%/images/export_rml_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.convertFB?execute
+
+
+
+ %origin%/images/convetFtoB_s.png
+
+
+ %origin%/images/convetFtoB_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.convertBF?execute
+
+
+
+ %origin%/images/convetBtoF_s.png
+
+
+ %origin%/images/convetBtoF_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.modify?execute
+
+
+
+ %origin%/images/modify_s.png
+
+
+ %origin%/images/modify_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.serverparam?execute
+
+
+
+ %origin%/images/logo_1.png
+
+
+ %origin%/images/logo_s.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.about?execute
+
+
+
+ %origin%/images/aboutus_s.png
+
+
+ %origin%/images/aboutus_b.png
+
+
+
+
+
+ service:org.openoffice.openerp.report.langtag?execute
+
+
+
+ %origin%/images/lang_s.png
+
+
+ %origin%/images/lang_b.png
+
+
+
+
+
+
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/About.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/About.py
new file mode 100644
index 00000000000..319a1d6703c
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/About.py
@@ -0,0 +1,111 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+from com.sun.star.task import XJobExecutor
+
+if __name__<>'package':
+ from lib.gui import *
+
+class About(unohelper.Base, XJobExecutor):
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ self.win = DBModalDialog(60, 50, 175, 115, "About OpenERP Report Designer")
+
+ fdBigFont = createUnoStruct("com.sun.star.awt.FontDescriptor")
+ fdBigFont.Width = 20
+ fdBigFont.Height = 25
+ fdBigFont.Weight = 120
+ fdBigFont.Family= 3
+
+ oLabelTitle1 = self.win.addFixedText("lblTitle1", 1, 1, 35, 30)
+ oLabelTitle1.Model.TextColor = 16056320
+ oLabelTitle1.Model.FontDescriptor = fdBigFont
+ oLabelTitle1.Model.FontRelief = 1
+ oLabelTitle1.Text = "Open"
+
+ oLabelTitle2 = self.win.addFixedText("lblTitle2", 35, 1, 30, 30)
+ oLabelTitle2.Model.TextColor = 1
+ oLabelTitle2.Model.FontDescriptor = fdBigFont
+ oLabelTitle2.Model.FontRelief = 1
+ oLabelTitle2.Text = "ERP"
+
+ oLabelProdDesc = self.win.addFixedText("lblProdDesc", 1, 30, 173, 75)
+ oLabelProdDesc.Model.TextColor = 1
+ fdBigFont.Width = 10
+ fdBigFont.Height = 11
+ fdBigFont.Weight = 76
+ oLabelProdDesc.Model.FontDescriptor = fdBigFont
+ oLabelProdDesc.Model.Align = 1
+ oLabelProdDesc.Model.FontRelief = 1
+ oLabelProdDesc.Model.MultiLine = True
+ oLabelProdDesc.Text = "This package helps you to create or modify\nreports in OpenERP. Once connected to the\nserver, you can design your template of reports\nusing fields and expressions and browsing the\ncomplete structure of OpenERP object database."
+
+ oLabelFooter = self.win.addFixedText("lblFooter", -1, -1, 173, 25)
+ oLabelFooter.Model.TextColor = 255
+ #oLabelFooter.Model.BackgroundColor = 1
+ oLabelFooter.Model.Border = 2
+ oLabelFooter.Model.BorderColor = 255
+ fdBigFont.Width = 8
+ fdBigFont.Height = 9
+ fdBigFont.Weight = 100
+ oLabelFooter.Model.FontDescriptor = fdBigFont
+ oLabelFooter.Model.Align = 1
+ oLabelFooter.Model.FontRelief = 1
+ oLabelFooter.Model.MultiLine = True
+ sMessage = "OpenERP Report Designer v1.0 \nCopyright 2007-TODAY Tiny sprl \nThis product is free software, under the GNU Affero General Public License."
+ oLabelFooter.Text = sMessage
+
+ self.win.doModalDialog("",None)
+
+if __name__<>"package" and __name__=="__main__":
+ About(None)
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( About, "org.openoffice.openerp.report.about", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/AddAttachment.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/AddAttachment.py
new file mode 100644
index 00000000000..d42cb4614aa
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/AddAttachment.py
@@ -0,0 +1,277 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import os
+import uno
+import unohelper
+import xmlrpclib
+import base64
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from lib.error import ErrorDialog
+ from lib.tools import *
+ from LoginTest import *
+ from lib.rpc import *
+ database="test"
+ uid = 3
+
+class AddAttachment(unohelper.Base, XJobExecutor ):
+ Kind = {
+ 'PDF' : 'pdf',
+ 'OpenOffice': 'sxw',
+ }
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ LoginTest()
+ if not loginstatus and __name__=="package":
+ exit(1)
+
+ self.aSearchResult = []
+ desktop=getDesktop()
+ oDoc2 = desktop.getCurrentComponent()
+ docinfo=oDoc2.getDocumentInfo()
+
+ global passwd
+ self.password = passwd
+ global url
+ self.sock=RPCSession(url)
+ if docinfo.getUserFieldValue(2) <> "" and docinfo.getUserFieldValue(3) <> "":
+ self.win = DBModalDialog(60, 50, 180, 70, "Add Attachment to Server")
+ self.win.addFixedText("lblResourceType", 2 , 5, 100, 10, "Select Appropriate Resource Type:")
+ self.win.addComboListBox("lstResourceType", -2, 25, 176, 15,True)
+ self.win.addButton('btnOkWithoutInformation', -2 , -5, 25 , 15,'OK' ,actionListenerProc = self.btnOkWithoutInformation_clicked )
+ else:
+ self.win = DBModalDialog(60, 50, 180, 190, "Add Attachment to Server")
+ self.win.addFixedText("lblModuleName",2 , 9, 42, 20, "Select Module:")
+ self.win.addComboListBox("lstmodel", -2, 5, 134, 15,True)
+ self.lstModel = self.win.getControl( "lstmodel" )
+ self.dModel = {}
+
+ # Open a new connexion to the server
+
+ ids = self.sock.execute(database, uid, self.password, 'ir.module.module', 'search', [('name','=','base_report_model'),('state', '=', 'installed')])
+ if not len(ids):
+ # If the module 'base_report_model' is not installed, use the default model
+ self.dModel = {
+ "Partner":'res.partner',
+ }
+ else:
+
+ ids =self.sock.execute(database, uid, self.password, 'base.report.model' , 'search', [])
+ res = self.sock.execute(database, uid, self.password, 'base.report.model' , 'read', ids, ['name','model_id'])
+ models = self.sock.execute(database, uid, self.password, 'ir.model' , 'read', map(lambda x:x['model_id'][0], res), ['model'])
+ models = dict(map(lambda x:(x['id'],x['model']), models))
+ self.dModel = dict(map(lambda x: (x['name'],models[x['model_id'][0]]), res))
+
+ for item in self.dModel.keys():
+ self.lstModel.addItem(item, self.lstModel.getItemCount())
+
+ self.win.addFixedText("lblSearchName",2 , 25, 60, 10, "Enter Search String:")
+ self.win.addEdit("txtSearchName", 2, 35, 149, 15,)
+ self.win.addButton('btnSearch', -2 , 35, 25 , 15,'Search' ,actionListenerProc = self.btnSearch_clicked )
+
+ self.win.addFixedText("lblSearchRecord", 2 , 55, 60, 10, "Search Result:")
+ self.win.addComboListBox("lstResource", -2, 65, 176, 70, False )
+ self.lstResource = self.win.getControl( "lstResource" )
+
+ self.win.addFixedText("lblResourceType", 2 , 137, 100, 20, "Select Appropriate Resource Type:")
+ self.win.addComboListBox("lstResourceType", -2, 147, 176, 15,True )
+
+ self.win.addButton('btnOkWithInformation', -2 , -5, 25 , 15,'OK' ,actionListenerProc = self.btnOkWithInformation_clicked )
+
+ self.lstResourceType = self.win.getControl( "lstResourceType" )
+ for kind in self.Kind.keys():
+ self.lstResourceType.addItem( kind, self.lstResourceType.getItemCount() )
+
+ self.win.addButton('btnCancel', -2 - 27 , -5 , 30 , 15, 'Cancel' ,actionListenerProc = self.btnCancel_clicked )
+ self.win.doModalDialog("lstResourceType", self.Kind.keys()[0])
+
+ def btnSearch_clicked( self, oActionEvent ):
+ modelSelectedItem = self.win.getListBoxSelectedItem("lstmodel")
+ if modelSelectedItem == "":
+ return
+
+ desktop=getDesktop()
+ oDoc2 = desktop.getCurrentComponent()
+ docinfo=oDoc2.getDocumentInfo()
+
+
+ self.aSearchResult =self.sock.execute( database, uid, self.password, self.dModel[modelSelectedItem], 'name_search', self.win.getEditText("txtSearchName"))
+ self.win.removeListBoxItems("lstResource", 0, self.win.getListBoxItemCount("lstResource"))
+ if self.aSearchResult == []:
+ ErrorDialog("No search result found !!!", "", "Search ERROR" )
+ return
+
+ for result in self.aSearchResult:
+ self.lstResource.addItem(result[1],result[0])
+
+ def _send_attachment( self, name, data, res_model, res_id ):
+ desktop = getDesktop()
+ oDoc2 = desktop.getCurrentComponent()
+ docinfo = oDoc2.getDocumentInfo()
+
+ params = {
+ 'name': name,
+ 'datas': base64.encodestring( data ),
+ 'datas_fname': name,
+ 'res_model' : res_model,
+ 'res_id' : int(res_id),
+ }
+
+ return self.sock.execute( database, uid, self.password, 'ir.attachment', 'create', params )
+
+ def send_attachment( self, model, resource_id ):
+ desktop = getDesktop()
+ oDoc2 = desktop.getCurrentComponent()
+ docinfo = oDoc2.getDocumentInfo()
+
+ if oDoc2.getURL() == "":
+ ErrorDialog("Please save your file", "", "Saving ERROR" )
+ return None
+
+ url = oDoc2.getURL()
+ if self.Kind[self.win.getListBoxSelectedItem("lstResourceType")] == "pdf":
+ url = self.doc2pdf(url[7:])
+
+ if url == None:
+ ErrorDialog( "Ploblem in creating PDF", "", "PDF Error" )
+ return None
+
+ url = url[7:]
+ data = read_data_from_file( get_absolute_file_path( url ) )
+ return self._send_attachment( os.path.basename( url ), data, model, resource_id )
+
+ def btnOkWithoutInformation_clicked( self, oActionEvent ):
+ desktop = getDesktop()
+ oDoc2 = desktop.getCurrentComponent()
+ docinfo = oDoc2.getDocumentInfo()
+
+ if self.win.getListBoxSelectedItem("lstResourceType") == "":
+ ErrorDialog("Please select resource type", "", "Selection ERROR" )
+ return
+
+ res = self.send_attachment( docinfo.getUserFieldValue(3), docinfo.getUserFieldValue(2) )
+ self.win.endExecute()
+
+ def btnOkWithInformation_clicked(self,oActionEvent):
+ if self.win.getListBoxSelectedItem("lstResourceType") == "":
+ ErrorDialog( "Please select resource type", "", "Selection ERROR" )
+ return
+
+ if self.win.getListBoxSelectedItem("lstResource") == "" or self.win.getListBoxSelectedItem("lstmodel") == "":
+ ErrorDialog("Please select Model and Resource","","Selection ERROR")
+ return
+
+ resourceid = None
+ for s in self.aSearchResult:
+ if s[1] == self.win.getListBoxSelectedItem("lstResource"):
+ resourceid = s[0]
+ break
+
+ if resourceid == None:
+ ErrorDialog("No resource selected !!!", "", "Resource ERROR" )
+ return
+
+ res = self.send_attachment( self.dModel[self.win.getListBoxSelectedItem('lstmodel')], resourceid )
+ self.win.endExecute()
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+ def doc2pdf(self, strFile):
+ oDoc = None
+ strFilterSubName = ''
+
+ strUrl = convertToURL( strFile )
+ desktop = getDesktop()
+ oDoc = desktop.loadComponentFromURL( strUrl, "_blank", 0, Array(self._MakePropertyValue("Hidden",True)))
+ if oDoc:
+ strFilterSubName = ""
+ # select appropriate filter
+ if oDoc.supportsService("com.sun.star.presentation.PresentationDocument"):
+ strFilterSubName = "impress_pdf_Export"
+ elif oDoc.supportsService("com.sun.star.sheet.SpreadsheetDocument"):
+ strFilterSubName = "calc_pdf_Export"
+ elif oDoc.supportsService("com.sun.star.text.WebDocument"):
+ strFilterSubName = "writer_web_pdf_Export"
+ elif oDoc.supportsService("com.sun.star.text.GlobalDocument"):
+ strFilterSubName = "writer_globaldocument_pdf_Export"
+ elif oDoc.supportsService("com.sun.star.text.TextDocument"):
+ strFilterSubName = "writer_pdf_Export"
+ elif oDoc.supportsService("com.sun.star.drawing.DrawingDocument"):
+ strFilterSubName = "draw_pdf_Export"
+ elif oDoc.supportsService("com.sun.star.formula.FormulaProperties"):
+ strFilterSubName = "math_pdf_Export"
+ elif oDoc.supportsService("com.sun.star.chart.ChartDocument"):
+ strFilterSubName = "chart_pdf_Export"
+ else:
+ pass
+
+ filename = len(strFilterSubName) > 0 and convertToURL( os.path.splitext( strFile )[0] + ".pdf" ) or None
+
+ if len(strFilterSubName) > 0:
+ oDoc.storeToURL( filename, Array(self._MakePropertyValue("FilterName", strFilterSubName ),self._MakePropertyValue("CompressMode", "1" )))
+
+ oDoc.close(True)
+ # Can be None if len(strFilterSubName) <= 0
+ return filename
+
+ def _MakePropertyValue(self, cName = "", uValue = u"" ):
+ oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" )
+ if cName:
+ oPropertyValue.Name = cName
+ if uValue:
+ oPropertyValue.Value = uValue
+ return oPropertyValue
+
+
+if __name__<>"package" and __name__=="__main__":
+ AddAttachment(None)
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( AddAttachment, "org.openoffice.openerp.report.addattachment", ("com.sun.star.task.Job",),)
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Change.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Change.py
new file mode 100644
index 00000000000..7dc26c78505
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Change.py
@@ -0,0 +1,109 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+if __name__<>"package":
+ from lib.gui import *
+ from lib.functions import *
+ from lib.rpc import *
+
+class Change:
+ def __init__(self, aVal= None, sURL=""):
+ self.win=DBModalDialog(60, 50, 120, 90, "Connect to Open ERP Server")
+
+ self.win.addFixedText("lblVariable", 38, 12, 60, 15, "Server")
+
+ self.win.addEdit("txtHost",-2,9,60,15,sURL[sURL.find("/")+2:sURL.rfind(":")])
+
+ self.win.addFixedText("lblReportName",45 , 31, 60, 15, "Port")
+ self.win.addEdit("txtPort",-2,28,60,15,sURL[sURL.rfind(":")+1:])
+
+ self.win.addFixedText("lblLoginName", 2, 51, 60, 15, "Protocol Connection")
+
+ self.win.addComboListBox("lstProtocol", -2, 48, 60, 15, True)
+ self.lstProtocol = self.win.getControl( "lstProtocol" )
+
+# self.lstProtocol.addItem( "XML-RPC", 0)
+ #self.lstProtocol.addItem( "XML-RPC secure", 1)
+ #self.lstProtocol.addItem( "NET-RPC (faster)", 2)
+
+ self.win.addButton( 'btnOK', -2, -5, 30, 15, 'Ok', actionListenerProc = self.btnOk_clicked )
+
+ self.win.addButton( 'btnCancel', -2 - 30 - 5 ,-5, 30, 15, 'Cancel', actionListenerProc = self.btnCancel_clicked )
+ self.aVal=aVal
+ self.protocol = {
+ 'XML-RPC': 'http://',
+ 'XML-RPC secure': 'https://',
+ 'NET-RPC': 'socket://',
+ }
+ for i in self.protocol.keys():
+ self.lstProtocol.addItem(i,self.lstProtocol.getItemCount() )
+
+ sValue=self.protocol.keys()[0]
+ if sURL<>"":
+ sValue=self.protocol.keys()[self.protocol.values().index(sURL[:sURL.find("/")+2])]
+
+ self.win.doModalDialog( "lstProtocol", sValue)
+
+ def btnOk_clicked(self,oActionEvent):
+ global url
+ url = self.protocol[self.win.getListBoxSelectedItem("lstProtocol")]+self.win.getEditText("txtHost")+":"+self.win.getEditText("txtPort")
+ self.sock=RPCSession(url)
+ docinfo=doc.getDocumentInfo()
+ docinfo.setUserFieldValue(0,url)
+ res=self.sock.listdb()
+ if res == -1:
+ self.aVal.append(url)
+ elif res == 0:
+ self.aVal.append("No Database found !!!")
+ else:
+ self.aVal.append(url)
+ self.aVal.append(res)
+ self.win.endExecute()
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ConvertBracesToField.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ConvertBracesToField.py
new file mode 100644
index 00000000000..d4e8b5855ff
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ConvertBracesToField.py
@@ -0,0 +1,285 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import uno
+import unohelper
+import string
+import re
+import base64
+
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from LoginTest import *
+ from lib.logreport import *
+ from lib.rpc import *
+ database="test"
+ uid = 1
+
+
+
+class ConvertBracesToField( unohelper.Base, XJobExecutor ):
+
+ def __init__(self,ctx):
+
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ LoginTest()
+ self.logobj=Logger()
+ if not loginstatus and __name__=="package":
+ exit(1)
+
+ global passwd
+ self.password = passwd
+ global url
+ self.sock=RPCSession(url)
+ self.aReportSyntex=[]
+ self.getBraces(self.aReportSyntex)
+
+ self.setValue()
+
+
+ def setValue(self):
+
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo= doc.getDocumentInfo()
+ count = 0
+ regexes = [
+ ['[a-zA-Z0-9_]+\.[a-zA-Z0-9_.]+',"Field"],
+ ['\\[\\[ *repeatIn\\( *([a-zA-Z0-9_\.]+), *\'([a-zA-Z0-9_]+)\' *\\) *\\]\\]', "RepeatIn"],
+ ['\\[\\[ *([a-zA-Z0-9_\.]+) *\\]\\]', "Field"]
+ # ['\\[\\[ ([a-zA-Z0-9_]+\.[a-zA-Z1-9]) \\]\\]',"Field"],
+ # ['\\[\\[ [a-zA-Z0-9_\.]+ and ([a-zA-Z0-9_\.]+) or .+? \\]\\]',"Field"],
+ # ['\\[\\[ ([a-zA-Z0-9_\.]+) or .+? \\]\\]',"Field"],
+ # ['\\[\\[ ([a-zA-Z0-9_\.]+) and .+? \\]\\]',"Field"],
+ # ['\\[\\[ .+? or ([a-zA-Z0-9_\.]+) \\]\\]',"Field"],
+ # ['\\[\\[ (.+?) and ([a-zA-Z0-9_\.]+) \\]\\]',"Field"],
+ # ['\\[\\[ .+? % ([a-zA-Z0-9_\.]+) \\]\\]',"Field"]
+ ]
+ oFieldObject = []
+ oRepeatInObjects = []
+ saRepeatInList = []
+ sHost = docinfo.getUserFieldValue(0)
+ nCount = 0
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ nCount += 1
+ getList(oRepeatInObjects,sHost,nCount)
+ for ro in oRepeatInObjects:
+ if ro.find("(")<>-1:
+ saRepeatInList.append( [ ro[:ro.find("(")], ro[ro.find("(")+1:ro.find(")")] ])
+ try:
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ for reg in regexes:
+ res=re.findall(reg[0],oPar.Items[1])
+ if len(res) <> 0:
+ if res[0][0] == "objects":
+ sTemp = docinfo.getUserFieldValue(3)
+ sTemp = "|-." + sTemp[sTemp.rfind(".")+1:] + ".-|"
+ oPar.Items=(sTemp.encode("utf-8"),oPar.Items[1].replace(' ',""))
+ oPar.update()
+ elif type(res[0]) <> type(u''):
+
+ sObject = self.getRes(self.sock, docinfo.getUserFieldValue(3), res[0][0][res[0][0].find(".")+1:].replace(".","/"))
+ r = self.sock.execute(database, uid, self.password, docinfo.getUserFieldValue(3) , 'fields_get')
+ sExpr="|-." + r[res[0][0][res[0][0].rfind(".")+1:]]["string"] + ".-|"
+ oPar.Items=(sExpr.encode("utf-8"),oPar.Items[1].replace(' ',""))
+ oPar.update()
+ else:
+
+ obj = None
+ for rl in saRepeatInList:
+ if rl[0] == res[0][:res[0].find(".")]:
+ obj=rl[1]
+ try:
+ sObject = self.getRes(self.sock, obj, res[0][res[0].find(".")+1:].replace(".","/"))
+ r = self.sock.execute(database, uid, self.password, sObject , 'read',[1])
+ except Exception,e:
+ r = "TTT"
+ self.logobj.log_write('ConvertBracesToField', LOG_ERROR, str(e))
+ if len(r) <> 0:
+ if r <> "TTT":
+ if len(res)>1:
+ sExpr=""
+ print res
+ if reg[1] == 'Field':
+ for ires in res:
+ try:
+ sExpr=r[0][ires[ires.rfind(".")+1:]]
+ break
+ except Exception,e:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ConvertBracesToField', LOG_ERROR,info)
+ try:
+ oPar.Items=(sExpr.encode("utf-8") ,oPar.Items[1])
+ oPar.update()
+ except:
+ oPar.Items=(str(sExpr) ,oPar.Items[1])
+ oPar.update()
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ConvertBracesToField', LOG_ERROR, info)
+
+ else:
+ sExpr=r[0][res[0][res[0].rfind(".")+1:]]
+ try:
+
+ if sExpr:
+ oPar.Items=(sExpr.encode("utf-8") ,oPar.Items[1])
+ oPar.update()
+ else:
+ oPar.Items=(u"/",oPar.Items[1])
+ oPar.update()
+ except:
+ oPar.Items=(str(sExpr) ,oPar.Items[1])
+ oPar.update()
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ConvertBracesToField', LOG_ERROR,info)
+
+ else:
+ oPar.Items=(u""+r,oPar.Items[1])
+ oPar.update()
+ else:
+ oPar.Items=(u"TTT",oPar.Items[1])
+ oPar.update()
+ except:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ConvertBraceToField', LOG_ERROR, info)
+
+ def getRes(self,sock,sObject,sVar):
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ res = sock.execute(database, uid, self.password, sObject , 'fields_get')
+ key = res.keys()
+ key.sort()
+ myval=None
+ if not sVar.find("/")==-1:
+ myval=sVar[:sVar.find("/")]
+ else:
+ myval=sVar
+ for k in key:
+ if (res[k]['type'] in ['many2one']) and k==myval:
+ sObject = self.getRes(sock,res[myval]['relation'], sVar[sVar.find("/")+1:])
+ return sObject
+
+ def getBraces(self,aReportSyntex=[]):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ aSearchString=[]
+ aReplaceString=[]
+ aRes=[]
+
+ try:
+ regexes = [
+ ['\\[\\[ *repeatIn\\( *([a-zA-Z0-9_\.]+), *\'([a-zA-Z0-9_]+)\' *\\) *\\]\\]', "RepeatIn"],
+ ['\\[\\[ *([a-zA-Z0-9_\.]+) *\\]\\]', "Field"],
+ ['\\[\\[ *.+? *\\]\\]', "Expression"]
+ ]
+
+ search = doc.createSearchDescriptor()
+ search.SearchRegularExpression = True
+
+ for reg in regexes:
+ search.SearchString = reg[0]
+ found = doc.findFirst( search )
+ while found:
+ res=re.findall(reg[0],found.String)
+ print len(res)
+
+ if found.String not in [r[0] for r in aReportSyntex] and len(res) == 1 :
+ text=found.getText()
+ oInputList = doc.createInstance("com.sun.star.text.TextField.DropDown")
+ if reg[1]<>"Expression":
+ oInputList.Items=(u""+found.String,u""+found.String)
+ else:
+ oInputList.Items=(u"?",u""+found.String)
+ aReportSyntex.append([oInputList,reg[1]])
+ text.insertTextContent(found,oInputList,False)
+ found.String =""
+
+ else:
+ aRes.append([res,reg[1]])
+ found = doc.findNext(found.End, search)
+ search = doc.createSearchDescriptor()
+ search.SearchRegularExpression = False
+
+ for res in aRes:
+ for r in res[0]:
+ search.SearchString=r
+ found=doc.findFirst(search)
+ while found:
+
+ text=found.getText()
+
+ oInputList = doc.createInstance("com.sun.star.text.TextField.DropDown")
+ if res[1]<>"Expression":
+ oInputList.Items=(u""+found.String,u""+found.String)
+ else:
+ oInputList.Items=(u"?",u""+found.String)
+ aReportSyntex.append([oInputList,res[1]])
+ text.insertTextContent(found,oInputList,False)
+ found.String =""
+ found = doc.findNext(found.End, search)
+ except:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ConvertBraceToField', LOG_ERROR, info)
+
+if __name__<>"package":
+ ConvertBracesToField(None)
+else:
+ g_ImplementationHelper.addImplementation( ConvertBracesToField, "org.openoffice.openerp.report.convertBF", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ConvertFieldsToBraces.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ConvertFieldsToBraces.py
new file mode 100644
index 00000000000..05a794410b6
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ConvertFieldsToBraces.py
@@ -0,0 +1,85 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+import unohelper
+import string
+import re
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from LoginTest import *
+ database="test"
+ uid = 3
+
+class ConvertFieldsToBraces( unohelper.Base, XJobExecutor ):
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ LoginTest()
+ if not loginstatus and __name__=="package":
+ exit(1)
+ self.aReportSyntex=[]
+ self.getFields()
+
+ def getFields(self):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ oPar.getAnchor().Text.insertString(oPar.getAnchor(),oPar.Items[1],False)
+ oPar.dispose()
+
+if __name__<>"package":
+ ConvertFieldsToBraces(None)
+else:
+ g_ImplementationHelper.addImplementation( ConvertFieldsToBraces, "org.openoffice.openerp.report.convertFB", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ExportToRML.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ExportToRML.py
new file mode 100644
index 00000000000..875fe210c03
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ExportToRML.py
@@ -0,0 +1,132 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import os
+import uno
+import unohelper
+import string
+import tempfile
+import base64
+import sys
+
+reload(sys)
+sys.setdefaultencoding("utf8")
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from LoginTest import *
+ from lib.error import *
+ from lib.tools import *
+ from lib.logreport import *
+ from lib.rpc import *
+ database="test"
+ uid = 3
+
+
+class ExportToRML( unohelper.Base, XJobExecutor ):
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ LoginTest()
+ if not loginstatus and __name__=="package":
+ exit(1)
+
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ global url
+ self.sock=RPCSession(url)
+
+ # Read Data from sxw file
+ tmpsxw = tempfile.mktemp('.'+"sxw")
+
+ if not doc.hasLocation():
+ mytype = Array(makePropertyValue("MediaType","application/vnd.sun.xml.writer"),)
+ doc.storeAsURL("file://"+tmpsxw,mytype)
+ data = read_data_from_file( get_absolute_file_path( doc.getURL()[7:] ) )
+ file_type = doc.getURL()[7:].split(".")[-1]
+ if docinfo.getUserFieldValue(2) == "":
+ ErrorDialog("Please Save this file on server","Use Send To Server Option in OpenERP Report Menu","Error")
+ exit(1)
+ filename = self.GetAFileName()
+ if not filename:
+ exit(1)
+ global passwd
+ self.password = passwd
+ try:
+
+ res = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'sxwtorml',base64.encodestring(data),file_type)
+ if res['report_rml_content']:
+ write_data_to_file( get_absolute_file_path( filename[7:] ), res['report_rml_content'] )
+ except Exception,e:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ExportToRML',LOG_ERROR, info)
+ ErrorDialog("Can't save the file to the hard drive.", "Exception: %s" % e, "Error" )
+
+ def GetAFileName(self):
+ sFilePickerArgs = Array(10)
+ oFileDialog = createUnoService("com.sun.star.ui.dialogs.FilePicker")
+ oFileDialog.initialize(sFilePickerArgs)
+ oFileDialog.appendFilter("OpenERP Report File Save To ....","*.rml")
+
+ f_path = "OpenERP-"+ os.path.basename( tempfile.mktemp("","") ) + ".rml"
+ initPath = tempfile.gettempdir()
+ oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
+ if oUcb.exists(initPath):
+ oFileDialog.setDisplayDirectory('file://' + ( os.name == 'nt' and '/' or '' ) + initPath )
+
+ oFileDialog.setDefaultName(f_path )
+
+ sPath = oFileDialog.execute() == 1 and oFileDialog.Files[0] or None
+ oFileDialog.dispose()
+ return sPath
+
+if __name__<>"package" and __name__=="__main__":
+ ExportToRML(None)
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( ExportToRML, "org.openoffice.openerp.report.exporttorml", ("com.sun.star.task.Job",),)
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Expression.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Expression.py
new file mode 100644
index 00000000000..43531d10168
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Expression.py
@@ -0,0 +1,115 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import uno
+import string
+import unohelper
+import xmlrpclib
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from lib.error import ErrorDialog
+ from lib.functions import *
+ database="test"
+ uid = 3
+
+class Expression(unohelper.Base, XJobExecutor ):
+ def __init__(self,sExpression="",sName="", bFromModify=False):
+ LoginTest()
+ if not loginstatus and __name__=="package":
+ exit(1)
+ self.win = DBModalDialog(60, 50, 180, 65, "Expression Builder")
+ self.win.addFixedText("lblExpression",17 , 10, 35, 15, "Expression :")
+ self.win.addEdit("txtExpression", -5, 5, 123, 15)
+ self.win.addFixedText("lblName", 2, 30, 50, 15, "Displayed Name :")
+ self.win.addEdit("txtName", -5, 25, 123, 15)
+ self.win.addButton( "btnOK", -5, -5, 40, 15, "OK", actionListenerProc = self.btnOk_clicked )
+ self.win.addButton( "btnCancel", -5 - 40 -5, -5, 40, 15, "Cancel", actionListenerProc = self.btnCancel_clicked )
+ self.bModify=bFromModify
+ if self.bModify==True:
+ self.win.setEditText("txtExpression",sExpression)
+ self.win.setEditText("txtName",sName)
+ self.win.doModalDialog("",None)
+
+
+ def btnOk_clicked( self, oActionEvent ):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ text = doc.Text
+ cursor = doc.getCurrentController().getViewCursor()
+ if self.bModify==True:
+ oCurObj=cursor.TextField
+ sKey=u""+self.win.getEditText("txtName")
+ sValue=u"[[ " + self.win.getEditText("txtExpression") + " ]]"
+ oCurObj.Items = (sKey,sValue)
+ oCurObj.update()
+ self.win.endExecute()
+ else:
+ oInputList = doc.createInstance("com.sun.star.text.TextField.DropDown")
+ if self.win.getEditText("txtName")!="" and self.win.getEditText("txtExpression")!="":
+ sKey=u""+self.win.getEditText("txtName")
+ sValue=u"[[ " + self.win.getEditText("txtExpression") + " ]]"
+ if cursor.TextTable==None:
+ oInputList.Items = (sKey,sValue)
+ text.insertTextContent(cursor,oInputList,False)
+ else:
+ oTable = cursor.TextTable
+ oCurCell = cursor.Cell
+ tableText = oTable.getCellByName( oCurCell.CellName )
+ oInputList.Items = (sKey,sValue)
+ tableText.insertTextContent(cursor,oInputList,False)
+ self.win.endExecute()
+ else:
+ ErrorDialog("Please Fill appropriate data in Name field or \nExpression field")
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+if __name__<>"package" and __name__=="__main__":
+ Expression()
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( Expression, "org.openoffice.openerp.report.expression", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Fields.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Fields.py
new file mode 100644
index 00000000000..4e2f40889c9
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Fields.py
@@ -0,0 +1,291 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+
+import uno
+import string
+import unohelper
+import xmlrpclib
+
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from lib.functions import *
+ from lib.error import ErrorDialog
+ from LoginTest import *
+ from lib.logreport import *
+ from lib.rpc import *
+ database="report"
+ uid = 3
+
+
+class Fields(unohelper.Base, XJobExecutor ):
+ def __init__(self,sVariable="",sFields="",sDisplayName="",bFromModify=False):
+ LoginTest()
+ if not loginstatus and __name__=="package":
+ exit(1)
+ self.logobj=Logger()
+ self.win = DBModalDialog(60, 50, 200, 225, "Field Builder")
+
+ self.win.addFixedText("lblVariable", 27, 12, 60, 15, "Variable :")
+ self.win.addComboBox("cmbVariable", 180-120-2, 10, 130, 15,True, itemListenerProc=self.cmbVariable_selected)
+ self.insVariable = self.win.getControl( "cmbVariable" )
+
+ self.win.addFixedText("lblFields", 10, 32, 60, 15, "Variable Fields :")
+ self.win.addComboListBox("lstFields", 180-120-2, 30, 130, 150, False,True,itemListenerProc=self.lstbox_selected)
+ self.insField = self.win.getControl( "lstFields" )
+
+ self.win.addFixedText("lblUName", 8, 187, 60, 15, "Displayed name :")
+ self.win.addEdit("txtUName", 180-120-2, 185, 130, 15,)
+
+ self.win.addButton('btnOK',-5 ,-5,45,15,'Ok' ,actionListenerProc = self.btnOk_clicked )
+ self.win.addButton('btnCancel',-5 - 45 - 5 ,-5,45,15,'Cancel' ,actionListenerProc = self.btnCancel_clicked )
+
+ global passwd
+ self.password = passwd
+ global url
+ self.sock=RPCSession(url)
+
+ self.sValue=None
+ self.sObj=None
+ self.aSectionList=[]
+ self.sGDisplayName=sDisplayName
+ self.aItemList=[]
+ self.aComponentAdd=[]
+ self.aObjectList=[]
+ self.aListFields=[]
+ self.aVariableList=[]
+ EnumDocument(self.aItemList,self.aComponentAdd)
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ self.sMyHost= ""
+
+ if not docinfo.getUserFieldValue(3) == "" and not docinfo.getUserFieldValue(0)=="":
+ self.sMyHost = docinfo.getUserFieldValue(0)
+ self.count = 0
+ oParEnum = doc.getTextFields().createEnumeration()
+
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ self.count += 1
+
+ getList(self.aObjectList, self.sMyHost,self.count)
+ cursor = doc.getCurrentController().getViewCursor()
+ text = cursor.getText()
+ tcur = text.createTextCursorByRange(cursor)
+
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == "Objects", self.aObjectList ) )
+
+ for i in range(len(self.aItemList)):
+ try:
+ anItem = self.aItemList[i][1]
+ component = self.aComponentAdd[i]
+
+ if component == "Document":
+ sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == sLVal, self.aObjectList ) )
+
+ if tcur.TextSection:
+ getRecersiveSection(tcur.TextSection,self.aSectionList)
+ if component in self.aSectionList:
+ sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == sLVal, self.aObjectList ) )
+
+ if tcur.TextTable:
+ if not component == "Document" and component[component.rfind(".")+1:] == tcur.TextTable.Name:
+ VariableScope(tcur, self.aVariableList, self.aObjectList, self.aComponentAdd, self.aItemList, component)
+ except:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('Fields', LOG_ERROR, info)
+
+ self.bModify=bFromModify
+ if self.bModify==True:
+ sItem=""
+ for anObject in self.aObjectList:
+ if anObject[:anObject.find("(")] == sVariable:
+ sItem = anObject
+ self.insVariable.setText(sItem)
+ genTree(
+ sItem[sItem.find("(")+1:sItem.find(")")],
+ self.aListFields,
+ self.insField,
+ self.sMyHost,
+ 2,
+ ending_excl=['one2many','many2one','many2many','reference'],
+ recur=['many2one']
+ )
+ self.sValue= self.win.getListBoxItem("lstFields",self.aListFields.index(sFields))
+ for var in self.aVariableList:
+
+ self.model_ids =self.sock.execute(database, uid, self.password, 'ir.model' , 'search', [('model','=',var[var.find("(")+1:var.find(")")])])
+ fields=['name','model']
+ self.model_res = self.sock.execute(database, uid, self.password, 'ir.model', 'read', self.model_ids,fields)
+ if self.model_res <> []:
+ self.insVariable.addItem(var[:var.find("(")+1] + self.model_res[0]['name'] + ")" ,self.insVariable.getItemCount())
+ else:
+ self.insVariable.addItem(var ,self.insVariable.getItemCount())
+
+ self.win.doModalDialog("lstFields",self.sValue)
+ else:
+ ErrorDialog("Please insert user define field Field-1 or Field-4","Just go to File->Properties->User Define \nField-1 Eg. http://localhost:8069 \nOR \nField-4 Eg. account.invoice")
+ self.win.endExecute()
+
+ def lstbox_selected(self,oItemEvent):
+ try:
+
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ sItem= self.win.getComboBoxText("cmbVariable")
+ for var in self.aVariableList:
+ if var[:var.find("(")+1]==sItem[:sItem.find("(")+1]:
+ sItem = var
+ sMain=self.aListFields[self.win.getListBoxSelectedItemPos("lstFields")]
+ sObject=self.getRes(self.sock,sItem[sItem.find("(")+1:-1],sMain[1:])
+ ids = self.sock.execute(database, uid, self.password, sObject , 'search', [])
+ res = self.sock.execute(database, uid, self.password, sObject , 'read',[ids[0]])
+ self.win.setEditText("txtUName",res[0][sMain[sMain.rfind("/")+1:]])
+ except:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('Fields', LOG_ERROR, info)
+ self.win.setEditText("txtUName","TTT")
+ if self.bModify:
+ self.win.setEditText("txtUName",self.sGDisplayName)
+
+ def getRes(self,sock ,sObject,sVar):
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ res = sock.execute(database, uid, self.password, sObject , 'fields_get')
+ key = res.keys()
+ key.sort()
+ myval=None
+ if not sVar.find("/")==-1:
+ myval=sVar[:sVar.find("/")]
+ else:
+ myval=sVar
+ if myval in key:
+ if (res[myval]['type'] in ['many2one']):
+ sObject = res[myval]['relation']
+ return self.getRes(sock,res[myval]['relation'], sVar[sVar.find("/")+1:])
+ else:
+ return sObject
+
+ def cmbVariable_selected(self,oItemEvent):
+ if self.count > 0 :
+ try:
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ self.win.removeListBoxItems("lstFields", 0, self.win.getListBoxItemCount("lstFields"))
+ self.aListFields=[]
+ tempItem = self.win.getComboBoxText("cmbVariable")
+ for var in self.aVariableList:
+ if var[:var.find("(")] == tempItem[:tempItem.find("(")]:
+ sItem=var
+
+ genTree(
+ sItem[sItem.find("(")+1:sItem.find(")")],
+ self.aListFields,
+ self.insField,
+ self.sMyHost,
+ 2,
+ ending_excl=['one2many','many2one','many2many','reference'],
+ recur=['many2one']
+ )
+ except:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('Fields', LOG_ERROR, info)
+
+ def btnOk_clicked( self, oActionEvent ):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ cursor = doc.getCurrentController().getViewCursor()
+ for i in self.win.getListBoxSelectedItemsPos("lstFields"):
+ itemSelected = self.aListFields[i]
+ itemSelectedPos = i
+ txtUName=self.win.getEditText("txtUName")
+ sKey=u""+txtUName
+ if itemSelected != "" and txtUName != "" and self.bModify==True :
+ txtUName=self.sGDisplayName
+ sKey=u""+txtUName
+ txtUName=self.sGDisplayName
+ oCurObj=cursor.TextField
+ sObjName=self.insVariable.getText()
+ sObjName=sObjName[:sObjName.find("(")]
+ sValue=u"[[ " + sObjName + self.aListFields[itemSelectedPos].replace("/",".") + " ]]"
+ oCurObj.Items = (sKey,sValue)
+ oCurObj.update()
+ self.win.endExecute()
+ elif itemSelected != "" and txtUName != "" :
+
+ oInputList = doc.createInstance("com.sun.star.text.TextField.DropDown")
+ sObjName=self.win.getComboBoxText("cmbVariable")
+ sObjName=sObjName[:sObjName.find("(")]
+
+ widget = ( cursor.TextTable and cursor.TextTable.getCellByName( cursor.Cell.CellName ) or doc.Text )
+
+ sValue = u"[[ " + sObjName + self.aListFields[itemSelectedPos].replace("/",".") + " ]]"
+ oInputList.Items = (sKey,sValue)
+ widget.insertTextContent(cursor,oInputList,False)
+ self.win.endExecute()
+ else:
+ ErrorDialog("Please Fill appropriate data in Name field \nor select perticular value from the list of fields")
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+if __name__<>"package" and __name__=="__main__":
+ Fields()
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( Fields, "org.openoffice.openerp.report.fields", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/LoginTest.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/LoginTest.py
new file mode 100644
index 00000000000..507ec28efb8
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/LoginTest.py
@@ -0,0 +1,55 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+if __name__<>"package":
+ from ServerParameter import *
+ from lib.gui import *
+
+class LoginTest:
+ def __init__(self):
+ if not loginstatus:
+ ServerParameter(None)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ModifyExistingReport.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ModifyExistingReport.py
new file mode 100644
index 00000000000..cc1d30ba6b0
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ModifyExistingReport.py
@@ -0,0 +1,213 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+import string
+import unohelper
+import xmlrpclib
+import base64, tempfile
+
+
+from com.sun.star.task import XJobExecutor
+import os
+import sys
+if __name__<>'package':
+ from lib.gui import *
+ from lib.error import *
+ from LoginTest import *
+ from lib.logreport import *
+ from lib.rpc import *
+ database="test"
+ uid = 3
+
+#
+class ModifyExistingReport(unohelper.Base, XJobExecutor):
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+
+ LoginTest()
+ if not loginstatus and __name__=="package":
+ exit(1)
+
+ self.win = DBModalDialog(60, 50, 180, 120, "Modify Existing Report")
+ self.win.addFixedText("lblReport", 2, 3, 60, 15, "Report Selection")
+ self.win.addComboListBox("lstReport", -1,15,178,80 , False )
+ self.lstReport = self.win.getControl( "lstReport" )
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ self.logobj=Logger()
+ self.hostname = docinfo.getUserFieldValue(0)
+ global passwd
+ self.password = passwd
+ global url
+ self.sock=RPCSession(url)
+ # Open a new connexion to the server
+
+
+ ids = self.sock.execute(database, uid, self.password, 'ir.module.module', 'search', [('name','=','base_report_designer'),('state', '=', 'installed')])
+ if not len(ids):
+ ErrorDialog("Please Install base_report_designer module", "", "Module Uninstalled Error")
+ exit(1)
+
+ ids = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'search', [('report_xsl', '=', False),('report_xml', '=', False)])
+
+ fields=['id', 'name','report_name','model']
+
+ self.reports = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'read', ids, fields)
+ self.report_with_id = []
+
+ for report in self.reports:
+ if report['name']<>"":
+ model_ids = self.sock.execute(database, uid, self.password, 'ir.model' , 'search', [('model','=', report['model'])])
+ model_res_other =self.sock.execute(database, uid, self.password, 'ir.model', 'read', model_ids, [ 'name', 'model' ] )
+ if model_res_other <> []:
+ name = model_res_other[0]['name'] + " - " + report['name']
+ else:
+ name = report['name'] + " - " + report['model']
+ self.report_with_id.append( (report['id'], name, report['model'] ) )
+
+ self.report_with_id.sort( lambda x, y: cmp( x[1], y[1] ) )
+
+ for id, report_name, model_name in self.report_with_id:
+ self.lstReport.addItem( report_name, self.lstReport.getItemCount() )
+
+ self.win.addButton('btnSave',10,-5,50,15,'Open Report' ,actionListenerProc = self.btnOk_clicked )
+ self.win.addButton('btnCancel',-10 ,-5,50,15,'Cancel' ,actionListenerProc = self.btnCancel_clicked )
+ self.win.addButton('btnDelete',15 -80 ,-5,50,15,'Delete Report',actionListenerProc = self.btnDelete_clicked)
+ self.win.doModalDialog("lstReport",self.report_with_id[0][1] )
+
+ def btnOk_clicked(self, oActionEvent):
+ try:
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+
+ selectedItemPos = self.win.getListBoxSelectedItemPos( "lstReport" )
+ id = self.report_with_id[ selectedItemPos ][0]
+
+ res = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'report_get', id)
+
+ if res['file_type'] in ['sxw','odt'] :
+ file_type = res['file_type']
+ else :
+ file_type = 'sxw'
+
+ fp_name = tempfile.mktemp('.'+file_type)
+ fp_name1="r"+fp_name
+ fp_path=os.path.join(fp_name1).replace("\\","/")
+ fp_win=fp_path[1:]
+
+ filename = ( os.name == 'nt' and fp_win or fp_name )
+ if res['report_sxw_content']:
+ write_data_to_file( filename, base64.decodestring(res['report_sxw_content']))
+ url = "file:///%s" % filename
+
+ arr=Array(makePropertyValue("MediaType","application/vnd.sun.xml.writer"),)
+ oDoc2 = desktop.loadComponentFromURL(url, "openerp", 55, arr)
+ docinfo2=oDoc2.getDocumentInfo()
+ docinfo2.setUserFieldValue(0, self.hostname)
+ docinfo2.setUserFieldValue(1,self.password)
+ docinfo2.setUserFieldValue(2,id)
+ docinfo2.setUserFieldValue(3,self.report_with_id[selectedItemPos][2])
+
+ oParEnum = oDoc2.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ oPar.SelectedItem = oPar.Items[0]
+ oPar.update()
+ if oDoc2.isModified():
+ if oDoc2.hasLocation() and not oDoc2.isReadonly():
+ oDoc2.store()
+
+ ErrorDialog("Download is Completed","Your file has been placed here :\n"+ fp_name,"Download Message")
+ obj=Logger()
+ obj.log_write('Modify Existing Report',LOG_INFO, ':successful download report %s using database %s' % (self.report_with_id[selectedItemPos][2], database))
+ except Exception, e:
+ ErrorDialog("Report has not been downloaded", "Report: %s\nDetails: %s" % ( fp_name, str(e) ),"Download Message")
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ModifyExistingReport', LOG_ERROR, info)
+
+ self.win.endExecute()
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+ def btnDelete_clicked( self, oActionEvent ):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+
+ selectedItemPos = self.win.getListBoxSelectedItemPos( "lstReport" )
+ name=self.win.getListBoxSelectedItem ("lstReport")
+ id = self.report_with_id[ selectedItemPos ][0]
+ temp = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'unlink', id,)
+ str_value='ir.actions.report.xml,'+str(id)
+ ids = self.sock.execute(database, uid, self.password, 'ir.values' , 'search',[('value','=',str_value)])
+ if ids:
+ rec = self.sock.execute(database, uid, self.password, 'ir.values', 'unlink', ids,)
+ else :
+ pass
+ if temp:
+ ErrorDialog("Report","Report has been Delete:\n "+name,"Message")
+ self.logobj.log_write('Delete Report',LOG_INFO, ':successful delete report %s using database %s' % (name, database))
+
+ else:
+ ErrorDialog("Report","Report has not Delete:\n"+name," Message")
+ self.win.endExecute()
+
+
+
+if __name__<>"package" and __name__=="__main__":
+ ModifyExistingReport(None)
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( ModifyExistingReport, "org.openoffice.openerp.report.modifyreport", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/NewReport.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/NewReport.py
new file mode 100644
index 00000000000..06ba55275d5
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/NewReport.py
@@ -0,0 +1,119 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import uno
+import string
+import unohelper
+import xmlrpclib
+
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from lib.error import ErrorDialog
+ from lib.functions import *
+ from lib.logreport import *
+ from LoginTest import *
+ from lib.rpc import *
+ database="test"
+ uid = 3
+#
+#
+#
+# Start OpenOffice.org, listen for connections and open testing document
+#
+#
+class NewReport(unohelper.Base, XJobExecutor):
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ LoginTest()
+ self.logobj=Logger()
+ if not loginstatus and __name__=="package":
+ exit(1)
+ self.win=DBModalDialog(60, 50, 180, 115, "Open New Report")
+ self.win.addFixedText("lblModuleSelection", 2, 2, 60, 15, "Module Selection")
+ self.win.addComboListBox("lstModule", -2,13,176,80 , False)
+ self.lstModule = self.win.getControl( "lstModule" )
+ self.aModuleName=[]
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+
+ global passwd
+ self.password = passwd
+ global url
+ self.sock=RPCSession(url)
+ ids = self.sock.execute(database, uid, self.password, 'ir.model' , 'search',[])
+ fields = [ 'model','name']
+ res = self.sock.execute(database, uid, self.password, 'ir.model' , 'read', ids, fields)
+ res.sort(lambda x, y: cmp(x['name'],y['name']))
+
+ for i in range(len(res)):
+ self.lstModule.addItem(res[i]['name'],self.lstModule.getItemCount())
+ self.aModuleName.append(res[i]['model'])
+ self.win.addButton('btnOK',-2 ,-5, 70,15,'Use Module in Report' ,actionListenerProc = self.btnOk_clicked )
+ self.win.addButton('btnCancel',-2 - 70 - 5 ,-5, 35,15,'Cancel' ,actionListenerProc = self.btnCancel_clicked )
+ self.win.doModalDialog("",None)
+
+ def btnOk_clicked(self,oActionEvent):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ docinfo.setUserFieldValue(3,self.aModuleName[self.lstModule.getSelectedItemPos()])
+ self.logobj.log_write('Module Name',LOG_INFO, ':Module use in creating a report %s using database %s' % (self.aModuleName[self.lstModule.getSelectedItemPos()], database))
+ self.win.endExecute()
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+if __name__<>"package" and __name__=="__main__":
+ NewReport(None)
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( \
+ NewReport,
+ "org.openoffice.openerp.report.opennewreport",
+ ("com.sun.star.task.Job",),)
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Repeatln.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Repeatln.py
new file mode 100644
index 00000000000..4e26508f106
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Repeatln.py
@@ -0,0 +1,300 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import uno
+import string
+import unohelper
+import xmlrpclib
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from lib.error import ErrorDialog
+ from lib.functions import *
+ from ServerParameter import *
+ from lib.logreport import *
+ from lib.rpc import *
+ from LoginTest import *
+
+ database="test_db1"
+ uid = 3
+
+
+#class RepeatIn:
+class RepeatIn( unohelper.Base, XJobExecutor ):
+ def __init__(self,sObject="",sVariable="",sFields="",sDisplayName="",bFromModify=False):
+ # Interface Design
+ LoginTest()
+ self.logobj=Logger()
+ if not loginstatus and __name__=="package":
+ exit(1)
+
+ self.win = DBModalDialog(60, 50, 180, 250, "RepeatIn Builder")
+ self.win.addFixedText("lblVariable", 2, 12, 60, 15, "Objects to loop on :")
+ self.win.addComboBox("cmbVariable", 180-120-2, 10, 120, 15,True, itemListenerProc=self.cmbVariable_selected)
+ self.insVariable = self.win.getControl( "cmbVariable" )
+
+ self.win.addFixedText("lblFields", 10, 32, 60, 15, "Field to loop on :")
+ self.win.addComboListBox("lstFields", 180-120-2, 30, 120, 150, False,itemListenerProc=self.lstbox_selected)
+ self.insField = self.win.getControl( "lstFields" )
+
+ self.win.addFixedText("lblName", 12, 187, 60, 15, "Variable name :")
+ self.win.addEdit("txtName", 180-120-2, 185, 120, 15,)
+
+ self.win.addFixedText("lblUName", 8, 207, 60, 15, "Displayed name :")
+ self.win.addEdit("txtUName", 180-120-2, 205, 120, 15,)
+
+ self.win.addButton('btnOK',-2 ,-10,45,15,'Ok', actionListenerProc = self.btnOk_clicked )
+
+ self.win.addButton('btnCancel',-2 - 45 - 5 ,-10,45,15,'Cancel', actionListenerProc = self.btnCancel_clicked )
+
+ global passwd
+ self.password = passwd
+ global url
+ self.sock=RPCSession(url)
+ # Variable Declaration
+ self.sValue=None
+ self.sObj=None
+ self.aSectionList=[]
+ self.sGVariable=sVariable
+ self.sGDisplayName=sDisplayName
+ self.aItemList=[]
+ self.aComponentAdd=[]
+ self.aObjectList=[]
+ self.aListRepeatIn=[]
+ self.aVariableList=[]
+ # Call method to perform Enumration on Report Document
+ EnumDocument(self.aItemList,self.aComponentAdd)
+ # Perform checking that Field-1 and Field - 4 is available or not alos get Combobox
+ # filled if condition is true
+ desktop = getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo = doc.getDocumentInfo()
+ # Check weather Field-1 is available if not then exit from application
+ self.sMyHost= ""
+
+ if not docinfo.getUserFieldValue(3) == "" and not docinfo.getUserFieldValue(0)=="":
+ self.sMyHost= docinfo.getUserFieldValue(0)
+ self.count=0
+ oParEnum = doc.getTextFields().createEnumeration()
+
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ self.count += 1
+
+ getList(self.aObjectList, self.sMyHost,self.count)
+ cursor = doc.getCurrentController().getViewCursor()
+ text = cursor.getText()
+ tcur = text.createTextCursorByRange(cursor)
+
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find(" ")] == "List", self.aObjectList ) )
+
+ for i in range(len(self.aItemList)):
+ try:
+ anItem = self.aItemList[i][1]
+ component = self.aComponentAdd[i]
+
+ if component == "Document":
+ sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == sLVal, self.aObjectList ) )
+
+ if tcur.TextSection:
+ getRecersiveSection(tcur.TextSection,self.aSectionList)
+ if component in self.aSectionList:
+ sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == sLVal, self.aObjectList ) )
+
+ if tcur.TextTable:
+ if not component == "Document" and component[component.rfind(".") + 1:] == tcur.TextTable.Name:
+ VariableScope( tcur, self.aVariableList, self.aObjectList, self.aComponentAdd, self.aItemList, component )
+ except :
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('RepeatIn', LOG_ERROR, info)
+ self.bModify=bFromModify
+
+ if self.bModify==True:
+
+ if sObject=="":
+ self.insVariable.setText("List of "+docinfo.getUserFieldValue(3))
+ self.insField.addItem("objects",self.win.getListBoxItemCount("lstFields"))
+ self.win.setEditText("txtName", sVariable)
+ self.win.setEditText("txtUName",sDisplayName)
+ self.sValue= "objects"
+ else:
+ sItem=""
+ for anObject in self.aObjectList:
+ if anObject[:anObject.find("(")] == sObject:
+ sItem = anObject
+ self.insVariable.setText( sItem )
+
+ genTree(
+ sItem[sItem.find("(")+1:sItem.find(")")],
+ self.aListRepeatIn,
+ self.insField,
+ self.sMyHost,
+ 2,
+ ending=['one2many','many2many'],
+ recur=['one2many','many2many']
+ )
+
+ self.sValue= self.win.getListBoxItem("lstFields",self.aListRepeatIn.index(sFields))
+
+ for var in self.aVariableList:
+
+ if var[:8] <> 'List of ':
+ self.model_ids = self.sock.execute(database, uid, self.password, 'ir.model' , 'search', [('model','=',var[var.find("(")+1:var.find(")")])])
+ else:
+ self.model_ids = self.sock.execute(database, uid, self.password, 'ir.model' , 'search', [('model','=',var[8:])])
+ fields=['name','model']
+ self.model_res = self.sock.execute(database, uid, self.password, 'ir.model', 'read', self.model_ids,fields)
+ if self.model_res <> []:
+ if var[:8]<>'List of ':
+ self.insVariable.addItem(var[:var.find("(")+1] + self.model_res[0]['name'] + ")" ,self.insVariable.getItemCount())
+ else:
+ self.insVariable.addItem('List of ' + self.model_res[0]['name'] ,self.insVariable.getItemCount())
+ else:
+ self.insVariable.addItem(var ,self.insVariable.getItemCount())
+
+ self.win.doModalDialog("lstFields",self.sValue)
+ else:
+ ErrorDialog("Please Select Appropriate module" ,"Create new report from: \nOpenERP -> Open a New Report")
+ self.win.endExecute()
+
+ def lstbox_selected(self,oItemEvent):
+ sItem=self.win.getListBoxSelectedItem("lstFields")
+ sMain=self.aListRepeatIn[self.win.getListBoxSelectedItemPos("lstFields")]
+
+ if self.bModify==True:
+ self.win.setEditText("txtName", self.sGVariable)
+ self.win.setEditText("txtUName",self.sGDisplayName)
+ else:
+ self.win.setEditText("txtName",sMain[sMain.rfind("/")+1:])
+ self.win.setEditText("txtUName","|-."+sItem[sItem.rfind("/")+1:]+".-|")
+
+ def cmbVariable_selected(self,oItemEvent):
+
+ if self.count > 0 :
+
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ self.win.removeListBoxItems("lstFields", 0, self.win.getListBoxItemCount("lstFields"))
+ sItem=self.win.getComboBoxText("cmbVariable")
+ for var in self.aVariableList:
+ if var[:8]=='List of ':
+ if var[:8]==sItem[:8]:
+ sItem = var
+ elif var[:var.find("(")+1] == sItem[:sItem.find("(")+1]:
+ sItem = var
+ self.aListRepeatIn=[]
+
+ data = ( sItem[sItem.rfind(" ") + 1:] == docinfo.getUserFieldValue(3) ) and docinfo.getUserFieldValue(3) or sItem[sItem.find("(")+1:sItem.find(")")]
+ genTree( data, self.aListRepeatIn, self.insField, self.sMyHost, 2, ending=['one2many','many2many'], recur=['one2many','many2many'] )
+
+ self.win.selectListBoxItemPos("lstFields", 0, True )
+
+ else:
+ sItem=self.win.getComboBoxText("cmbVariable")
+ for var in self.aVariableList:
+ if var[:8]=='List of ' and var[:8] == sItem[:8]:
+ sItem = var
+ if sItem.find(".")==-1:
+ temp=sItem[sItem.rfind("x_"):]
+ else:
+ temp=sItem[sItem.rfind(".")+1:]
+ self.win.setEditText("txtName",temp)
+ self.win.setEditText("txtUName","|-."+temp+".-|")
+ self.insField.addItem("objects",self.win.getListBoxItemCount("lstFields"))
+ self.win.selectListBoxItemPos("lstFields", 0, True )
+
+ def btnOk_clicked(self, oActionEvent):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ cursor = doc.getCurrentController().getViewCursor()
+ selectedItem = self.win.getListBoxSelectedItem( "lstFields" )
+ selectedItemPos = self.win.getListBoxSelectedItemPos( "lstFields" )
+ txtName = self.win.getEditText( "txtName" )
+ txtUName = self.win.getEditText( "txtUName" )
+ if selectedItem != "" and txtName != "" and txtUName != "":
+ sKey=u""+ txtUName
+ if selectedItem == "objects":
+ sValue=u"[[ repeatIn(" + selectedItem + ",'" + txtName + "') ]]"
+ else:
+ sObjName=self.win.getComboBoxText("cmbVariable")
+ sObjName=sObjName[:sObjName.find("(")]
+ sValue=u"[[ repeatIn(" + sObjName + self.aListRepeatIn[selectedItemPos].replace("/",".") + ",'" + txtName +"') ]]"
+
+ if self.bModify == True:
+ oCurObj = cursor.TextField
+ oCurObj.Items = (sKey,sValue)
+ oCurObj.update()
+ else:
+ oInputList = doc.createInstance("com.sun.star.text.TextField.DropDown")
+ if self.win.getListBoxSelectedItem("lstFields") == "objects":
+ oInputList.Items = (sKey,sValue)
+ doc.Text.insertTextContent(cursor,oInputList,False)
+ else:
+ sValue=u"[[ repeatIn(" + sObjName + self.aListRepeatIn[selectedItemPos].replace("/",".") + ",'" + txtName +"') ]]"
+ if cursor.TextTable==None:
+ oInputList.Items = (sKey,sValue)
+ doc.Text.insertTextContent(cursor,oInputList,False)
+ else:
+ oInputList.Items = (sKey,sValue)
+ widget = ( cursor.TextTable or selectedItem <> 'objects' ) and cursor.TextTable.getCellByName( cursor.Cell.CellName ) or doc.Text
+ widget.insertTextContent(cursor,oInputList,False)
+ self.win.endExecute()
+ else:
+ ErrorDialog("Please Fill appropriate data in Object Field or Name field \nor select perticular value from the list of fields")
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+if __name__<>"package" and __name__=="__main__":
+ RepeatIn()
+elif __name__=="package":
+ g_ImplementationHelper = unohelper.ImplementationHelper()
+ g_ImplementationHelper.addImplementation( RepeatIn, "org.openoffice.openerp.report.repeatln", ("com.sun.star.task.Job",),)
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/SendToServer.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/SendToServer.py
new file mode 100644
index 00000000000..fd8a874749d
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/SendToServer.py
@@ -0,0 +1,241 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+import string
+import unohelper
+import random
+import xmlrpclib
+import base64, tempfile
+from com.sun.star.task import XJobExecutor
+import os
+import sys
+if __name__<>'package':
+ from lib.gui import *
+ from lib.error import *
+ from lib.functions import *
+ from lib.logreport import *
+ from lib.tools import *
+ from LoginTest import *
+ from lib.rpc import *
+ database="report"
+ uid = 3
+
+#
+#
+class SendtoServer(unohelper.Base, XJobExecutor):
+ Kind = {
+ 'PDF' : 'pdf',
+ 'OpenOffice': 'sxw',
+ 'HTML' : 'html'
+ }
+
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ LoginTest()
+ self.logobj=Logger()
+ if not loginstatus and __name__=="package":
+ exit(1)
+
+ global passwd
+ self.password = passwd
+ global url
+ self.sock=RPCSession(url)
+ desktop=getDesktop()
+ oDoc2 = desktop.getCurrentComponent()
+ docinfo=oDoc2.getDocumentInfo()
+
+ self.ids = self.sock.execute(database, uid, self.password, 'ir.module.module', 'search', [('name','=','base_report_designer'),('state', '=', 'installed')])
+ if not len(self.ids):
+ ErrorDialog("Please Install base_report_designer module", "", "Module Uninstalled Error")
+ exit(1)
+
+ report_name = ""
+ name=""
+ if docinfo.getUserFieldValue(2)<>"" :
+ try:
+ fields=['name','report_name']
+ self.res_other = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'read', [int(docinfo.getUserFieldValue(2))],fields)
+ name = self.res_other[0]['name']
+ report_name = self.res_other[0]['report_name']
+ except:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logob.log_write('ServerParameter', LOG_ERROR, info)
+ elif docinfo.getUserFieldValue(3) <> "":
+ name = ""
+ result = "rnd"
+ for i in range(5):
+ result =result + random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
+
+ report_name = docinfo.getUserFieldValue(3) + "." + result
+ else:
+ ErrorDialog("Please select appropriate module...","Note: use OpenERP Report -> Open a new Report", "Module selection ERROR");
+ exit(1)
+
+ self.win = DBModalDialog(60, 50, 180, 100, "Send To Server")
+ self.win.addFixedText("lblName",10 , 9, 40, 15, "Report Name :")
+ self.win.addEdit("txtName", -5, 5, 123, 15,name)
+ self.win.addFixedText("lblReportName", 2, 30, 50, 15, "Technical Name :")
+ self.win.addEdit("txtReportName", -5, 25, 123, 15,report_name)
+ self.win.addCheckBox("chkHeader", 51, 45, 70 ,15, "Corporate Header")
+ self.win.addFixedText("lblResourceType", 2 , 60, 50, 15, "Select Rpt. Type :")
+ self.win.addComboListBox("lstResourceType", -5, 58, 123, 15,True,itemListenerProc=self.lstbox_selected)
+ self.lstResourceType = self.win.getControl( "lstResourceType" )
+ self.txtReportName=self.win.getControl( "txtReportName" )
+ self.txtReportName.Enable=False
+ for kind in self.Kind.keys():
+ self.lstResourceType.addItem( kind, self.lstResourceType.getItemCount() )
+
+ self.win.addButton( "btnSend", -5, -5, 80, 15, "Send Report to Server", actionListenerProc = self.btnOk_clicked)
+ self.win.addButton( "btnCancel", -5 - 80 -5, -5, 40, 15, "Cancel", actionListenerProc = self.btnCancel_clicked)
+
+ self.win.doModalDialog("lstResourceType", self.Kind.keys()[0])
+
+ def lstbox_selected(self,oItemEvent):
+ pass
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+ def btnOk_clicked(self, oActionEvent):
+ if self.win.getEditText("txtName") <> "" and self.win.getEditText("txtReportName") <> "":
+ desktop=getDesktop()
+ oDoc2 = desktop.getCurrentComponent()
+ docinfo=oDoc2.getDocumentInfo()
+ self.getInverseFieldsRecord(1)
+ fp_name = tempfile.mktemp('.'+"sxw")
+ if not oDoc2.hasLocation():
+ oDoc2.storeAsURL("file://"+fp_name,Array(makePropertyValue("MediaType","application/vnd.sun.xml.writer"),))
+
+ if docinfo.getUserFieldValue(2)=="":
+ name=self.win.getEditText("txtName"),
+ name_id={}
+ try:
+ name_id = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml' , 'search',[('name','=',name)])
+ if not name_id:
+ id=self.getID()
+ docinfo.setUserFieldValue(2,id)
+ rec = {
+ 'name': self.win.getEditText("txtReportName"),
+ 'key': 'action',
+ 'model': docinfo.getUserFieldValue(3),
+ 'value': 'ir.actions.report.xml,'+str(id),
+ 'key2': 'client_print_multi',
+ 'object': True
+ }
+ res = self.sock.execute(database, uid, self.password, 'ir.values' , 'create',rec )
+ else :
+ ErrorDialog(" Report Name is all ready given !!!\n\n\n Please specify other Name","","Report Name")
+ self.logobj.log_write('SendToServer',LOG_WARNING, ':Report name all ready given DB %s' % (database))
+ self.win.endExecute()
+ except Exception,e:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ServerParameter', LOG_ERROR, info)
+ else:
+
+ id = docinfo.getUserFieldValue(2)
+ vId = self.sock.execute(database, uid, self.password, 'ir.values' , 'search', [('value','=','ir.actions.report.xml,'+str(id))])
+ rec = { 'name': self.win.getEditText("txtReportName") }
+ res = self.sock.execute(database, uid, self.password, 'ir.values' , 'write',vId,rec)
+ oDoc2.store()
+ data = read_data_from_file( get_absolute_file_path( oDoc2.getURL()[7:] ) )
+ self.getInverseFieldsRecord(0)
+ #sock = xmlrpclib.ServerProxy(docinfo.getUserFieldValue(0) +'/xmlrpc/object')
+
+ file_type = oDoc2.getURL()[7:].split(".")[-1]
+ res = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'upload_report', int(docinfo.getUserFieldValue(2)),base64.encodestring(data),file_type,{})
+ params = {
+ 'name': self.win.getEditText("txtName"),
+ 'model': docinfo.getUserFieldValue(3),
+ 'report_name': self.win.getEditText("txtReportName"),
+ 'header': (self.win.getCheckBoxState("chkHeader") <> 0),
+ 'report_type': self.Kind[self.win.getListBoxSelectedItem("lstResourceType")],
+ }
+ if self.win.getListBoxSelectedItem("lstResourceType")=='OpenOffice':
+ params['report_type']=file_type
+ res = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'write', int(docinfo.getUserFieldValue(2)), params)
+ self.logobj.log_write('SendToServer',LOG_INFO, ':Report %s successfully send using %s'%(params['name'],database))
+ self.win.endExecute()
+ else:
+ ErrorDialog("Either Report Name or Technical Name is blank !!!\nPlease specify appropriate Name","","Blank Field ERROR")
+ self.logobj.log_write('SendToServer',LOG_WARNING, ':Either Report Name or Technical Name is blank')
+ self.win.endExecute()
+
+ def getID(self):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ params = {
+ 'name': self.win.getEditText("txtName"),
+ 'model': docinfo.getUserFieldValue(3),
+ 'report_name': self.win.getEditText('txtReportName')
+ }
+
+
+ id=self.sock.execute(database, uid, self.password, 'ir.actions.report.xml' ,'create', params)
+ return id
+
+ def getInverseFieldsRecord(self,nVal):
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ count=0
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ oPar.SelectedItem = oPar.Items[nVal]
+ if nVal==0:
+ oPar.update()
+
+if __name__<>"package" and __name__=="__main__":
+ SendtoServer(None)
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( SendtoServer, "org.openoffice.openerp.report.sendtoserver", ("com.sun.star.task.Job",),)
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ServerParameter.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ServerParameter.py
new file mode 100644
index 00000000000..659357ef100
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/ServerParameter.py
@@ -0,0 +1,208 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import uno
+import string
+import unohelper
+import xmlrpclib
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from lib.error import ErrorDialog
+ from lib.functions import *
+ from lib.logreport import *
+ from lib.rpc import *
+ from Change import *
+ database="test"
+
+class ServerParameter( unohelper.Base, XJobExecutor ):
+ def __init__(self,ctx):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+ desktop=getDesktop()
+ log_detail(self)
+ self.logobj=Logger()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ self.win=DBModalDialog(60, 50, 160, 108, "Server Connection Parameter")
+
+ self.win.addFixedText("lblVariable", 2, 12, 35, 15, "Server URL")
+ if docinfo.getUserFieldValue(0)=="":
+ docinfo.setUserFieldValue(0,"http://localhost:8069")
+ self.win.addEdit("txtHost",-34,9,91,15,docinfo.getUserFieldValue(0))
+ self.win.addButton('btnChange',-2 ,9,30,15,'Change', actionListenerProc = self.btnChange_clicked )
+
+ self.win.addFixedText("lblDatabaseName", 6, 31, 31, 15, "Database")
+ #self.win.addFixedText("lblMsg", -2,28,123,15)
+# self.win.addComboListBox("lstDatabase", -2,28,123,15, True)
+# self.lstDatabase = self.win.getControl( "lstDatabase" )
+ #self.win.selectListBoxItem( "lstDatabase", docinfo.getUserFieldValue(2), True )
+ #self.win.setEnabled("lblMsg",False)
+
+ self.win.addFixedText("lblLoginName", 17, 51, 20, 15, "Login")
+ self.win.addEdit("txtLoginName",-2,48,123,15,docinfo.getUserFieldValue(1))
+
+ self.win.addFixedText("lblPassword", 6, 70, 31, 15, "Password")
+ self.win.addEdit("txtPassword",-2,67,123,15,)
+ self.win.setEchoChar("txtPassword",42)
+
+
+ self.win.addButton('btnOK',-2 ,-5, 60,15,'Connect' ,actionListenerProc = self.btnOk_clicked )
+
+ self.win.addButton('btnCancel',-2 - 60 - 5 ,-5, 35,15,'Cancel' ,actionListenerProc = self.btnCancel_clicked )
+ sValue=""
+ if docinfo.getUserFieldValue(0)<>"":
+ global url
+ global result
+ url=docinfo.getUserFieldValue(0)
+ self.sock=RPCSession(url)
+ res=self.sock.listdb()
+ result=res
+ if res == -1:
+ self.win.addEdit("lstDatabase",-2,28,123,15)
+# sValue="Could not connect to the server!"
+# self.lstDatabase.addItem("Could not connect to the server!",0)
+ elif res == 0:
+ sValue="No Database found !!!"
+ self.lstDatabase.addItem("No Database found !!!",0)
+ else:
+ self.win.addComboListBox("lstDatabase", -2,28,123,15, True)
+ self.lstDatabase = self.win.getControl( "lstDatabase" )
+ self.win.removeListBoxItems("lstDatabase", 0, self.win.getListBoxItemCount("lstDatabase"))
+ for i in range(len(res)):
+ self.lstDatabase.addItem(res[i],i)
+ sValue = database
+ if sValue:
+ self.win.doModalDialog("lstDatabase",sValue)
+ else:
+ self.win.doModalDialog("lstDatabase",None)
+
+ #self.win.doModalDialog("lstDatabase",docinfo.getUserFieldValue(2))
+
+ def btnOk_clicked(self,oActionEvent):
+
+
+ sLogin=self.win.getEditText("txtLoginName")
+ sPassword=self.win.getEditText("txtPassword")
+ global url
+ global result
+ if result==-1:
+ sDatabase=self.win.getEditText("lstDatabase")
+ else:
+ sDatabase=self.win.getListBoxSelectedItem("lstDatabase")
+ self.sock=RPCSession(url)
+ UID = self.sock.login(sDatabase,sLogin,sPassword)
+ if not UID :
+ ErrorDialog("Connection Refuse...","Please enter valid Login/Password")
+ self.win.endExecute()
+ try:
+
+ ids = self.sock.execute(sDatabase,UID,sPassword, 'res.groups' , 'search', [('name','=','OpenOfficeReportDesigner')])
+ ids_module =self.sock.execute(sDatabase, UID, sPassword, 'ir.module.module', 'search', [('name','=','base_report_designer'),('state', '=', 'installed')])
+ dict_groups =self.sock.execute(sDatabase, UID,sPassword, 'res.groups' , 'read',ids,['users'])
+ except :
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ self.logobj.log_write('ServerParameter', LOG_ERROR, info)
+
+ if not len(ids) :
+ ErrorDialog("Group Not Found!!! Create a group named \n\n"'"OpenOfficeReportDesigner"'" \n\n ","","Group Name Error")
+ self.logobj.log_write('Group Error',LOG_WARNING, ':Create a group OpenOfficeReportDesigner using database %s' % (sDatabase))
+ self.win.endExecute()
+ if not len(ids_module):
+ ErrorDialog("Please Install base_report_designer module", "", "Module Uninstalled Error")
+ self.logobj.log_write('Module Not Found',LOG_WARNING, ':base_report_designer not install in database %s' % (sDatabase))
+ self.win.endExecute()
+
+ if UID not in dict_groups[0]['users']:
+ ErrorDialog("Connection Refuse...","You have not access these Report Designer")
+ self.logobj.log_write('Connection Refuse',LOG_WARNING, " Not Access Report Designer ")
+ self.win.endExecute()
+ else:
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ docinfo.setUserFieldValue(0,self.win.getEditText("txtHost"))
+ docinfo.setUserFieldValue(1,self.win.getEditText("txtLoginName"))
+ global passwd
+ passwd=self.win.getEditText("txtPassword")
+ global loginstatus
+ loginstatus=True
+ global database
+ database=sDatabase
+ global uid
+ uid=UID
+ #docinfo.setUserFieldValue(2,self.win.getListBoxSelectedItem("lstDatabase"))
+ #docinfo.setUserFieldValue(3,"")
+
+ ErrorDialog(" You can start creating your report in \n \t the current document.","After Creating sending to the server.","Message")
+ self.logobj.log_write('successful login',LOG_INFO, ':successful login from %s using database %s' % (sLogin, sDatabase))
+ self.win.endExecute()
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+ def btnChange_clicked(self,oActionEvent):
+ aVal=[]
+ url= self.win.getEditText("txtHost")
+ Change(aVal,url)
+ if aVal[1]== -1:
+ self.win.getEditText("lstDatabase")
+ elif aVal[1]==0:
+ ErrorDialog(aVal[0],"")
+ else:
+ self.win.setEditText("txtHost",aVal[0])
+ self.win.removeListBoxItems("lstDatabase", 0, self.win.getListBoxItemCount("lstDatabase"))
+ for i in range(len(aVal[1])):
+ self.lstDatabase.addItem(aVal[1][i],i)
+
+
+if __name__<>"package" and __name__=="__main__":
+ ServerParameter(None)
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( ServerParameter, "org.openoffice.openerp.report.serverparam", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Translation.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Translation.py
new file mode 100644
index 00000000000..e1df582c1e5
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/Translation.py
@@ -0,0 +1,274 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+import string
+import unohelper
+import xmlrpclib
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from lib.functions import *
+ from lib.error import ErrorDialog
+ from LoginTest import *
+ from lib.rpc import *
+ database="test_001"
+ uid = 3
+
+
+class AddLang(unohelper.Base, XJobExecutor ):
+ def __init__(self,sVariable="",sFields="",sDisplayName="",bFromModify=False):
+ LoginTest()
+ if not loginstatus and __name__=="package":
+ exit(1)
+ global passwd
+ self.password = passwd
+ self.win = DBModalDialog(60, 50, 180, 225, "Set Lang Builder")
+
+ self.win.addFixedText("lblVariable", 27, 12, 60, 15, "Variable :")
+ self.win.addComboBox("cmbVariable", 180-120-2, 10, 120, 15,True,
+ itemListenerProc=self.cmbVariable_selected)
+ self.insVariable = self.win.getControl( "cmbVariable" )
+
+ self.win.addFixedText("lblFields", 10, 32, 60, 15, "Variable Fields :")
+ self.win.addComboListBox("lstFields", 180-120-2, 30, 120, 150, False,itemListenerProc=self.lstbox_selected)
+ self.insField = self.win.getControl( "lstFields" )
+ self.win.addFixedText("lblUName", 8, 187, 60, 15, "Displayed name :")
+ self.win.addEdit("txtUName", 180-120-2, 185, 120, 15,)
+
+ self.win.addButton('btnOK',-5 ,-5, 45, 15, 'Ok', actionListenerProc = self.btnOk_clicked )
+ self.win.addButton('btnCancel',-5 - 45 - 5 ,-5,45,15,'Cancel', actionListenerProc = self.btnCancel_clicked )
+ self.sValue=None
+ self.sObj=None
+ self.aSectionList=[]
+ self.sGDisplayName=sDisplayName
+ self.aItemList=[]
+ self.aComponentAdd=[]
+ self.aObjectList=[]
+ self.aListFields=[]
+ self.aVariableList=[]
+ EnumDocument(self.aItemList,self.aComponentAdd)
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ self.sMyHost= ""
+ global url
+ self.sock=RPCSession(url)
+
+ if not docinfo.getUserFieldValue(3) == "" and not docinfo.getUserFieldValue(0)=="":
+ self.sMyHost= docinfo.getUserFieldValue(0)
+ self.count=0
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ self.count += 1
+ getList(self.aObjectList, self.sMyHost,self.count)
+ cursor = doc.getCurrentController().getViewCursor()
+ text=cursor.getText()
+ tcur=text.createTextCursorByRange(cursor)
+
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == "Objects", self.aObjectList ) )
+
+ for i in range(len(self.aItemList)):
+ anItem = self.aItemList[i][1]
+ component = self.aComponentAdd[i]
+
+ if component == "Document":
+ sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == sLVal, self.aObjectList ) )
+
+ if tcur.TextSection:
+ getRecersiveSection(tcur.TextSection,self.aSectionList)
+ if component in self.aSectionList:
+ sLVal = anItem[anItem.find(",'") + 2:anItem.find("')")]
+ self.aVariableList.extend( filter( lambda obj: obj[:obj.find("(")] == sLVal, self.aObjectList ) )
+
+ if tcur.TextTable:
+ if not component == "Document" and component[component.rfind(".") + 1:] == tcur.TextTable.Name:
+ VariableScope(tcur,self.insVariable,self.aObjectList,self.aComponentAdd,self.aItemList,component)
+
+ self.bModify=bFromModify
+ if self.bModify==True:
+ sItem=""
+ for anObject in self.aObjectList:
+ if anObject[:anObject.find("(")] == sVariable:
+ sItem = anObject
+ self.insVariable.setText( sItem )
+ genTree(sItem[sItem.find("(")+1:sItem.find(")")],self.aListFields, self.insField,self.sMyHost,2,ending_excl=['one2many','many2one','many2many','reference'], recur=['many2one'])
+ self.sValue= self.win.getListBoxItem("lstFields",self.aListFields.index(sFields))
+
+ for var in self.aVariableList:
+
+ self.model_ids = self.sock.execute(database, uid, self.password, 'ir.model' , 'search', [('model','=',var[var.find("(")+1:var.find(")")])])
+ fields=['name','model']
+ self.model_res = self.sock.execute(database, uid, self.password, 'ir.model', 'read', self.model_ids,fields)
+ if self.model_res <> []:
+ self.insVariable.addItem(var[:var.find("(")+1] + self.model_res[0]['name'] + ")" ,self.insVariable.getItemCount())
+ else:
+ self.insVariable.addItem(var ,self.insVariable.getItemCount())
+
+ self.win.doModalDialog("lstFields",self.sValue)
+ else:
+ ErrorDialog("Please insert user define field Field-1 or Field-4","Just go to File->Properties->User Define \nField-1 Eg. http://localhost:8069 \nOR \nField-4 Eg. account.invoice")
+ self.win.endExecute()
+
+ def lstbox_selected(self,oItemEvent):
+ try:
+
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ sItem= self.win.getComboBoxText("cmbVariable")
+ for var in self.aVariableList:
+ if var[:var.find("(")+1]==sItem[:sItem.find("(")+1]:
+ sItem = var
+ sMain=self.aListFields[self.win.getListBoxSelectedItemPos("lstFields")]
+ t=sMain.rfind('/lang')
+ if t!=-1:
+ sObject=self.getRes(self.sock,sItem[sItem.find("(")+1:-1],sMain[1:])
+ ids = self.sock.execute(database, uid, self.password, sObject , 'search', [])
+ res = self.sock.execute(database, uid, self.password, sObject , 'read',[ids[0]])
+ self.win.setEditText("txtUName",res[0][sMain[sMain.rfind("/")+1:]])
+ else:
+ ErrorDialog("Please select the Language Field")
+
+ except:
+ import traceback;traceback.print_exc()
+ self.win.setEditText("txtUName","TTT")
+ if self.bModify:
+ self.win.setEditText("txtUName",self.sGDisplayName)
+
+ def getRes(self,sock ,sObject,sVar):
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ res = sock.execute(database, uid, self.password, sObject , 'fields_get')
+ key = res.keys()
+ key.sort()
+ myval=None
+ if not sVar.find("/")==-1:
+ myval=sVar[:sVar.find("/")]
+ else:
+ myval=sVar
+ if myval in key:
+ if (res[myval]['type'] in ['many2one']):
+ sObject = res[myval]['relation']
+ return self.getRes(sock,res[myval]['relation'], sVar[sVar.find("/")+1:])
+ else:
+ return sObject
+
+
+ def cmbVariable_selected(self,oItemEvent):
+ if self.count > 0 :
+ try:
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ self.win.removeListBoxItems("lstFields", 0, self.win.getListBoxItemCount("lstFields"))
+ self.aListFields=[]
+ tempItem = self.win.getComboBoxText("cmbVariable")
+ for var in self.aVariableList:
+ if var[:var.find("(")] == tempItem[:tempItem.find("(")]:
+ sItem=var
+
+ genTree(
+ sItem[ sItem.find("(") + 1:sItem.find(")")],
+ self.aListFields,
+ self.insField,
+ self.sMyHost,
+ 2,
+ ending_excl=['one2many','many2one','many2many','reference'],
+ recur=['many2one']
+ )
+
+ except:
+ import traceback;traceback.print_exc()
+
+ def btnOk_clicked( self, oActionEvent ):
+ self.bOkay = True
+ desktop=getDesktop()
+ doc = desktop.getCurrentComponent()
+ cursor = doc.getCurrentController().getViewCursor()
+
+ itemSelected = self.win.getListBoxSelectedItem( "lstFields" )
+ itemSelectedPos = self.win.getListBoxSelectedItemPos( "lstFields" )
+ txtUName = self.win.getEditText("txtUName")
+ sKey=u""+ txtUName
+
+ if itemSelected != "" and txtUName != "" and self.bModify==True :
+ oCurObj=cursor.TextField
+ sObjName=self.insVariable.getText()
+ sObjName=sObjName[:sObjName.find("(")]
+ sValue=u"[[ setLang" + sObjName + self.aListFields[itemSelectedPos].replace("/",".") + ")" " ]]"
+ oCurObj.Items = (sKey,sValue)
+ oCurObj.update()
+ self.win.endExecute()
+ elif itemSelected != "" and txtUName != "" :
+ oInputList = doc.createInstance("com.sun.star.text.TextField.DropDown")
+ sObjName=self.win.getComboBoxText("cmbVariable")
+ sObjName=sObjName[:sObjName.find("(")]
+
+ widget = ( cursor.TextTable and cursor.TextTable.getCellByName( cursor.Cell.CellName ) or doc.Text )
+
+ sValue = u"[[setLang" + "(" + sObjName + self.aListFields[itemSelectedPos].replace("/",".") +")" " ]]"
+ oInputList.Items = (sKey,sValue)
+ widget.insertTextContent(cursor,oInputList,False)
+
+ self.win.endExecute()
+ else:
+ ErrorDialog("Please Fill appropriate data in Name field \nor select perticular value from the list of fields")
+
+ def btnCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
+
+if __name__<>"package" and __name__=="__main__":
+ AddLang()
+elif __name__=="package":
+ g_ImplementationHelper.addImplementation( AddLang, "org.openoffice.openerp.report.langtag", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/__init__.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/__init__.py
new file mode 100644
index 00000000000..af5e28965ce
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/__init__.py
@@ -0,0 +1,61 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import Expression
+import lib
+import Fields
+import modify
+import Repeatln
+import ServerParameter
+import NewReport
+import LoginTest
+import Change
+import About
+import AddAttachment
+import ConvertBracesToField
+import ConvertFieldsToBraces
+import ExportToRML
+import SendtoServer
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/compile_all.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/compile_all.py
new file mode 100644
index 00000000000..5a95c61ecae
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/compile_all.py
@@ -0,0 +1,49 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+import compileall
+
+compileall.compile_dir('package')
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/import b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/import
new file mode 100644
index 00000000000..e14c925b619
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/import
@@ -0,0 +1,2 @@
+__name__="package"
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/__init__.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/__init__.py
new file mode 100644
index 00000000000..b67392208fe
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/__init__.py
@@ -0,0 +1,28 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import actions
+import error
+import functions
+import gui
+import logreport
+import rpc
+import tiny_socket
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/actions.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/actions.py
new file mode 100644
index 00000000000..8faec4cb5aa
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/actions.py
@@ -0,0 +1,111 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+import unohelper
+import os
+#--------------------------------------------------
+# An ActionListener adapter.
+# This object implements com.sun.star.awt.XActionListener.
+# When actionPerformed is called, this will call an arbitrary
+# python procedure, passing it...
+# 1. the oActionEvent
+# 2. any other parameters you specified to this object's constructor (as a tuple).
+if __name__<>"package":
+ os.system( "ooffice '-accept=socket,host=localhost,port=2002;urp;'" )
+passwd=""
+database=""
+uid=""
+loginstatus=False
+from com.sun.star.awt import XActionListener
+class ActionListenerProcAdapter( unohelper.Base, XActionListener ):
+ def __init__( self, oProcToCall, tParams=() ):
+ self.oProcToCall = oProcToCall # a python procedure
+ self.tParams = tParams # a tuple
+
+ # oActionEvent is a com.sun.star.awt.ActionEvent struct.
+ def actionPerformed( self, oActionEvent ):
+ if callable( self.oProcToCall ):
+ apply( self.oProcToCall, (oActionEvent,) + self.tParams )
+
+#--------------------------------------------------
+# An ItemListener adapter.
+# This object implements com.sun.star.awt.XItemListener.
+# When itemStateChanged is called, this will call an arbitrary
+# python procedure, passing it...
+# 1. the oItemEvent
+# 2. any other parameters you specified to this object's constructor (as a tuple).
+from com.sun.star.awt import XItemListener
+class ItemListenerProcAdapter( unohelper.Base, XItemListener ):
+ def __init__( self, oProcToCall, tParams=() ):
+ self.oProcToCall = oProcToCall # a python procedure
+ self.tParams = tParams # a tuple
+
+ # oItemEvent is a com.sun.star.awt.ItemEvent struct.
+ def itemStateChanged( self, oItemEvent ):
+ if callable( self.oProcToCall ):
+ apply( self.oProcToCall, (oItemEvent,) + self.tParams )
+
+#--------------------------------------------------
+# An TextListener adapter.
+# This object implements com.sun.star.awt.XTextistener.
+# When textChanged is called, this will call an arbitrary
+# python procedure, passing it...
+# 1. the oTextEvent
+# 2. any other parameters you specified to this object's constructor (as a tuple).
+from com.sun.star.awt import XTextListener
+class TextListenerProcAdapter( unohelper.Base, XTextListener ):
+ def __init__( self, oProcToCall, tParams=() ):
+ self.oProcToCall = oProcToCall # a python procedure
+ self.tParams = tParams # a tuple
+
+ # oTextEvent is a com.sun.star.awt.TextEvent struct.
+ def textChanged( self, oTextEvent ):
+ if callable( self.oProcToCall ):
+ apply( self.oProcToCall, (oTextEvent,) + self.tParams )
+
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/error.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/error.py
new file mode 100644
index 00000000000..bb51a35caf1
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/error.py
@@ -0,0 +1,60 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+if __name__<>"package":
+ from gui import *
+class ErrorDialog:
+ def __init__(self,sErrorMsg, sErrorHelpMsg="",sTitle="Error Message"):
+ self.win = DBModalDialog(50, 50, 150, 90, sTitle)
+ self.win.addFixedText("lblErrMsg", 5, 5, 190, 25, sErrorMsg)
+ self.win.addFixedText("lblErrHelpMsg", 5, 30, 190, 25, sErrorHelpMsg)
+ self.win.addButton('btnOK', 55,-5,40,15,'Ok'
+ ,actionListenerProc = self.btnOkOrCancel_clicked )
+ self.win.doModalDialog("",None)
+ def btnOkOrCancel_clicked( self, oActionEvent ):
+ self.win.endExecute()
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/functions.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/functions.py
new file mode 100644
index 00000000000..2f5f5186828
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/functions.py
@@ -0,0 +1,264 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+import xmlrpclib
+import re
+import socket
+import cPickle
+import marshal
+import tempfile
+if __name__<>"package":
+ from gui import *
+ from logreport import *
+ from rpc import *
+ database="test"
+ uid = 1
+
+def genTree(object,aList,insField,host,level=3, ending=[], ending_excl=[], recur=[], root='', actualroot=""):
+ try:
+ global url
+ sock=RPCSession(url)
+ global passwd
+ res = sock.execute(database, uid, passwd, object , 'fields_get')
+ key = res.keys()
+ key.sort()
+ for k in key:
+ if (not ending or res[k]['type'] in ending) and ((not ending_excl) or not (res[k]['type'] in ending_excl)):
+ insField.addItem(root+'/'+res[k]["string"],len(aList))
+ aList.append(actualroot+'/'+k)
+ if (res[k]['type'] in recur) and (level>0):
+ genTree(res[k]['relation'],aList,insField,host ,level-1, ending, ending_excl, recur,root+'/'+res[k]["string"],actualroot+'/'+k)
+ except:
+ obj=Logger()
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ obj.log_write('Function', LOG_ERROR, info)
+
+def VariableScope(oTcur,insVariable,aObjectList,aComponentAdd,aItemList,sTableName=""):
+ if sTableName.find(".") != -1:
+ for i in range(len(aItemList)):
+ if aComponentAdd[i]==sTableName:
+ sLVal=aItemList[i][1][aItemList[i][1].find(",'")+2:aItemList[i][1].find("')")]
+ for j in range(len(aObjectList)):
+ if aObjectList[j][:aObjectList[j].find("(")] == sLVal:
+ insVariable.append(aObjectList[j])
+ VariableScope(oTcur,insVariable,aObjectList,aComponentAdd,aItemList, sTableName[:sTableName.rfind(".")])
+ else:
+ for i in range(len(aItemList)):
+ if aComponentAdd[i]==sTableName:
+ sLVal=aItemList[i][1][aItemList[i][1].find(",'")+2:aItemList[i][1].find("')")]
+ for j in range(len(aObjectList)):
+ if aObjectList[j][:aObjectList[j].find("(")] == sLVal and sLVal!="":
+ insVariable.append(aObjectList[j])
+
+def getList(aObjectList,host,count):
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ docinfo=doc.getDocumentInfo()
+ sMain=""
+ if not count == 0:
+ if count >= 1:
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ sItem=oPar.Items[1]
+ if sItem[sItem.find("(")+1:sItem.find(",")]=="objects":
+ sMain = sItem[sItem.find(",'")+2:sItem.find("')")]
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ sItem=oPar.Items[1]
+ if sItem[sItem.find("[[ ")+3:sItem.find("(")]=="repeatIn":
+ if sItem[sItem.find("(")+1:sItem.find(",")]=="objects":
+ aObjectList.append(sItem[sItem.rfind(",'")+2:sItem.rfind("')")] + "(" + docinfo.getUserFieldValue(3) + ")")
+ else:
+ sTemp=sItem[sItem.find("(")+1:sItem.find(",")]
+ if sMain == sTemp[:sTemp.find(".")]:
+ getRelation(docinfo.getUserFieldValue(3), sItem[sItem.find(".")+1:sItem.find(",")], sItem[sItem.find(",'")+2:sItem.find("')")],aObjectList,host)
+ else:
+ sPath=getPath(sItem[sItem.find("(")+1:sItem.find(",")], sMain)
+ getRelation(docinfo.getUserFieldValue(3), sPath, sItem[sItem.find(",'")+2:sItem.find("')")],aObjectList,host)
+ else:
+ aObjectList.append("List of " + docinfo.getUserFieldValue(3))
+
+def getRelation(sRelName, sItem, sObjName, aObjectList, host ):
+ global url
+ sock=RPCSession(url)
+ global passwd
+ res = sock.execute(database, uid, passwd, sRelName , 'fields_get')
+ key = res.keys()
+ for k in key:
+ if sItem.find(".") == -1:
+ if k == sItem:
+ aObjectList.append(sObjName + "(" + res[k]['relation'] + ")")
+ return 0
+ if k == sItem[:sItem.find(".")]:
+ getRelation(res[k]['relation'], sItem[sItem.find(".")+1:], sObjName,aObjectList,host)
+
+
+def getPath(sPath,sMain):
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ oParEnum = doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.supportsService("com.sun.star.text.TextField.DropDown"):
+ sItem=oPar.Items[1]
+ if sPath[:sPath.find(".")] == sMain:
+ break;
+ else:
+ res = re.findall('\\[\\[ *([a-zA-Z0-9_\.]+) *\\]\\]',sPath)
+ if len(res) <> 0:
+ if sItem[sItem.find(",'")+2:sItem.find("')")] == sPath[:sPath.find(".")]:
+ sPath = sItem[sItem.find("(")+1:sItem.find(",")] + sPath[sPath.find("."):]
+ getPath(sPath, sMain)
+ return sPath
+
+def EnumDocument(aItemList,aComponentAdd):
+ desktop = getDesktop()
+ parent=""
+ bFlag = False
+ Doc =desktop.getCurrentComponent()
+ #oVC = Doc.CurrentController.getViewCursor()
+ oParEnum = Doc.getTextFields().createEnumeration()
+ while oParEnum.hasMoreElements():
+ oPar = oParEnum.nextElement()
+ if oPar.Anchor.TextTable:
+ #parent = oPar.Anchor.TextTable.Name
+ getChildTable(oPar.Anchor.TextTable,aItemList,aComponentAdd)
+ elif oPar.Anchor.TextSection:
+ parent = oPar.Anchor.TextSection.Name
+ elif oPar.Anchor.Text:
+ parent = "Document"
+ sItem=oPar.Items[1].replace(' ',"")
+ if sItem[sItem.find("[[ ")+3:sItem.find("(")]=="repeatIn" and not oPar.Items in aItemList:
+ templist=oPar.Items[0],sItem
+ aItemList.append( templist )
+ aComponentAdd.append( parent )
+
+def getChildTable(oPar,aItemList,aComponentAdd,sTableName=""):
+ sNames = oPar.getCellNames()
+ bEmptyTableFlag=True
+ for val in sNames:
+ oCell = oPar.getCellByName(val)
+ oCurEnum = oCell.createEnumeration()
+ while oCurEnum.hasMoreElements():
+ try:
+ oCur = oCurEnum.nextElement()
+
+ if oCur.supportsService("com.sun.star.text.TextTable"):
+ if sTableName=="":
+ getChildTable(oCur,aItemList,aComponentAdd,oPar.Name)
+ else:
+ getChildTable(oCur,aItemList,aComponentAdd,sTableName+"."+oPar.Name)
+ else:
+ oSecEnum = oCur.createEnumeration()
+ while oSecEnum.hasMoreElements():
+ oSubSection = oSecEnum.nextElement()
+ if oSubSection.supportsService("com.sun.star.text.TextField"):
+ bEmptyTableFlag=False
+ sItem=oSubSection.TextField.Items[1]
+ if sItem[sItem.find("[[ ")+3:sItem.find("(")]=="repeatIn":
+ if aItemList.__contains__(oSubSection.TextField.Items)==False:
+ aItemList.append(oSubSection.TextField.Items)
+ if sTableName=="":
+ if aComponentAdd.__contains__(oPar.Name)==False:
+ aComponentAdd.append(oPar.Name)
+ else:
+ if aComponentAdd.__contains__(sTableName+"."+oPar.Name)==False:
+ aComponentAdd.append(sTableName+"."+oPar.Name)
+ except:
+ obj=Logger()
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ obj.log_write('Function', LOG_ERROR, info)
+ if bEmptyTableFlag==True:
+ aItemList.append((u'',u''))
+ if sTableName=="":
+ if aComponentAdd.__contains__(oPar.Name)==False:
+ aComponentAdd.append(oPar.Name)
+ else:
+ if aComponentAdd.__contains__(sTableName+"."+oPar.Name)==False:
+ aComponentAdd.append(sTableName+"."+oPar.Name)
+ return 0
+
+def getRecersiveSection(oCurrentSection,aSectionList):
+ desktop=getDesktop()
+ doc =desktop.getCurrentComponent()
+ oParEnum=doc.getText().createEnumeration()
+ aSectionList.append(oCurrentSection.Name)
+ if oCurrentSection.ParentSection:
+ getRecersiveSection(oCurrentSection.ParentSection,aSectionList)
+ else:
+ return
+
+def GetAFileName():
+ oFileDialog=None
+ iAccept=None
+ sPath=""
+ InitPath=""
+ oUcb=None
+ oFileDialog = createUnoService("com.sun.star.ui.dialogs.FilePicker")
+ oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
+ oFileDialog.appendFilter("OpenERP Report File","*.sxw")
+ oFileDialog.setCurrentFilter("OpenERP Report File")
+ if InitPath == "":
+ InitPath =tempfile.gettempdir()
+ #End If
+ if oUcb.exists(InitPath):
+ oFileDialog.setDisplayDirectory(InitPath)
+ #End If
+ iAccept = oFileDialog.execute()
+ if iAccept == 1:
+ sPath = oFileDialog.Files[0]
+ oFileDialog.dispose()
+ return sPath
+
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/gui.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/gui.py
new file mode 100644
index 00000000000..4210f2afe1e
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/gui.py
@@ -0,0 +1,822 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import uno
+import unohelper
+import pythonloader
+if __name__<>"package":
+ from actions import *
+
+
+#------------------------------------------------------------
+# Uno ServiceManager access
+# A different version of this routine and global variable
+# is needed for code running inside a component.
+#------------------------------------------------------------
+
+
+# The ServiceManager of the running OOo.
+# It is cached in a global variable.
+goServiceManager = False
+pythonloader.DEBUG = 0
+def getServiceManager( cHost="localhost", cPort="2002" ):
+ """Get the ServiceManager from the running OpenOffice.org.
+ Then retain it in the global variable goServiceManager for future use.
+ This is similar to the GetProcessServiceManager() in OOo Basic.
+ """
+ global goServiceManager
+ global pythonloader
+ if not goServiceManager:
+ # Get the uno component context from the PyUNO runtime
+ oLocalContext = uno.getComponentContext()
+ # Create the UnoUrlResolver on the Python side.
+
+ # Connect to the running OpenOffice.org and get its context.
+ if __name__<>"package":
+ oLocalResolver = oLocalContext.ServiceManager.createInstanceWithContext(
+ "com.sun.star.bridge.UnoUrlResolver", oLocalContext )
+ oContext = oLocalResolver.resolve( "uno:socket,host=" + cHost + ",port=" + cPort + ";urp;StarOffice.ComponentContext" )
+ # Get the ServiceManager object
+ goServiceManager = oContext.ServiceManager
+ else:
+ goServiceManager=oLocalContext.ServiceManager
+
+ return goServiceManager
+
+
+#------------------------------------------------------------
+# Uno convenience functions
+# The stuff in this section is just to make
+# python progrmaming of OOo more like using OOo Basic.
+#------------------------------------------------------------
+
+
+# This is the same as ServiceManager.createInstance( ... )
+def createUnoService( cClass ):
+ """A handy way to create a global objects within the running OOo.
+ Similar to the function of the same name in OOo Basic.
+ """
+ oServiceManager = getServiceManager()
+ oObj = oServiceManager.createInstance( cClass )
+ return oObj
+
+
+# The StarDesktop object. (global like in OOo Basic)
+# It is cached in a global variable.
+StarDesktop = None
+def getDesktop():
+ """An easy way to obtain the Desktop object from a running OOo.
+ """
+ global StarDesktop
+ if StarDesktop == None:
+ StarDesktop = createUnoService( "com.sun.star.frame.Desktop" )
+ return StarDesktop
+# preload the StarDesktop variable.
+#getDesktop()
+
+
+# The CoreReflection object.
+# It is cached in a global variable.
+goCoreReflection = False
+def getCoreReflection():
+ global goCoreReflection
+ if not goCoreReflection:
+ goCoreReflection = createUnoService( "com.sun.star.reflection.CoreReflection" )
+ return goCoreReflection
+
+
+def createUnoStruct( cTypeName ):
+ """Create a UNO struct and return it.
+ Similar to the function of the same name in OOo Basic.
+ """
+ oCoreReflection = getCoreReflection()
+ # Get the IDL class for the type name
+ oXIdlClass = oCoreReflection.forName( cTypeName )
+ # Create the struct.
+ oReturnValue, oStruct = oXIdlClass.createObject( None )
+ return oStruct
+
+#------------------------------------------------------------
+# API helpers
+#------------------------------------------------------------
+
+def hasUnoInterface( oObject, cInterfaceName ):
+ """Similar to Basic's HasUnoInterfaces() function, but singular not plural."""
+
+ # Get the Introspection service.
+ oIntrospection = createUnoService( "com.sun.star.beans.Introspection" )
+
+ # Now inspect the object to learn about it.
+ oObjInfo = oIntrospection.inspect( oObject )
+
+ # Obtain an array describing all methods of the object.
+ oMethods = oObjInfo.getMethods( uno.getConstantByName( "com.sun.star.beans.MethodConcept.ALL" ) )
+ # Now look at every method.
+ for oMethod in oMethods:
+ # Check the method's interface to see if
+ # these aren't the droids you're looking for.
+ cMethodInterfaceName = oMethod.getDeclaringClass().getName()
+ if cMethodInterfaceName == cInterfaceName:
+ return True
+ return False
+
+def hasUnoInterfaces( oObject, *cInterfaces ):
+ """Similar to the function of the same name in OOo Basic."""
+ for cInterface in cInterfaces:
+ if not hasUnoInterface( oObject, cInterface ):
+ return False
+ return True
+
+#------------------------------------------------------------
+# High level general purpose functions
+#------------------------------------------------------------
+
+
+def makePropertyValue( cName=None, uValue=None, nHandle=None, nState=None ):
+ """Create a com.sun.star.beans.PropertyValue struct and return it.
+ """
+ oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" )
+
+ if cName != None:
+ oPropertyValue.Name = cName
+ if uValue != None:
+ oPropertyValue.Value = uValue
+ if nHandle != None:
+ oPropertyValue.Handle = nHandle
+ if nState != None:
+ oPropertyValue.State = nState
+
+ return oPropertyValue
+
+
+def makePoint( nX, nY ):
+ """Create a com.sun.star.awt.Point struct."""
+ oPoint = createUnoStruct( "com.sun.star.awt.Point" )
+ oPoint.X = nX
+ oPoint.Y = nY
+ return oPoint
+
+
+def makeSize( nWidth, nHeight ):
+ """Create a com.sun.star.awt.Size struct."""
+ oSize = createUnoStruct( "com.sun.star.awt.Size" )
+ oSize.Width = nWidth
+ oSize.Height = nHeight
+ return oSize
+
+
+def makeRectangle( nX, nY, nWidth, nHeight ):
+ """Create a com.sun.star.awt.Rectangle struct."""
+ oRect = createUnoStruct( "com.sun.star.awt.Rectangle" )
+ oRect.X = nX
+ oRect.Y = nY
+ oRect.Width = nWidth
+ oRect.Height = nHeight
+ return oRect
+
+
+def Array( *args ):
+ """This is just sugar coating so that code from OOoBasic which
+ contains the Array() function can work perfectly in python."""
+ tArray = ()
+ for arg in args:
+ tArray += (arg,)
+ return tArray
+
+
+def loadComponentFromURL( cUrl, tProperties=() ):
+ """Open or Create a document from it's URL.
+ New documents are created from URL's such as:
+ private:factory/sdraw
+ private:factory/swriter
+ private:factory/scalc
+ private:factory/simpress
+ """
+ StarDesktop = getDesktop()
+ oDocument = StarDesktop.loadComponentFromURL( cUrl, "_blank", 0, tProperties )
+ return oDocument
+
+
+#------------------------------------------------------------
+# Styles
+#------------------------------------------------------------
+
+
+def defineStyle( oDrawDoc, cStyleFamily, cStyleName, cParentStyleName=None ):
+ """Add a new style to the style catalog if it is not already present.
+ This returns the style object so that you can alter its properties.
+ """
+
+ oStyleFamily = oDrawDoc.getStyleFamilies().getByName( cStyleFamily )
+
+ # Does the style already exist?
+ if oStyleFamily.hasByName( cStyleName ):
+ # then get it so we can return it.
+ oStyle = oStyleFamily.getByName( cStyleName )
+ else:
+ # Create new style object.
+ oStyle = oDrawDoc.createInstance( "com.sun.star.style.Style" )
+
+ # Set its parent style
+ if cParentStyleName != None:
+ oStyle.setParentStyle( cParentStyleName )
+
+ # Add the new style to the style family.
+ oStyleFamily.insertByName( cStyleName, oStyle )
+
+ return oStyle
+
+
+def getStyle( oDrawDoc, cStyleFamily, cStyleName ):
+ """Lookup and return a style from the document.
+ """
+ return oDrawDoc.getStyleFamilies().getByName( cStyleFamily ).getByName( cStyleName )
+
+#------------------------------------------------------------
+# General Utility functions
+#------------------------------------------------------------
+
+
+def convertToURL( cPathname ):
+ """Convert a Windows or Linux pathname into an OOo URL."""
+ if len( cPathname ) > 1:
+ if cPathname[1:2] == ":":
+ cPathname = "/" + cPathname[0] + "|" + cPathname[2:]
+ cPathname = cPathname.replace( "\\", "/" )
+ cPathname = "file://" + cPathname
+ return cPathname
+
+# The global Awt Toolkit.
+# This is initialized the first time it is needed.
+#goAwtToolkit = createUnoService( "com.sun.star.awt.Toolkit" )
+goAwtToolkit = None
+
+def getAwtToolkit():
+ global goAwtToolkit
+ if goAwtToolkit == None:
+ goAwtToolkit = createUnoService( "com.sun.star.awt.Toolkit" )
+ return goAwtToolkit
+
+# This class builds dialog boxes.
+# This can be used in two different ways...
+# 1. by subclassing it (elegant)
+# 2. without subclassing it (less elegant)
+class DBModalDialog:
+ """Class to build a dialog box from the com.sun.star.awt.* services.
+ This doesn't do anything you couldn't already do using OOo's UNO API,
+ this just makes it much easier.
+ You can change the dialog box size, position, title, etc.
+ You can add controls, and listeners for those controls to the dialog box.
+ This class can be used by subclassing it, or without subclassing it.
+ """
+ def __init__( self, nPositionX=None, nPositionY=None, nWidth=None, nHeight=None, cTitle=None ):
+ self.oDialogModel = createUnoService( "com.sun.star.awt.UnoControlDialogModel" )
+ if nPositionX != None: self.oDialogModel.PositionX = nPositionX
+ if nPositionY != None: self.oDialogModel.PositionY = nPositionY
+ if nWidth != None: self.oDialogModel.Width = nWidth
+ if nHeight != None: self.oDialogModel.Height = nHeight
+ if cTitle != None: self.oDialogModel.Title = cTitle
+ self.oDialogControl = createUnoService( "com.sun.star.awt.UnoControlDialog" )
+ self.oDialogControl.setModel( self.oDialogModel )
+
+ def release( self ):
+ """Release resources.
+ After calling this, you can no longer use this object.
+ """
+ self.oDialogControl.dispose()
+
+ #--------------------------------------------------
+ # Dialog box adjustments
+ #--------------------------------------------------
+
+ def setDialogPosition( self, nX, nY ):
+ self.oDialogModel.PositionX = nX
+ self.oDialogModel.PositionY = nY
+
+ def setDialogSize( self, nWidth, nHeight ):
+ self.oDialogModel.Width = nWidth
+ self.oDialogModel.Height = nHeight
+
+ def setDialogTitle( self, cCaption ):
+ self.oDialogModel.Title = cCaption
+
+ def setVisible( self, bVisible ):
+ self.oDialogControl.setVisible( bVisible )
+
+
+ #--------------------------------------------------
+ # com.sun.star.awt.UnoControlButton
+ #--------------------------------------------------
+
+ # After you add a Button control, you can call self.setControlModelProperty()
+ # passing any of the properties for a...
+ # com.sun.star.awt.UnoControlButtonModel
+ # com.sun.star.awt.UnoControlDialogElement
+ # com.sun.star.awt.UnoControlModel
+ def addButton( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ cLabel=None,
+ actionListenerProc=None,
+ nTabIndex=None ):
+ self.addControl( "com.sun.star.awt.UnoControlButtonModel",
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight, bDropdown=None, bMultiSelection=None,
+ cLabel=cLabel,
+ nTabIndex=nTabIndex )
+ if actionListenerProc != None:
+ self.addActionListenerProc( cCtrlName, actionListenerProc )
+
+ def setButtonLabel( self, cCtrlName, cLabel ):
+ """Set the label of the control."""
+ oControl = self.getControl( cCtrlName )
+ oControl.setLabel( cLabel )
+
+ #--------------------------------------------------
+ # com.sun.star.awt.UnoControlEditModel
+ #--------------------------------------------------
+ def addEdit( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ cText=None,
+ textListenerProc=None ):
+ """Add a Edit control to the window."""
+ self.addControl( "com.sun.star.awt.UnoControlEditModel",
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight, bDropdown=None)
+
+ if cText != None:
+ self.setEditText( cCtrlName, cText )
+ if textListenerProc != None:
+ self.addTextListenerProc( cCtrlName, textListenerProc )
+
+ #--------------------------------------------------
+ # com.sun.star.awt.UnoControlCheckBox
+ #--------------------------------------------------
+
+ # After you add a CheckBox control, you can call self.setControlModelProperty()
+ # passing any of the properties for a...
+ # com.sun.star.awt.UnoControlCheckBoxModel
+ # com.sun.star.awt.UnoControlDialogElement
+ # com.sun.star.awt.UnoControlModel
+ def addCheckBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ cLabel=None,
+ itemListenerProc=None,
+ nTabIndex=None ):
+ self.addControl( "com.sun.star.awt.UnoControlCheckBoxModel",
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight, bDropdown=None, bMultiSelection=None,
+ cLabel=cLabel,
+ nTabIndex=nTabIndex )
+ if itemListenerProc != None:
+ self.addItemListenerProc( cCtrlName, itemListenerProc )
+
+ def setEditText( self, cCtrlName, cText ):
+ """Set the text of the edit box."""
+ oControl = self.getControl( cCtrlName )
+ oControl.setText( cText )
+
+ def getEditText( self, cCtrlName):
+ """Set the text of the edit box."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.getText()
+
+ def setCheckBoxLabel( self, cCtrlName, cLabel ):
+ """Set the label of the control."""
+ oControl = self.getControl( cCtrlName )
+ oControl.setLabel( cLabel )
+
+ def getCheckBoxState( self, cCtrlName ):
+ """Get the state of the control."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.getState();
+
+ def setCheckBoxState( self, cCtrlName, nState ):
+ """Set the state of the control."""
+ oControl = self.getControl( cCtrlName )
+ oControl.setState( nState )
+
+ def enableCheckBoxTriState( self, cCtrlName, bTriStateEnable ):
+ """Enable or disable the tri state mode of the control."""
+ oControl = self.getControl( cCtrlName )
+ oControl.enableTriState( bTriStateEnable )
+
+
+ #--------------------------------------------------
+ # com.sun.star.awt.UnoControlFixedText
+ #--------------------------------------------------
+
+ def addFixedText( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ cLabel=None ):
+ self.addControl( "com.sun.star.awt.UnoControlFixedTextModel",
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ bDropdown=None, bMultiSelection=None,
+ cLabel=cLabel )
+
+ return self.getControl( cCtrlName )
+
+ #--------------------------------------------------
+ # Add Controls to dialog
+ #--------------------------------------------------
+
+ def addControl( self, cCtrlServiceName,
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ bDropdown=None,
+ bMultiSelection=None,
+ cLabel=None,
+ nTabIndex=None,
+ sImagePath=None,
+ ):
+ oControlModel = self.oDialogModel.createInstance( cCtrlServiceName )
+ self.oDialogModel.insertByName( cCtrlName, oControlModel )
+ # if negative coordinates are given for X or Y position,
+ # then make that coordinate be relative to the right/bottom
+ # edge of the dialog box instead of to the left/top.
+ if nPositionX < 0: nPositionX = self.oDialogModel.Width + nPositionX - nWidth
+ if nPositionY < 0: nPositionY = self.oDialogModel.Height + nPositionY - nHeight
+ oControlModel.PositionX = nPositionX
+ oControlModel.PositionY = nPositionY
+ oControlModel.Width = nWidth
+ oControlModel.Height = nHeight
+ oControlModel.Name = cCtrlName
+
+ if bDropdown != None:
+ oControlModel.Dropdown = bDropdown
+
+ if bMultiSelection!=None:
+ oControlModel.MultiSelection=bMultiSelection
+
+ if cLabel != None:
+ oControlModel.Label = cLabel
+
+ if nTabIndex != None:
+ oControlModel.TabIndex = nTabIndex
+
+ if sImagePath != None:
+ oControlModel.ImageURL = sImagePath
+ #--------------------------------------------------
+ # Access controls and control models
+ #--------------------------------------------------
+
+ #--------------------------------------------------
+ # com.sun.star.awt.UnoContorlListBoxModel
+ #--------------------------------------------------
+
+
+ def addComboListBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ bDropdown=True,
+ bMultiSelection=False,
+ itemListenerProc=None,
+ actionListenerProc=None,
+ ):
+
+ mod = self.addControl( "com.sun.star.awt.UnoControlListBoxModel",
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight,bDropdown,bMultiSelection )
+
+ if itemListenerProc != None:
+ self.addItemListenerProc( cCtrlName, itemListenerProc )
+
+ def addListBoxItems( self, cCtrlName, tcItemTexts, nPosition=0 ):
+ """Add a tupple of items to the ListBox at specified position."""
+ oControl = self.getControl( cCtrlName )
+ oControl.addItems( tcItemTexts, nPosition )
+
+ def selectListBoxItem( self, cCtrlName, cItemText, bSelect=True ):
+ """Selects/Deselects the ispecified item."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.selectItem( cItemText, bSelect )
+
+ def selectListBoxItemPos( self, cCtrlName, nItemPos, bSelect=True ):
+ """Select/Deselect the item at the specified position."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.selectItemPos( nItemPos, bSelect )
+
+ def removeListBoxItems( self, cCtrlName, nPosition, nCount=1 ):
+ """Remove items from a ListBox."""
+ oControl = self.getControl( cCtrlName )
+ oControl.removeItems( nPosition, nCount )
+
+ def getListBoxItemCount( self, cCtrlName ):
+ """Get the number of items in a ListBox."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.getItemCount()
+
+ def getListBoxSelectedItem( self, cCtrlName ):
+ """Returns the currently selected item."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.getSelectedItem()
+
+ def getListBoxItem( self, cCtrlName, nPosition ):
+ """Return the item at specified position within the ListBox."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.getItem( nPosition )
+
+ def getListBoxSelectedItemPos(self,cCtrlName):
+
+ oControl = self.getControl( cCtrlName )
+ return oControl.getSelectedItemPos()
+
+ def getListBoxSelectedItems(self,cCtrlName):
+ oControl = self.getControl( cCtrlName )
+ return oControl.getSelectedItems()
+
+ def getListBoxSelectedItemsPos(self,cCtrlName):
+
+ oControl = self.getControl( cCtrlName )
+ return oControl.getSelectedItemsPos()
+
+ #--------------------------------------------------
+ # com.sun.star.awt.UnoControlComboBoxModel
+ #--------------------------------------------------
+ def addComboBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ bDropdown=True,
+ itemListenerProc=None,
+ actionListenerProc=None ):
+
+ mod = self.addControl( "com.sun.star.awt.UnoControlComboBoxModel",
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight,bDropdown)
+ if itemListenerProc != None:
+ self.addItemListenerProc( cCtrlName, itemListenerProc )
+ if actionListenerProc != None:
+ self.addActionListenerProc( cCtrlName, actionListenerProc )
+
+
+ def setComboBoxText( self, cCtrlName, cText ):
+ """Set the text of the ComboBox."""
+ oControl = self.getControl( cCtrlName )
+ oControl.setText( cText )
+
+ def getComboBoxText( self, cCtrlName):
+ """Set the text of the ComboBox."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.getText()
+
+ def getComboBoxSelectedText( self, cCtrlName ):
+ """Get the selected text of the ComboBox."""
+ oControl = self.getControl( cCtrlName )
+ return oControl.getSelectedText();
+
+ def getControl( self, cCtrlName ):
+ """Get the control (not its model) for a particular control name.
+ The control returned includes the service com.sun.star.awt.UnoControl,
+ and another control-specific service which inherits from it.
+ """
+ oControl = self.oDialogControl.getControl( cCtrlName )
+ return oControl
+
+ def getControlModel( self, cCtrlName ):
+ """Get the control model (not the control) for a particular control name.
+ The model returned includes the service UnoControlModel,
+ and another control-specific service which inherits from it.
+ """
+ oControl = self.getControl( cCtrlName )
+ oControlModel = oControl.getModel()
+ return oControlModel
+ #---------------------------------------------------
+ # com.sun.star.awt.UnoControlImageControlModel
+ #---------------------------------------------------
+ def addImageControl( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,
+ sImagePath="",
+ itemListenerProc=None,
+ actionListenerProc=None ):
+
+ mod = self.addControl( "com.sun.star.awt.UnoControlImageControlModel",
+ cCtrlName, nPositionX, nPositionY, nWidth, nHeight, sImagePath=sImagePath)
+
+ if itemListenerProc != None:
+ self.addItemListenerProc( cCtrlName, itemListenerProc )
+ if actionListenerProc != None:
+ self.addActionListenerProc( cCtrlName, actionListenerProc )
+
+
+ #--------------------------------------------------
+ # Adjust properties of control models
+ #--------------------------------------------------
+
+ def setControlModelProperty( self, cCtrlName, cPropertyName, uValue ):
+ """Set the value of a property of a control's model.
+ This affects the control model, not the control.
+ """
+ oControlModel = self.getControlModel( cCtrlName )
+ oControlModel.setPropertyValue( cPropertyName, uValue )
+
+ def getControlModelProperty( self, cCtrlName, cPropertyName ):
+ """Get the value of a property of a control's model.
+ This affects the control model, not the control.
+ """
+ oControlModel = self.getControlModel( cCtrlName )
+ return oControlModel.getPropertyValue( cPropertyName )
+
+ #--------------------------------------------------
+ # Sugar coated property adjustments to control models.
+ #--------------------------------------------------
+
+ def setEnabled( self, cCtrlName, bEnabled=True ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+ self.setControlModelProperty( cCtrlName, "Enabled", bEnabled )
+
+ def getEnabled( self, cCtrlName ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+
+ return self.getControlModelProperty( cCtrlName, "Enabled" )
+
+ def setState( self, cCtrlName, nState ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+ self.setControlModelProperty( cCtrlName, "State", nState )
+
+ def getState( self, cCtrlName ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+ return self.getControlModelProperty( cCtrlName, "State" )
+
+ def setLabel( self, cCtrlName, cLabel ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+ self.setControlModelProperty( cCtrlName, "Label", cLabel )
+
+ def getLabel( self, cCtrlName ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+ return self.getControlModelProperty( cCtrlName, "Label" )
+
+ def setHelpText( self, cCtrlName, cHelpText ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+ self.setControlModelProperty( cCtrlName, "HelpText", cHelpText )
+
+ def getHelpText( self, cCtrlName ):
+ """Supported controls...
+ UnoControlButtonModel
+ UnoControlCheckBoxModel
+ """
+ return self.getControlModelProperty( cCtrlName, "HelpText" )
+
+
+ #--------------------------------------------------
+ # Adjust controls (not models)
+ #--------------------------------------------------
+
+ # The following apply to all controls which are a
+ # com.sun.star.awt.UnoControl
+
+ def setDesignMode( self, cCtrlName, bDesignMode=True ):
+ oControl = self.getControl( cCtrlName )
+ oControl.setDesignMode( bDesignMode )
+
+ def isDesignMode( self, cCtrlName, bDesignMode=True ):
+ oControl = self.getControl( cCtrlName )
+ return oControl.isDesignMode()
+
+ def isTransparent( self, cCtrlName, bDesignMode=True ):
+ oControl = self.getControl( cCtrlName )
+ return oControl.isTransparent()
+
+
+ # The following apply to all controls which are a
+ # com.sun.star.awt.UnoControlDialogElement
+
+ def setPosition( self, cCtrlName, nPositionX, nPositionY ):
+ self.setControlModelProperty( cCtrlName, "PositionX", nPositionX )
+ self.setControlModelProperty( cCtrlName, "PositionY", nPositionY )
+ def setPositionX( self, cCtrlName, nPositionX ):
+ self.setControlModelProperty( cCtrlName, "PositionX", nPositionX )
+ def setPositionY( self, cCtrlName, nPositionY ):
+ self.setControlModelProperty( cCtrlName, "PositionY", nPositionY )
+ def getPositionX( self, cCtrlName ):
+ return self.getControlModelProperty( cCtrlName, "PositionX" )
+ def getPositionY( self, cCtrlName ):
+ return self.getControlModelProperty( cCtrlName, "PositionY" )
+
+ def setSize( self, cCtrlName, nWidth, nHeight ):
+ self.setControlModelProperty( cCtrlName, "Width", nWidth )
+ self.setControlModelProperty( cCtrlName, "Height", nHeight )
+ def setWidth( self, cCtrlName, nWidth ):
+ self.setControlModelProperty( cCtrlName, "Width", nWidth )
+ def setHeight( self, cCtrlName, nHeight ):
+ self.setControlModelProperty( cCtrlName, "Height", nHeight )
+ def getWidth( self, cCtrlName ):
+ return self.getControlModelProperty( cCtrlName, "Width" )
+ def getHeight( self, cCtrlName ):
+ return self.getControlModelProperty( cCtrlName, "Height" )
+
+ def setTabIndex( self, cCtrlName, nWidth, nTabIndex ):
+ self.setControlModelProperty( cCtrlName, "TabIndex", nTabIndex )
+ def getTabIndex( self, cCtrlName ):
+ return self.getControlModelProperty( cCtrlName, "TabIndex" )
+
+ def setStep( self, cCtrlName, nWidth, nStep ):
+ self.setControlModelProperty( cCtrlName, "Step", nStep )
+ def getStep( self, cCtrlName ):
+ return self.getControlModelProperty( cCtrlName, "Step" )
+
+ def setTag( self, cCtrlName, nWidth, cTag ):
+ self.setControlModelProperty( cCtrlName, "Tag", cTag )
+ def getTag( self, cCtrlName ):
+ return self.getControlModelProperty( cCtrlName, "Tag" )
+
+ def setEchoChar(self, cCtrlName , cVal):
+ self.setControlModelProperty(cCtrlName, "EchoChar", cVal)
+ def getEchoChar(self, cCtrlName):
+ return self.setControlModelProperty(cCtrlName, "EchoChar")
+
+ #--------------------------------------------------
+ # Add listeners to controls.
+ #--------------------------------------------------
+
+ # This applies to...
+ # UnoControlButton
+ def addActionListenerProc( self, cCtrlName, actionListenerProc ):
+ """Create an com.sun.star.awt.XActionListener object and add it to a control.
+ A listener object is created which will call the python procedure actionListenerProc.
+ The actionListenerProc can be either a method or a global procedure.
+ The following controls support XActionListener:
+ UnoControlButton
+ """
+ oControl = self.getControl( cCtrlName )
+ oActionListener = ActionListenerProcAdapter( actionListenerProc )
+ oControl.addActionListener( oActionListener )
+
+ # This applies to...
+ # UnoControlCheckBox
+ def addItemListenerProc( self, cCtrlName, itemListenerProc ):
+ """Create an com.sun.star.awt.XItemListener object and add it to a control.
+ A listener object is created which will call the python procedure itemListenerProc.
+ The itemListenerProc can be either a method or a global procedure.
+ The following controls support XActionListener:
+ UnoControlCheckBox
+ """
+ oControl = self.getControl( cCtrlName )
+ oActionListener = ItemListenerProcAdapter( itemListenerProc )
+ oControl.addItemListener( oActionListener )
+
+ #--------------------------------------------------
+ # Display the modal dialog.
+ #--------------------------------------------------
+
+ def doModalDialog( self, sObjName,sValue):
+ """Display the dialog as a modal dialog."""
+ self.oDialogControl.setVisible( True )
+ if not sValue==None:
+ self.selectListBoxItem( sObjName, sValue, True )
+ self.oDialogControl.execute()
+
+ def endExecute( self ):
+ """Call this from within one of the listeners to end the modal dialog.
+ For instance, the listener on your OK or Cancel button would call this to end the dialog.
+ """
+ self.oDialogControl.endExecute()
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/logreport.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/logreport.py
new file mode 100644
index 00000000000..0e47ab627fb
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/logreport.py
@@ -0,0 +1,48 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import logging
+import tempfile
+LOG_DEBUG='debug'
+LOG_INFO='info'
+LOG_WARNING='warn'
+LOG_ERROR='error'
+LOG_CRITICAL='critical'
+
+def log_detail(self):
+ import os
+ logger = logging.getLogger()
+ logfile_name = os.path.join(tempfile.gettempdir(), "openerp_report_designer.log")
+ hdlr = logging.FileHandler(logfile_name)
+ formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+ hdlr.setFormatter(formatter)
+ logger.addHandler(hdlr)
+ logger.setLevel(logging.INFO)
+
+class Logger(object):
+ def log_write(self,name,level,msg):
+ log = logging.getLogger(name)
+ getattr(log,level)(msg)
+
+ def shutdown(self):
+ logging.shutdown()
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/rpc.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/rpc.py
new file mode 100644
index 00000000000..446d00094b4
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/rpc.py
@@ -0,0 +1,204 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import time
+import socket
+import xmlrpclib
+#import tiny_socket
+import re
+
+class RPCGateway(object):
+ def __init__(self, host, port, protocol):
+
+ self.protocol = protocol
+ self.host = host
+ self.port = port
+
+ def get_url(self):
+
+ """Get the url
+ """
+ return "%s://%s:%s/"%(self.protocol, self.host, self.port)
+
+ def listdb(self):
+ """Get the list of databases.
+ """
+ pass
+
+ def login(self, db, user, password):
+ pass
+
+ def execute(self, obj, method, *args):
+ pass
+
+
+
+class RPCSession(object):
+ def __init__(self,url):
+
+ m = re.match('^(http[s]?://|socket://)([\w.\-]+):(\d{1,5})$', url or '')
+
+ host = m.group(2)
+ port = m.group(3)
+ protocol = m.group(1)
+ if not m:
+ return -1
+ if protocol == 'http://' or protocol == 'http://':
+ self.gateway = XMLRPCGateway(host, port, 'http')
+ elif protocol == 'socket://':
+
+ self.gateway = NETRPCGateway(host, port)
+
+ def listdb(self):
+ return self.gateway.listdb()
+
+ def login(self, db, user, password):
+
+ if password is None:
+ return -1
+
+ uid = self.gateway.login(db, user or '', password or '')
+
+ if uid <= 0:
+ return -1
+
+ self.uid = uid
+ self.db = db
+ self.password = password
+ self.open = True
+ return uid
+
+
+ def execute(self, obj, method, *args):
+ try:
+ result = self.gateway.execute(obj, method, *args)
+ return self.__convert(result)
+ except Exception,e:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+
+ def __convert(self, result):
+
+ if isinstance(result, basestring):
+ # try to convert into unicode string
+ try:
+ return ustr(result)
+ except Exception, e:
+ return result
+
+ elif isinstance(result, list):
+ return [self.__convert(val) for val in result]
+
+ elif isinstance(result, tuple):
+ return tuple([self.__convert(val) for val in result])
+
+ elif isinstance(result, dict):
+ newres = {}
+ for key, val in result.items():
+ newres[key] = self.__convert(val)
+
+ return newres
+
+ else:
+ return result
+
+class XMLRPCGateway(RPCGateway):
+ """XML-RPC implementation.
+ """
+ def __init__(self, host, port, protocol='http'):
+
+ super(XMLRPCGateway, self).__init__(host, port, protocol)
+ global rpc_url
+ rpc_url = self.get_url() + 'xmlrpc/'
+
+ def listdb(self):
+ global rpc_url
+ sock = xmlrpclib.ServerProxy(rpc_url + 'db')
+ try:
+ return sock.list()
+ except Exception, e:
+ return -1
+
+ def login(self, db, user, password):
+
+ global rpc_url
+
+ sock = xmlrpclib.ServerProxy(rpc_url + 'common')
+
+ try:
+ res = sock.login(db, user, password)
+ except Exception, e:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ return -1
+
+ return res
+
+ def execute(self, sDatabase,UID,sPassword,obj, method, *args):
+ global rpc_url
+
+ sock = xmlrpclib.ServerProxy(rpc_url + 'object')
+
+ return sock.execute(sDatabase,UID,sPassword, obj ,method,*args)
+
+
+
+class NETRPCGateway(RPCGateway):
+ def __init__(self, host, port):
+
+ super(NETRPCGateway, self).__init__(host, port, 'socket')
+
+ def listdb(self):
+ sock = mysocket()
+ try:
+ sock.connect(self.host, self.port)
+ sock.mysend(('db', 'list'))
+ res = sock.myreceive()
+ sock.disconnect()
+ return res
+ except Exception, e:
+ return -1
+
+ def login(self, db, user, password):
+ sock = mysocket()
+ try:
+ sock.connect(self.host, self.port)
+ sock.mysend(('common', 'login', db, user, password))
+ res = sock.myreceive()
+ sock.disconnect()
+ except Exception, e:
+ return -1
+ return res
+ def execute(self,obj, method, *args):
+ sock = mysocket()
+ try:
+ sock.connect(self.host, self.port)
+ data=(('object', 'execute',obj,method,)+args)
+ sock.mysend(data)
+ res=sock.myreceive()
+ sock.disconnect()
+ return res
+
+ except Exception,e:
+ import traceback,sys
+ info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/tiny_socket.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/tiny_socket.py
new file mode 100644
index 00000000000..38ed0073d68
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/tiny_socket.py
@@ -0,0 +1,93 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import socket
+import cPickle
+import cStringIO
+import marshal
+
+class Myexception(Exception):
+ def __init__(self, faultCode, faultString):
+ self.faultCode = faultCode
+ self.faultString = faultString
+ self.args = (faultCode, faultString)
+
+class mysocket:
+ def __init__(self, sock=None):
+ if sock is None:
+ self.sock = socket.socket(
+ socket.AF_INET, socket.SOCK_STREAM)
+ else:
+ self.sock = sock
+ self.sock.settimeout(120)
+ def connect(self, host, port=False):
+ if not port:
+ protocol, buf = host.split('//')
+ host, port = buf.split(':')
+ self.sock.connect((host, int(port)))
+ def disconnect(self):
+ self.sock.shutdown(socket.SHUT_RDWR)
+ self.sock.close()
+ def mysend(self, msg, exception=False, traceback=None):
+
+ msg = cPickle.dumps([msg,traceback])
+ size = len(msg)
+ self.sock.send('%8d' % size)
+ self.sock.send(exception and "1" or "0")
+ totalsent = 0
+ while totalsent < size:
+ sent = self.sock.send(msg[totalsent:])
+ if sent == 0:
+ raise RuntimeError, "socket connection broken"
+ totalsent = totalsent + sent
+ def myreceive(self):
+ buf=''
+ while len(buf) < 8:
+ chunk = self.sock.recv(8 - len(buf))
+ if chunk == '':
+ raise RuntimeError, "socket connection broken"
+ buf += chunk
+ size = int(buf)
+ buf = self.sock.recv(1)
+ if buf != "0":
+ exception = buf
+ else:
+ exception = False
+ msg = ''
+ while len(msg) < size:
+ chunk = self.sock.recv(size-len(msg))
+ if chunk == '':
+ raise RuntimeError, "socket connection broken"
+ msg = msg + chunk
+ msgio = cStringIO.StringIO(msg)
+ unpickler = cPickle.Unpickler(msgio)
+ unpickler.find_global = None
+ res = unpickler.load()
+
+ if isinstance(res[0],Exception):
+ if exception:
+ raise Myexception(str(res[0]), str(res[1]))
+ raise res[0]
+ else:
+ return res[0]
+
+
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/tools.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/tools.py
new file mode 100644
index 00000000000..e5fa0d9f9e7
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/tools.py
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import urllib
+
+def get_absolute_file_path( url ):
+ url_unquoted = urllib.unquote(url)
+ return os.name == 'nt' and url_unquoted[1:] or url_unquoted
+
+# This function reads the content of a file and return it to the caller
+def read_data_from_file( filename ):
+ fp = file( filename, "rb" )
+ data = fp.read()
+ fp.close()
+ return data
+
+# This function writes the content to a file
+def write_data_to_file( filename, data ):
+ fp = file( filename, 'wb' )
+ fp.write( data )
+ fp.close()
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/bin/script/modify.py b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/modify.py
new file mode 100644
index 00000000000..730d5b3d33b
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/bin/script/modify.py
@@ -0,0 +1,138 @@
+##########################################################################
+#
+# Portions of this file are under the following copyright and license:
+#
+#
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#
+# and other portions are under the following copyright and license:
+#
+#
+# OpenERP, Open Source Management Solution>..
+# Copyright (C) 2004-2010 OpenERP SA ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+#
+##############################################################################
+
+import re
+import uno
+import string
+import unohelper
+import xmlrpclib
+from com.sun.star.task import XJobExecutor
+if __name__<>"package":
+ from lib.gui import *
+ from Expression import Expression
+ from Fields import Fields
+ from Repeatln import RepeatIn
+ from lib.error import *
+ database="test"
+ uid = 3
+
+class modify(unohelper.Base, XJobExecutor ):
+ def __init__( self, ctx ):
+ self.ctx = ctx
+ self.module = "openerp_report"
+ self.version = "0.1"
+
+ # Variable Declaration
+ desktop = getDesktop()
+ doc = desktop.getCurrentComponent()
+ docinfo = doc.getDocumentInfo()
+ self.oVC = doc.CurrentController.getViewCursor()
+ if not docinfo.getUserFieldValue(0)=="":
+ self.sMyHost= docinfo.getUserFieldValue(0)
+ else:
+ ErrorDialog(
+ "Please insert user define field Field-1",
+ "Just go to File->Properties->User Define \n"
+ "Field-1 Eg. http://localhost:8069"
+ )
+ exit(1)
+
+ # Check weather Field-4 is available or not otherwise exit from application
+ if not docinfo.getUserFieldValue(3) == "" and not docinfo.getUserFieldValue(0)=="":
+ if self.oVC.TextField:
+ self.oCurObj=self.oVC.TextField
+ item = self.oCurObj.Items[0]
+
+ kind, group1, group2 = self.getOperation(self.oCurObj.Items[1] )
+
+ start_group1 = group1[:group1.find(".")]
+ stop_group1 = group1[group1.find("."):].replace(".", "/")
+
+ if kind == "field":
+ Fields( start_group1, stop_group1, item, True )
+ elif kind == "expression":
+ Expression( group1, item, True )
+ elif kind == "repeatIn":
+ RepeatIn( start_group1, group2, stop_group1, item, True )
+ else:
+ ErrorDialog(
+ "Please place your cursor at begaining of field \n"
+ "which you want to modify",""
+ )
+
+ else:
+ ErrorDialog(
+ "Please insert user define field Field-1 or Field-4",
+ "Just go to File->Properties->User Define \n"
+ "Field-1 Eg. http://localhost:8069 \n"
+ "OR \n"
+ "Field-4 Eg. account.invoice"
+ )
+ exit(1)
+
+ def getOperation(self, str):
+ #str = "[[ RepeatIn(objects, 'variable') ]]" #repeatIn
+ #str = "[[ saleorder.partner_id.name ]]" # field
+ #str = "[[ some thing complex ]]" # expression
+ method1 = lambda x: (u'repeatIn', x.group(1), x.group(2))
+ method2 = lambda x: (u'field', x.group(1), None)
+ method3 = lambda x: (u'expression', x.group(1), None)
+ regexes = [
+ ('\\[\\[ *repeatIn\\( *(.+)*, *\'([a-zA-Z0-9_]+)\' *\\) *\\]\\]', method1),
+ ('\\[\\[ *([a-zA-Z0-9_\.]+) *\\]\\]', method2),
+ ('\\[\\[ *(.+) *\\]\\]', method3)
+ ]
+ for (rule,method) in regexes:
+ res = re.match(rule, str)
+ if res:
+ return method(res)
+
+if __name__<>"package":
+ modify(None)
+else:
+ g_ImplementationHelper.addImplementation( modify, "org.openoffice.openerp.report.modify", ("com.sun.star.task.Job",),)
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/test/test.txt b/addons/base_report_designer/plugin/openerp_report_designer/test/test.txt
new file mode 100644
index 00000000000..2d054ca35dc
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/test/test.txt
@@ -0,0 +1,57 @@
+Test Case of OpenERP Report Desinger Plugin into OpenOffice Writer
+====================================================================
+1. Connecting to the OpenERP Server
+-> OpenERP server ok
+-> OpenERP server not running
+-> Warning if base_report_designer not installed.
+
+2. Creating Report
+-> List of objects in sorted order by name
+
+3. Existing Report
+-> Exception if open non modifiable report (no sxw)
+-> List of exisiting report in sorted order
+
+4. Fields to Brackets
+-> Find the data correctly.
+-> Data for things like [[ '%.2f' % o.amount ]] is completed.
+-> Test on normal Sale Order
+-> Test on normal Purchase Order
+
+5. Modifying report
+-> Adding field if no initial repeatIn
+-> Adding fields (demo data correct)
+-> Adding loop
+-> Adding field within a loop
+-> Adding loop in a section
+-> Adding loop in a table
+-> Adding a loop in a table within a loop in a section
+-> Adding fields within a loop within a loop
+-> check context correct or not
+
+6. Modifying a field
+-> modify a field.
+-> modify a loop.
+-> modify an expression corretly
+-> Display correct data in all these cases
+
+7. Sending Report
+-> send in .SXW if user forgot to save as sxw
+-> Select with/without header
+-> Select between sxw/pdf
+-> Save as .odt and send to the server (check it is converted to sxw or warning)
+
+8. Printing Report into OpenERP clients
+-> Print report
+-> check images appears in report correctly or not.
+-> check report With or Without Header.
+-> check SXW working or not.
+-> check PDF working or not
+
+9. Print as SXW
+-> Check Send as attachment working or not and also check it is Attached to the right document.
+
+10. Miscelleanous
+-> check the translation tag working.
+-> Save to RML.
+
diff --git a/addons/base_report_designer/plugin/openerp_report_designer/test/test_fields.py b/addons/base_report_designer/plugin/openerp_report_designer/test/test_fields.py
new file mode 100644
index 00000000000..8afd773b3fb
--- /dev/null
+++ b/addons/base_report_designer/plugin/openerp_report_designer/test/test_fields.py
@@ -0,0 +1,32 @@
+#
+# Use this module to retrive the fields you need according to the type
+# of the OpenOffice operation:
+# * Insert a Field
+# * Insert a RepeatIn
+#
+
+import xmlrpclib
+import time
+
+sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
+
+def get(object, level=3, ending=[], ending_excl=[], recur=[], root=''):
+ res = sock.execute('terp', 3, 'admin', 'account.invoice', 'fields_get')
+ key = res.keys()
+ key.sort()
+ for k in key:
+ if (not ending or res[k]['type'] in ending) and ((not ending_excl) or not (res[k]['type'] in ending_excl)):
+ print root+'/'+k
+
+ if res[k]['type'] in recur:
+ print root+'/'+k
+ if (res[k]['type'] in recur) and (level>0):
+ get(res[k]['relation'], level-1, ending, ending_excl, recur, root+'/'+k)
+
+print 'Field selection for a rields', '='*40
+get('account.invoice', level=0, ending_excl=['one2many','many2one','many2many','reference'], recur=['many2one'])
+
+print
+print 'Field selection for a repeatIn', '='*40
+get('account.invoice', level=0, ending=['one2many','many2many'], recur=['many2one'])
+
diff --git a/addons/base_report_designer/base_report_data.xml b/addons/base_report_designer/security/base_report_security.xml
similarity index 100%
rename from addons/base_report_designer/base_report_data.xml
rename to addons/base_report_designer/security/base_report_security.xml
diff --git a/addons/base_report_designer/wizard/__init__.py b/addons/base_report_designer/wizard/__init__.py
index f80f87da1d5..d2b008e8c3a 100644
--- a/addons/base_report_designer/wizard/__init__.py
+++ b/addons/base_report_designer/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
diff --git a/addons/base_report_designer/wizard/base_report_design_view.xml b/addons/base_report_designer/wizard/base_report_design_view.xml
new file mode 100644
index 00000000000..504f0ab2ba1
--- /dev/null
+++ b/addons/base_report_designer/wizard/base_report_design_view.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ Base Report sxw
+ base.report.sxw
+ form
+
+
+
+
+
+
+ Base Report sxw
+ ir.actions.act_window
+ base.report.sxw
+ form
+ form
+ new
+
+
+
+ Base Report File sxw
+ base.report.file.sxw
+ form
+
+
+
+
+
+ Base Report File sxw
+ base.report.rml.save
+ form
+
+
+
+
+
+
+
+
diff --git a/addons/base_report_designer/wizard/base_report_designer_modify.py b/addons/base_report_designer/wizard/base_report_designer_modify.py
index 1af72086a24..e65a386a3f8 100644
--- a/addons/base_report_designer/wizard/base_report_designer_modify.py
+++ b/addons/base_report_designer/wizard/base_report_designer_modify.py
@@ -2,23 +2,23 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
+# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
+# $Id$
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU Affero General Public License
+# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
##############################################################################
-
import time
import wizard
import osv
@@ -27,246 +27,125 @@ import urllib
import base64
import tools
from tools.translate import _
+from osv import osv, fields
-intro_form = '''
-'''
+class base_report_sxw(osv.osv_memory):
+ """Base Report sxw """
+ _name = 'base.report.sxw'
-intro_fields = {
- 'text': {
- 'string': 'Introduction',
- 'type': 'text',
- 'readonly': True,
- 'default': lambda *args: """This system must be used with the OpenERP SA OpenOffice plugin. If you
-did not installed yet, you can find this package on:
- http://www.openerp.com
-
-This wizard will provide you the .SXW report that you can modify
-in OpenOffice. After having modified it, you will be able to reupload
-it to the OpenERP server.
-"""},
- 'operation': {
- 'string': 'Operation',
- 'type': 'selection',
- 'selection': [
- ('create','Create a new report'),
- ('modify','Modify an existing report')
- ],
- 'size': 32,
- 'required': True,
- 'default': lambda *args: 'create',
- },
-}
-
-get_form = '''
-'''
-
-get_fields = {
- 'report_id': {
- 'string': 'Report',
- 'type': 'many2one',
- 'relation': 'ir.actions.report.xml',
- 'required': True,
- 'domain': [('report_sxw_content','<>',False)],
- },
-}
-
-get_form_result = '''
-'''
-
-get_form_fields = {
- 'report_id': {
- 'string': 'Report',
- 'type': 'many2one',
- 'relation': 'ir.actions.report.xml',
- 'readonly': True,
- },
- 'file_sxw': {
- 'string': 'Your .SXW file',
- 'type': 'binary',
- 'readonly': True,
+ _columns = {
+ 'report_id': fields.many2one('ir.actions.report.xml', "Report", required=True,domain=[('report_sxw_content','<>',False)],),
}
-}
-send_form_result_arch = '''
-'''
+ def get_report(self, cr, uid, ids, context):
+ data=self.read(cr,uid,ids)[0]
+ data_obj = self.pool.get('ir.model.data')
+ id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_sxw')
+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
+ if id2:
+ id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ return {
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'base.report.file.sxw',
+ 'views': [(id2, 'form')],
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
-send_form_result_fields = {
-}
+base_report_sxw()
+class base_report_file_sxw(osv.osv_memory):
+ """Base Report File sxw """
+ _name = 'base.report.file.sxw'
-send_form_arch = '''
-'''
+ def default_get(self, cr, uid, fields, context=None):
+ """
+ To get default values for the object.
-send_form_fields = {
- 'report_id': {
- 'string': 'Report',
- 'type': 'many2one',
- 'relation': 'ir.actions.report.xml',
- 'required': True,
- 'domain': [('report_sxw_content','<>',False)]
- },
- 'file_sxw': {
- 'string': 'Your .SXW file',
- 'type': 'binary',
- 'required': True
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+
+ @return: A dictionary which of fields with values.
+
+ """
+
+ res = super(base_report_file_sxw, self).default_get(cr, uid, fields, context=context)
+ report_id1 = self.pool.get('base.report.sxw').search(cr,uid,[])
+ data=self.pool.get('base.report.sxw').read(cr,uid,report_id1)[0]
+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
+ if not context:
+ context={}
+ if 'report_id' in fields:
+ res['report_id'] = data['report_id']
+ res['file_sxw'] = base64.encodestring(report.report_sxw_content)
+ return res
+
+ _columns = {
+ 'report_id': fields.many2one('ir.actions.report.xml', "Report", readonly=True),
+ 'file_sxw':fields.binary('Your .SXW file',readonly=True),
+ 'file_sxw_upload':fields.binary('Your .SXW file',required=True)
}
-}
-rml_form_arch = '''
-
-'''
-
-rml_form_fields = {
- 'file_rml': {
- 'string': 'Save As',
- 'type': 'binary',
- }
-}
-
-save_rml_arch = '''
-'''
-
-def _get_default(obj, cursor, user, data, context):
- return {}
-
-
-class base_report_designer_modify(wizard.interface):
- def _upload_report_clear(self, cr, uid, data, context):
- return {'file_sxw': False}
-
- def _upload_report(self, cr, uid, data, context):
- import tiny_sxw2rml
+ def upload_report(self, cr, uid, ids, context):
+ from base_report_designer import openerp_sxw2rml
import StringIO
- pool = pooler.get_pool(cr.dbname)
- sxwval = StringIO.StringIO(base64.decodestring(data['form']['file_sxw']))
- fp = tools.file_open('normalized_oo2rml.xsl',subdir='addons/base_report_designer/wizard/tiny_sxw2rml')
- newrmlcontent = str(tiny_sxw2rml.sxw2rml(sxwval, xsl=fp.read()))
- report = pool.get('ir.actions.report.xml').write(cr, uid, [data['form']['report_id']], {
- 'report_sxw_content': base64.decodestring(data['form']['file_sxw']),
+ data=self.read(cr,uid,ids)[0]
+ sxwval = StringIO.StringIO(base64.decodestring(data['file_sxw_upload']))
+ fp = tools.file_open('normalized_oo2rml.xsl',subdir='addons/base_report_designer/openerp_sxw2rml')
+ newrmlcontent = str(openerp_sxw2rml.sxw2rml(sxwval, xsl=fp.read()))
+ report = self.pool.get('ir.actions.report.xml').write(cr, uid, [data['report_id']], {
+ 'report_sxw_content': base64.decodestring(data['file_sxw_upload']),
'report_rml_content': newrmlcontent
})
- return {'file_rml': base64.encodestring(newrmlcontent)}
+ cr.commit()
+ data_obj = self.pool.get('ir.model.data')
+ id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_rml')
+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
+ if id2:
+ id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ return {
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'base.report.rml.save',
+ 'views': [(id2, 'form')],
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+base_report_file_sxw()
- def _get_report(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- report = pool.get('ir.actions.report.xml').browse(cr, uid, data['form']['report_id'], context)
- try:
- return {'file_sxw': base64.encodestring(report.report_sxw_content)}
- except:
- raise wizard.except_wizard(_('Error'), _('Report does not contain the sxw content!'))
+class base_report_rml_save(osv.osv_memory):
+ """Base Report file Save"""
+ _name = 'base.report.rml.save'
+ def default_get(self, cr, uid, fields, context=None):
+ """
+ To get default values for the object.
- states = {
- 'init': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': intro_form,
- 'fields': intro_fields,
- 'state': [
- ('end','Cancel'),
- ('get_form','Modify a report')
- ]
- }
- },
- 'get_form': {
- 'actions': [_get_default],
- 'result': {
- 'type': 'form',
- 'arch': get_form,
- 'fields': get_fields,
- 'state': [
- ('end','Cancel'),
- ('get_form_result', 'Continue'),
- ]
- }
- },
- 'get_form_result': {
- 'actions': [_get_report],
- 'result': {
- 'type': 'form',
- 'arch': get_form_result,
- 'fields': get_form_fields,
- 'state': [
- ('end','Close'),
- ('send_form', 'Upload the modified report'),
- ]
- }
- },
- 'send_form': {
- 'actions': [_upload_report_clear],
- 'result': {
- 'type': 'form',
- 'arch': send_form_arch,
- 'fields': send_form_fields,
- 'state': [
- ('end','Close'),
- ('save_rml_to', 'Update the report'),
- ]
- }
- },
- 'save_rml_to': {
- 'actions': [_upload_report],
- 'result': {
- 'type': 'form',
- 'arch': rml_form_arch,
- 'fields': rml_form_fields,
- 'state': [
- ('save_rml', 'Save rml'),
- ('send_form_result','Skip'),
- ]
- }
- },
- 'send_form_result': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': send_form_result_arch,
- 'fields': send_form_result_fields,
- 'state': [
- ('end','Close'),
- ]
- }
- },
- 'save_rml': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': save_rml_arch, 'fields': {},
- 'state': [
- ('end','Close'),
- ]
- }
- },
- }
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+ @return: A dictionary which of fields with values.
-base_report_designer_modify('base_report_designer.modify')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ """
+ res = super(base_report_rml_save, self).default_get(cr, uid, fields, context=context)
+ report_id = self.pool.get('base.report.sxw').search(cr,uid,[])
+ data=self.pool.get('base.report.file.sxw').read(cr,uid,report_id)[0]
+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
+ if not context:
+ context={}
+ if 'file_rml' in fields:
+ res['file_rml'] = base64.encodestring(report.report_rml_content)
+ return res
+ _columns = {
+ 'file_rml':fields.binary('Save As'),
+ }
+base_report_rml_save()
diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml
index 0b5a508390c..4245f3da206 100644
--- a/addons/base_setup/base_setup_installer.xml
+++ b/addons/base_setup/base_setup_installer.xml
@@ -10,9 +10,8 @@
-
- Select applications you want to install. If you don't think you need any of these right now, you can easily install them later.
+
+ Select the Applications you want your system to cover. If you are not sure about your exact needs at this stage, you can easily install them later.
@@ -26,17 +25,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/base_setup/base_setup_todo.xml b/addons/base_setup/base_setup_todo.xml
index 59543200076..8151442855b 100644
--- a/addons/base_setup/base_setup_todo.xml
+++ b/addons/base_setup/base_setup_todo.xml
@@ -1,20 +1,20 @@
- Setup company information
+ Company Configuration
base.setup.company
form
- Information of your company will be used to customize your documents like Invoices, Sale Orders and many more.
+ Your company information will be used to personalize documents issued with OpenERP such as invoices, sales orders and much more.
- Configure Your Company
+ Configure Your Company Information
25
@@ -55,7 +55,7 @@
- Setup company information
+ Company Configuration
ir.actions.act_window
base.setup.company
diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py
index 5da836d7f80..77303336ab7 100644
--- a/addons/base_setup/installer.py
+++ b/addons/base_setup/installer.py
@@ -66,13 +66,12 @@ class base_setup_installer(osv.osv_memory):
"automatic picking lists generation and more."),
'marketing':fields.boolean('Marketing',
help="Helps you manage your marketing campaigns step by step."),
- 'profile_tools':fields.boolean('Miscellaneous Tools',
+ 'profile_tools':fields.boolean('Extra Tools',
help="Lets you install various interesting but non-essential tools "
"like Survey, Lunch and Ideas box."),
'report_designer':fields.boolean('Advanced Reporting',
help="Lets you install various tools to simplify and enhance "
"OpenERP's report creation."),
- 'thunderbird' :fields.boolean('Thunderbird'),
# Vertical modules
'product_expiry':fields.boolean('Food Industry',
help="Installs a preselected set of OpenERP applications "
@@ -108,11 +107,13 @@ class base_setup_installer(osv.osv_memory):
return ['account_voucher']
return None
- def onchange_moduleselection(self, cr, uid, ids, *args):
+ def onchange_moduleselection(self, cr, uid, ids, *args, **kargs):
+ value = {}
+ # Calculate progress
closed, total = self.get_current_progress(cr, uid)
-
progress = round(100. * closed / (total + len(filter(None, args))))
+ value.update({'progress':progress})
if progress < 10.:
progress = 10.
- return {'value':{'progress':progress}}
+ return {'value':value}
base_setup_installer()
diff --git a/addons/base_synchro/__init__.py b/addons/base_synchro/__init__.py
new file mode 100644
index 00000000000..c23ec3f2246
--- /dev/null
+++ b/addons/base_synchro/__init__.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import wizard
+import base_synchro_obj
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_synchro/__openerp__.py b/addons/base_synchro/__openerp__.py
new file mode 100644
index 00000000000..69fcb839715
--- /dev/null
+++ b/addons/base_synchro/__openerp__.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+{
+ "name":"Base Synchro",
+ "version":"0.1",
+ "author":"Tiny",
+ "category":"Generic Modules/Base",
+ "depends":["base"],
+ "demo_xml":[],
+ "update_xml":["base_synchro_wizard.xml","base_synchro_view.xml"],
+ "active":False,
+ "installable":True,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_synchro/base_synchro_obj.py b/addons/base_synchro/base_synchro_obj.py
new file mode 100755
index 00000000000..5093c8f787e
--- /dev/null
+++ b/addons/base_synchro/base_synchro_obj.py
@@ -0,0 +1,107 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from osv import fields,osv
+import tools
+import re
+import time
+
+class base_synchro_server(osv.osv):
+ '''Class to store the information regarding server'''
+ _name = "base.synchro.server"
+ _description = "Synchronized server"
+ _columns = {
+ 'name': fields.char('Server name', size=64,required=True),
+ 'server_url': fields.char('Server URL', size=64,required=True),
+ 'server_port': fields.integer('Server Port', size=64,required=True),
+ 'server_db': fields.char('Server Database', size=64,required=True),
+ 'login': fields.char('User Name',size=50,required=True),
+ 'password': fields.char('Password',size=64,invisible=True,required=True),
+ 'obj_ids' : fields.one2many('base.synchro.obj','server_id','Models',ondelete='cascade')
+ }
+ _defaults = {
+ 'server_port': lambda *args: 8069
+ }
+base_synchro_server()
+
+class base_synchro_obj(osv.osv):
+ '''Class to store the operations done by wizart'''
+ _name = "base.synchro.obj"
+ _description = "Register Class"
+ _columns = {
+ 'name':fields.char('Name', size=64, select=1, required=1),
+ 'domain':fields.char('Domain', size=64, select=1, required=1),
+ 'server_id':fields.many2one('base.synchro.server','Server', ondelete='cascade', select=1, required=1),
+ 'model_id': fields.many2one('ir.model', 'Object to synchronize',required=True),
+ 'action':fields.selection([('d','Download'),('u','Upload'),('b','Both')],'Synchronisation direction', required=True),
+ 'sequence': fields.integer('Sequence'),
+ 'active': fields.boolean('Active'),
+ 'synchronize_date':fields.datetime('Latest Synchronization', readonly=True),
+ 'line_id':fields.one2many('base.synchro.obj.line','obj_id','Ids Affected',ondelete='cascade'),
+ 'avoid_ids':fields.one2many('base.synchro.obj.avoid','obj_id','Fields Not Sync.'),
+ }
+ _defaults = {
+ 'active': lambda *args: True,
+ 'action': lambda *args: 'd',
+ 'domain': lambda *args: '[]'
+ }
+ _order = 'sequence'
+ #
+ # Return a list of changes: [ (date, id) ]
+ #
+ def _get_ids(self, cr, uid, object, dt, domain=[], context={}):
+ result = []
+ if dt:
+ domain2 = domain+[('write_date','>=',dt)]
+ domain3 = domain+[('create_date','>=',dt)]
+ else:
+ domain2 = domain3 = domain
+ ids = self.pool.get(object).search(cr, uid, domain2, context=context)
+ ids += self.pool.get(object).search(cr, uid, domain3, context=context)
+ for r in self.pool.get(object).perm_read(cr, uid, ids, context, details=False):
+ result.append( (r['write_date'] or r['create_date'], r['id'], context.get('action', 'd')))
+ return result
+base_synchro_obj()
+
+class base_synchro_obj_avoid(osv.osv):
+ _name = "base.synchro.obj.avoid"
+ _description = "Fields to not synchronize"
+ _columns = {
+ 'name':fields.char('Field Name', size=64, select=1, required=1),
+ 'obj_id':fields.many2one('base.synchro.obj', 'Object', required=1,ondelete='cascade'),
+ }
+base_synchro_obj_avoid()
+
+
+class base_synchro_obj_line(osv.osv):
+ '''Class to store the operations done by wizard'''
+ _name = "base.synchro.obj.line"
+ _description = "Synchronized instances"
+ _columns = {
+ 'name': fields.datetime('Date', required=True),
+ 'obj_id': fields.many2one('base.synchro.obj', 'Object', ondelete='cascade', select=True),
+ 'local_id': fields.integer('Local Id',readonly=True),
+ 'remote_id':fields.integer('Remote Id',readonly=True),
+ }
+ _defaults = {
+ 'name': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S')
+ }
+base_synchro_obj_line()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_synchro/base_synchro_view.xml b/addons/base_synchro/base_synchro_view.xml
new file mode 100755
index 00000000000..97995106070
--- /dev/null
+++ b/addons/base_synchro/base_synchro_view.xml
@@ -0,0 +1,146 @@
+
+
+
+
+
+ base.synchro.obj.line.tree
+ base.synchro.obj.line
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ base.synchro.obj.line.form
+ base.synchro.obj.line
+ form
+
+
+
+
+
+
+
+ Synchronized instances
+ ir.actions.act_window
+ base.synchro.obj.line
+ form
+
+
+
+
+
+
+ base.synchro.obj.form
+ base.synchro.obj
+ form
+
+
+
+
+
+
+ base.synchro.obj.tree
+ base.synchro.obj
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Synchronized objects
+ ir.actions.act_window
+ base.synchro.obj
+ form
+
+
+
+
+
+
+
+
+
+
+ base.synchro.server.tree
+ base.synchro.server
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ base.synchro.server.form
+ base.synchro.server
+ form
+
+
+
+
+
+
+ Synchronized Servers
+ ir.actions.act_window
+ base.synchro.server
+ form
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/base_synchro/base_synchro_wizard.xml b/addons/base_synchro/base_synchro_wizard.xml
new file mode 100644
index 00000000000..b26b3bbae2b
--- /dev/null
+++ b/addons/base_synchro/base_synchro_wizard.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/addons/base_synchro/wizard/__init__.py b/addons/base_synchro/wizard/__init__.py
new file mode 100644
index 00000000000..7ff450acd76
--- /dev/null
+++ b/addons/base_synchro/wizard/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import base_synchro
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_synchro/wizard/base_synchro.py b/addons/base_synchro/wizard/base_synchro.py
new file mode 100644
index 00000000000..3a394d4ba3b
--- /dev/null
+++ b/addons/base_synchro/wizard/base_synchro.py
@@ -0,0 +1,279 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import wizard
+import osv
+from datetime import date
+import time
+import pooler
+import xmlrpclib
+import re
+import tools
+import threading
+
+acc_synchro_form = '''
+'''
+
+acc_synchro_fields = {
+ 'server_url': {'string':'Server URL', 'type':'many2one', 'relation':'base.synchro.server','required':True},
+ 'user_id': {'string':'Send Result To', 'type':'many2one', 'relation':'res.users', 'default': lambda uid,data,state: uid},
+}
+
+finish_form ='''
+
+'''
+
+class RPCProxyOne(object):
+ def __init__(self, server, ressource):
+ self.server = server
+ local_url = 'http://%s:%d/xmlrpc/common'%(server.server_url,server.server_port)
+ rpc = xmlrpclib.ServerProxy(local_url)
+ self.uid = rpc.login(server.server_db, server.login, server.password)
+ local_url = 'http://%s:%d/xmlrpc/object'%(server.server_url,server.server_port)
+ self.rpc = xmlrpclib.ServerProxy(local_url)
+ self.ressource = ressource
+ def __getattr__(self, name):
+ return lambda cr, uid, *args, **kwargs: self.rpc.execute(self.server.server_db, self.uid, self.server.password, self.ressource, name, *args, **kwargs)
+
+class RPCProxy(object):
+ def __init__(self, server):
+ self.server = server
+ def get(self, ressource):
+ return RPCProxyOne(self.server, ressource)
+
+class wizard_cost_account_synchro(wizard.interface):
+ start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
+ report = []
+ report_total = 0
+ report_create = 0
+ report_write = 0
+ def _synchronize(self, cr, uid, server, object, context):
+ pool = pooler.get_pool(cr.dbname)
+ self.meta = {}
+ ids = []
+ pool1 = RPCProxy(server)
+ pool2 = pool
+ #try:
+ if object.action in ('d','b'):
+ ids = pool1.get('base.synchro.obj')._get_ids(cr, uid,
+ object.model_id.model,
+ object.synchronize_date,
+ eval(object.domain),
+ {'action':'d'}
+ )
+ if object.action in ('u','b'):
+ ids += pool2.get('base.synchro.obj')._get_ids(cr, uid,
+ object.model_id.model,
+ object.synchronize_date,
+ eval(object.domain),
+ {'action':'u'}
+ )
+ ids.sort()
+ iii = 0
+ for dt, id, action in ids:
+ print 'Process', dt, id, action
+ iii +=1
+ if action=='u':
+ pool_src = pool2
+ pool_dest = pool1
+ else:
+ pool_src = pool1
+ pool_dest = pool2
+ print 'Read', object.model_id.model, id
+ fields = False
+ if object.model_id.model=='crm.case.history':
+ fields = ['email','description','log_id']
+ value = pool_src.get(object.model_id.model).read(cr, uid, [id], fields)[0]
+ value = self._data_transform(cr, uid, pool_src, pool_dest, object.model_id.model, value, action)
+ id2 = self.get_id(cr, uid, object.id, id, action, context)
+ #
+ # Transform value
+ #
+ #tid=pool_dest.get(object.model_id.model).name_search(cr, uid, value['name'],[],'=',)
+ if not (iii%50):
+ print 'Record', iii
+
+ # Filter fields to not sync
+ for field in object.avoid_ids:
+ if field.name in value:
+ del value[field.name]
+
+ if id2:
+ #try:
+ pool_dest.get(object.model_id.model).write(cr, uid, [id2], value)
+ #except Exception, e:
+ #self.report.append('ERROR: Unable to update record ['+str(id2)+']:'+str(value.get('name', '?')))
+ self.report_total+=1
+ self.report_write+=1
+ else:
+ print value
+ idnew = pool_dest.get(object.model_id.model).create(cr, uid, value)
+ synid = pool.get('base.synchro.obj.line').create(cr, uid, {
+ 'obj_id': object.id,
+ 'local_id': (action=='u') and id or idnew,
+ 'remote_id': (action=='d') and id or idnew
+ })
+ self.report_total+=1
+ self.report_create+=1
+ self.meta = {}
+ return 'finish'
+
+ #
+ # IN: object and ID
+ # OUT: ID of the remote object computed:
+ # If object is synchronised, read the sync database
+ # Otherwise, use the name_search method
+ #
+ def get_id(self, cr, uid, object_id, id, action, context={}):
+ pool = pooler.get_pool(cr.dbname)
+ field_src = (action=='u') and 'local_id' or 'remote_id'
+ field_dest = (action=='d') and 'local_id' or 'remote_id'
+ rid = pool.get('base.synchro.obj.line').search(cr, uid, [('obj_id','=',object_id), (field_src,'=',id)], context=context)
+ result = False
+ if rid:
+ result = pool.get('base.synchro.obj.line').read(cr, uid, rid, [field_dest], context=context)[0][field_dest]
+ return result
+
+ def _relation_transform(self, cr, uid, pool_src, pool_dest, object, id, action, context={}):
+ if not id:
+ return False
+ pool = pooler.get_pool(cr.dbname)
+ cr.execute('''select o.id from base_synchro_obj o left join ir_model m on (o.model_id =m.id) where
+ m.model=%s and
+ o.active''', (object,))
+ obj = cr.fetchone()
+ result = False
+ if obj:
+ #
+ # If the object is synchronised and found, set it
+ #
+ result = self.get_id(cr, uid, obj[0], id, action, context)
+ else:
+ #
+ # If not synchronized, try to find it with name_get/name_search
+ #
+ names = pool_src.get(object).name_get(cr, uid, [id], context)[0][1]
+ res = pool_dest.get(object).name_search(cr, uid, names, [], 'like')
+ if res:
+ result = res[0][0]
+ else:
+ # LOG this in the report, better message.
+ print self.report.append('WARNING: Record "%s" on relation %s not found, set to null.' % (names,object))
+ return result
+
+ def _data_transform(self, cr, uid, pool_src, pool_dest, object, data, action='u', context={}):
+ self.meta.setdefault(pool_src, {})
+ if not object in self.meta[pool_src]:
+ self.meta[pool_src][object] = pool_src.get(object).fields_get(cr, uid, context)
+ fields = self.meta[pool_src][object]
+
+ for f in fields:
+ if f not in data:
+ continue
+ ftype = fields[f]['type']
+
+ if ftype in ('function', 'one2many', 'one2one'):
+ del data[f]
+ elif ftype == 'many2one':
+ if data[f]:
+ df = self._relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], data[f][0], action, context)
+ data[f] = df
+ if not data[f]:
+ del data[f]
+ elif ftype == 'many2many':
+ res = map(lambda x: self._relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], x, action, context), data[f])
+ data[f] = [(6, 0, res)]
+ del data['id']
+ return data
+
+ #
+ # Find all objects that are created or modified after the synchronize_date
+ # Synchronize these obejcts
+ #
+ def _upload_download(self, db_name, uid, data, context):
+ cr = pooler.get_db(db_name).cursor()
+ start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
+ pool = pooler.get_pool(cr.dbname)
+ server = pool.get('base.synchro.server').browse(cr, uid, data['form']['server_url'], context)
+ for object in server.obj_ids:
+ dt = time.strftime('%Y-%m-%d %H:%M:%S')
+ self._synchronize(cr, uid, server, object, context)
+ if object.action=='b':
+ time.sleep(1)
+ dt = time.strftime('%Y-%m-%d %H:%M:%S')
+ pool.get('base.synchro.obj').write(cr, uid, [object.id], {'synchronize_date': dt})
+ cr.commit()
+ end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
+ if 'user_id' in data['form'] and data['form']['user_id']:
+ request = pooler.get_pool(cr.dbname).get('res.request')
+ if not self.report:
+ self.report.append('No exception.')
+ summary = '''Here is the synchronization report:
+
+Synchronization started: %s
+Synchronization finnished: %s
+
+Synchronized records: %d
+Records updated: %d
+Records created: %d
+
+Exceptions:
+ '''% (start_date,end_date,self.report_total, self.report_write,self.report_create)
+ summary += '\n'.join(self.report)
+ request.create(cr, uid, {
+ 'name' : "Synchronization report",
+ 'act_from' : uid,
+ 'act_to' : data['form']['user_id'],
+ 'body': summary,
+ })
+ cr.commit()
+ cr.close()
+ return 'finish'
+
+ def _upload_download_multi_thread(self, cr, uid, data, context):
+ threaded_synchronization = threading.Thread(target=self._upload_download, args=(cr.dbname, uid, data, context))
+ threaded_synchronization.start()
+ return 'finish'
+
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':acc_synchro_form, 'fields':acc_synchro_fields, 'state':[('end','Cancel'),('upload_download','Synchronize')]}
+ },
+ 'upload_download': {
+ 'actions': [],
+ 'result':{'type':'choice', 'next_state': _upload_download_multi_thread}
+ },
+ 'finish': {
+ 'actions': [],
+ 'result':{'type':'form', 'arch':finish_form,'fields':{},'state':[('end','Ok')]}
+ },
+ }
+wizard_cost_account_synchro('account.analytic.account.transfer')
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 1ee2f295778..a16f749323d 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -499,10 +499,14 @@ class crm_case_section(osv.osv):
_name = "crm.case.section"
_description = "Sales Teams"
- _order = "parent_id, name"
+ _order = "complete_name"
+
+ def get_full_name(self, cr, uid, ids, field_name, arg, context={}):
+ return dict(self.name_get(cr, uid, ids, context))
_columns = {
'name': fields.char('Sales Team', size=64, required=True, translate=True),
+ 'complete_name': fields.function(get_full_name, method=True, type='char', size=256, readonly=True, store=True),
'code': fields.char('Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to "\
"true, it will allow you to hide the sales team without removing it."),
diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py
index 074821691e8..f7df076e24d 100644
--- a/addons/crm/crm_action_rule.py
+++ b/addons/crm/crm_action_rule.py
@@ -121,7 +121,11 @@ this if you want the rule to send an email to the partner."),
write['email_cc'] = obj.email_cc+','+obj.act_email_cc
else:
write['email_cc'] = obj.act_email_cc
-
+
+ # Put state change by rule in communication history
+ if hasattr(obj, 'state') and action.act_state:
+ model_obj._history(cr, uid, [obj], _(action.act_state))
+
model_obj.write(cr, uid, [obj.id], write, context)
emails = []
diff --git a/addons/crm/crm_installer_view.xml b/addons/crm/crm_installer_view.xml
index 6f276fc2afc..5fad3f41a3d 100644
--- a/addons/crm/crm_installer_view.xml
+++ b/addons/crm/crm_installer_view.xml
@@ -16,7 +16,7 @@
- You can enhance OpenERP's basic CRM support with a few additional OpenERP modules
+ Enhance your CRM basic Application with additional Addons.
13
diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py
index 193bd0bcaee..ad88d552e6b 100644
--- a/addons/delivery/__openerp__.py
+++ b/addons/delivery/__openerp__.py
@@ -40,7 +40,7 @@
'partner_view.xml'
],
'demo_xml': ['delivery_demo.xml'],
- 'test':['test/delivery_test.yml',],
+ 'test':['test/delivery_test.yml','test/delivery_report.yml'],
'installable': True,
'active': False,
'certificate': '0033981912253',
diff --git a/addons/delivery/test/delivery_report.yml b/addons/delivery/test/delivery_report.yml
new file mode 100644
index 00000000000..ed3a859f23d
--- /dev/null
+++ b/addons/delivery/test/delivery_report.yml
@@ -0,0 +1,8 @@
+-
+ In order to test the PDF reports defined on a Delievry, we will print a Delivery Order report
+-
+ !python {model: stock.picking}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.sale.shipping').create(cr, uid, [ref('stock.stock_picking_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'delievry-shipping'+format), 'wb+').write(data)
diff --git a/addons/document/wizard/document_configuration_view.xml b/addons/document/wizard/document_configuration_view.xml
index c6f40deb429..d922a4bcc1c 100644
--- a/addons/document/wizard/document_configuration_view.xml
+++ b/addons/document/wizard/document_configuration_view.xml
@@ -8,10 +8,10 @@
- Resource Directory Configuration
+ Configure Resource Directory
Choose the following Resouces to auto directory configuration.
diff --git a/addons/document_ftp/wizard/ftp_configuration_view.xml b/addons/document_ftp/wizard/ftp_configuration_view.xml
index df3aee360af..27df92ff515 100644
--- a/addons/document_ftp/wizard/ftp_configuration_view.xml
+++ b/addons/document_ftp/wizard/ftp_configuration_view.xml
@@ -15,10 +15,10 @@
- FTP Server Configuration
+ Configure FTP Server
Choose the address for the Document Management System's FTP server.
@@ -30,7 +30,7 @@
-
+
diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py
index 5a79566bcde..3714050cbdb 100644
--- a/addons/hr_attendance/__openerp__.py
+++ b/addons/hr_attendance/__openerp__.py
@@ -43,7 +43,9 @@
'wizard/hr_attendance_sign_in_out_view.xml',
],
'demo_xml': ['hr_attendance_demo.xml'],
- 'test': ['test/test_hr_attendance.yml'],
+ 'test': ['test/test_hr_attendance.yml',
+ 'test/hr_attendance_report.yml'
+ ],
'installable': True,
'active': False,
'certificate': '0063495605613',
diff --git a/addons/hr_attendance/test/hr_attendance_report.yml b/addons/hr_attendance/test/hr_attendance_report.yml
new file mode 100644
index 00000000000..d26f6ddb9bc
--- /dev/null
+++ b/addons/hr_attendance/test/hr_attendance_report.yml
@@ -0,0 +1,19 @@
+-
+ In order to test the PDF reports defined on HR Attendance, we will print a report of HR Attendance By Month
+-
+ !python {model: hr.employee}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'hr.employee', 'form': {'month': time.gmtime()[1], 'year': time.gmtime()[0]}}
+ (data, format) = netsvc.LocalService('report.hr.attendance.bymonth').create(cr, uid, [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-by_month_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on HR Attendance, we will print a report of HR Attendance Error
+-
+ !python {model: hr.employee}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'hr.employee', 'form': {'init_date': time.strftime('%Y-01-01'), 'end_date':time.strftime('%Y-%m-%d'), 'emp_ids': [ref('hr.employee1')], 'max_delay': 120}}
+ (data, format) = netsvc.LocalService('report.hr.attendance.error').create(cr, uid, [ref('hr.employee1')], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-error_report.'+format), 'wb+').write(data)
diff --git a/addons/hr_evaluation/__openerp__.py b/addons/hr_evaluation/__openerp__.py
index 9710a84b4d7..b28c6d4e913 100644
--- a/addons/hr_evaluation/__openerp__.py
+++ b/addons/hr_evaluation/__openerp__.py
@@ -40,6 +40,7 @@
],
"update_xml": [
"security/ir.model.access.csv",
+ "security/hr_evaluation_security.xml",
"wizard/hr_evaluation_mail_view.xml",
"hr_evaluation_view.xml",
"report/hr_evaluation_report_view.xml"
diff --git a/addons/hr_evaluation/security/hr_evaluation_security.xml b/addons/hr_evaluation/security/hr_evaluation_security.xml
new file mode 100644
index 00000000000..49b0e19177b
--- /dev/null
+++ b/addons/hr_evaluation/security/hr_evaluation_security.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_evaluation/security/ir.model.access.csv b/addons/hr_evaluation/security/ir.model.access.csv
index 4e37e74ca0f..181e412ce69 100644
--- a/addons/hr_evaluation/security/ir.model.access.csv
+++ b/addons/hr_evaluation/security/ir.model.access.csv
@@ -12,3 +12,20 @@
"access_hr_evaluation_plan_phase_system","hr_evaluation.plan.phase.system","model_hr_evaluation_plan_phase","base.group_system",1,1,1,1
"access_hr_evaluation_evaluation_system","hr_evaluation.evaluation.system","model_hr_evaluation_evaluation","base.group_system",1,0,0,0
"access_hr_evaluation_interview_system","hr.evaluation.interview.system","model_hr_evaluation_interview","base.group_system",1,0,0,0
+"access_survey_type_hr_manager","survey.type","survey.model_survey_type","base.group_hr_manager",1,1,1,1
+"access_survey_hr_manager","survey.hr.manager","survey.model_survey","base.group_hr_manager",1,1,1,1
+"access_survey_history_manager","survey.history","survey.model_survey_history","base.group_hr_manager",1,1,1,1
+"access_survey_page_hr_manager","survey.page","survey.model_survey_page","base.group_hr_manager",1,1,1,1
+"access_survey_question_hr_manager","survey.question","survey.model_survey_question","base.group_hr_manager",1,1,1,1
+"access_survey_question_column_heading_hr_manager","survey.question.column.heading","survey.model_survey_question_column_heading","base.group_hr_manager",1,1,1,1
+"access_survey_answer_hr_manager","survey.answer","survey.model_survey_answer","base.group_hr_manager",1,1,1,1
+"access_survey_response_hr_manager","survey.response","survey.model_survey_response","base.group_hr_manager",1,1,1,1
+"access_survey_response_line_hr_manager","survey.response.line","survey.model_survey_response_line","base.group_hr_manager",1,1,1,1
+"access_survey_tbl_column_heading_hr_manager","survey.tbl.column.heading","survey.model_survey_tbl_column_heading","base.group_hr_manager",1,1,1,1
+"access_survey_response_answer_hr_manager","survey.response.answer","survey.model_survey_response_answer","base.group_hr_manager",1,1,1,1
+"access_survey_request_hr_manager","survey.request","survey.model_survey_request","base.group_hr_manager",1,1,1,1
+"access_survey_hr_user","survey.hr.user","survey.model_survey","base.group_hr_user",1,1,1,0
+"access_survey_answer_hr_user","survey.answer.hr.user","survey.model_survey_answer","base.group_hr_user",1,1,1,0
+"access_survey_response_answer_hr_user","survey.response.answer.hr.user","survey.model_survey_response_answer","base.group_hr_user",1,1,1,0
+"access_survey_type_hr_user","survey.type.hr.user","survey.model_survey_type","base.group_hr_user",1,1,1,0
+"access_survey_question_hr_user","survey.question.hr.user","survey.model_survey_question","base.group_hr_user",1,1,1,0
\ No newline at end of file
diff --git a/addons/hr_expense/__openerp__.py b/addons/hr_expense/__openerp__.py
index aa45f4aa888..fe06b0110c2 100644
--- a/addons/hr_expense/__openerp__.py
+++ b/addons/hr_expense/__openerp__.py
@@ -55,7 +55,9 @@
'demo_xml': [
'hr_expense_demo.xml',
],
- 'test': ['test/test_hr_expense.yml'],
+ 'test': ['test/test_hr_expense.yml',
+ 'test/hr_expense_report.yml',
+ ],
'installable': True,
'active': False,
'certificate': '0062479841789',
diff --git a/addons/hr_expense/test/hr_expense_report.yml b/addons/hr_expense/test/hr_expense_report.yml
new file mode 100644
index 00000000000..4c81ceb5976
--- /dev/null
+++ b/addons/hr_expense/test/hr_expense_report.yml
@@ -0,0 +1,8 @@
+-
+ In order to test the PDF reports defined on a HR Expense, we will print a HR Expense
+-
+ !python {model: hr.expense.expense}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.hr.expense').create(cr, uid, [ref('hr_expense.hr_expense_expense_septemberexpenses0'),ref('hr_expense.hr_expense_expense_septemberexpenses1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_expense-report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/hr_holidays/__openerp__.py b/addons/hr_holidays/__openerp__.py
index 7d68b216494..e6d901ad02c 100644
--- a/addons/hr_holidays/__openerp__.py
+++ b/addons/hr_holidays/__openerp__.py
@@ -65,7 +65,9 @@
'board_hr_holidays_view.xml',
],
'demo_xml': ['hr_holidays_demo.xml',],
- 'test': ['test/test_hr_holiday.yml'],
+ 'test': ['test/test_hr_holiday.yml',
+ 'test/hr_holidays_report.yml',
+ ],
'installable': True,
'active': False,
'certificate': '0086579209325',
diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py
index a551e3a0a5d..a14970b31e5 100644
--- a/addons/hr_holidays/report/holidays_summary_report.py
+++ b/addons/hr_holidays/report/holidays_summary_report.py
@@ -87,7 +87,8 @@ class report_custom(report_rml):
depts=[]
emp_id={}
# done={}
-
+ rpt_obj = pooler.get_pool(cr.dbname).get('hr.holidays')
+ rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
cr.execute("SELECT name FROM res_company")
res=cr.fetchone()[0]
date_xml=[]
@@ -113,8 +114,8 @@ class report_custom(report_rml):
else:
type="Confirmed and Validated"
holiday_type=('confirm','validate')
- date_xml.append('%s\n'% (som))
- date_xml.append('%s\n' %(eom))
+ date_xml.append('%s\n'% (str(rml_obj.formatLang(som.strftime("%Y-%m-%d"),date=True))))
+ date_xml.append('%s\n' %(str(rml_obj.formatLang(eom.strftime("%Y-%m-%d"),date=True))))
date_xml.append('%s'%(type))
# date_xml=[]
@@ -229,8 +230,6 @@ class report_custom(report_rml):
emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom)
row_id = row_id +1
- rpt_obj = pooler.get_pool(cr.dbname).get('hr.holidays')
- rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
header_xml = '''
%s
diff --git a/addons/hr_holidays/test/hr_holidays_report.yml b/addons/hr_holidays/test/hr_holidays_report.yml
new file mode 100644
index 00000000000..9faf7358b53
--- /dev/null
+++ b/addons/hr_holidays/test/hr_holidays_report.yml
@@ -0,0 +1,14 @@
+-
+ In order to test the PDF reports defined on a HR Holidays, we will print HR Holidays
+-
+ !python {model: hr.holidays}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'depts' : [ref('hr.dep_sales')],'holiday_type' : 'Validated' }}
+ (data, format) = netsvc.LocalService('report.holidays.summary').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_holidays-dept_summary_report.'+format), 'wb+').write(data)
+
+ data_dict = {'model': 'hr.employee', 'form': {'date_from': time.strftime('%Y-%m-01'), 'depts' : [ref('hr.dep_sales')],'holiday_type' : 'Validated','emp':[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')] }}
+ (data, format) = netsvc.LocalService('report.holidays.summary').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_holidays-employee_summary_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/hr_payroll/__openerp__.py b/addons/hr_payroll/__openerp__.py
index b7886da2df0..ab814ed80c2 100644
--- a/addons/hr_payroll/__openerp__.py
+++ b/addons/hr_payroll/__openerp__.py
@@ -60,6 +60,7 @@
'test/payslip.yml',
'test/payment_advice.yml',
'test/payroll_register.yml',
+ 'test/hr_payroll_report.yml',
],
'demo_xml': [
'hr_payroll_demo.xml'
diff --git a/addons/hr_payroll/hr_payroll_demo.xml b/addons/hr_payroll/hr_payroll_demo.xml
index 9c2ce90cd7a..0d5b593279e 100644
--- a/addons/hr_payroll/hr_payroll_demo.xml
+++ b/addons/hr_payroll/hr_payroll_demo.xml
@@ -72,6 +72,7 @@
First Contract
+
This is a First Contract
diff --git a/addons/hr_payroll/report/payroll_register.rml b/addons/hr_payroll/report/payroll_register.rml
index 178695d2d9c..d7df0ada7cc 100644
--- a/addons/hr_payroll/report/payroll_register.rml
+++ b/addons/hr_payroll/report/payroll_register.rml
@@ -22,7 +22,7 @@
-
+
@@ -34,7 +34,7 @@
-
+
@@ -65,6 +65,7 @@
+
@@ -131,11 +132,11 @@
-
-
-
-
+
+
+
+
|
#
@@ -163,14 +164,18 @@
|
-
+
+
+
+
+
+ [[repeatIn(o.line_ids, 'l')]]
+
|
[[ get_no() ]]
|
- [[ repeatIn(o.line_ids, 'l') ]]
- [[add_line(l)]]
[[ l.employee_id.name ]]
|
@@ -193,40 +198,46 @@
|
-
-
- |
-
-
-
- |
-
- Total SAL([[ company.currency_id.code]])
- |
-
- [[formatLang(get_basic())]][[ company.currency_id.symbol]]
- |
-
- [[formatLang(get_other())]] [[ company.currency_id.symbol]]
- |
-
- [[formatLang(get_allow())]] [[ company.currency_id.symbol]]
- |
-
- [[formatLang(get_grows())]] [[ company.currency_id.symbol]]
- |
-
- [[formatLang(get_deduct())]] [[ company.currency_id.symbol]]
- |
-
- [[formatLang(get_net())]] [[ company.currency_id.symbol]]
- |
-
-
-
+
+
+
+ |
+
+
+
+ |
+
+ Total SAL([[ company.currency_id.code]])
+ |
+
+ [[formatLang(get_basic())]][[ company.currency_id.symbol]]
+ |
+
+ [[formatLang(get_other())]] [[ company.currency_id.symbol]]
+ |
+
+ [[formatLang(get_allow())]] [[ company.currency_id.symbol]]
+ |
+
+ [[formatLang(get_grows())]] [[ company.currency_id.symbol]]
+ |
+
+ [[formatLang(get_deduct())]] [[ company.currency_id.symbol]]
+ |
+
+ [[formatLang(get_net())]] [[ company.currency_id.symbol]]
+ |
+
+
+
+
+
+
+
+
|
diff --git a/addons/hr_payroll/report/report_emp_salary_structure.py b/addons/hr_payroll/report/report_emp_salary_structure.py
index 0c63f446c38..d4365a8423b 100644
--- a/addons/hr_payroll/report/report_emp_salary_structure.py
+++ b/addons/hr_payroll/report/report_emp_salary_structure.py
@@ -36,7 +36,8 @@ class salary_structure_report(report_sxw.rml_parse):
'get_type':self.get_type,
'get_contract':self.get_contract,
'get_line_amount_type':self.get_line_amount_type,
- 'get_line_type':self.get_line_type
+ 'get_line_type':self.get_line_type,
+ 'get_line_amount_symbol':self.get_line_amount_symbol
})
def get_contract(self,emp):
@@ -69,6 +70,10 @@ class salary_structure_report(report_sxw.rml_parse):
else:
return 'Fixed'
+ def get_line_amount_symbol(self,amount_type):
+ if amount_type != 'per':
+ return self.pool.get('res.users').browse(self.cr, self.uid,self.uid).company_id.currency_id.symbol
+
def get_line_type(self,type):
if type == 'allounce':
return 'Allowance'
diff --git a/addons/hr_payroll/report/report_emp_salary_structure.rml b/addons/hr_payroll/report/report_emp_salary_structure.rml
index 11bfee609f0..ee564052af3 100644
--- a/addons/hr_payroll/report/report_emp_salary_structure.rml
+++ b/addons/hr_payroll/report/report_emp_salary_structure.rml
@@ -441,7 +441,7 @@
[[ get_line_amount_type(line.amount_type) ]]
|
- [[ formatLang(line.amount) or '']][[ employee.company_id.currency_id.symbol]]
+ [[ formatLang(line.amount) or '']][[ get_line_amount_symbol(line.amount_type) ]]
|
[[ get_line_type(line.type) ]]
diff --git a/addons/hr_payroll/report/report_employees_detail.rml b/addons/hr_payroll/report/report_employees_detail.rml
index 8a9689b45c6..3b032af3409 100644
--- a/addons/hr_payroll/report/report_employees_detail.rml
+++ b/addons/hr_payroll/report/report_employees_detail.rml
@@ -172,19 +172,19 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -194,13 +194,13 @@
-
-
-
-
+
+
+
+
-
-
+
+
@@ -210,8 +210,8 @@
-
-
+
+
@@ -225,10 +225,10 @@
+
-
- [[ repeatIn(get_employee(data['form']), 'o') ]]
+ [[ repeatIn(get_employee(data['form']), 'o') ]] [[ get_employee_detail(o) ]]
Employees Salary Details
For [[ get_fiscalyear(data['form']['fiscalyear_id']) ]]
@@ -284,7 +284,7 @@
Designation
|
- [[ o.contract_ids and o.contract_ids[0].function.name or '' ]]
+ [[ o.contract_ids and o.contract_ids[0].job_id.name or '' ]]
|
Phone No.
@@ -355,7 +355,9 @@
- [[ get_employee_detail(o) ]]
+
+
+
Allowances with Basic:
[[ repeatIn(get_allow(),'e1') ]]
@@ -528,43 +530,43 @@
[[ get_monthly_total()[0] ]]
|
- [[ formatLang(get_monthly_total()[1]) ]]
+ [[ formatLang(get_monthly_total()[1]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[2]) ]]
+ [[ formatLang(get_monthly_total()[2]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[3]) ]]
+ [[ formatLang(get_monthly_total()[3]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[4]) ]]
+ [[ formatLang(get_monthly_total()[4]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[5]) ]]
+ [[ formatLang(get_monthly_total()[5]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[6]) ]]
+ [[ formatLang(get_monthly_total()[6]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[7]) ]]
+ [[ formatLang(get_monthly_total()[7]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[8]) ]]
+ [[ formatLang(get_monthly_total()[8]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[9]) ]]
+ [[ formatLang(get_monthly_total()[9]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[10]) ]]
+ [[ formatLang(get_monthly_total()[10]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[11]) ]]
+ [[ formatLang(get_monthly_total()[11]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_monthly_total()[12]) ]]
+ [[ formatLang(get_monthly_total()[12]) ]][[ company.currency_id.symbol ]]
|
- [[ formatLang(get_total()) ]]
+ [[ formatLang(get_total()) ]][[ company.currency_id.symbol ]]
|
@@ -579,4 +581,4 @@
-
+
\ No newline at end of file
diff --git a/addons/hr_payroll/test/hr_payroll_report.yml b/addons/hr_payroll/test/hr_payroll_report.yml
new file mode 100644
index 00000000000..35020d30ceb
--- /dev/null
+++ b/addons/hr_payroll/test/hr_payroll_report.yml
@@ -0,0 +1,39 @@
+-
+ In order to test the PDF reports defined on HR Payroll, we will print Employees' Salary Structure
+-
+ !python {model: hr.employee}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.salary.structure').create(cr, uid, [ref('hr_payroll.hr_employee_bonamy0')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-salary_structure.'+format), 'wb+').write(data)
+
+-
+ Print HR Payslip
+-
+ !python {model: hr.payslip}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.payslip.pdf').create(cr, uid, [ref('hr_payroll.hr_payslip_salaryslipofbonamyforjune0')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payslip_report.'+format), 'wb+').write(data)
+
+-
+ Print HR Employee Salary Details
+-
+ !python {model: hr.payslip}: |
+ import netsvc, tools, os, time
+ emp_ids = [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]
+ data_dict = {'model': 'ir.ui.menu', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'employee_ids': emp_ids, 'ids':emp_ids }}
+ (data, format) = netsvc.LocalService('report.employees.salary').create(cr, uid, [], data_dict, {'active_ids': emp_ids})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_salary_detail_report.'+format), 'wb+').write(data)
+-
+ Print HR Employee Salary Details Annual basis
+-
+ !python {model: hr.payslip}: |
+ import netsvc, tools, os, time
+ emp_ids = [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]
+ data_dict = {'model': 'hr.payslip', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'salary_on': 'current_month', 'employee_ids': emp_ids, 'ids':emp_ids}}
+ (data, format) = netsvc.LocalService('report.year.salary').create(cr, uid, [], data_dict,{'active_ids': emp_ids} )
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_yearly_salary_detail_report.'+format), 'wb+').write(data)
+
diff --git a/addons/hr_payroll/test/payment_advice.yml b/addons/hr_payroll/test/payment_advice.yml
index a2a9c3d5dbe..934485109b6 100644
--- a/addons/hr_payroll/test/payment_advice.yml
+++ b/addons/hr_payroll/test/payment_advice.yml
@@ -52,3 +52,12 @@
from tools.translate import _
advice_id=self.browse(cr, uid, ref("hr_payroll_advice_advice0"))
assert(advice_id.state == 'confirm'), _('State not changed!')
+
+-
+ Print Payroll Advice
+-
+ !python {model: hr.payroll.advice}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.payroll.advice').create(cr, uid, [ref('hr_payroll_advice_advice0')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payroll-advice.'+format), 'wb+').write(data)
diff --git a/addons/hr_payroll/test/payroll_register.yml b/addons/hr_payroll/test/payroll_register.yml
index f5772602db4..6ce953c1d94 100644
--- a/addons/hr_payroll/test/payroll_register.yml
+++ b/addons/hr_payroll/test/payroll_register.yml
@@ -1,6 +1,5 @@
-
I test the 'Payroll Register' in order to check the hr_payroll in OpenERP
--
I create a new employee “Keith”
-
!record {model: hr.employee, id: hr_employee_keith0}:
@@ -61,3 +60,12 @@
from tools.translate import _
reg_brw=self.browse(cr, uid, ref("hr_payroll_register_payroll0"))
assert(reg_brw.state == 'hr_check'), _('State not changed!')
+
+-
+ Print HR Payroll Register
+-
+ !python {model: hr.payroll.register}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.hr.payroll.register.sheet').create(cr, uid, [ref('hr_payroll_register_payroll0')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-register_report.'+format), 'wb+').write(data)
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 6138bf42b99..ee2221b58c2 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -194,9 +194,6 @@
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"
icon="terp-mail-message-new" type="action" />
-
diff --git a/addons/hr_recruitment/report/hr_recruitment_report_view.xml b/addons/hr_recruitment/report/hr_recruitment_report_view.xml
index a789206b518..edb00d1f727 100644
--- a/addons/hr_recruitment/report/hr_recruitment_report_view.xml
+++ b/addons/hr_recruitment/report/hr_recruitment_report_view.xml
@@ -130,7 +130,7 @@
{'search_default_month':1,'search_default_User':1,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}
-
+
diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py
index c7207b6761c..90ddc25fff6 100644
--- a/addons/hr_timesheet/__openerp__.py
+++ b/addons/hr_timesheet/__openerp__.py
@@ -50,7 +50,9 @@ to set up a management by affair.
'wizard/hr_timesheet_sign_in_out_view.xml',
],
'demo_xml': ['hr_timesheet_demo.xml'],
- 'test': ['test/test_hr_timesheet.yml'],
+ 'test': ['test/test_hr_timesheet.yml',
+ 'test/hr_timesheet_report.yml',
+ ],
'installable': True,
'active': False,
'certificate': '0071405533469',
diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml
index cbd0675208f..6029336542d 100644
--- a/addons/hr_timesheet/hr_timesheet_view.xml
+++ b/addons/hr_timesheet/hr_timesheet_view.xml
@@ -31,17 +31,31 @@
form
diff --git a/addons/hr_timesheet/security/ir.model.access.csv b/addons/hr_timesheet/security/ir.model.access.csv
index cab38e5b519..0b75f11e2c4 100644
--- a/addons/hr_timesheet/security/ir.model.access.csv
+++ b/addons/hr_timesheet/security/ir.model.access.csv
@@ -7,3 +7,4 @@
"access_product_uom_hr_timesheet","product.uom.hr.timesheet","product.model_product_uom","base.group_hr_user",1,0,0,0
"access_hr_analytic_timesheet_manager","hr.analytic.timesheet.manager","model_hr_analytic_timesheet","base.group_hr_manager",1,0,0,0
"access_hr_analytic_timesheet_system","hr.analytic.timesheet.system","model_hr_analytic_timesheet","base.group_system",1,0,0,0
+"access_hr_analytic_timesheet_employee","hr.analytic.timesheet.employee","model_hr_analytic_timesheet","base.group_user",1,1,1,0
diff --git a/addons/hr_timesheet/test/hr_timesheet_report.yml b/addons/hr_timesheet/test/hr_timesheet_report.yml
new file mode 100644
index 00000000000..811858eb7f2
--- /dev/null
+++ b/addons/hr_timesheet/test/hr_timesheet_report.yml
@@ -0,0 +1,23 @@
+-
+ In order to test the PDF reports defined on HR Timesheet User Report, we will print a HR Timesheet User Report
+-
+ !python {model: hr.employee}: |
+ import netsvc, tools, os, time
+ month = time.gmtime()[1]
+ year = time.gmtime()[0]
+ data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'user_id' : uid }}
+ (data, format) = netsvc.LocalService('report.hr.analytical.timesheet').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet-user_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on HR Timesheet Users Report, we will print a HR Timesheet Users Report
+-
+ !python {model: hr.employee}: |
+ import netsvc, tools, os, time
+ month = time.gmtime()[1]
+ year = time.gmtime()[0]
+ data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'user_ids' : [uid] }}
+ (data, format) = netsvc.LocalService('report.hr.analytical.timesheet_users').create(cr, uid, [], data_dict, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet-users_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/__openerp__.py b/addons/hr_timesheet_invoice/__openerp__.py
index f9be64cc454..f45490867c2 100644
--- a/addons/hr_timesheet_invoice/__openerp__.py
+++ b/addons/hr_timesheet_invoice/__openerp__.py
@@ -47,7 +47,9 @@ reports, eso.""",
],
'demo_xml': ['hr_timesheet_invoice_demo.xml',
],
- 'test': ['test/test_hr_timesheet_invoice.yml'],
+ 'test': ['test/test_hr_timesheet_invoice.yml',
+ 'test/hr_timesheet_invoice_report.yml',
+ ],
'installable': True,
'active': False,
'certificate': '0056091842381',
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
index ef4bee1deb3..1befaebf168 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
@@ -21,28 +21,16 @@
-
- account.analytic.account.form
- account.analytic.account
-
- form
-
-
-
-
-
-
-
hr.analytic.timesheet.form
hr.analytic.timesheet
form
-
+
-
+
diff --git a/addons/hr_timesheet_invoice/report/account_analytic_profit.rml b/addons/hr_timesheet_invoice/report/account_analytic_profit.rml
index 0e6a12030f2..3cb4b150395 100644
--- a/addons/hr_timesheet_invoice/report/account_analytic_profit.rml
+++ b/addons/hr_timesheet_invoice/report/account_analytic_profit.rml
@@ -157,10 +157,12 @@
|
- [[ data['form']['date_from'] ]]
+ [[ formatLang (data['form']['date_from'],date=True)
+]]
|
- [[ data['form']['date_to'] ]]
+ [[ formatLang (data['form']['date_to'],date=True)
+ ]]
|
[[ company.currency_id.name ]]
diff --git a/addons/hr_timesheet_invoice/security/ir.model.access.csv b/addons/hr_timesheet_invoice/security/ir.model.access.csv
index 619fc6344cf..7089e184f98 100644
--- a/addons/hr_timesheet_invoice/security/ir.model.access.csv
+++ b/addons/hr_timesheet_invoice/security/ir.model.access.csv
@@ -12,3 +12,5 @@
"access_report_analytic_account_close_system","report.analytic.account.close system","model_report_analytic_account_close","base.group_system",1,1,1,1
"access_report_account_analytic_line_to_invoice_system","report.account.analytic.line.to.invoice system","model_report_account_analytic_line_to_invoice","base.group_system",1,1,1,1
"access_report_timesheet_line","report.timesheet.line","model_report_timesheet_line","base.group_hr_manager",1,0,0,0
+"access_account_invoice_hr_user","account.invoice.hr.user","account.model_account_invoice","base.group_hr_user",1,1,1,0
+"access_account_fiscalyear_hr_user","account.fiscalyear.hr.user","account.model_account_fiscalyear","base.group_hr_user",1,1,1,0
diff --git a/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml
new file mode 100644
index 00000000000..ecdd486a65e
--- /dev/null
+++ b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml
@@ -0,0 +1,20 @@
+-
+ In order to test the PDF reports defined on HR Timesheet Account Analytic Profit, we will print report of HR Timesheet Account Analytic Profit
+-
+ !python {model: account.analytic.line}: |
+ import netsvc, tools, os, time
+ data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'employee_ids': [[6,0,[ref('hr.employee1'), ref('hr.employee2'),ref('hr.employee3')]]], 'journal_ids': [[6,0,[ref('account.cose_journal_sale'),ref('account.exp'),ref('account.sit')]]], 'date_to': time.strftime('%Y-%m-%d')}}
+ (data, format) = netsvc.LocalService('report.account.analytic.profit').create(cr, uid, [], data_dict, {})
+ 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)
+
+-
+ In order to test the PDF reports defined on HR Cost Ledger, we will print report of HR Cost Ledger
+-
+ !python {model: account.analytic.account}: |
+ import netsvc, tools, os, time
+ acc_ids = [ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_sednacom'),ref('account.analytic_thymbra'),ref('account.analytic_partners_camp_to_camp')]
+ data_dict = {'model': 'ir.ui.menu', 'form': {'date1': time.strftime('%Y-01-01'), 'date2': time.strftime('%Y-%m-%d')}}
+ (data, format) = netsvc.LocalService('report.hr.timesheet.invoice.account.analytic.account.cost_ledger').create(cr, uid, acc_ids, data_dict, {'active_ids': acc_ids})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-cost_ledger_report.'+format), 'wb+').write(data)
diff --git a/addons/hr_timesheet_sheet/security/ir.model.access.csv b/addons/hr_timesheet_sheet/security/ir.model.access.csv
index 3ca4d966f78..de19d325f5f 100644
--- a/addons/hr_timesheet_sheet/security/ir.model.access.csv
+++ b/addons/hr_timesheet_sheet/security/ir.model.access.csv
@@ -6,7 +6,7 @@
"access_hr_timesheet_sheet_sheet_manager","hr_timesheet_sheet.sheet.manager","model_hr_timesheet_sheet_sheet","base.group_hr_manager",1,1,1,1
"access_hr_timesheet_sheet_sheet_system","hr_timesheet_sheet.sheet.system","model_hr_timesheet_sheet_sheet","base.group_system",1,0,0,0
"access_timesheet_report_manager","timesheet.report.manager","model_timesheet_report","base.group_hr_manager",1,1,1,1
-"access_hr_timesheet_sheet_sheet_employee","hr_timesheet_sheet.sheet.employee","model_hr_timesheet_sheet_sheet","base.group_user",1,0,0,0
+"access_hr_timesheet_sheet_sheet_employee","hr_timesheet_sheet.sheet.employee","model_hr_timesheet_sheet_sheet","base.group_user",1,1,1,0
"access_hr_timesheet_sheet_sheet_day_manager","hr_timesheet_sheet.sheet.day.manager","model_hr_timesheet_sheet_sheet_day","base.group_hr_manager",1,1,1,1
"access_hr_timesheet_sheet_sheet_account_manager","hr_timesheet_sheet.sheet.account.manager","model_hr_timesheet_sheet_sheet_account","base.group_hr_manager",1,1,1,1
"access_hr_timesheet_sheet_sheet_day_employee","hr_timesheet_sheet.sheet.day.employee","model_hr_timesheet_sheet_sheet_day","base.group_user",1,0,0,0
diff --git a/addons/knowledge/knowledge_installer.xml b/addons/knowledge/knowledge_installer.xml
index e184c8b8933..681bf2253d5 100644
--- a/addons/knowledge/knowledge_installer.xml
+++ b/addons/knowledge/knowledge_installer.xml
@@ -20,7 +20,7 @@
- You can select various OpenERP applications which will help you and your employees to store and share information.
+ Share information within the company with these specific Addons.
diff --git a/addons/l10n_ch/__openerp__.py b/addons/l10n_ch/__openerp__.py
index de378528b33..1af2e70ca59 100644
--- a/addons/l10n_ch/__openerp__.py
+++ b/addons/l10n_ch/__openerp__.py
@@ -94,6 +94,9 @@ TODO :
"account_journal_view.xml",
"security/ir.model.access.csv",
],
+ 'test' : [
+ 'test/l10n_ch_report.yml',
+ ],
"active": False,
"installable": True,
}
diff --git a/addons/l10n_ch/test/l10n_ch_report.yml b/addons/l10n_ch/test/l10n_ch_report.yml
new file mode 100644
index 00000000000..49c058a4bc8
--- /dev/null
+++ b/addons/l10n_ch/test/l10n_ch_report.yml
@@ -0,0 +1,17 @@
+-
+ In order to test the PDF reports defined on a l10n_ch, we will print BVR Report
+-
+ !python {model: account.invoice}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.l10n_ch.bvr').create(cr, uid, [ref('account.test_invoice_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'l10ch-bvr_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a l10n_ch, we will print a BVR Invoice Report
+-
+ !python {model: account.invoice}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.l10n_ch.invoice.bvr').create(cr, uid, [ref('account.test_invoice_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'l10ch-bvr_invoice_report.'+format), 'wb+').write(data)
diff --git a/addons/l10n_fr/__openerp__.py b/addons/l10n_fr/__openerp__.py
index f96945a8bc8..0de26734781 100644
--- a/addons/l10n_fr/__openerp__.py
+++ b/addons/l10n_fr/__openerp__.py
@@ -48,8 +48,9 @@ Credits: Sistheo Zeekom CrysaLEAD
"security/ir.model.access.csv",
"wizard/fr_report_bilan_view.xml",
"wizard/fr_report_compute_resultant_view.xml",
-
+
],
+ "test": ['test/l10n_fr_report.yml'],
"demo_xml" : [],
"certificate" : "00435321693876313629",
"active": False,
diff --git a/addons/l10n_fr/test/l10n_fr_report.yml b/addons/l10n_fr/test/l10n_fr_report.yml
new file mode 100644
index 00000000000..ddc95595175
--- /dev/null
+++ b/addons/l10n_fr/test/l10n_fr_report.yml
@@ -0,0 +1,26 @@
+-
+ In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear "Fiscal Year 2011" to which the entries will move
+-
+ !record {model: account.fiscalyear, id: account_fiscalyear_01}:
+ code: FY2011
+ company_id: base.main_company
+ date_start: '2012-01-01'
+ date_stop: '2012-12-31'
+ name: Fiscal Year 2012
+-
+ In order to test the PDF reports defined on a l10n_fr, we will print an Account Move Line Report for l10n_fr
+-
+ !python {model: account.move.line}: |
+ import netsvc, tools, os, time
+ (data, format) = netsvc.LocalService('report.l10n.fr.bilan').create(cr, uid, [], {'model':'account.move.line', 'form':{'fiscalyear_id': ref('account_fiscalyear_01')}}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-bilan_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a l10n_fr, we will print a Compute Resultant Report for l10n_fr
+-
+ !python {model: account.move.line}: |
+ import netsvc, tools, os,time
+ (data, format) = netsvc.LocalService('report.l10n.fr.compute_resultant').create(cr, uid, [], {'model':'account.move.line', 'form':{'fiscalyear_id': ref('account.data_fiscalyear')}}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-compute_resultant_report.'+format), 'wb+').write(data)
diff --git a/addons/l10n_lu/__openerp__.py b/addons/l10n_lu/__openerp__.py
index 739f36c9ce4..d1f6ba49905 100644
--- a/addons/l10n_lu/__openerp__.py
+++ b/addons/l10n_lu/__openerp__.py
@@ -41,6 +41,7 @@ This module installs:
'account.tax.template.csv',
'wizard/print_vat_view.xml'
],
+ 'test': ['test/l10n_lu_report.yml'],
'demo_xml': ['account.report.report.csv'],
'installable': True,
'active': False,
diff --git a/addons/l10n_lu/test/l10n_lu_report.yml b/addons/l10n_lu/test/l10n_lu_report.yml
new file mode 100644
index 00000000000..43b1ce35df1
--- /dev/null
+++ b/addons/l10n_lu/test/l10n_lu_report.yml
@@ -0,0 +1,14 @@
+-
+ It is demo data for the account.tax.code
+-
+ !record {model: account.tax.code, id: account_tax_code_id_r1}:
+ name: a
+
+-
+ In order to test the PDF reports defined on a l10u_lu, we will print a VAT Report
+-
+ !python {model: res.partner}: |
+ import netsvc, tools, os
+ (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')}}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'l10n_lu-vat_report.'+format), 'wb+').write(data)
diff --git a/addons/lunch/__openerp__.py b/addons/lunch/__openerp__.py
index ab540ad10d3..2e5c2489339 100644
--- a/addons/lunch/__openerp__.py
+++ b/addons/lunch/__openerp__.py
@@ -49,9 +49,8 @@
'report/report_lunch_order_view.xml',
],
"demo_xml": ['lunch_demo.xml'],
- "test": ['test/test_lunch.yml'],
+ "test": ['test/test_lunch.yml', 'test/lunch_report.yml'],
"installable": True,
}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/lunch/test/lunch_report.yml b/addons/lunch/test/lunch_report.yml
new file mode 100644
index 00000000000..2043afe7796
--- /dev/null
+++ b/addons/lunch/test/lunch_report.yml
@@ -0,0 +1,8 @@
+-
+ In order to test the PDF reports defined on a Lunch, we will print a Lunch Order Report
+-
+ !python {model: lunch.order}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.lunch.order').create(cr, uid, [ref('lunch.lunch_order_0'),ref('lunch.lunch_order_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'lunch-lunch_order_report.'+format), 'wb+').write(data)
diff --git a/addons/marketing/marketing_view.xml b/addons/marketing/marketing_view.xml
index 3c5950b355f..b96ba8fb7e3 100644
--- a/addons/marketing/marketing_view.xml
+++ b/addons/marketing/marketing_view.xml
@@ -19,7 +19,7 @@
- OpenERP provides tools to automate your leads process, design marketing campaigns and profile efficiently your customers.
+ OpenERP provides Addons to better manage your sales and marketing processes. Select the ones you would be interested in.
13
diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py
index f8630065598..c56466501e0 100644
--- a/addons/mrp/__openerp__.py
+++ b/addons/mrp/__openerp__.py
@@ -92,7 +92,8 @@
'test/mrp_packs.yml',
'test/mrp_phantom_bom.yml',
'test/mrp_production_order.yml',
-
+ 'test/mrp_report.yml',
+
],
'installable': True,
'active': False,
diff --git a/addons/mrp/mrp_installer.xml b/addons/mrp/mrp_installer.xml
index 4ba15e03f0e..d317cf6face 100644
--- a/addons/mrp/mrp_installer.xml
+++ b/addons/mrp/mrp_installer.xml
@@ -16,7 +16,7 @@
- After having installed the core manufacturing application, you can extend it depending on the needs of your MRP's organization
+ Add more functionalities to the core Manufacturing Application with the following addons.
diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py
index 762d1e4b2a6..3a6ab81a308 100644
--- a/addons/mrp/report/price.py
+++ b/addons/mrp/report/price.py
@@ -23,7 +23,9 @@ import ir
import pooler
from report.interface import report_rml
from report.interface import toxml
-
+from tools import to_xml
+from report import report_sxw
+from datetime import datetime
from tools.translate import _
@@ -38,6 +40,9 @@ class report_custom(report_rml):
workcenter_pool = pool.get('mrp.workcenter')
user_pool = pool.get('res.users')
bom_pool = pool.get('mrp.bom')
+ rml_obj=report_sxw.rml_parse(cr, uid, product_pool._name,context)
+ rml_obj.localcontext.update({'lang':context.get('lang',False)})
+ company_currency = user_pool.browse(cr, uid, uid).company_id.currency_id
def process_bom(bom, currency_id, factor=1):
xml = ''
sum = 0
@@ -55,7 +60,7 @@ class report_custom(report_rml):
main_sp_name = "%s\r\n" %(prod.seller_id.name)
price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]
price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
- main_sp_price = '%.2f\r\n' %(price)
+ main_sp_price = """"""+rml_obj.formatLang(price)+' '+ company_currency.symbol+"""\r\n"""
sum += prod_qtty*price
std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id)
main_strd_price = str(std_price) + '\r\n'
@@ -64,13 +69,12 @@ class report_custom(report_rml):
sellers += '- '+ seller_id.name.name +'\r\n'
price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]
price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
- sellers_price += """%.2f\r\n"""%(price)
- xml += """ %s
- %s
- %.2f
- %s
- %.2f
- %s'"""%(prod_name,main_sp_name + sellers ,prod_qtty, product_uom.name,float(main_strd_price),main_sp_price + sellers_price)
+ sellers_price += """"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""\r\n"""
+ xml += """ """+ prod_name +"""
+ """+ main_sp_name + sellers + """
+ """+ rml_obj.formatLang(prod_qtty) +' '+ product_uom.name +"""
+ """+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""
+ """ + main_sp_price + sellers_price + """'"""
xml += ' '
return xml, sum, sum_strd
@@ -83,10 +87,9 @@ class report_custom(report_rml):
xml = ''
xml += "" + workcenter.name + ''
xml += ""
- xml += ""
- xml += """%.2f"""%(cost_cycle)
- xml += """%.2f"""%(cost_hour)
- xml += """%.2f"""%(cost_hour + cost_cycle)
+ xml += """"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """"""
+ xml += """"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """"""
+ xml += """"""+rml_obj.formatLang(cost_hour + cost_cycle)+' '+ company_currency.symbol + """"""
xml += ' '
return xml, total
@@ -95,13 +98,13 @@ class report_custom(report_rml):
xml = ''
config_start = """
- %s
+ """ + to_xml(rml_obj.formatLang(datetime.now().strftime('%Y-%m-%d %H:%M:%S'),date_time=True)) + """
%s
210.00mm,297.00mm
595.27
841.88
- 55.00mm,55.00mm, 20.00mm, 22.00mm, 22.00mm, 25.00mm
- """ % (time.strftime('%m/%d/%Y %H:%M'),user_pool.browse(cr, uid, uid).company_id.name)
+ 55.00mm,58.00mm,29.00mm,29.00mm,29.00mm
+ """ % (user_pool.browse(cr, uid, uid).company_id.name)
config_stop = """
Generated by OpenERP
@@ -111,14 +114,13 @@ class report_custom(report_rml):
%s
-
%s
%s
%s
- """ % (_('Work Center name'), _('Cycles Cost'), _('Hourly Cost'),_('Work Cost'))
+ """ % (_('Work Center name'), _('Cycles Cost')+'('+company_currency.code+')', _('Hourly Cost')+'('+company_currency.code+')',_('Work Cost')+'('+company_currency.code+')')
prod_header = """
%s
@@ -126,11 +128,9 @@ class report_custom(report_rml):
%s
%s
%s
- %s
- """ % (_('Component'), _('Component suppliers'), _('Quantity'), _('Uom'), _('Cost Price per Uom'), _('Supplier Price per Uom'))
+ """ % (_('Component'), _('Component suppliers'), _('Quantity'),_('Cost Price per Uom')+'('+company_currency.code+')', _('Supplier Price per Uom')+'('+company_currency.code+')')
- company_currency = user_pool.browse(cr, uid, uid).company_id.currency_id.id
for product in product_pool.browse(cr, uid, ids, context=context):
bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
title = "%s" %(_("Cost Structure"))
@@ -145,16 +145,14 @@ class report_custom(report_rml):
-
-
-
- -
"""
xml += """
- %s %s %s %s :
-
+ """ + _('Total Cost ') + _('of ') + str(number) +' '+ product.uom_id.name +'('+company_currency.code+')'+ """:
- %.2f
- %.2f
- '"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, total_strd, total)
+ """+ rml_obj.formatLang(total_strd) +' '+ company_currency.symbol + """
+ """+ rml_obj.formatLang(total) +' '+ company_currency.symbol + """
+ '"""
else:
bom = bom_pool.browse(cr, uid, bom_id, context=context)
factor = number * product.uom_id.factor / bom.product_uom.factor
@@ -169,20 +167,19 @@ class report_custom(report_rml):
}
xml_tmp = ''
for sub_bom in (sub_boms and sub_boms[0]) or [parent_bom]:
- txt, sum, sum_strd = process_bom(sub_bom, company_currency)
+ txt, sum, sum_strd = process_bom(sub_bom, company_currency.id)
xml_tmp += txt
total += sum
total_strd += sum_strd
xml += "" + xml_tmp + ''
xml += """
- %s %s %s %s :
-
+ """ + _('Cost ') + _('of ') + str(number) +' '+ product.uom_id.name +'(' + company_currency.code +')'+ """:
- %.2f
- %.2f
- '"""%(_('Cost'), _('of'), str(number), product.uom_id.name, total_strd, total)
+ """+ rml_obj.formatLang(total_strd) +' '+ company_currency.symbol + """
+ """+ rml_obj.formatLang(total) +' '+ company_currency.symbol + """
+ '"""
total2 = 0
xml_tmp = ''
@@ -194,27 +191,22 @@ class report_custom(report_rml):
xml += workcenter_header
xml += "" + xml_tmp + ''
xml += """
- %s %s %s %s :
+ """ + _('Work Cost ') + _('of ') + str(number) +' '+ product.uom_id.name +'('+company_currency.code+')'+""":
-
- %.2f
- '"""%(_('Work Cost'), _('of'), str(number), product.uom_id.name, total2)
+ """+ rml_obj.formatLang(total2) +' '+ company_currency.symbol +"""
+ '"""
xml += """
- %s %s %s %s :
-
+ """ + _('Total Cost ') + _('of ') + str(number) +' '+ product.uom_id.name +'('+company_currency.code+')'+ """:
- %.2f
- %.2f
- '"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, total_strd+total2, total+total2)
+ """+ rml_obj.formatLang(total_strd+total2) +' '+ company_currency.symbol + """
+ """+ rml_obj.formatLang(total+total2) +' '+ company_currency.symbol + """
+ '"""
xml = '' + config_start + config_stop + xml + ''
return xml
report_custom('report.product.price', 'product.product', '', 'addons/mrp/report/price.xsl')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp/test/mrp_report.yml b/addons/mrp/test/mrp_report.yml
new file mode 100644
index 00000000000..db9a83d495b
--- /dev/null
+++ b/addons/mrp/test/mrp_report.yml
@@ -0,0 +1,35 @@
+-
+ In order to test the PDF reports defined on a MRP, we will print a BOM Structure Report
+-
+ !python {model: mrp.bom}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.bom.structure').create(cr, uid, [ref('mrp.mrp_bom_0'),ref('mrp.mrp_bom_1'),ref('mrp.mrp_bom_2'),ref('mrp.mrp_bom_23'),ref('mrp.mrp_bom_1901'),ref('mrp.mrp_bom_assemblysection0'),ref('mrp.mrp_bom_sidepanel0'),ref('mrp.mrp_bom_defaultbomforshelfofcm1'),ref('mrp.mrp_bom_sidepanel3')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'mrp-bom_structure_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a MRP, we will print Production Order Report
+-
+ !python {model: mrp.production}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.mrp.production.order').create(cr, uid, [ref('mrp.mrp_production_mo1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'mrp-production_order_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a MRP, we will print Product Price Report
+-
+ !python {model: product.product}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.product.price').create(cr, uid, [1,2,3,5], {'model':'product.product', 'form':{'number': 1}}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'mrp-product_price_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a MRP, we will print Workcenter Load Report
+-
+ !python {model: mrp.workcenter}: |
+ import netsvc, tools, os, time
+ (data, format) = netsvc.LocalService('report.mrp.workcenter.load').create(cr, uid, [ref('mrp_workcenter_0'),ref('mrp_workcenter_1')], {'model':'mrp.workcenter', 'form':{'time_unit': 'day', 'measure_unit': 'hours'}}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'mrp-workcenter_load_report.'+format), 'wb+').write(data)
diff --git a/addons/mrp_operations/__openerp__.py b/addons/mrp_operations/__openerp__.py
index d4d5cf98d08..5170cc4c627 100644
--- a/addons/mrp_operations/__openerp__.py
+++ b/addons/mrp_operations/__openerp__.py
@@ -61,7 +61,7 @@
'process/mrp_operation_process.xml'
],
'demo_xml': ['mrp_operation_data.xml'],
- 'test': ['test/mrp_operations.yml'],
+ 'test': ['test/mrp_operations.yml', 'test/mrp_operations_report.yml'],
'installable': True,
'active': False,
'certificate': '0056233813133',
diff --git a/addons/mrp_operations/test/mrp_operations_report.yml b/addons/mrp_operations/test/mrp_operations_report.yml
new file mode 100644
index 00000000000..f0a646adf4e
--- /dev/null
+++ b/addons/mrp_operations/test/mrp_operations_report.yml
@@ -0,0 +1,17 @@
+-
+ In order to test the PDF reports defined on a MRP Operations, we will print a Barcode Report
+-
+ !python {model: mrp_operations.operation.code}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.mrp.code.barcode').create(cr, uid, [ref('mrp_operations.mrp_op_1'),ref('mrp_operations.mrp_op_2'),ref('mrp_operations.mrp_op_3'),ref('mrp_operations.mrp_op_4'),ref('mrp_operations.mrp_op_5')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-barcode_report.'+format), 'wb+').write(data)
+
+-
+ In order to test the PDF reports defined on a MRP Operations, we will print Workcenter's Barcode Report
+-
+ !python {model: mrp.workcenter}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.mrp.wc.barcode').create(cr, uid, [ref('mrp.mrp_workcenter_0'),ref('mrp.mrp_workcenter_1')], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-workcenter_barcode_report.'+format), 'wb+').write(data)
diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py
index c9a4068f925..4313ae1a062 100644
--- a/addons/mrp_repair/__openerp__.py
+++ b/addons/mrp_repair/__openerp__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
@@ -31,13 +31,13 @@
* Invoicing (products and/or services)
* Warranty concept
* Repair quotation report
- * Notes for the technician and for the final customer
+ * Notes for the technician and for the final customer
""",
'author': 'OpenERP SA',
'depends': ['mrp', 'sale', 'account'],
'update_xml': [
'security/ir.model.access.csv',
- 'mrp_repair_sequence.xml',
+ 'mrp_repair_sequence.xml',
'wizard/mrp_repair_cancel_view.xml',
'wizard/mrp_repair_make_invoice_view.xml',
'mrp_repair_view.xml',
@@ -45,7 +45,7 @@
'mrp_repair_report.xml',
],
'demo_xml': [],
- 'test': ['test/test_mrp_repair.yml'],
+ 'test': ['test/test_mrp_repair.yml', 'test/mrp_repair_report.yml'],
'installable': True,
'active': False,
'certificate': '0060814381277',
diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml
index dae2a25ec0e..c71abb614cf 100644
--- a/addons/mrp_repair/report/order.rml
+++ b/addons/mrp_repair/report/order.rml
@@ -277,7 +277,7 @@
Unit Price
|
- Price([[ o.pricelist_id.currency_id. name ]])
+ Price([[ o.pricelist_id.currency_id. name ]])
|
@@ -307,9 +307,6 @@
|
-