Browse Source

add mis_builder_demo to contains some data

pull/86/head
laetitia.gangloff@acsone.eu 10 years ago
committed by Stéphane Bidoul
parent
commit
50c5ef83a9
  1. 9
      mis_builder/models/mis_builder.py
  2. 3
      mis_builder/tests/mis.report.csv
  3. 3
      mis_builder/tests/mis.report.instance.csv
  4. 7
      mis_builder/tests/mis.report.instance.period.csv
  5. 8
      mis_builder/tests/mis.report.kpi.csv
  6. 3
      mis_builder/tests/mis.report.query.csv
  7. 22
      mis_builder_demo/__init__.py
  8. 48
      mis_builder_demo/__openerp__.py
  9. 3
      mis_builder_demo/mis.report.csv
  10. 3
      mis_builder_demo/mis.report.instance.csv
  11. 9
      mis_builder_demo/mis.report.instance.period.csv
  12. 11
      mis_builder_demo/mis.report.kpi.csv
  13. 3
      mis_builder_demo/mis.report.query.csv

9
mis_builder/models/mis_builder.py

@ -326,13 +326,16 @@ class mis_report_instance_period(orm.Model):
elif c.type == 'fp':
period_obj = self.pool['account.period']
all_period_ids = period_obj.search(cr, uid,
[('special', '=', False), ('company_id', '=', c.company_id.id)],
[('special', '=', False),
'|', ('company_id', '=', False),
('company_id', '=', c.company_id.id)],
order='date_start',
context=context)
current_period_ids = period_obj.search(cr, uid,
[('special', '=', False),
('date_start', '<=', d),
('date_stop', '>=', d),
'|', ('company_id', '=', False),
('company_id', '=', c.company_id.id)],
context=context)
if not current_period_ids:
@ -436,7 +439,7 @@ class mis_report_instance_period(orm.Model):
'date_to': c.date_to})
# TODO: initial balance?
account_ids = account_obj.search(cr, uid, [('company_id', '=', c.company_id.id)], context=context)
account_ids = account_obj.search(cr, uid, ['|', ('company_id', '=', False), ('company_id', '=', c.company_id.id)], context=context)
account_datas = account_obj.read(cr, uid, account_ids, ['code', 'balance'], context=search_ctx)
balances = {}
for account_data in account_datas:
@ -462,7 +465,7 @@ class mis_report_instance_period(orm.Model):
domain.extend([(query.date_field.name, '>=', datetime_from),
(query.date_field.name, '<', datetime_to)])
if obj._columns.get('company_id', False):
domain.extend([('company_id', '=', c.company_id.id)])
domain.extend(['|', ('company_id', '=', False), ('company_id', '=', c.company_id.id)])
field_names = [field.name for field in query.field_ids]
obj_ids = obj.search(cr, uid, domain, context=context)
obj_datas = obj.read(cr, uid, obj_ids, field_names, context=context)

3
mis_builder/tests/mis.report.csv

@ -1,3 +1,2 @@
"id","description","kpi_ids/id","name","query_ids/id"
"mis_report","","mis_report_kpi_1,mis_report_kpi_2,mis_report_kpi_3,mis_report_kpi_4,mis_report_kpi_5,mis_report_kpi_6","Test","mis_report_query"
"mis_report_test","","mis_report_kpi_test","Test report","mis_report_query_test"
"mis_report_test","","mis_report_kpi_test","Test report","mis_report_query_test"

3
mis_builder/tests/mis.report.instance.csv

@ -1,3 +1,2 @@
"id","date","description","name","period_ids/id","report_id/id"
"mis_report_instance","","","Test-report-instance","mis_report_instance_period_1,mis_report_instance_period_2,mis_report_instance_period_3,mis_report_instance_period_4,mis_report_instance_period_5","mis_report"
"mis_report_instance_test","2014-07-31","","Test-report-instance without company","mis_report_instance_period_test","mis_report_test"
"mis_report_instance_test","2014-07-31","","Test-report-instance without company","mis_report_instance_period_test","mis_report_test"

7
mis_builder/tests/mis.report.instance.period.csv

