Browse Source
Merge pull request #158 from Eficent/8.0-prefix_2
Merge pull request #158 from Eficent/8.0-prefix_2
[mis_builder][8.0] add prefixespull/166/head
Stéphane Bidoul (ACSONE)
9 years ago
14 changed files with 110 additions and 365 deletions
-
26mis_builder/__init__.py
-
26mis_builder/__openerp__.py
-
26mis_builder/models/__init__.py
-
32mis_builder/models/aep.py
-
26mis_builder/models/aggregate.py
-
46mis_builder/models/mis_builder.py
-
26mis_builder/report/__init__.py
-
44mis_builder/report/mis_builder_xls.py
-
26mis_builder/report/report_mis_report_instance.py
-
26mis_builder/tests/__init__.py
-
33mis_builder/tests/test_mis_builder.py
-
1mis_builder/views/mis_builder.xml
-
26mis_builder/wizard/__init__.py
-
111mis_builder/wizard/mis_builder_dashboard.py
@ -1,26 +1,6 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# mis_builder module for Odoo, Management Information System Builder |
|||
# Copyright (C) 2014-2015 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/>. |
|||
# |
|||
############################################################################## |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>) |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import models |
|||
from . import wizard |
|||
|
@ -1,26 +1,6 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# mis_builder module for Odoo, Management Information System Builder |
|||
# Copyright (C) 2014-2015 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/>. |
|||
# |
|||
############################################################################## |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>) |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import mis_builder |
|||
from . import aep |
@ -1,25 +1,5 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# mis_builder module for Odoo, Management Information System Builder |
|||
# Copyright (C) 2014-2015 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/>. |
|||
# |
|||
############################################################################## |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>) |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import test_mis_builder |
@ -1,25 +1,5 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# mis_builder module for Odoo, Management Information System Builder |
|||
# Copyright (C) 2014-2015 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/>. |
|||
# |
|||
############################################################################## |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>) |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import mis_builder_dashboard |
@ -1,87 +1,66 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# mis_builder module for Odoo, Management Information System Builder |
|||
# Copyright (C) 2014-2015 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/>. |
|||
# |
|||
############################################################################## |
|||
# -*- coding: utf-8 -*- |
|||
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>) |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from openerp.osv import orm, fields |
|||
from openerp import api, fields, models |
|||
from lxml import etree |
|||
|
|||
|
|||
class add_mis_report_instance_dashboard(orm.TransientModel): |
|||
class AddMisReportInstanceDashboard(models.TransientModel): |
|||
_name = "add.mis.report.instance.dashboard.wizard" |
|||
|
|||
_columns = {'name': fields.char('Name', size=32, required=True), |
|||
'dashboard_id': fields.many2one( |
|||
'ir.actions.act_window', |
|||
string="Dashboard", required=True, |
|||
domain="[('res_model', '=', 'board.board')]"), |
|||
} |
|||
name = fields.Char('Name', size=32, required=True) |
|||
|
|||
def default_get(self, cr, uid, fields, context=None): |
|||
if context is None: |
|||
context = {} |
|||
if context.get('active_id'): |
|||
res = super(add_mis_report_instance_dashboard, self).default_get( |
|||
cr, uid, fields, context=context) |
|||
dashboard_id = fields.Many2one('ir.actions.act_window', |
|||
string="Dashboard", required=True, |
|||
domain="[('res_model', '=', " |
|||
"'board.board')]") |
|||
|
|||
@api.model |
|||
def default_get(self, fields): |
|||
res = {} |
|||
if self.env.context.get('active_id', False): |
|||
res = super(AddMisReportInstanceDashboard, self).default_get( |
|||
fields) |
|||
# get report instance name |
|||
res['name'] = self.pool['mis.report.instance'].read( |
|||
cr, uid, context['active_id'], ['name'])['name'] |
|||
res['name'] = self.env['mis.report.instance'].browse( |
|||
self.env.context['active_id']).name |
|||
return res |
|||
|
|||
def action_add_to_dashboard(self, cr, uid, ids, context=None): |
|||
if context is None: |
|||
context = {} |
|||
assert 'active_id' in context, "active_id missing in context" |
|||
wizard_data = self.browse(cr, uid, ids, context=context)[0] |
|||
@api.multi |
|||
def action_add_to_dashboard(self): |
|||
assert self.env.context.get('active_id', False), \ |
|||
"active_id missing in context" |
|||
# create the act_window corresponding to this report |
|||
view_id = self.pool['ir.model.data'].get_object_reference( |
|||
cr, uid, 'mis_builder', 'mis_report_instance_result_view_form')[1] |
|||
report_result = self.pool['ir.actions.act_window'].create( |
|||
cr, uid, |
|||
self.env.ref('mis_builder.mis_report_instance_result_view_form') |
|||
view = self.env.ref( |
|||
'mis_builder.mis_report_instance_result_view_form') |
|||
report_result = self.env['ir.actions.act_window'].create( |
|||
{'name': 'mis.report.instance.result.view.action.%d' |
|||
% context['active_id'], |
|||
% self.env.context['active_id'], |
|||
'res_model': 'mis.report.instance', |
|||
'res_id': context['active_id'], |
|||
'res_id': self.env.context['active_id'], |
|||
'target': 'current', |
|||
'view_mode': 'form', |
|||
'view_id': view_id}) |
|||
'view_id': view.id}) |
|||
# add this result in the selected dashboard |
|||
last_customization = self.pool['ir.ui.view.custom'].search( |
|||
cr, uid, |
|||
[('user_id', '=', uid), |
|||
('ref_id', '=', wizard_data.dashboard_id.view_id.id)], limit=1) |
|||
arch = wizard_data.dashboard_id.view_id.arch |
|||
last_customization = self.env['ir.ui.view.custom'].search( |
|||
[('user_id', '=', self.env.uid), |
|||
('ref_id', '=', self.dashboard_id.view_id.id)], limit=1) |
|||
arch = self.dashboard_id.view_id.arch |
|||
if last_customization: |
|||
arch = self.pool['ir.ui.view.custom'].read( |
|||
cr, uid, last_customization[0], ['arch'])['arch'] |
|||
arch = self.env['ir.ui.view.custom'].browse( |
|||
last_customization[0].id).arch |
|||
new_arch = etree.fromstring(arch) |
|||
column = new_arch.xpath("//column")[0] |
|||
column.append(etree.Element('action', {'context': str(context), |
|||
'name': str(report_result), |
|||
'string': wizard_data.name, |
|||
'view_mode': 'form'})) |
|||
self.pool['ir.ui.view.custom'].create( |
|||
cr, uid, {'user_id': uid, |
|||
'ref_id': wizard_data.dashboard_id.view_id.id, |
|||
'arch': etree.tostring(new_arch, pretty_print=True)}) |
|||
column.append(etree.Element('action', {'context': str( |
|||
self.env.context), |
|||
'name': str(report_result.id), |
|||
'string': self.name, |
|||
'view_mode': 'form'})) |
|||
self.env['ir.ui.view.custom'].create( |
|||
{'user_id': self.env.uid, |
|||
'ref_id': self.dashboard_id.view_id.id, |
|||
'arch': etree.tostring(new_arch, pretty_print=True)}) |
|||
|
|||
return {'type': 'ir.actions.act_window_close', } |
Write
Preview
Loading…
Cancel
Save
Reference in new issue