@ -1,7 +1,2 @@
"id","duration","name","offset","type","sequence","company_id/id"
"mis_report_instance_period_1","1","today","","Day","","base.main_company"
"mis_report_instance_period_2","1","yesterday","-1","Day","","base.main_company"
"mis_report_instance_period_3","1","last week","-1","Week","2","base.main_company"
"mis_report_instance_period_4","2","last 2 period","-2","Fiscal Period","3","base.main_company"
"mis_report_instance_period_5","2","last 2 week","-2","Week","4","base.main_company"
"mis_report_instance_period_test","1","today","","Day","","base.main_company"
"mis_report_instance_period_test","1","today","","Day","","base.main_company"

8
mis_builder/tests/mis.report.kpi.csv

@ -1,8 +1,2 @@
"id","compare_method","description","expression","divider","name","dp","sequence","type","suffix"
"mis_report_kpi_1","Percentage","chiffre d'affaire","-bal_70","","ca","","1","Numeric","€"
"mis_report_kpi_2","Percentage","cost","-bal_60 - bal_61","","cost","","2","Numeric","€"
"mis_report_kpi_3","Percentage","profit","ca - cost","","profit","","3","Numeric","€"
"mis_report_kpi_4","Difference","margin","profit/ca","","margin","","4","Percentage","%"
"mis_report_kpi_5","None","couleur","'vert' if profit > 0 else 'rouge'","","couleur","","5","String",""
"mis_report_kpi_6","Percentage","total invoice","len(inv)","","total_invoice","","6","Numeric","€"
"mis_report_kpi_test","Percentage","total test","len(test)","","total_test","","1","Numeric",""
"mis_report_kpi_test","Percentage","total test","len(test)","","total_test","","1","Numeric",""

3
mis_builder/tests/mis.report.query.csv

@ -1,3 +1,2 @@
"id","date_field/id","domain","field_ids/id","model_id/id","name"
"mis_report_query","account.field_account_invoice_date_invoice","","account.field_account_invoice_amount_untaxed","account.model_account_invoice","inv"
"mis_report_query_test","account.field_account_analytic_balance_date1","","account.field_account_analytic_balance_empty_acc","account.model_account_analytic_balance","test"
"mis_report_query_test","account.field_account_analytic_balance_date1","","account.field_account_analytic_balance_empty_acc","account.model_account_analytic_balance","test"

22
mis_builder_demo/__init__.py

@ -0,0 +1,22 @@
#==============================================================================
# =
# mis_builder module for OpenERP, Management Information System Builder
# Copyright (C) 2014 ACSONE SA/NV (<http://acsone.eu>)
# =
# This file is a part of mis_builder
# =
# mis_builder is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 or later
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# =
# mis_builder 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 v3 or later for more details.
# =
# You should have received a copy of the GNU Affero General Public License
# v3 or later along with this program.
# If not, see <http://www.gnu.org/licenses/>.
# =
#==============================================================================

48
mis_builder_demo/__openerp__.py

@ -0,0 +1,48 @@
#==============================================================================
# =
# mis_builder module for OpenERP, Management Information System Builder
# Copyright (C) 2014 ACSONE SA/NV (<http://acsone.eu>)
# =
# This file is a part of mis_builder
# =
# mis_builder is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 or later
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# =
# mis_builder 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 v3 or later for more details.
# =
# You should have received a copy of the GNU Affero General Public License
# v3 or later along with this program.
# If not, see <http://www.gnu.org/licenses/>.
# =
#==============================================================================
{
'name': 'mis builder demo',
'version': '0.1',
'category': 'Reporting',
'description': """
Management Information System Builder Demo
""",
'author': 'ACSONE SA/NV',
'website': 'http://acsone.eu',
'depends': ['mis_builder', 'crm'],
'data': [
'mis.report.kpi.csv',
'mis.report.query.csv',
'mis.report.csv',
'mis.report.instance.period.csv',
'mis.report.instance.csv',
],
'test': [
],
'demo': [
],
'installable': True,
'application': True,
'auto_install': False,
'license': 'AGPL-3',
}

3
mis_builder_demo/mis.report.csv

@ -0,0 +1,3 @@
"id","description","kpi_ids/id","name","query_ids/id"
"mis_report","","mis_report_kpi_1,mis_report_kpi_2,mis_report_kpi_3,mis_report_kpi_4,mis_report_kpi_5,mis_report_kpi_6","Test","mis_report_query"
"mis_report_phonecall","","mis_report_phonecall_kpi_1,mis_report_phonecall_kpi_2,mis_report_phonecall_kpi_3,mis_report_phonecall_kpi_4","Phonecall report","mis_report_phonecall_query"

3
mis_builder_demo/mis.report.instance.csv

@ -0,0 +1,3 @@
"id","date","description","name","period_ids/id","report_id/id"
"mis_report_instance","","","Test-report-instance","mis_report_instance_period_1,mis_report_instance_period_2,mis_report_instance_period_3,mis_report_instance_period_4,mis_report_instance_period_5","mis_report"
"mis_report_phonecall_instance","","","Test phonecall report instance","mis_report_phonecall_instance_period_1,mis_report_phonecall_instance_period_2,mis_report_phonecall_instance_period_3","mis_report_phonecall"

9
mis_builder_demo/mis.report.instance.period.csv

@ -0,0 +1,9 @@
"id","duration","name","offset","type","sequence","company_id/id"
"mis_report_instance_period_1","1","today","","Day","","base.main_company"
"mis_report_instance_period_2","1","yesterday","-1","Day","","base.main_company"
"mis_report_instance_period_3","1","last week","-1","Week","2","base.main_company"
"mis_report_instance_period_4","2","last 2 period","-2","Fiscal Period","3","base.main_company"
"mis_report_instance_period_5","2","last 2 week","-2","Week","4","base.main_company"
"mis_report_phonecall_instance_period_1","1","today","0","Day","1","base.main_company"
"mis_report_phonecall_instance_period_2","1","this period","0","Fiscal Period","2","base.main_company"
"mis_report_phonecall_instance_period_3","1","previous period","-1","Fiscal Period","3","base.main_company"

11
mis_builder_demo/mis.report.kpi.csv

@ -0,0 +1,11 @@
id,compare_method,description,expression,divider,name,dp,sequence,type,suffix
mis_report_kpi_1,Percentage,chiffre d'affaire,-bal_70,,ca,,1,Numeric,€
mis_report_kpi_2,Percentage,cost,-bal_60 - bal_61,,cost,,2,Numeric,€
mis_report_kpi_3,Percentage,profit,ca - cost,,profit,,3,Numeric,€
mis_report_kpi_4,Difference,margin,profit/ca,,margin,,4,Percentage,%
mis_report_kpi_5,None,couleur,'vert' if profit > 0 else 'rouge',,couleur,,5,String,
mis_report_kpi_6,Percentage,total invoice,len(inv),,total_invoice,,6,Numeric,€
mis_report_phonecall_kpi_1,Percentage,Total phone call,len(phone),,total_phone_call,,1,Numeric,
mis_report_phonecall_kpi_2,Percentage,Average duration phone call,sum([p.duration for p in phone])/total_phone_call,,average_duration_phone_call,2,2,Numeric,
mis_report_phonecall_kpi_3,Percentage,Total converted phone call,sum([p.opportunity_id and 1 or 0 for p in phone]),,phone_call_convert,,3,Numeric,
mis_report_phonecall_kpi_4,Percentage,Average duration converted phone call,sum([p.opportunity_id and p.duration or 0 for p in phone]),,average_convert_duration_phone_c,2,4,Numeric,

3
mis_builder_demo/mis.report.query.csv

@ -0,0 +1,3 @@
"id","date_field/id","domain","field_ids/id","model_id/id","name"
"mis_report_query","account.field_account_invoice_date_invoice","","account.field_account_invoice_amount_untaxed","account.model_account_invoice","inv"
"mis_report_phonecall_query","crm.field_crm_phonecall_date","","crm.field_crm_phonecall_duration,crm.field_crm_phonecall_opportunity_id","crm.model_crm_phonecall","phone"
Loading…
Cancel
Save