[MERGE] menu structure
bzr revid: hmo@tinyerp.com-20100120130015-mo5nbqsi0m7spb2o
This commit is contained in:
commit
50334da539
|
@ -2,7 +2,7 @@
|
|||
<openerp>
|
||||
<data>
|
||||
<menuitem name="Auction Management" id="auction_menu_root" icon="terp-purchase"/>
|
||||
<menuitem name="Configuration" parent="auction_menu_root" id="auction_config_menu" sequence="1"/>
|
||||
<menuitem name="Configuration" parent="auction_menu_root" id="auction_config_menu" sequence="7"/>
|
||||
|
||||
=======================================================
|
||||
Auction Management/Configuration/artist
|
||||
|
@ -127,7 +127,7 @@
|
|||
<field name="view_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Auction Dates" parent="auction_menu_root" id="auction_date_menu"/>
|
||||
<menuitem name="Auction Dates" parent="auction_menu_root" id="auction_date_menu" sequence="1"/>
|
||||
<menuitem name="Next Auction Dates" parent="auction_date_menu" id="menu_auction_dates_next1" action="action_auction_dates_next"/>
|
||||
=======================================================
|
||||
Auction Management/Auction Dates/Old Auction Dates
|
||||
|
@ -361,10 +361,10 @@
|
|||
<field name="res_model">auction.lots</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('state','=','sold')]</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Objects" parent="auction_menu_root" id="auction_objects_menu"/>
|
||||
<menuitem name="Objects" parent="auction_menu_root" id="auction_objects_menu" sequence="2"/>
|
||||
<menuitem name="All objects" action="action_all_objects" parent="auction_objects_menu" id="auction_all_objects_menu"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_all_objects_to_sell">
|
||||
|
@ -373,7 +373,7 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','<>','sold')]</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_all_objects_unplanned">
|
||||
|
@ -382,7 +382,7 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('auction_id','=', False),('state','=','draft')]</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- for the sold object start-->
|
||||
|
@ -392,7 +392,7 @@
|
|||
<field name="res_model">auction.lots</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('state','=','unsold')]</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- form3: simplified form meant for during the sale (action button in dates) -->
|
||||
|
@ -439,7 +439,7 @@
|
|||
<button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
|
||||
<button name="button_draft" string="Set to draft" states="sold,unsold" type="object" icon="gtk-convert"/>
|
||||
<button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Statements">
|
||||
<field name="statement_id" domain="[('state','=','draft')]" colspan="4" nolabel="1"
|
||||
|
@ -465,7 +465,7 @@
|
|||
<field name="res_model">report.unclassified.objects</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="v12">
|
||||
|
@ -583,7 +583,7 @@
|
|||
<field name="view_id" ref="view_deposit_border_tree2"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Sellers" id="auction_seller_menu" parent="auction_menu_root"/>
|
||||
<menuitem name="Sellers" id="auction_seller_menu" parent="auction_menu_root" sequence="3"/>
|
||||
<menuitem name="Deposit border" parent="auction_seller_menu" action="action_deposit_border" id="menu_auction_deposit_border"/>
|
||||
|
||||
=======================================================
|
||||
|
@ -679,7 +679,7 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Buyers" id="auction_buyers_menu" parent="auction_menu_root"/>
|
||||
<menuitem name="Buyers" id="auction_buyers_menu" parent="auction_menu_root" sequence="4"/>
|
||||
<menuitem name="Bids" parent="auction_buyers_menu" action="action_bid_open" id="menu_action_bid_open"/>
|
||||
|
||||
|
||||
|
@ -728,7 +728,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Reporting" id="auction_report_menu" parent="auction_menu_root"/>
|
||||
<menuitem name="Reporting" id="auction_report_menu" parent="auction_menu_root" sequence="6"/>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_auction_report_allmonth_view1">
|
||||
|
|
|
@ -35,20 +35,20 @@
|
|||
name="auction.pay.buy"
|
||||
id="wizard_pay"/>
|
||||
|
||||
<wizard
|
||||
string="Gestion emporte"
|
||||
model="auction.dates"
|
||||
<wizard
|
||||
string="Gestion emporte"
|
||||
model="auction.dates"
|
||||
name="auction.taken"
|
||||
multi="1"
|
||||
id="wizard_emporte"/>
|
||||
|
||||
<menuitem name="Tools Bar Codes"
|
||||
|
||||
<menuitem name="Tools Bar Codes"
|
||||
id="auction_outils_menu"
|
||||
parent="auction_menu_root"
|
||||
parent="auction_menu_root" sequence="6"
|
||||
/>
|
||||
|
||||
<menuitem name="Deliveries Management"
|
||||
action="wizard_emporte"
|
||||
|
||||
<menuitem name="Deliveries Management"
|
||||
action="wizard_emporte"
|
||||
type="wizard"
|
||||
id="menu_wizard_emporte"
|
||||
parent="auction_outils_menu"
|
||||
|
|
|
@ -105,10 +105,10 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Custom Reports" id="menu_custom_reports"
|
||||
action="base_report_creator_action" parent="board.dashboard_menu" sequence="1"/>
|
||||
name="Custom Reports" id="base.menu_custom_reports"
|
||||
action="base_report_creator_action" parent="base.reporting_menu" sequence="1"/>
|
||||
<menuitem
|
||||
name="Custom Reports" parent="board.next_id_50"
|
||||
name="Custom Reports" parent="base.next_id_50"
|
||||
id="menu_base_report_creator_action_config"
|
||||
action="base_report_creator_action"/>
|
||||
|
||||
|
@ -127,7 +127,7 @@
|
|||
<field name="view_type">tree</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Custom Reports" parent="menu_custom_reports"
|
||||
name="Custom Reports" parent="base.menu_custom_reports"
|
||||
id="menu_base_report_creator_action"
|
||||
action="base_report_creator_action_tree"/>
|
||||
|
||||
|
|
|
@ -8,12 +8,20 @@
|
|||
name="base_report_designer.modify"
|
||||
id="wizard_report_designer_modify"/>
|
||||
|
||||
<menuitem icon="terp-graph" id="base.reporting_menu" name="Reporting"/>
|
||||
<menuitem
|
||||
id="base.next_id_50"
|
||||
name="Configuration"
|
||||
parent="base.reporting_menu"
|
||||
groups="base.group_system"
|
||||
sequence="3"/>
|
||||
<menuitem
|
||||
parent="base.menu_custom"
|
||||
parent="base.next_id_50"
|
||||
name="Report Designer"
|
||||
action="wizard_report_designer_modify"
|
||||
type="wizard"
|
||||
id="menu_wizard_report_designer_modify"/>
|
||||
id="menu_wizard_report_designer_modify"
|
||||
sequence="70"/>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem icon="terp-graph" id="dashboard_menu" name="Reporting"/>
|
||||
<menuitem icon="terp-graph" id="dashboard" name="Dashboards" sequence="2" parent="dashboard_menu"/>
|
||||
<menuitem icon="terp-graph" id="base.reporting_menu" name="Reporting"/>
|
||||
<!-- <menuitem icon="terp-graph" id="dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>-->
|
||||
<record id="view_board_note_tree" model="ir.ui.view">
|
||||
<field name="name">board.note.tree</field>
|
||||
<field name="model">board.note</field>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<field name="view_mode">form,tree</field>
|
||||
</record>
|
||||
|
||||
<wizard id="wizard_board_create_menu" model="board.board" multi="True" name="board.board.menu.create" string="Create Board Menu"/>
|
||||
<wizard id="wizard_board_create_menu" model="board.board" multi="True" name="board.board.menu.create" string="Create Board Menu" />
|
||||
|
||||
<record id="view_board_tree" model="ir.ui.view">
|
||||
<field name="name">board.board.tree</field>
|
||||
|
@ -81,17 +81,17 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
id="next_id_50"
|
||||
id="base.next_id_50"
|
||||
name="Configuration"
|
||||
parent="board.dashboard_menu"
|
||||
parent="base.reporting_menu"
|
||||
groups="base.group_system"
|
||||
sequence="3"/>
|
||||
<menuitem
|
||||
action="action_view_board_list_form"
|
||||
id="menu_view_board_form"
|
||||
parent="next_id_50"/>
|
||||
<menuitem action="action_view_board_note_form" id="menu_view_board_note_form" parent="next_id_50"
|
||||
sequence="100"
|
||||
parent="base.next_id_50" sequence="1"/>
|
||||
<menuitem action="action_view_board_note_form" id="menu_view_board_note_form" parent="base.next_id_50"
|
||||
sequence="3"
|
||||
groups="base.group_system" />
|
||||
<act_window context="{'view': active_id}" id="dashboard_open" multi="True" name="Open Dashboard" res_model="board.board" src_model="board.board"/>
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
<field name="usage">menu</field>
|
||||
<field name="view_id" ref="board_account_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="next_id_68" name="Accounting" parent="board.dashboard"
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem id="next_id_68" name="Accounting" parent="base.dashboard"
|
||||
groups="account.group_account_manager"/>
|
||||
<menuitem action="open_board_account" icon="terp-graph" id="menu_board_account" parent="next_id_68" sequence="1"/>
|
||||
</data>
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="board_associations_manager_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="board_associations" name="Associations" parent="board.dashboard" />
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem id="board_associations" name="Associations" parent="base.dashboard" />
|
||||
<menuitem
|
||||
name="Associations" parent="board_associations"
|
||||
action="open_board_associations_manager"
|
||||
|
|
|
@ -69,8 +69,8 @@
|
|||
<field name="usage">menu</field>
|
||||
<field name="view_id" ref="board_auction_manager_form1"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Auction Manager" id="board_menu_auction_manager" parent="board.dashboard" />
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem name="Auction Manager" id="board_menu_auction_manager" parent="base.dashboard" />
|
||||
<menuitem
|
||||
name="Auction Manager"
|
||||
action="open_board_auction_manager"
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
<field name="usage">menu</field>
|
||||
<field name="view_id" ref="board_auction_manager_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Auction Member" id="board_menu_auction_member" parent="board.dashboard" />
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem name="Auction Member" id="board_menu_auction_member" parent="base.dashboard" />
|
||||
<menuitem
|
||||
name="Auction Member"
|
||||
action="open_board_auction"
|
||||
|
|
|
@ -110,8 +110,9 @@
|
|||
<field name="view_id" ref="board_crm_statistical_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem
|
||||
name="CRM Configuration" parent="board.dashboard"
|
||||
name="CRM Configuration" parent="base.dashboard"
|
||||
id="menu_board_crm_config"
|
||||
groups="crm.group_crm_manager"/>
|
||||
<menuitem
|
||||
|
|
|
@ -50,10 +50,11 @@
|
|||
<field name="view_id" ref="board_document_manager_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem
|
||||
name="Document"
|
||||
id="menu_board_document"
|
||||
parent="board.dashboard"
|
||||
parent="base.dashboard"
|
||||
groups="document.group_document_manager"/>
|
||||
|
||||
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="board_mrp_manager_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem
|
||||
id="next_id_87"
|
||||
name="Production"
|
||||
parent="board.dashboard"
|
||||
parent="base.dashboard"
|
||||
groups="mrp.group_mrp_manager"/>
|
||||
<menuitem
|
||||
action="open_board_manufacturing"
|
||||
|
|
|
@ -76,11 +76,11 @@
|
|||
<field name="usage">menu</field>
|
||||
<field name="view_id" ref="board_project_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem
|
||||
id="next_id_86"
|
||||
name="Project"
|
||||
parent="board.dashboard"/>
|
||||
parent="base.dashboard"/>
|
||||
<menuitem
|
||||
action="open_board_project"
|
||||
icon="terp-graph"
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
<field name="view_id" ref="board_sales_manager_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="next_id_88" name="Sales" parent="board.dashboard"/><menuitem action="open_board_sales_manager" icon="terp-graph" id="menu_board_sales_manager" parent="next_id_88" sequence="1"/>
|
||||
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
|
||||
<menuitem id="next_id_88" name="Sales" parent="base.dashboard"/><menuitem action="open_board_sales_manager" icon="terp-graph" id="menu_board_sales_manager" parent="next_id_88" sequence="1"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<data>
|
||||
<menuitem icon="terp-hr" id="menu_hr_root" name="Human Resources"/>
|
||||
<menuitem id="menu_hr_human_resources" sequence="1" name="Human Resources" parent="menu_hr_root"/>
|
||||
<menuitem
|
||||
<!-- <menuitem
|
||||
id="menu_hr_reporting"
|
||||
name="Reporting"
|
||||
parent="hr.menu_hr_root"
|
||||
sequence="40" />
|
||||
sequence="40" /> -->
|
||||
<menuitem
|
||||
id="menu_hr_configuration"
|
||||
name="Configuration"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
""",
|
||||
'author': 'Tiny & Axelor',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['hr', 'crm', 'process'],
|
||||
'depends': ['hr', 'crm', 'process','hr_attendance'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'security/ir.model.access.csv',
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem
|
||||
id="hr.menu_hr_reporting"
|
||||
name="Reporting"
|
||||
parent="hr.menu_hr_root"
|
||||
sequence="40" />
|
||||
<wizard string="Print Summary of Holidays"
|
||||
name="hr.holidays.summary"
|
||||
id="holidays_summary"/>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem
|
||||
<!--<menuitem
|
||||
id="menu_hr_reporting"
|
||||
name="Reporting"
|
||||
parent="hr.menu_hr_root"
|
||||
sequence="40" />
|
||||
sequence="40" />-->
|
||||
<!-- Menu Items -->
|
||||
|
||||
<record id="view_hr_holidays_filter" model="ir.ui.view">
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem
|
||||
id="hr.menu_hr_reporting"
|
||||
name="Reporting"
|
||||
parent="hr.menu_hr_root"
|
||||
sequence="40" />
|
||||
<report auto="False" id="report_user_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet" xsl="hr_timesheet/report/user_timesheet.xsl"/>
|
||||
|
||||
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem
|
||||
id="hr.menu_hr_reporting"
|
||||
name="Reporting"
|
||||
parent="hr.menu_hr_root"
|
||||
sequence="40" />
|
||||
<report auto="False" id="account_analytic_account_cost_ledger" menu="False" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger" rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>
|
||||
|
||||
<wizard id="account_analytic_account_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger.report" string="Cost Ledger"/>
|
||||
|
@ -23,8 +27,8 @@
|
|||
string="Timesheet Profit"
|
||||
groups="account.group_account_manager"/>
|
||||
|
||||
<menuitem action="account_analytic_profit"
|
||||
id="print_account_analytic_profit"
|
||||
<menuitem action="account_analytic_profit"
|
||||
id="print_account_analytic_profit"
|
||||
parent="hr.menu_hr_reporting"
|
||||
type="wizard"
|
||||
groups="hr.group_hr_manager"/>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import lunch
|
||||
import wizard
|
||||
import report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name": "Lunch Module",
|
||||
"author": "Tiny",
|
||||
"version": "0.1",
|
||||
"depends": ["base"],
|
||||
"category" : "Generic Modules/Others",
|
||||
"init_xml": [],
|
||||
"update_xml": [
|
||||
'security/ir.model.access.csv',
|
||||
'lunch_wizard.xml',
|
||||
'lunch_view.xml',
|
||||
'lunch_report.xml',
|
||||
#'process/lunch_process.xml'
|
||||
],
|
||||
"demo_xml": ['lunch_demo.xml'],
|
||||
"installable": True,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,347 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * lunch
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 04:56:11+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 04:56:11+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_category
|
||||
#: view:lunch.category:0
|
||||
#: field:lunch.product,category_id:0
|
||||
msgid "Category"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.cashbox.clean,init:0
|
||||
msgid "Reset cashbox"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: selection:lunch.order,state:0
|
||||
msgid "Confirmed"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_cashmove
|
||||
msgid "lunch.cashmove"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.order.cancel,init:0
|
||||
msgid "Are you sure you want to cancel this order ?"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.module.module,shortdesc:lunch.module_meta_information
|
||||
msgid "Lunch Module"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_cashmove_form
|
||||
msgid "Cash Moves"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: rml:lunch.order:0
|
||||
msgid "Printed at :"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_product
|
||||
msgid "lunch.product"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.cashbox.clean,init:0
|
||||
msgid "Are you sure you want to reset this cashbox ?"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,state:0
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_cashbox_form
|
||||
#: view:lunch.cashbox:0
|
||||
msgid "CashBox"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: selection:lunch.order,state:0
|
||||
msgid "Draft"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: constraint:ir.actions.act_window:0
|
||||
msgid "Invalid model name in the action definition."
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,user_cashmove:0
|
||||
#: field:lunch.order,user_id:0
|
||||
#: field:report.lunch.amount,user_id:0
|
||||
msgid "User Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_report_amount_tree
|
||||
#: view:report.lunch.amount:0
|
||||
msgid "Box Amount by User"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:report.lunch.amount:0
|
||||
msgid "Total box"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_product_form
|
||||
#: field:lunch.order,product:0
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: rml:lunch.order:0
|
||||
#: field:lunch.product,description:0
|
||||
msgid "Description"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,price:0
|
||||
#: field:lunch.product,price:0
|
||||
msgid "Price"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.order.cancel,init,end:0
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.category:0
|
||||
#: rml:lunch.order:0
|
||||
#: view:lunch.order:0
|
||||
msgid "Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,create_date:0
|
||||
msgid "Created date"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch
|
||||
msgid "Lunch"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,descript:0
|
||||
msgid "Description Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.wizard,name:lunch.lunch_order_confirm
|
||||
#: wizard_button:lunch.order.confirm,init,go:0
|
||||
msgid "Confirm Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.order.confirm,init:0
|
||||
msgid "Orders Confirmation"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,active:0
|
||||
#: field:lunch.product,active:0
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_order_day_form
|
||||
msgid " Order of the day"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_category_root
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.wizard,name:lunch.wizard_id_cancel
|
||||
#: wizard_view:lunch.order.cancel,init:0
|
||||
msgid "Cancel Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_cashbox_form
|
||||
msgid " CashBox "
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_report_lunch_amount_tree
|
||||
msgid "Lunch amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashbox,name:0
|
||||
#: field:lunch.cashmove,name:0
|
||||
#: field:lunch.category,name:0
|
||||
#: rml:lunch.order:0
|
||||
#: field:lunch.product,name:0
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_category_form
|
||||
msgid " Category of product "
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.cashmove:0
|
||||
msgid "Total amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_cashbox
|
||||
msgid "lunch.cashbox"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,date:0
|
||||
msgid "Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,amount:0
|
||||
#: field:report.lunch.amount,amount:0
|
||||
msgid "Amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_product_form
|
||||
#: view:lunch.product:0
|
||||
msgid "Products"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_category_form
|
||||
msgid "Category of product"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.report.xml,name:lunch.report_lunch_order
|
||||
msgid "Print Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_order_day_form
|
||||
msgid "Order of the day"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_report_lunch_amount
|
||||
msgid "Amount available by user and box"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.category:0
|
||||
msgid "Category related to Products"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_order
|
||||
msgid "lunch.order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashbox,sum_remain:0
|
||||
msgid "Remained Total"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_order_form
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_order_form
|
||||
msgid "Make order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.wizard,name:lunch.wizard_clean_cashbox
|
||||
msgid "Set CashBox to Zero"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,box:0
|
||||
#: field:report.lunch.amount,box:0
|
||||
msgid "Box Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashbox,manager:0
|
||||
msgid "Manager"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: rml:lunch.order:0
|
||||
msgid "Unit Price"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_field:lunch.order.confirm,init,confirm_cashbox:0
|
||||
msgid "Name of box"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.order:0
|
||||
msgid "Total price"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.cashbox.clean,init,end:0
|
||||
#: wizard_button:lunch.order.confirm,init,end:0
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.cashbox.clean,init,zero:0
|
||||
msgid "Set to Zero"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.order.cancel,init,cancel:0
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_tools
|
||||
msgid "Tools"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_cashmove_form
|
||||
#: view:lunch.cashmove:0
|
||||
#: field:lunch.order,cashmove:0
|
||||
msgid "CashMove"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
import time
|
||||
|
||||
class lunch_category(osv.osv):
|
||||
_name = 'lunch.category'
|
||||
_description = "Category"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True, size=50),
|
||||
}
|
||||
|
||||
_order = 'name'
|
||||
|
||||
lunch_category()
|
||||
|
||||
class lunch_product(osv.osv):
|
||||
_name = 'lunch.product'
|
||||
|
||||
def _category_name_get(self, cr, uid, context={}):
|
||||
obj = self.pool.get('lunch.category')
|
||||
cat_ids= obj.search(cr,uid,[])
|
||||
res = obj.read(cr,uid,cat_ids,['name', 'category'])
|
||||
return [(str(r['id']), r['name']) for r in res]+ [('0','')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=50, required=True),
|
||||
'category_id': fields.selection(_category_name_get, 'Category', size=32),
|
||||
'description': fields.char('Description', size=128, required=False),
|
||||
'price': fields.float('Price', digits=(16,2)),
|
||||
'active': fields.boolean('Active'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a : True,
|
||||
}
|
||||
|
||||
lunch_product()
|
||||
|
||||
class lunch_cashbox(osv.osv):
|
||||
_name='lunch.cashbox'
|
||||
|
||||
def amount_available(self, cr, uid, ids, field_name, arg, context):
|
||||
cr.execute("SELECT box,sum(amount) from lunch_cashmove where active = 't' group by box")
|
||||
r = dict(cr.fetchall())
|
||||
for i in ids :
|
||||
r.setdefault(i,0)
|
||||
return r
|
||||
|
||||
_columns={
|
||||
'manager':fields.many2one('res.users','Manager'),
|
||||
'name':fields.char('Name',size=30,required=True, unique = True),
|
||||
'sum_remain': fields.function(amount_available, method=True, string='Remained Total'),
|
||||
}
|
||||
|
||||
lunch_cashbox()
|
||||
|
||||
|
||||
|
||||
|
||||
class lunch_cashmove(osv.osv):
|
||||
_name= 'lunch.cashmove'
|
||||
|
||||
_columns={
|
||||
'name': fields.char('Name',size=128),
|
||||
'user_cashmove': fields.many2one('res.users','User Name', required=True),
|
||||
'amount': fields.float('Amount', digits=(16,2)),
|
||||
'box':fields.many2one('lunch.cashbox','Box Name',size=30,required=True),
|
||||
'active':fields.boolean('Active'),
|
||||
'create_date': fields.datetime('Created date', readonly=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'active': lambda *a: True,
|
||||
}
|
||||
|
||||
lunch_cashmove()
|
||||
|
||||
|
||||
|
||||
class lunch_order(osv.osv):
|
||||
_name='lunch.order'
|
||||
_rec_name= "user_id"
|
||||
|
||||
def _price_get(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for o in self.browse(cr, uid, ids):
|
||||
res[o.id] = o.product.price
|
||||
return res
|
||||
|
||||
_columns={
|
||||
'user_id': fields.many2one('res.users','User Name', required=True,
|
||||
readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'product':fields.many2one('lunch.product','Product', required=True,
|
||||
readonly=True, states={'draft':[('readonly',False)]}, change_default=True),
|
||||
'date': fields.date('Date',readonly=True,states={'draft':[('readonly',False)]}),
|
||||
'cashmove':fields.many2one('lunch.cashmove', 'CashMove' , readonly=True ),
|
||||
'descript':fields.char('Description Order', readonly=True, size=50,
|
||||
states={'draft':[('readonly',False)]}),
|
||||
'state': fields.selection([('draft','Draft'), ('confirmed','Confirmed'),],
|
||||
'State', readonly=True, select=True),
|
||||
'price': fields.function(_price_get, method=True, string="Price"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'user_id': lambda self,cr,uid,context: uid,
|
||||
'date': lambda self,cr,uid,context: time.strftime('%Y-%m-%d'),
|
||||
'state': lambda self,cr,uid,context: 'draft',
|
||||
}
|
||||
|
||||
def confirm(self,cr,uid,ids,box,context):
|
||||
cashmove_ref= self.pool.get('lunch.cashmove')
|
||||
for order in self.browse(cr,uid,ids):
|
||||
if order.state == 'confirmed':
|
||||
continue
|
||||
new_id= cashmove_ref.create(cr,uid,{'name': order.product.name+' order',
|
||||
'amount':-order.product.price,
|
||||
'user_cashmove':order.user_id.id,
|
||||
'box':box,
|
||||
'active':True,
|
||||
})
|
||||
self.write(cr,uid,[order.id],{'cashmove':new_id, 'state':'confirmed'})
|
||||
return {}
|
||||
|
||||
def lunch_order_cancel(self,cr,uid,ids,context):
|
||||
orders= self.browse(cr,uid,ids)
|
||||
for order in orders:
|
||||
if not order.cashmove:
|
||||
continue
|
||||
self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
|
||||
self.write(cr,uid,ids,{'state':'draft'})
|
||||
return {}
|
||||
|
||||
def onchange_product(self, cr, uid, ids, product):
|
||||
if not product:
|
||||
return {'value': {'price': 0.0}}
|
||||
price = self.pool.get('lunch.product').read(cr, uid, product, ['price'])['price']
|
||||
return {'value': {'price': price}}
|
||||
|
||||
lunch_order()
|
||||
|
||||
class report_lunch_amount(osv.osv):
|
||||
_name='report.lunch.amount'
|
||||
_description = "Amount available by user and box"
|
||||
_auto = False
|
||||
_rec_name= "user"
|
||||
|
||||
_columns = {
|
||||
'user_id': fields.many2one('res.users','User Name',readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True, digits=(16,2)),
|
||||
'box':fields.many2one('lunch.cashbox','Box Name',size=30,readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_lunch_amount as (
|
||||
select
|
||||
min(lc.id) as id,
|
||||
lc.user_cashmove as user_id,
|
||||
sum(amount) as amount,
|
||||
lc.box as box
|
||||
from
|
||||
lunch_cashmove lc
|
||||
where
|
||||
active = 't'
|
||||
group by lc.user_cashmove, lc.box
|
||||
)""")
|
||||
|
||||
report_lunch_amount()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record model="lunch.category" id="categ_sandwich">
|
||||
<field name="name">Sandwich</field>
|
||||
</record>
|
||||
|
||||
<record model="lunch.product" id="product_club">
|
||||
<field name="name">Club</field>
|
||||
<field name="category_id" eval="str(ref('categ_sandwich'))"/>
|
||||
<field name="price">2.75</field>
|
||||
</record>
|
||||
|
||||
<record model="lunch.cashbox" id="cashbox_cashbox">
|
||||
<field name="name">Cashbox</field>
|
||||
<field name="manager" ref="base.user_admin"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<report
|
||||
id="report_lunch_order"
|
||||
string="Print Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order"
|
||||
rml="lunch/report/order.rml"
|
||||
auto="False"
|
||||
/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,243 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem icon="STOCK_PREFERENCES" id="base.menu_tools" name="Tools"/>
|
||||
<!--<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
|
||||
<menuitem name="Lunch Order" parent="menu_tools" id="menu_lunch" sequence="1"/>
|
||||
<menuitem name="Reporting" parent="menu_tools" id="menu_lunch_reporting" sequence="4"/>
|
||||
<menuitem name="Lunch Orders" parent="menu_lunch_reporting" id="menu_lunch_reporting_order" sequence="1"/>
|
||||
<menuitem name="Configuration" parent="menu_tools" id="menu_lunch_category_root" sequence="5"/>-->
|
||||
<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>-->
|
||||
|
||||
<menuitem name="Lunch Order" parent="base.menu_tools" id="menu_lunch" sequence="1"/>
|
||||
<menuitem name="Reporting" parent="base.menu_tools" id="menu_lunch_reporting" sequence="4"/>
|
||||
<menuitem name="Lunch Orders" parent="menu_lunch_reporting" id="menu_lunch_reporting_order" sequence="1"/>
|
||||
<menuitem name="Configuration" parent="base.menu_tools" id="base.menu_lunch_survey_root" sequence="5"/>
|
||||
|
||||
|
||||
<menuitem name="Lunch" parent="base.menu_lunch_survey_root" id="menu_lunch_category_root_configuration" sequence="5"/>
|
||||
<record model="ir.ui.view" id="view_lunch_order_form">
|
||||
<field name="name">Order</field>
|
||||
<field name="model">lunch.order</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Order">
|
||||
<group colspan="2" col="4">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="product" select="1" on_change="onchange_product(product)"/>
|
||||
<field name="price"/>
|
||||
<field name="descript"/>
|
||||
<field name="cashmove"/>
|
||||
<field name="state" select="2"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_order_tree">
|
||||
<field name="name">Order</field>
|
||||
<field name="model">lunch.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Order">
|
||||
<field name="user_id"/>
|
||||
<field name="product"/>
|
||||
<field name="date"/>
|
||||
<field name="cashmove"/>
|
||||
<field name="state"/>
|
||||
<field name="descript"/>
|
||||
<field name="price" sum="Total price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_order_form">
|
||||
<field name="name">Orders</field>
|
||||
<field name="res_model">lunch.order</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
</record>
|
||||
<menuitem name="Order" parent="menu_lunch" id="menu_lunch_order_form" action="action_lunch_order_form"/>
|
||||
|
||||
<!-- <record model="ir.actions.act_window" id="action_lunch_order_day_form">-->
|
||||
<!-- <field name="name"> Order of the day</field>-->
|
||||
<!-- <field name="res_model">lunch.order</field>-->
|
||||
<!-- <field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>-->
|
||||
<!---->
|
||||
<!-- </record>-->
|
||||
<!-- <menuitem name="Order of the day" parent="menu_lunch_order_form" id="menu_lunch_order_day_form" action="action_lunch_order_day_form"/>-->
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashbox_form">
|
||||
<field name="name">CashBox</field>
|
||||
<field name="model">lunch.cashbox</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="CashBox">
|
||||
<field name="name" select="1"/>
|
||||
<field name="manager" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashbox_tree">
|
||||
<field name="name">CashBox</field>
|
||||
<field name="model">lunch.cashbox</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="CashBox" colors="red:sum_remain<=0">
|
||||
<field name="name" select="1"/>
|
||||
<field name="manager" select="1"/>
|
||||
<field name="sum_remain" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_cashbox_form">
|
||||
<field name="name"> CashBox </field>
|
||||
<field name="res_model">lunch.cashbox</field>
|
||||
</record>
|
||||
<menuitem name="CashBox" parent="menu_lunch_category_root_configuration" id="menu_lunch_cashbox_form" action="action_lunch_cashbox_form"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashmove_form">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="CashMove">
|
||||
<field name="name" select="1"/>
|
||||
<field name="user_cashmove" select="1"/>
|
||||
<field name="amount" select="2"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="create_date" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashmove_tree">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="CashMove" editable="top">
|
||||
<field name="name" select="1" required="1"/>
|
||||
<field name="user_cashmove" select="1"/>
|
||||
<field name="amount" select="1" sum="Total amount"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="create_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_cashmove_form">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="res_model">lunch.cashmove</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Cash Moves" parent="menu_lunch" id="menu_lunch_cashmove_form" action="action_lunch_cashmove_form"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_category_form">
|
||||
<field name="name"> Category of product </field>
|
||||
<field name="model">lunch.category</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Category">
|
||||
<separator string="Category related to Products" colspan="4"/>
|
||||
<field name="name" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_category_tree">
|
||||
<field name="name">Category</field>
|
||||
<field name="model">lunch.category</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Order">
|
||||
<field name="name" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_category_form">
|
||||
<field name="name"> Category of product </field>
|
||||
<field name="res_model">lunch.category</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_form">
|
||||
<field name="name">Products</field>
|
||||
<field name="type">form</field>
|
||||
<field name="model">lunch.product</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Products">
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="description" select="1"/>
|
||||
<field name="price" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_tree">
|
||||
<field name="name">Products</field>
|
||||
<field name="model">lunch.product</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Products">
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="description" select="1"/>
|
||||
<field name="price" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_product_form">
|
||||
<field name="name">Product</field>
|
||||
<field name="res_model">lunch.product</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Tools/Lunch/Configuration/Products" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="1"/>
|
||||
<menuitem name="Products" parent="menu_lunch_category_root_configuration" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="2"/>
|
||||
<menuitem name="Category of product" parent="menu_lunch_category_root_configuration" id="menu_lunch_category_form" action="action_lunch_category_form" sequence="1"/>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_report_lunch_amount_tree">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="model">report.lunch.amount</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Box Amount by User">
|
||||
<field name="box" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="amount" select="1" sum="Total box" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_report_lunch_amount_form">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="model">report.lunch.amount</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Box Amount by User">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="amount" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_report_lunch_amount_tree">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="res_model">report.lunch.amount</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem name="Cash Position by User" parent="menu_lunch_reporting_order" action="action_report_lunch_amount_tree" id="menu_lunch_report_amount_tree"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
string="Confirm Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order.confirm"
|
||||
keyword="client_action_multi"
|
||||
id="lunch_order_confirm"/>
|
||||
|
||||
<wizard
|
||||
string="Cancel Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order.cancel"
|
||||
keyword="client_action_multi"
|
||||
id="wizard_id_cancel"/>
|
||||
|
||||
<wizard
|
||||
string="Set CashBox to Zero"
|
||||
model="lunch.cashbox"
|
||||
name="lunch.cashbox.clean"
|
||||
keyword="client_action_multi"
|
||||
id="wizard_clean_cashbox"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,24 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import order
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
from osv import osv
|
||||
|
||||
|
||||
class order(report_sxw.rml_parse):
|
||||
|
||||
def sum_price(self, orders):
|
||||
res = 0.0
|
||||
for o in orders:
|
||||
res += o.price
|
||||
return res
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(order, self).__init__(cr, uid, name, context)
|
||||
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'sum_price': self.sum_price,
|
||||
})
|
||||
|
||||
report_sxw.report_sxw('report.lunch.order', 'lunch.order',
|
||||
'addons/lunch/report/order.rml',parser=order, header=False)
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="34.0" y1="42.0" width="527" height="758"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="15.0" leading="19"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="16.0" leading="20"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman"/>
|
||||
<paraStyle name="P4" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P5" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P6" fontName="Times-BoldItalic" fontSize="9.0" leading="11"/>
|
||||
<paraStyle name="P7" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="P12" fontName="Times-BoldItalic" fontSize="6.0" leading="8"/>
|
||||
<paraStyle name="P13" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Header" fontName="Times-Roman"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Footnote" rightIndent="0.0" leftIndent="14.0" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P1">
|
||||
<font face="Times-Roman">Printed at : [[time.strftime("%Hh%M")]]</font>
|
||||
</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="149.0,135.0,103.0,140.0" repeatRows="1" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P4">Name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Order</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Unit Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<blockTable colWidths="148.0,135.0,103.0,140.0" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">[[repeatIn(objects, 'o') ]]</para>
|
||||
<para style="P7">[[ o.user_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[o.product.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ o.descript ]]</para>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P14">[['%.2f' % o.price ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ '%.2f' % sum_price(objects) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_lunch_category","lunch.category","model_lunch_category",base.group_user,1,1,1,1
|
||||
"access_lunch_product","lunch.product","model_lunch_product",base.group_user,1,1,1,1
|
||||
"access_lunch_cashbox","lunch.cashbox","model_lunch_cashbox",base.group_user,1,1,1,1
|
||||
"access_lunch_cashmove","lunch.cashmove","model_lunch_cashmove",base.group_user,1,1,1,1
|
||||
"access_lunch_order","lunch.order","model_lunch_order",base.group_user,1,1,1,1
|
||||
"access_report_lunch_amount","report.lunch.amount","model_report_lunch_amount",base.group_user,1,1,1,1
|
|
|
@ -0,0 +1,26 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import confirm
|
||||
import cancel
|
||||
import reset_box
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
cancel_form = """<?xml version="1.0"?>
|
||||
<form string="Cancel Order">
|
||||
<label string="Are you sure you want to cancel this order ?"/>
|
||||
</form>"""
|
||||
|
||||
|
||||
cancel_fields = {
|
||||
}
|
||||
|
||||
def _cancel(self,cr,uid,data,context):
|
||||
return pooler.get_pool(cr.dbname).get('lunch.order').lunch_order_cancel(cr,uid,data['ids'],context)
|
||||
|
||||
class order_cancel(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':cancel_form, 'fields':cancel_fields, 'state':[('end','No'),('cancel','Yes')]}
|
||||
},
|
||||
'cancel': {
|
||||
'actions': [_cancel],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
order_cancel('lunch.order.cancel')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
confirm_order_form = """<?xml version="1.0"?>
|
||||
<form title="Confirm">
|
||||
<separator string="Orders Confirmation" colspan="4"/>
|
||||
<field name="confirm_cashbox"/>
|
||||
<newline/>
|
||||
</form>
|
||||
"""
|
||||
|
||||
confirm_order_fields = {
|
||||
'confirm_cashbox': {'string':'Name of box', 'type':'many2one', 'required':True, 'relation':'lunch.cashbox' },
|
||||
}
|
||||
|
||||
def _confirm(self,cr,uid,data,context):
|
||||
pool= pooler.get_pool(cr.dbname)
|
||||
order_ref = pool.get('lunch.order')
|
||||
order_ref.confirm(cr,uid,data['ids'],data['form']['confirm_cashbox'],context)
|
||||
return {}
|
||||
|
||||
class order_confirm(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'action':[],
|
||||
'result':{'type' : 'form', 'arch' : confirm_order_form, 'fields' : confirm_order_fields, 'state' : [('end', 'Cancel'),('go', 'Confirm Order') ]},
|
||||
},
|
||||
'go' : {
|
||||
'actions' : [_confirm],
|
||||
'result' : {'type' : 'state', 'state' : 'end'}
|
||||
},
|
||||
}
|
||||
order_confirm('lunch.order.confirm')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
set_to_zero_form = """<?xml version="1.0"?>
|
||||
<form string="Reset cashbox">
|
||||
<label string="Are you sure you want to reset this cashbox ?"/>
|
||||
</form>"""
|
||||
|
||||
|
||||
|
||||
confirm_setting_zero_fields = {}
|
||||
|
||||
def _set_to_zero(self,cr,uid,data,context):
|
||||
pool= pooler.get_pool(cr.dbname)
|
||||
cashmove_ref = pool.get('lunch.cashmove')
|
||||
cr.execute("select user_cashmove, box,sum(amount) from lunch_cashmove where active= 't' and box in (%s) group by user_cashmove, box"%','.join(map(str,data['ids'])))
|
||||
res= cr.fetchall()
|
||||
cr.execute("update lunch_cashmove set active = 'f' where active= 't' and box in (%s)"%','.join(map(str,data['ids'])))
|
||||
## to_unactive= {}.fromkeys([r[0] for r in cr.fetchall]).keys()
|
||||
## print to_unactive
|
||||
## cashmove_ref.write(cr,uid,to_unactive,{'active':False})
|
||||
##
|
||||
for (user_id,box_id,amount) in res:
|
||||
cashmove_ref.create(cr,uid,{'name': 'Summary for user'+ str(user_id),
|
||||
'amount': amount,
|
||||
'user_cashmove': user_id,
|
||||
'box': box_id,
|
||||
'active': True,
|
||||
})
|
||||
return {}
|
||||
|
||||
|
||||
class cashbox_set_to_zero(wizard.interface):
|
||||
|
||||
states = {
|
||||
|
||||
'init': {
|
||||
'action':[],
|
||||
'result':{'type' : 'form',
|
||||
'arch' : set_to_zero_form,
|
||||
'fields' : confirm_setting_zero_fields,
|
||||
'state' : [('end', 'Cancel'),('zero', 'Set to Zero') ]},
|
||||
|
||||
},
|
||||
'zero' : {
|
||||
'actions' : [_set_to_zero],
|
||||
'result' : {'type' : 'state', 'state' : 'end'}
|
||||
},
|
||||
}
|
||||
|
||||
cashbox_set_to_zero('lunch.cashbox.clean')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -82,9 +82,12 @@
|
|||
</record>
|
||||
|
||||
<menuitem name="Membership" id="menu_membership" icon="terp-crm"/>
|
||||
<menuitem name="Members" parent="menu_membership"
|
||||
id="menu_member"
|
||||
sequence="1"/>
|
||||
<menuitem name="Configuration" parent="menu_membership"
|
||||
id="menu_conf"
|
||||
sequence="1"/>
|
||||
sequence="3"/>
|
||||
<menuitem name="Membership products" parent="menu_conf"
|
||||
id="menu_membership_products"
|
||||
action="action_membership_products"/>
|
||||
|
@ -144,8 +147,8 @@
|
|||
<field name="view_mode">form</field>
|
||||
<field name="act_window_id" ref="action_membership_members"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Current members" parent="menu_membership"
|
||||
|
||||
<menuitem name="Current members" parent="menu_member"
|
||||
id="menu_members"
|
||||
sequence="2"
|
||||
action="action_membership_members"/>
|
||||
|
@ -207,7 +210,7 @@
|
|||
|
||||
<!-- MEMBERSHIP/REPORTING -->
|
||||
<menuitem name="Reporting" parent="menu_membership"
|
||||
sequence="5"
|
||||
sequence="2"
|
||||
id="menu_reporting"/>
|
||||
|
||||
<!-- REPORTING/MEMBERSHIP BY YEAR -->
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
# Fabien Pinckaers <fp@tiny.Be>
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import olap
|
||||
import wizard
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name" : "Olap Schemes Management",
|
||||
"version" : "0.1",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://www.openerp.com",
|
||||
"depends" : ["base"],
|
||||
"category" : "Generic Modules/Olap",
|
||||
"description": """
|
||||
Base module to manage Olap schemas. Cube designer.
|
||||
""",
|
||||
"init_xml" : ["data/olap_data.xml"],
|
||||
"update_xml" : [
|
||||
"data/olap_view.xml",
|
||||
"data/olap_wizard.xml",
|
||||
"data/olap_cube_view.xml",
|
||||
"data/olap_fact_view.xml",
|
||||
"data/olap_cube_workflow.xml",
|
||||
"data/olap_security.xml"
|
||||
],
|
||||
"demo_xml" : ["data/olap_demo.xml"],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
DATABASE = 'bi'
|
||||
|
||||
all: simple sale date where sublevels calc_meas cross page complex test
|
||||
|
||||
simple:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].[all]} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[measures].[Credit Limit],[measures].[Count]} on rows, {[User].[all],[User].children} on columns from Partner"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].children} on rows from Partner"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].[all],[User].children} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].children} on rows, {[User].children} on columns from Partner where ([measures].[Count])"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].children} on rows, {[measures].[Count]} on columns from Partner where ([User].[3])"
|
||||
# ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[Date].[2008]} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[Date].[all],[Date].children} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner"
|
||||
|
||||
sale:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].children} on rows from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].children} on rows from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].children,[City].[Paris].children,[Partner Country].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].[all],[Order Date].children,[Users].children} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children, [Order Date].[all]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].children} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].[China]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].[Belgium]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
|
||||
date:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].[2007]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].[2008]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children,[Order Date].[2008].children,[Order Date].[2008].[Q2].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children,[Order Date].[2008].children,[Order Date].[2008].[Q2].children} on rows, {[measures].[Total Sales]} on columns from Sales where ([Order Date].[2008].[Q2])"
|
||||
|
||||
where:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c " select crossjoin (crossjoin ({[Order Date].[all],[Users].[all]} , {[Users].children} ) , {[Partner Country].[all]}) on rows, {[measures].[Units Sold]} on columns from Sales"
|
||||
sublevels:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children,[City].[Liege].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Products Category].[all],[Products Category].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Products Category].[all],[Products Category].children,[Products Category].[PC].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
|
||||
calc_meas:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all]} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns from Sales"
|
||||
|
||||
cross:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin ({[Order Date].[all],[Order Date].children} , {[All Products].[all]}) on rows from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all]},{[Users].[all]}) on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all],[Users].[all]},{[Order Date].[all]}) on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all],[City].children},{[Order Date].children}) on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Users].children}),{[Order Date].children}) on rows, {[measures].[Total Sales]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Users].children}),{[Order Date].children}) on rows, {[measures].[Total Sales],[measures].[Units Sold]} on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[Users].[all]},{[Order Date].[all]}),{[Order Date].children}) on rows, crossjoin({[All Products].[all],[Products Category].[all]},{[Partner Country].children}) on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all]},{[Users].[all]}) on rows, crossjoin({[measures].[Total Sales]},{[Order Date].children}) on columns from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all]},{[Users].[all]}) on rows, crossjoin(crossjoin({[measures].[Total Sales]},{[Order Date].children}),{[Users].children}) on columns from Sales"
|
||||
|
||||
page:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns, {[Order Date].children} on pages from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[measures].[Units Sold],[measures].[Total Sales]} on rows, {[City].[all],[City].children} on columns, {[Order Date].children} on pages from Sales"
|
||||
|
||||
complex:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all],[City].children},{[Order Date].[all]}) on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns, {[Order Date].children} on pages from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Order Date].children}),{[Users].children}) on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns, {[Order Date].children} on pages from Sales"
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Order Date].children}),{[Users].children}) on rows, crossjoin({[measures].[Units Sold],[measures].[Total Sales]},{[City].children}) on columns, {[Order Date].children} on pages from Sales"
|
||||
|
||||
test:
|
||||
./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c " select crossjoin (crossjoin ({[Order Date].[all],[Users].[all]} , {[Users].children} ) , {[Partner Country].[all]}) on rows, {[measures].[Units Sold]} on columns from Sales"
|
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
# Fabien Pinckaers <fp@tiny.Be>
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
#
|
||||
# This module test all RPC methods
|
||||
#
|
||||
|
||||
import optparse
|
||||
|
||||
import xmlrpclib
|
||||
import time
|
||||
|
||||
__version__ = '1.0'
|
||||
|
||||
parser = optparse.OptionParser(version=__version__)
|
||||
|
||||
group = optparse.OptionGroup(parser, "General options")
|
||||
group.add_option("-c", "--command", dest="command", help="The query to execute")
|
||||
group.add_option("-s", "--schema", dest="schema", help="The schema to use for the query")
|
||||
parser.add_option_group(group)
|
||||
|
||||
group = optparse.OptionGroup(parser, "Connection options")
|
||||
group.add_option("-d", "--database", dest="database", help="Database name")
|
||||
group.add_option("-H", "--hostname", dest="hostname", default='localhost', help="Server hostname")
|
||||
group.add_option("-U", "--username", dest="username", default='admin', help="Username")
|
||||
group.add_option("-W", "--password", dest="password", default='admin', help="Password")
|
||||
group.add_option("-p", "--port", dest="port", default=8069, help="Server port")
|
||||
parser.add_option_group(group)
|
||||
|
||||
(opt, args) = parser.parse_args()
|
||||
|
||||
sock = xmlrpclib.ServerProxy('http://'+opt.hostname+':'+str(opt.port)+'/xmlrpc/object')
|
||||
uid = 1
|
||||
|
||||
axis,data = sock.execute(opt.database, uid, opt.password, 'olap.schema', 'request', opt.schema, opt.command)
|
||||
COLSPAN = 18
|
||||
ROWSPAN = 18
|
||||
|
||||
print
|
||||
if len(axis)>1:
|
||||
for i in range(8):
|
||||
ok = False
|
||||
for x in axis[1]:
|
||||
if len(x[0])==i:
|
||||
ok = True
|
||||
if not ok:
|
||||
continue
|
||||
print ' '*COLSPAN,
|
||||
print (('%-'+str(ROWSPAN)+'s ' ) * len(axis[1])) % tuple(map(lambda x: str(len(x[0])==i and x[1] or ''),axis[1]))
|
||||
for col in data:
|
||||
print ('%-'+str(COLSPAN)+'s')% (' '*(len(axis[0][0][0])-1)*2 + str(axis[0].pop(0)[1]),),
|
||||
for row in col:
|
||||
if row==[False]:
|
||||
print ('%-'+str(ROWSPAN)+'s')%('',),
|
||||
else:
|
||||
print ('%-'+str(ROWSPAN)+'s')%(row,),
|
||||
print
|
||||
print
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from mdx_parser import mdx_parser
|
||||
from mdx_output import mdx_output
|
||||
from warehouse import warehouse
|
|
@ -0,0 +1,9 @@
|
|||
import sqlalchemy
|
||||
|
||||
agregator = {}
|
||||
agregator['sum'] = sqlalchemy.func.sum
|
||||
agregator['count'] = sqlalchemy.func.count
|
||||
agregator['avg'] = sqlalchemy.func.avg
|
||||
agregator['min'] = sqlalchemy.func.min
|
||||
agregator['max'] = sqlalchemy.func.max
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
import sqlalchemy
|
||||
import common
|
||||
|
||||
|
||||
|
||||
class axis(object):
|
||||
def __init__(self, axis, name=None):
|
||||
self.axis = axis
|
||||
self.name = name
|
||||
|
||||
def validate(self, cube):
|
||||
self.object = cube
|
||||
self.axis.validate(cube)
|
||||
|
||||
def name_set(self, name):
|
||||
self.name = name
|
||||
|
||||
def __repr__(self):
|
||||
res = '\t<olap.axis ['+str(self.name)+']\n'
|
||||
res += str(self.axis)
|
||||
res += '\t>'
|
||||
return res
|
||||
|
||||
#
|
||||
# Output:
|
||||
# a list of grouped values that can be computed at once
|
||||
# a group is defined by elements having the same query
|
||||
#
|
||||
# [
|
||||
# {
|
||||
# 'level': ["Time","2008","Q1"],
|
||||
# 'value': '1er Trim 2008',
|
||||
# 'query': SQLAlchemy query object
|
||||
# }
|
||||
# ]
|
||||
#
|
||||
|
||||
def run(self, metadata):
|
||||
result = self.axis.run(metadata)
|
||||
return result
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,109 @@
|
|||
#
|
||||
# Interface for all mapping objects to map values into the right
|
||||
# position in the cube, according to cube definition
|
||||
#
|
||||
|
||||
class mapping(object):
|
||||
def query_init(self):
|
||||
pass
|
||||
def position_get(self):
|
||||
return 0
|
||||
|
||||
class column_static(mapping):
|
||||
def __init__(self, value=False, position=0):
|
||||
self.value = value
|
||||
def cube_set(self, cube, value, delta=0):
|
||||
return cube[ delta]
|
||||
def value_set(self, value=False):
|
||||
value.pop(0)
|
||||
return self.value
|
||||
|
||||
|
||||
class column_static_dummy(mapping):
|
||||
def __init__(self, value=False, position=0):
|
||||
self.value = value
|
||||
def cube_set(self, cube, value, delta=0):
|
||||
return cube[ delta]
|
||||
def value_set(self, value=False):
|
||||
value.pop(0)
|
||||
return self.value
|
||||
|
||||
class column_fixed(mapping):
|
||||
def __init__(self, pos=0, position=0):
|
||||
self.pos = pos
|
||||
def cube_set(self, cube, value, delta=0):
|
||||
return cube[ self.pos +delta]
|
||||
def value_set(self, value):
|
||||
return value.pop(0)
|
||||
|
||||
class column_mapping_value(mapping):
|
||||
def __init__(self, value, position=0):
|
||||
self.axis_value = {}
|
||||
for v in range(len(value)):
|
||||
self.axis_value[value[v][0]] = v
|
||||
|
||||
def cube_set(self, cube, value, delta=0):
|
||||
pos = value.pop(0)
|
||||
return cube[ self.axis_value[pos]+delta ]
|
||||
def value_set(self, value):
|
||||
return False
|
||||
|
||||
class column_mapping(mapping):
|
||||
def __init__(self, value, position=0):
|
||||
self.axis_value = {}
|
||||
for v in range(len(value)):
|
||||
self.axis_value[value[v][0]] = v
|
||||
|
||||
def cube_set(self, cube, value, delta=0):
|
||||
pos = value.pop(0)
|
||||
return cube[ self.axis_value[pos]+delta ]
|
||||
|
||||
def value_set(self, value):
|
||||
return False
|
||||
|
||||
def position_get(self):
|
||||
return 1
|
||||
|
||||
|
||||
class column_mapping_axis(mapping):
|
||||
def __init__(self, mapping, axis, position=0):
|
||||
keys = {}
|
||||
i = 0
|
||||
for a in axis:
|
||||
keys[tuple(list(a)[0][1:])] = i
|
||||
i+=1
|
||||
|
||||
self.axis_value = {}
|
||||
for m in mapping:
|
||||
k = tuple(list(m)[:-1])
|
||||
a = keys[k]
|
||||
self.axis_value[tuple(m)[-1]] = a
|
||||
|
||||
def cube_set(self, cube, value, delta=0):
|
||||
pos = value.pop(0)
|
||||
return cube[ self.axis_value[pos]+delta ]
|
||||
|
||||
def value_set(self, value):
|
||||
return False
|
||||
|
||||
def position_get(self):
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
class column_mapping_join(mapping):
|
||||
def __init__(self, mappings, position=0):
|
||||
self.mappings = mappings
|
||||
|
||||
def cube_set(self, cube, value, delta=0):
|
||||
for m in self.mappings:
|
||||
cube = m.cube_set(cube, value, delta)
|
||||
return cube
|
||||
|
||||
def value_set(self, value):
|
||||
for m in self.mappings:
|
||||
value = m.value_set(value)
|
||||
return value
|
||||
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,109 @@
|
|||
import sqlalchemy
|
||||
from sqlalchemy import *
|
||||
import common
|
||||
|
||||
def measure_sql_exp_col(metadata,col):
|
||||
temp = col.split(".")
|
||||
table_name = filter(lambda x: x.name==temp[0],metadata.table_iterator(reverse=False))
|
||||
if table_name:
|
||||
if not col in table_name[0].c:
|
||||
col = sqlalchemy.Column(temp[1], sqlalchemy.Float)
|
||||
table_name[0].append_column(col)
|
||||
return col
|
||||
else:
|
||||
for k in table_name[0].c:
|
||||
if temp[1] == k.name:
|
||||
return k
|
||||
else:
|
||||
print "The table %s do not exist or match to cube fact table"%(temp[0])
|
||||
# To be Improved
|
||||
# I am sure it exist something better in SA
|
||||
def col_get(table, col_obj):
|
||||
# table = sqlalchemy table object
|
||||
# level = level object
|
||||
|
||||
# Check for the columns
|
||||
|
||||
datatypes = {
|
||||
'timestamp': sqlalchemy.DateTime,
|
||||
'timestampz': sqlalchemy.DateTime,
|
||||
'numeric': sqlalchemy.Numeric,
|
||||
'int': sqlalchemy.Integer,
|
||||
'float8': sqlalchemy.Float,
|
||||
'varchar': sqlalchemy.String,
|
||||
'bool': sqlalchemy.Boolean,
|
||||
'bytea':'Byte A', # Not Clear
|
||||
'int2':sqlalchemy.SmallInteger,
|
||||
'int4':sqlalchemy.Integer,
|
||||
'int8':sqlalchemy.Integer,
|
||||
'text':sqlalchemy.String,
|
||||
'date':sqlalchemy.Date,
|
||||
'time': sqlalchemy.Time,
|
||||
'number':sqlalchemy.Numeric,
|
||||
}
|
||||
if not ('.').join([col_obj.table_id.table_db_name,col_obj.column_db_name]) in table.c:
|
||||
col = sqlalchemy.Column(col_obj.column_db_name, datatypes[col_obj.type])
|
||||
table.append_column(col)
|
||||
return col
|
||||
else:
|
||||
for k in table.c:
|
||||
if col_obj.column_db_name == k.name:
|
||||
return k
|
||||
|
||||
def get_primary_key(table):
|
||||
for cols in table.columns:
|
||||
if cols.primary_key == True:
|
||||
return cols
|
||||
|
||||
|
||||
# It gets the olap_cube_table browse object
|
||||
def table_get(metadata, table):
|
||||
result = False
|
||||
table1 = False
|
||||
table2 = False
|
||||
if table.line_ids:
|
||||
temp = 0
|
||||
for i in range(len(table.line_ids)):
|
||||
table1 = sqlalchemy.Table(table.line_ids[i].table_id.table_db_name,metadata)
|
||||
pk = get_primary_key(table.line_ids[i].table_id)
|
||||
if result:
|
||||
|
||||
result = join(result,table1, onclause=col_get(table1,pk)==col_get(table2,table.line_ids[i-1].field_id))
|
||||
elif table2:
|
||||
result = join(table1, table2, onclause=col_get(table1,pk)==col_get(table2,table.line_ids[i-1].field_id))
|
||||
else:
|
||||
table2=table1
|
||||
temp=i
|
||||
|
||||
if not result:
|
||||
result = table1
|
||||
pk = get_primary_key(table.line_ids[temp].table_id)
|
||||
tab = sqlalchemy.Table(table.line_ids[temp].field_id.related_to.table_db_name,metadata)
|
||||
result = join(result, tab,onclause=col_get(tab,pk)
|
||||
==col_get(sqlalchemy.Table(table.line_ids[temp].table_id.table_db_name,metadata),table.line_ids[temp].field_id))
|
||||
|
||||
else:
|
||||
if table.column_link_id.related_to:
|
||||
result = sqlalchemy.Table(table.column_link_id.related_to.table_db_name,metadata)
|
||||
else:
|
||||
result = sqlalchemy.Table(table.column_link_id.table_id.table_db_name,metadata)
|
||||
|
||||
return result
|
||||
|
||||
def xcombine(*seqin):
|
||||
"""
|
||||
Cartesian product of the list of list that produce all distinct
|
||||
subsets of my query.
|
||||
"""
|
||||
def rloop(seqin,comb):
|
||||
'''recursive looping function'''
|
||||
if seqin:
|
||||
for item in seqin[0]:
|
||||
newcomb=comb+[item]
|
||||
for item in rloop(seqin[1:],newcomb):
|
||||
yield item
|
||||
else:
|
||||
yield comb
|
||||
return rloop(seqin, [])
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
import sqlalchemy
|
||||
import common
|
||||
import level
|
||||
|
||||
class cross(object):
|
||||
def __init__(self, cross):
|
||||
self.cross = cross
|
||||
self.name = False
|
||||
self.object = False
|
||||
|
||||
def validate(self, cube):
|
||||
for obj in self.cross:
|
||||
self.object = obj.validate(cube)
|
||||
return self.object
|
||||
|
||||
def name_set(self, name):
|
||||
self.name = name
|
||||
|
||||
def __repr__(self):
|
||||
res = '\t<olap.cross\n'
|
||||
res += str(self.cross)
|
||||
res += '\t>'
|
||||
return res
|
||||
|
||||
def run(self, metadata):
|
||||
print '*'*40
|
||||
for obj in self.cross:
|
||||
result = obj.run(metadata)
|
||||
return result
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
import sqlalchemy
|
||||
import common
|
||||
|
||||
class cube(object):
|
||||
def __init__(self, name=None):
|
||||
super(cube, self).__init__()
|
||||
self.object = False
|
||||
self.name = name
|
||||
|
||||
def run(self, metadata):
|
||||
table = common.table_get(metadata, self.object.table_id)
|
||||
return sqlalchemy.select(from_obj = [table], columns=[]),table
|
||||
|
||||
def validate(self, schema):
|
||||
for cube in schema.cube_ids:
|
||||
if self.name == cube.name:
|
||||
self.object = cube
|
||||
break
|
||||
return self.object
|
||||
|
||||
def __repr__(self):
|
||||
return self.name
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
class datatype_class(object):
|
||||
def __init__(self):
|
||||
self.datatype = {}
|
||||
def subscribe(self, name, data):
|
||||
self.datatype[name] = data
|
||||
datatype = datatype_class()
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,8 @@
|
|||
class formatstring_class(object):
|
||||
def __init__(self):
|
||||
self.formatstrings = {}
|
||||
def subscribe(self, name, data):
|
||||
self.formatstrings[name] = data
|
||||
formatstring = formatstring_class()
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,322 @@
|
|||
|
||||
import sqlalchemy
|
||||
import common
|
||||
import axis_map
|
||||
import pooler,tools
|
||||
|
||||
class level(object):
|
||||
def __init__(self, level, sublevels=[]):
|
||||
self.level = level
|
||||
self.sublevels = sublevels
|
||||
self.object = False
|
||||
|
||||
def validate(self, cube):
|
||||
for dimension in cube.dimension_ids:
|
||||
if self.object:
|
||||
break
|
||||
for hierarchy in dimension.hierarchy_ids:
|
||||
if hierarchy.name==self.level:
|
||||
self.object = hierarchy
|
||||
break
|
||||
|
||||
#
|
||||
# TODO: implement access to unique levels for not fully qualified names
|
||||
#
|
||||
if not self.object:
|
||||
raise 'This dimension (%s) does not exist !' % (self.level,)
|
||||
|
||||
obj = hierarchy
|
||||
pos = 0
|
||||
for level in self.sublevels:
|
||||
res = level.validate(hierarchy.level_ids[pos])
|
||||
if res:
|
||||
pos += 1
|
||||
return self.object
|
||||
|
||||
def _to_unicode(self,s):
|
||||
try:
|
||||
return s.encode('ascii')
|
||||
except UnicodeError:
|
||||
try:
|
||||
return s.decode('utf-8')
|
||||
except UnicodeError:
|
||||
try:
|
||||
return s.decode('latin')
|
||||
except UnicodeError:
|
||||
return s
|
||||
|
||||
def _to_decode(self,s):
|
||||
try:
|
||||
return s.encode('utf-8')
|
||||
except UnicodeError:
|
||||
try:
|
||||
return s.encode('latin')
|
||||
except UnicodeError:
|
||||
try:
|
||||
return s.decode('ascii')
|
||||
except UnicodeError:
|
||||
return s
|
||||
|
||||
def run(self, metadata):
|
||||
'''
|
||||
RETURN: {
|
||||
'value': [(ID, NAME)], # ID = ['user', 3]
|
||||
'query': {
|
||||
'whereclause': [col.in_(*primary_keys)],
|
||||
'column': [col],
|
||||
'group_by': [col]
|
||||
},
|
||||
'axis_mapping': axis_map.column_mapping(result),
|
||||
'delta':0
|
||||
}
|
||||
'''
|
||||
if self.sublevels[0].name=='all':
|
||||
return [{
|
||||
'value': [([str(self.level)], str(self.level), False)],
|
||||
'query': {
|
||||
'column': [sqlalchemy.literal('all')],
|
||||
},
|
||||
'axis_mapping': axis_map.column_static(False),
|
||||
'delta':0,
|
||||
}]
|
||||
|
||||
|
||||
# Make these 2 commands working in all cases:
|
||||
# return self._run_transform(metadata)
|
||||
# return self._run_star(metadata)
|
||||
|
||||
if self.object.table_id<>self.object.dimension_id.cube_id.table_id: # Add a condition on the object
|
||||
result = self._run_transform(metadata)
|
||||
else:
|
||||
result = self._run_star(metadata)
|
||||
return result
|
||||
|
||||
def _compute_axis(self, metadata, primarykey=False):
|
||||
"""
|
||||
Compute axis values, and transform the main query in the same way
|
||||
to add this branch of the star for this subset. The mappers
|
||||
reassign to values.
|
||||
"""
|
||||
|
||||
#
|
||||
# Build a query on all tables of the hierarchy
|
||||
# It passes the hierarchy table_id browse object (olap_cube_table )
|
||||
#
|
||||
table = common.table_get(metadata, self.object.table_id)
|
||||
#
|
||||
# Implement the query for all sublevels
|
||||
# Return:
|
||||
# [ (ID1, ID2, ID3, NAME, [PRIMARYKEY]) ]
|
||||
#
|
||||
result_axis = {}
|
||||
for slevel in self.sublevels:
|
||||
res = slevel.run(metadata, table)
|
||||
for key in res.keys():
|
||||
result_axis.setdefault(key, [])
|
||||
result_axis[key] += res[key]
|
||||
cols = []
|
||||
axis_select = sqlalchemy.select(from_obj=[table], columns=[], distinct=True)
|
||||
for where in result_axis.get('where_clause', []):
|
||||
axis_select.append_whereclause(where)
|
||||
for col in result_axis.get('column', []):
|
||||
axis_select.append_column(col)
|
||||
for group in result_axis.get('group_by', []):
|
||||
axis_select.append_group_by(group)
|
||||
# TODO: find a way to do: axis_select2 = axis_select.copy()
|
||||
axis_select2 = sqlalchemy.select(from_obj=[table], columns=[], distinct=True)
|
||||
for where in result_axis.get('where_clause', []):
|
||||
axis_select2.append_whereclause(where)
|
||||
for col in result_axis.get('column', []):
|
||||
axis_select2.append_column(col)
|
||||
for group in result_axis.get('group_by', []):
|
||||
axis_select2.append_group_by(group)
|
||||
# TODO: end
|
||||
#metadata.bind.echo = True
|
||||
axis_select2.append_column(result_axis['column_name'][-1].label('axis_name'))
|
||||
query = axis_select2.execute()
|
||||
result = query.fetchall()
|
||||
|
||||
def _tuple_define(x):
|
||||
y=list(x)
|
||||
if y[-1] == None:
|
||||
y[-1] = '/'
|
||||
elif isinstance(y[-1],float):
|
||||
y[-1] = str (int(y[-1]))
|
||||
else:
|
||||
y[-1] = self._to_unicode(y[-1])
|
||||
y[-1] = tools.ustr(y[-1])
|
||||
return ([self.level]+y[:-1]),y[-1]
|
||||
|
||||
axis = map(_tuple_define, result)
|
||||
# Gives the mapping
|
||||
|
||||
primary_key = ''
|
||||
if primarykey:
|
||||
if self.object.table_id.column_link_id.related_to:
|
||||
primary_key = self.object.table_id.column_link_id.related_to
|
||||
else:
|
||||
primary_key = self.object.table_id.column_link_id.table_id
|
||||
tableprim = sqlalchemy.Table(primary_key.table_db_name, metadata)
|
||||
pk = common.get_primary_key(primary_key)
|
||||
col = common.col_get(tableprim,pk)
|
||||
axis_select.append_column(col.label('axis_primarykey'))
|
||||
query = axis_select.execute()
|
||||
result = query.fetchall()
|
||||
else:
|
||||
# To find the primary key that suits best as per the given criteria
|
||||
raise 'Primary key table not made in the hierarchy'
|
||||
|
||||
maps = []
|
||||
position =0
|
||||
for mapping in result_axis['axis_mapping']:
|
||||
mapinst = mapping(result, position)
|
||||
maps.append(mapinst)
|
||||
position += mapinst.position_get()
|
||||
result_axis['axis_mapping'] = maps
|
||||
#
|
||||
# #
|
||||
# # Apply the filters on the main query object due to this block
|
||||
# #
|
||||
#
|
||||
# maps = []
|
||||
# position =0
|
||||
# for mapping in result_axis['axis_mapping']:
|
||||
# mapinst = mapping(result, position)
|
||||
# maps.append(mapinst)
|
||||
# position += mapinst.position_get()
|
||||
# result_axis['axis_mapping'] = maps
|
||||
# print '*'*50
|
||||
# print table, result, result_axis
|
||||
return table, axis, result ,result_axis
|
||||
|
||||
def _run_star(self, metadata):
|
||||
"""
|
||||
Compute axis values, and transform the main query in the same way
|
||||
to add this branch of the star for this subset. The mappers
|
||||
reassign to values.
|
||||
"""
|
||||
print '*** Start ***'
|
||||
table, result,result_mapping, result_axis = self._compute_axis(metadata, True)
|
||||
result_axis.setdefault('where_clause', [])
|
||||
#
|
||||
# The result to be applied to the main query object
|
||||
#
|
||||
result = {
|
||||
'value': result,
|
||||
'query': {
|
||||
# 'whereclause': result_axis.get('where_clause',[]),
|
||||
'column': result_axis.get('column', []),
|
||||
'group_by': result_axis.get('column', [])
|
||||
},
|
||||
##
|
||||
## How to use group of axis_mapping ?
|
||||
##
|
||||
'axis_mapping': axis_map.column_static(False),
|
||||
'delta':0,
|
||||
}
|
||||
return [result]
|
||||
|
||||
def _run_transform(self, metadata):
|
||||
"""
|
||||
Compute axis values, and transform the main query according to axis
|
||||
values for this subset. The main query slicer is transformed to a
|
||||
single condition like: foreign_key in (...) and reapplied to axis
|
||||
values.
|
||||
"""
|
||||
|
||||
table, axis, mapping, result_axis = self._compute_axis(metadata, True)
|
||||
table2 = common.table_get(metadata, self.object.dimension_id.cube_id.table_id)
|
||||
sql_table = sqlalchemy.Table(self.object.table_id.column_link_id.table_id.table_db_name,metadata)
|
||||
col = common.col_get(sql_table, self.object.table_id.column_link_id)
|
||||
|
||||
#
|
||||
# The result to be applied to the main query object
|
||||
#
|
||||
|
||||
result = []
|
||||
for a in axis:
|
||||
k = tuple(list(a)[0][1:])
|
||||
mapping_axis = filter(lambda m: tuple(list(m)[:-1])==k, mapping)
|
||||
primary_keys = map(lambda x:list(x)[-1], mapping_axis)
|
||||
# To convert everything in to the string so that no conversion needed at later stage
|
||||
# This is for the elements to be displayed in the rows and columns
|
||||
for i in range(len(a[0])):
|
||||
if a[0][i]:
|
||||
if isinstance(a[0][i],int):
|
||||
a[0][i] = str(a[0][i])
|
||||
elif isinstance(a[0][i],float):
|
||||
a[0][i] = str(int(a[0][i]))
|
||||
else:
|
||||
a[0][i] = '/'
|
||||
a = list(a)
|
||||
if isinstance(a[-1],int):
|
||||
a[-1] = str(a[-1])
|
||||
elif isinstance(a[-1],float):
|
||||
a[-1] = str(int(a[-1]))
|
||||
a = tuple(a)
|
||||
primary_keys = map(lambda x: str(x),primary_keys)
|
||||
result.append( {
|
||||
'value': [a],
|
||||
'query': {
|
||||
|
||||
'whereclause': [col.in_(primary_keys)],#.extend(result_axis['where_clause']),
|
||||
'column': [sqlalchemy.literal('transform')],
|
||||
},
|
||||
'axis_mapping': axis_map.column_static(False),
|
||||
'delta':0,
|
||||
})
|
||||
return result
|
||||
|
||||
def __repr__(self):
|
||||
res= '\t\t<olap.level \n'
|
||||
res+= '\t\t\t'+str(self.level)+'\n'
|
||||
for l in self.sublevels:
|
||||
res+= '\t\t\t'+str(l)+'\n'
|
||||
res += '\t\t>'
|
||||
return res
|
||||
|
||||
class level_filter(object):
|
||||
def __init__(self, name):
|
||||
self.name=name
|
||||
self.object=None
|
||||
|
||||
def validate(self, level):
|
||||
self.object = level
|
||||
return 1
|
||||
|
||||
#
|
||||
# Modify for the query select to return tuples:
|
||||
# (id, name)
|
||||
# where:
|
||||
# id: ["Time","2008","Q1"]
|
||||
# name: Quarter 1
|
||||
# Return a description of what have been added
|
||||
#
|
||||
def run(self, metadata, table):
|
||||
return self.object._types[self.object.type].run( self, metadata, table)
|
||||
|
||||
def __repr__(self):
|
||||
return '<olap.level_filter '+self.name+'>'
|
||||
|
||||
class level_function(object):
|
||||
def __init__(self, name):
|
||||
self.type='function'
|
||||
self.name = name
|
||||
self.object = None
|
||||
# [{
|
||||
# 'level': ["Time","2008","Q1"],
|
||||
# 'value': '1er Trim 2008',
|
||||
# 'query': SQLAlchemy query object
|
||||
# }]
|
||||
def run(self, metadata, table):
|
||||
return self.object._types[self.object.type].children( self, metadata, table)
|
||||
|
||||
def validate(self, level):
|
||||
self.object = level
|
||||
return 0
|
||||
|
||||
def __repr__(self):
|
||||
return '<olap.level_function '+self.name+'>'
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,3 @@
|
|||
import level_interface
|
||||
from level_normal import level_normal
|
||||
from level_date import *
|
|
@ -0,0 +1,109 @@
|
|||
|
||||
import sqlalchemy
|
||||
from level_interface import level_interface
|
||||
|
||||
from olap.cube import common
|
||||
from olap.cube import axis_map
|
||||
|
||||
#
|
||||
# To Be Fixed:
|
||||
# Mapping of QX and Month
|
||||
#
|
||||
|
||||
class level_date_month(level_interface):
|
||||
def run(self, level, metadata, table):
|
||||
col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
result = {
|
||||
'column': [sqlalchemy.func.date_part('month',col_id)],
|
||||
'column_name': [sqlalchemy.func.date_part('month', col)],
|
||||
'axis_mapping': [axis_map.column_mapping],
|
||||
'where_clause': [sqlalchemy.func.date_part('month',col_id) == level.name]
|
||||
}
|
||||
return result
|
||||
|
||||
def children(self, level, metadata, table):
|
||||
col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
qexpr = sqlalchemy.literal('Q')+ sqlalchemy.sql.cast(sqlalchemy.func.date_part('QUARTER',col_id), sqlalchemy.types.String) + sqlalchemy.sql.cast(sqlalchemy.func.date_part('month',col_id),sqlalchemy.types.String)
|
||||
return {
|
||||
'column': [sqlalchemy.func.date_part('month',col)],
|
||||
'column_name':[sqlalchemy.func.date_part('month',col)],
|
||||
'axis_mapping': [axis_map.column_mapping]
|
||||
}
|
||||
|
||||
def validate(self, level, name):
|
||||
|
||||
return 1
|
||||
|
||||
class level_date_year(level_interface):
|
||||
def run(self, level, metadata, table):
|
||||
col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata),level.object.column_name)
|
||||
col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
result = {
|
||||
'column': [sqlalchemy.func.date_part('year',col_id)],
|
||||
'column_name': [sqlalchemy.func.date_part('year', col)],
|
||||
'axis_mapping': [axis_map.column_mapping],
|
||||
'where_clause': [sqlalchemy.func.date_part('year',col_id) == level.name]
|
||||
}
|
||||
return result
|
||||
|
||||
def children(self, level, metadata, table):
|
||||
col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
return {
|
||||
'column': [sqlalchemy.func.date_part('year',col_id)],
|
||||
'column_name':[sqlalchemy.func.date_part('year',col)],
|
||||
'axis_mapping': [axis_map.column_mapping],
|
||||
'where_clause':[]
|
||||
}
|
||||
|
||||
def validate(self, level, name):
|
||||
return 1
|
||||
|
||||
#
|
||||
# To Do: Create your own axis mapping
|
||||
#
|
||||
class level_date_quarter(level_interface):
|
||||
|
||||
def run(self, level, metadata, table):
|
||||
quarters = {
|
||||
'Q1': [1,2,3],
|
||||
'Q2': [4,5,6],
|
||||
'Q3': [7,8,9],
|
||||
'Q4': [10,11,12]
|
||||
}
|
||||
col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
qexpr = sqlalchemy.literal('Q')+ sqlalchemy.sql.cast(sqlalchemy.func.date_part('QUARTER',col_id), sqlalchemy.types.String)
|
||||
if not level.name in quarters:
|
||||
raise 'Quarter should be in Q1,Q2,Q3,Q4 !'
|
||||
|
||||
result = {
|
||||
'column': [qexpr],
|
||||
'column_name': [qexpr],
|
||||
'axis_mapping': [axis_map.column_static],
|
||||
'where_clause': [
|
||||
(sqlalchemy.func.date_part('month',col_id)==quarters[level.name][0]) |
|
||||
(sqlalchemy.func.date_part('month',col_id)==quarters[level.name][1]) |
|
||||
(sqlalchemy.func.date_part('month',col_id)==quarters[level.name][2])
|
||||
]
|
||||
}
|
||||
return result
|
||||
|
||||
|
||||
|
||||
def children(self, level, metadata, table):
|
||||
table = sqlalchemy.Table(level.object.table_name, metadata)
|
||||
col =common.col_get(table, level.object.column_name)
|
||||
col_id = common.col_get(table,level.object.column_name)
|
||||
qexpr = sqlalchemy.literal('Q')+ sqlalchemy.sql.cast(sqlalchemy.func.date_part('QUARTER',col_id), sqlalchemy.types.String)
|
||||
return {
|
||||
'column': [qexpr],
|
||||
'column_name': [qexpr],
|
||||
'axis_mapping': [axis_map.column_mapping_value]
|
||||
}
|
||||
|
||||
def validate(self, level, name):
|
||||
return 1
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
class level_interface(object):
|
||||
#
|
||||
# Return the number of position consummed by this level
|
||||
# 1 means this goes to the next level object (.[20])
|
||||
# 0 means that the next argument is still on the same level object (.children)
|
||||
#
|
||||
def validate(self, level, name):
|
||||
return 1
|
||||
|
||||
def run(self, level, metadata, table):
|
||||
col = None
|
||||
return {}
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,32 @@
|
|||
import sqlalchemy
|
||||
from olap.cube import common
|
||||
from olap.cube import axis_map
|
||||
from level_interface import level_interface
|
||||
|
||||
class level_normal(level_interface):
|
||||
def run(self, level, metadata, table):
|
||||
col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
result = {
|
||||
'column': [col_id],
|
||||
'column_name': [col],
|
||||
'axis_mapping': [axis_map.column_mapping],
|
||||
'where_clause': [col_id == level.name ]
|
||||
}
|
||||
return result
|
||||
|
||||
def children(self, level, metadata, table):
|
||||
col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name)
|
||||
result = {
|
||||
'column': [col_id],
|
||||
'column_name': [col],
|
||||
'axis_mapping': [axis_map.column_mapping],
|
||||
'where_clause': []
|
||||
}
|
||||
return result
|
||||
|
||||
def validate(self, level, name):
|
||||
return 1
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1 @@
|
|||
from mdx_input import mdx_input
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
class mdx_input(object):
|
||||
|
||||
def parse(self, mdx):
|
||||
return mdx
|
|
@ -0,0 +1,35 @@
|
|||
import common
|
||||
|
||||
#
|
||||
# Class constructed by {..., ...}
|
||||
#
|
||||
class mdx_set(object):
|
||||
def __init__(self, list):
|
||||
self.list = list
|
||||
|
||||
def run(self, metadata):
|
||||
"""
|
||||
Should use xcombine, I think it's currently False
|
||||
common.xcombine(*result)
|
||||
"""
|
||||
result = []
|
||||
for l in self.list:
|
||||
result += l.run(metadata)
|
||||
position = 0
|
||||
for r in result:
|
||||
r['delta'] = position
|
||||
position += len(r['value'])
|
||||
return result
|
||||
|
||||
def validate(self, object):
|
||||
for l in self.list:
|
||||
l.validate(object)
|
||||
return True
|
||||
|
||||
def __repr__(self):
|
||||
res = '\tSet: ['
|
||||
for l in self.list:
|
||||
res += str(l)+',\n'
|
||||
res += '\t]'
|
||||
return res
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1 @@
|
|||
from mdx_output import *
|
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# Modify the final result (axis, data), for instance, reordering of axes
|
||||
#
|
||||
import copy
|
||||
|
||||
def decimal_to_float(cube):
|
||||
# Note FP: I think the decimal > float conversion should be done more
|
||||
# in upstream
|
||||
if type(cube)==type([]) and len(cube):
|
||||
if type(cube[0])==type([]):
|
||||
for b in cube:
|
||||
decimal_to_float(b)
|
||||
else:
|
||||
for l in range(len(cube)):
|
||||
cube[l] = str(float(cube[l]))
|
||||
|
||||
def sort_apply(cube, axis_pos):
|
||||
cube2 = copy.copy(cube)
|
||||
for i in range(len(axis_pos)):
|
||||
cube[i] = cube2[axis_pos[i]]
|
||||
return cube
|
||||
|
||||
def sort_axis(data):
|
||||
for axis_id in range(len(data[0])):
|
||||
axis_pos = []
|
||||
for i in range(len(data[0][axis_id])):
|
||||
axis_pos.append((data[0][axis_id][i], i))
|
||||
axis_pos.sort()
|
||||
data[0][axis_id] = map(lambda x: x[0], axis_pos)
|
||||
axis_pos2 = map(lambda x: x[1], axis_pos)
|
||||
cubes = [ data[1] ]
|
||||
for i in range(axis_id):
|
||||
cubes2 = []
|
||||
for cube in cubes:
|
||||
cubes2 += cube
|
||||
cubes = cubes2
|
||||
for cube in cubes:
|
||||
sort_apply(cube, axis_pos2)
|
||||
|
||||
def mdx_output(data):
|
||||
print 'DATA', data
|
||||
# decimal_to_float(data[1])
|
||||
# sort_axis(data)
|
||||
return data
|
||||
|
||||
if __name__=='__main__':
|
||||
print 'Testing Code'
|
||||
data = ([[(['user'], 'All user')], [(['measures', 'credit_limit'], 'credit_limit'), (['measures', 'count'], 'count')]], [[[66700.0], [22L]]])
|
||||
data = ([[([u'Products'], u'All Products'), ([u'Order Date'], u'All Order Date')]], [[False], [False]])
|
||||
data = ([[([u'Order Date'], u'All Order Date'), ([u'Order Date', 2007.0], 2007.0), ([u'Order Date', 2008.0], 2008.0), ([u'Order Date', 2007.0, 'Q1'], 'Q1'), ([u'Order Date', 2007.0, 'Q2'], 'Q2'), ([u'Order Date', 2007.0, 'Q3'], 'Q3'), ([u'Order Date', 2007.0, 'Q4'], 'Q4'), ([u'Users'], u'All Users'), ([u'Users', 'Administrator'], 'Administrator'), ([u'Users', 'Demo User'], 'Demo User'), ([u'Users', 'Root'], 'Root'), ([u'Partner Country'], u'All Partner Country'), ([u'Partner Country', 'Belgium'], 'Belgium'), ([u'Partner Country', 'China'], 'China'), ([u'Partner Country', 'France'], 'France'), ([u'Partner Country', 'Taiwan'], 'Taiwan')]], [[False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False]])
|
||||
data = ([[([u'Order Date'], u'All Order Date'), ([u'Order Date', 2007.0], 2007.0), ([u'Order Date', 2008.0], 2008.0), ([u'Order Date', 2007.0, 'Q1'], 'Q1'), ([u'Order Date', 2007.0, 'Q2'], 'Q2'), ([u'Order Date', 2007.0, 'Q3'], 'Q3'), ([u'Order Date', 2007.0, 'Q4'], 'Q4'), ([u'Users'], u'All Users'), ([u'Users', 'Administrator'], 'Administrator'), ([u'Users', 'Demo User'], 'Demo User'), ([u'Users', 'Root'], 'Root'), ([u'Partner Country'], u'All Partner Country'), ([u'Partner Country', 'Belgium'], 'Belgium'), ([u'Partner Country', 'China'], 'China'), ([u'Partner Country', 'France'], 'France'), ([u'Partner Country', 'Taiwan'], 'Taiwan')], [(['measures', u'Items Sold'], u'Items Sold')]], [[[Decimal("258.00")]], [[Decimal("34.00")]], [[Decimal("224.00")]], [[Decimal("12.00")]], [[Decimal("9.00")]], [[Decimal("6.00")]], [[Decimal("7.00")]], [[Decimal("258.00")]], [[Decimal("204.00")]], [[Decimal("16.00")]], [[Decimal("38.00")]], [[Decimal("258.00")]], [[Decimal("17.00")]], [[Decimal("78.00")]], [[Decimal("139.00")]], [[Decimal("2.00")]]])
|
||||
print 'Old', data
|
||||
sort_axis(data)
|
||||
print 'New', data
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,201 @@
|
|||
"""
|
||||
Tiny BI
|
||||
Copyright (C)2007 Fabien Pinckaers
|
||||
|
||||
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 version 2.
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
"""
|
||||
|
||||
from pyparsing import *
|
||||
|
||||
import cube, axis, measure, level, query, slicer, cross
|
||||
import mdx_operator
|
||||
|
||||
|
||||
#
|
||||
# Predicate: the construction of the object's query does not depend
|
||||
# on the schema architecture. I think we can go on for this, this will
|
||||
# simplify the extension/module architecture.
|
||||
#
|
||||
# Rethink about that in one month.
|
||||
#
|
||||
|
||||
class mdx_parser(object):
|
||||
def mdx_level(self):
|
||||
"""
|
||||
Return a parser that parse the level part of the MDX query and
|
||||
return a level object
|
||||
Examples:
|
||||
[prod].[all prod].children
|
||||
[prod].[all prod].join(...)
|
||||
"""
|
||||
leftSqBr = Literal("[").suppress()
|
||||
rightSqBr = Literal("]").suppress()
|
||||
dotToken = Literal(".").suppress()
|
||||
measuresToken = Literal("measures").suppress()
|
||||
scalar = Word(alphanums+alphas8bit.encode("utf-8") +"_"+" "+"-" )
|
||||
level_filter = leftSqBr + scalar + rightSqBr
|
||||
level_function = Keyword("children", caseless=True)
|
||||
level_filter.setParseAction(lambda s,a,toks: level.level_filter(toks[0]))
|
||||
level_function.setParseAction(lambda s,a,toks: level.level_function(toks[0]))
|
||||
level_item = level_filter | level_function
|
||||
level_parse = leftSqBr + scalar + rightSqBr + Optional(dotToken + delimitedList(level_item, ".", combine=False))
|
||||
level_parse.setParseAction(lambda s,a,toks: level.level(toks[0], toks[1:]))
|
||||
measure_parse = leftSqBr + measuresToken + rightSqBr + dotToken + leftSqBr + scalar + rightSqBr
|
||||
measure_parse.setParseAction(lambda s,a,toks: measure.measure(toks[0]))
|
||||
lev = measure_parse | level_parse
|
||||
return lev
|
||||
|
||||
|
||||
def mdx_axis(self):
|
||||
"""
|
||||
Return a parser that parse the axis part of the MDX query and
|
||||
return an axis object
|
||||
Examples:
|
||||
{[prod].[all prod].children, [a]}
|
||||
OR
|
||||
crossjoin({[Order Date].[all]},{[prod].[all prod].children, [a]})
|
||||
This is to be made recursive for the cross join
|
||||
crossjoin(crossjoin({[City].[all],[City].children},{[User].[all]}),{[User].[Administrator]})
|
||||
|
||||
"""
|
||||
leftCurlBr = Literal("{").suppress()
|
||||
rightCurlBr = Literal("}").suppress()
|
||||
comma = Literal(",").suppress()
|
||||
|
||||
level_parse = self.mdx_level()
|
||||
axis_parser = delimitedList(level_parse, ",", combine=False)
|
||||
axis_parser.setParseAction(lambda s,a,toks:axis.axis(mdx_operator.mdx_set(toks)))
|
||||
|
||||
mdx = leftCurlBr + axis_parser + rightCurlBr
|
||||
|
||||
return mdx
|
||||
|
||||
def cross_axis(self):
|
||||
leftCurlBr = Literal("{").suppress()
|
||||
rightCurlBr = Literal("}").suppress()
|
||||
cross_parser = self.mdx_level()
|
||||
cross_parser.setParseAction(lambda s,a,toks:cross.cross(toks))
|
||||
|
||||
cross_parse = leftCurlBr + cross_parser + rightCurlBr
|
||||
|
||||
return cross_parse
|
||||
|
||||
def mdx_cross_axis(self):
|
||||
leftRoundBr = Literal("(").suppress()
|
||||
rightRoundBr = Literal(")").suppress()
|
||||
comma = Literal(",").suppress()
|
||||
crossjoinToken = Keyword("crossjoin", caseless=True).suppress()
|
||||
|
||||
crossx = Forward()
|
||||
cross_mdx = crossx | self.mdx_axis()
|
||||
crossx << (crossjoinToken + leftRoundBr + cross_mdx + comma + self.cross_axis() + rightRoundBr)
|
||||
# crossx.setParseAction(lambda s,a,toks:axis.axis(toks)
|
||||
simple_mdx = self.mdx_axis()
|
||||
|
||||
mdx = simple_mdx | crossx
|
||||
return mdx
|
||||
|
||||
def mdx_axis_list(self):
|
||||
#
|
||||
# TODO: accept notation line AXIS(0) = rows, AXIS(1)=columns, ...
|
||||
#
|
||||
row_names = ["rows","columns","pages"]
|
||||
onToken = Keyword("on", caseless=True).suppress()
|
||||
page_name = oneOf(' '.join(row_names))
|
||||
axis_parser = self.mdx_cross_axis() + Optional(onToken + page_name)
|
||||
|
||||
def _assign_name(s,a,toks):
|
||||
if len(toks)>=3:
|
||||
toks[0].name_set(toks[-1])
|
||||
for x in range(1,len(toks)-1):
|
||||
toks[x].name_set('cross')
|
||||
elif len(toks)==2:
|
||||
toks[0].name_set(toks[1])
|
||||
elif len(toks)==1:
|
||||
toks[0].name_set(row_names.pop(0))
|
||||
else:
|
||||
raise 'invalid size'
|
||||
return toks[:-1]
|
||||
axis_parser.setParseAction(_assign_name)
|
||||
axis_lst = delimitedList(axis_parser, ",")
|
||||
axis_lst.setParseAction(lambda s,a,toks: [toks])
|
||||
return axis_lst
|
||||
|
||||
def mdx_slice(self):
|
||||
""" Return a MDX parser of the where clause of a MDX query """
|
||||
leftBr = Literal("(").suppress()
|
||||
rightBr = Literal(")").suppress()
|
||||
levels = delimitedList(self.mdx_level(), ',', combine=False)
|
||||
levels.setParseAction(lambda s,a,toks: toks)
|
||||
slicer_lst = delimitedList(leftBr + levels + rightBr, ",", combine=False)
|
||||
slicer_lst.setParseAction(lambda s,a,toks:slicer.slicer(list(toks)))
|
||||
return slicer_lst
|
||||
|
||||
def mdx_cube(self):
|
||||
""" Return a MDX parser of the from clause of a MDX query """
|
||||
mdx = Word(alphas+'_')
|
||||
mdx.setParseAction(lambda s,a,toks: cube.cube(toks[0]))
|
||||
return mdx
|
||||
|
||||
def mdx_query(self):
|
||||
""" Return a MDX parser of the from clause of a MDX query """
|
||||
selectToken = Keyword("select", caseless=True).suppress()
|
||||
fromToken = Keyword("from", caseless=True).suppress()
|
||||
whereToken = Keyword("where", caseless=True).suppress()
|
||||
semicolon = Literal(";").suppress()
|
||||
mdx = selectToken + self.mdx_axis_list() + fromToken + self.mdx_cube() + Optional(whereToken + self.mdx_slice()) + Optional(semicolon)
|
||||
mdx.setParseAction(lambda s,a,toks: query.query(*toks))
|
||||
return mdx
|
||||
|
||||
def parse(self, query):
|
||||
""" Parse a string and get a MDX object """
|
||||
return self.mdx_query().parseString(query)[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
mdx = mdx_parser()
|
||||
level_parse = mdx.mdx_level()
|
||||
for test in ['[sales].children','[prod].[all prod]']:
|
||||
print 'Testing level', test
|
||||
print level_parse.parseString(test)
|
||||
print
|
||||
axis_parser = mdx.mdx_axis()
|
||||
for test in ['{[a]}','{[prod].[all prod],[time].[Q3].[Sep]}']:
|
||||
print 'Testing axis', test
|
||||
print axis_parser.parseString(test)
|
||||
|
||||
axis_parser = mdx.mdx_axis_list()
|
||||
for test in ['{[a]} on rows, {[prod].[all prod],[time].[Q3].[Sep]} on columns',
|
||||
'{[region].[all region].children} on rows, {[prod].[all prod].children} on columns'
|
||||
]:
|
||||
print 'Testing axis', test
|
||||
print axis_parser.parseString(test)
|
||||
|
||||
cube_parser = mdx.mdx_cube()
|
||||
for test in ['sales']:
|
||||
print 'Testing axis', test
|
||||
print cube_parser.parseString(test)
|
||||
|
||||
for query_parser in [
|
||||
"Select {[region].[all region].children} on rows, {[product]} on columns from cubulus where ([time].[all time].[time_2005])",
|
||||
"Select {[region].[all region].children} on rows, {[prod].[all prod].children} on columns from cubulus where ([time].[all time].[time_2005])",
|
||||
#"Select {[time].[all time].children} on rows, crossjoin([region].[all region].children, [region].[all region].children) on columns from cubulus"
|
||||
]:
|
||||
print 'Testing ', query_parser
|
||||
print mdx.parse(query_parser)
|
||||
|
||||
print mdx.parse('''select
|
||||
{[date].[2007].[Q2].children} on rows,
|
||||
{[country_id].children,[country_id].[1].children} on columns
|
||||
from res_partner where ([measure].[credit_limit])''')
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,84 @@
|
|||
|
||||
import sqlalchemy
|
||||
import common
|
||||
import copy
|
||||
import pyparsing
|
||||
import operator
|
||||
from operator import add,sub
|
||||
from pyparsing import *
|
||||
|
||||
from agregator import agregator
|
||||
import axis_map
|
||||
|
||||
class measure(object):
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.object = False
|
||||
def validate(self, cube):
|
||||
for measure in cube.measure_ids:
|
||||
if measure.name==self.name:
|
||||
self.object = measure
|
||||
if not self.object:
|
||||
raise 'This measure does not exist !'
|
||||
return True
|
||||
|
||||
def run(self, metadata):
|
||||
table = common.table_get(metadata, self.object.cube_id.table_id)
|
||||
if self.object.measure_type == 'fact_column':
|
||||
col = common.col_get(sqlalchemy.Table(self.object.table_name,metadata), self.object.value_column)
|
||||
col_agregated = agregator[self.object.agregator](col)
|
||||
else:
|
||||
scalar = Word(alphanums+"_"+" "+".")
|
||||
sql_func = ["sum","max","min","count","avg"]
|
||||
arith_operator = ["-","*","/","+"]
|
||||
|
||||
sql_function = oneOf(' '.join(sql_func))
|
||||
leftRdBr = Literal("(").suppress()
|
||||
rightRdBr = Literal(")").suppress()
|
||||
operator_arith = oneOf(' '.join(arith_operator))
|
||||
sqlexpression = sql_function.setResultsName('sql_func') + leftRdBr + delimitedList(scalar,",",combine=False) + rightRdBr | sql_function + leftRdBr + scalar + ZeroOrMore(operator_arith.setResultsName('arithmetic') + scalar) + rightRdBr
|
||||
res = sqlexpression.parseString(self.object.value_sql)
|
||||
operators = []
|
||||
cols = []
|
||||
function = None
|
||||
for item in res:
|
||||
if str(item) == res.sql_func:
|
||||
function = str(item)
|
||||
elif str(item) == res.arithmetic or str(item) in ["+","-","/","*"]:
|
||||
operators.append(str(item))
|
||||
else:
|
||||
cols.append(common.measure_sql_exp_col(metadata,str(item)))
|
||||
operations = {
|
||||
'+':operator.add,
|
||||
'-':operator.sub,
|
||||
'/':operator.div,
|
||||
'%':operator.mod,
|
||||
'*':operator.mul,
|
||||
}
|
||||
operators = [operations[name] for name in operators]
|
||||
ops_cols = zip(operators, cols[1:])
|
||||
col = reduce(lambda expr, op_col: op_col[0](expr, op_col[1]), ops_cols,cols[0])
|
||||
|
||||
if function:
|
||||
col_agregated = agregator[function](col)
|
||||
else:
|
||||
col_agregated = col
|
||||
|
||||
return [ {
|
||||
'value': [(['measures',self.name], self.name, False)],
|
||||
'query': {
|
||||
'column': [col_agregated]
|
||||
},
|
||||
'axis_mapping': axis_map.column_fixed(0),
|
||||
'delta': 0,
|
||||
'format':self.object.formatstring
|
||||
} ]
|
||||
|
||||
def children(self, level, metadata):
|
||||
raise 'Not yet implemented !'
|
||||
|
||||
def __repr__(self):
|
||||
res= '\t\t<olap.measure %s>\n' % (self.name,)
|
||||
return res
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,236 @@
|
|||
import locale
|
||||
|
||||
|
||||
import mdx_input
|
||||
import sqlalchemy
|
||||
import common
|
||||
import slicer
|
||||
import datetime
|
||||
import pooler
|
||||
import copy
|
||||
|
||||
class mapper(object):
|
||||
def __init__(self, size):
|
||||
self.size = size
|
||||
|
||||
class query(object):
|
||||
def __init__(self, axis, cube, slicer_obj=None, *args):
|
||||
super(query, self).__init__()
|
||||
self.object = False
|
||||
self.cube = cube
|
||||
self.axis = axis
|
||||
if not slicer_obj:
|
||||
slicer_obj = slicer.slicer([])
|
||||
self.slicer = slicer_obj
|
||||
|
||||
#
|
||||
# Generate the cube with 'False' values
|
||||
# This function could be improved
|
||||
#
|
||||
def _cube_create(self, cube_size):
|
||||
cube_data = [False]
|
||||
while cube_size:
|
||||
newcube = []
|
||||
for i in range(cube_size.pop()):
|
||||
newcube.append(copy.deepcopy(cube_data))
|
||||
cube_data = newcube
|
||||
return cube_data
|
||||
|
||||
def run(self,currency):
|
||||
db = sqlalchemy.create_engine(self.object.schema_id.database_id.connection_url,encoding='utf-8')
|
||||
metadata = sqlalchemy.MetaData(db)
|
||||
print 'Connected to database...', self.object.schema_id.database_id.connection_url
|
||||
#
|
||||
# Compute axis
|
||||
#
|
||||
axis = []
|
||||
axis_result = []
|
||||
cube_size = []
|
||||
cross = False
|
||||
cross_all = []
|
||||
for ax in self.axis:
|
||||
if ax.name == 'cross':
|
||||
cross = True
|
||||
cross = ax.run(metadata)
|
||||
cube_size[-1] = cube_size[-1] * len(cross)
|
||||
temp = axis_result[0][:]
|
||||
cross_all.append(cross)
|
||||
final_axis = []
|
||||
for cr in cross:
|
||||
for el in axis_result[-1]:
|
||||
t = copy.deepcopy(el)
|
||||
t = list(t)
|
||||
t[0].append(cr['value'][0][0])
|
||||
t.append(cr['value'][0][1])
|
||||
final_axis.append(tuple(t))
|
||||
axis_result[-1]=final_axis[:]
|
||||
final_axis=[]
|
||||
len_axis = len(axis[-1])
|
||||
len_cross = len(cross)
|
||||
delta_count = 0
|
||||
d=0
|
||||
for data in common.xcombine(axis[-1],cross):
|
||||
flag = False
|
||||
make_where = []
|
||||
temp_where = []
|
||||
temp_column = []
|
||||
if 'whereclause' in data[0]['query'].keys():
|
||||
flag = True
|
||||
temp_where = data[0]['query']['whereclause'][0]
|
||||
data[0]['query']['whereclause']=str(data[0]['query']['whereclause'][0])
|
||||
|
||||
if isinstance(type(data[0]['query']['column'][0]),type(sqlalchemy.sql.expression._BindParamClause)):
|
||||
temp_column = data[0]['query']['column'][0]
|
||||
data[0]['query']['column'][0] = str(data[0]['query']['column'][0])
|
||||
data_temp = copy.deepcopy(data[0])
|
||||
if 'whereclause' in data[1]['query'].keys():
|
||||
if 'whereclause' in data_temp['query'].keys():
|
||||
make_where.append(data[1]['query']['whereclause'][0])
|
||||
else:
|
||||
make_where.append(data[1]['query']['whereclause'][0])
|
||||
delta_count = delta_count + 1
|
||||
if delta_count >= len_cross and len_cross!=1:
|
||||
delta_count = 0
|
||||
data_temp['delta'] = d
|
||||
d = d + 1
|
||||
else:
|
||||
data_temp['delta'] = d
|
||||
d = d + 1
|
||||
if flag:
|
||||
data[0]['query']['whereclause']=[temp_where]
|
||||
data_temp['query']['whereclause'] = [temp_where]
|
||||
if make_where:
|
||||
if 'whereclause' in data_temp['query'].keys():
|
||||
data_temp['query']['whereclause'].append(make_where[0])
|
||||
else:
|
||||
data_temp['query']['whereclause'] = make_where
|
||||
if temp_column:
|
||||
data[0]['query']['column'] = [temp_column]
|
||||
data_temp['query']['column'] = [temp_column]
|
||||
final_axis.append(data_temp)
|
||||
axis[-1] = []
|
||||
axis[-1] = final_axis
|
||||
else:
|
||||
cross = False
|
||||
result = ax.run(metadata)
|
||||
length = 0
|
||||
axis_result2 = []
|
||||
for r in result:
|
||||
length += len(r['value'])
|
||||
axis_result2 += map(lambda x: (map(lambda y: y or False,x[0]),x[1] or False), r['value'])
|
||||
axis_result.append(axis_result2)
|
||||
axis.append(result)
|
||||
cube_size.append(length)
|
||||
cube_data = self._cube_create(cube_size)
|
||||
cr = []
|
||||
slice = self.slicer.run(metadata)
|
||||
position = 0
|
||||
ax = []
|
||||
for subset in common.xcombine(*axis):
|
||||
select,table_fact = self.cube.run(metadata)
|
||||
for s in subset+slice:
|
||||
for key,val in s['query'].items():
|
||||
for v in val:
|
||||
if key=='column':
|
||||
v = v.label('p_%d' % (position,))
|
||||
position += 1
|
||||
select.append_column(v)
|
||||
elif key=='whereclause':
|
||||
select.append_whereclause(v)
|
||||
elif key=='group_by':
|
||||
select.append_group_by(v)
|
||||
else:
|
||||
raise 'Error, %s not implemented !'% (key,)
|
||||
# metadata.bind.echo = True
|
||||
query = select.execute()
|
||||
result = query.fetchall()
|
||||
for record in result:
|
||||
cube = cube_data
|
||||
r = list(record)
|
||||
value = False
|
||||
for s in subset:
|
||||
if s.has_key('format'):
|
||||
# To make use of the format string if specified for the measure
|
||||
# Its set to static for a testing
|
||||
if not currency:
|
||||
currency = "EUR"
|
||||
if isinstance(r[0],float) or isinstance(r[0],int) or isinstance(r[0],long):
|
||||
a = {'data':r[0]}
|
||||
r[0] = str(r[0])
|
||||
else:
|
||||
r[0] = '0.0'
|
||||
a = {'data':0.0}
|
||||
if s['format'] == 'cr_prefix':
|
||||
r[0] = currency + " " + "%.2f"%a['data']
|
||||
elif s['format'] == 'cr_postfix':
|
||||
r[0] = "%.2f"%a['data'] + " " + currency
|
||||
elif s['format'] == 'comma_sep':
|
||||
r[0] = locale.format("%(data).2f", a, 1)
|
||||
elif s['format'] == 'cr_prefix_comma':
|
||||
r[0] = locale.format("%(data).2f", a, 1)
|
||||
r[0] = currency + " " + str(r[0])
|
||||
elif s['format'] == 'cr_postfix_comma':
|
||||
a['currency'] = currency
|
||||
r[0] = locale.format("%(data).2f %(currency)s", a, 1)
|
||||
cube = s['axis_mapping'].cube_set(cube, r, s['delta'])
|
||||
value = s['axis_mapping'].value_set(r) or value
|
||||
for s in slice:
|
||||
value = s['axis_mapping'].value_set(r) or value
|
||||
if value:
|
||||
assert not cube[0], 'Already a value in cube, this is a bug !'
|
||||
cube[0] = value
|
||||
|
||||
i=0
|
||||
for a in cube_data:
|
||||
i=i+1;
|
||||
return (axis_result, cube_data)
|
||||
|
||||
def preprocess(self):
|
||||
wrapper = mdx_input.mdx_input()
|
||||
wrapper.parse(self)
|
||||
|
||||
def validate(self, schema):
|
||||
""" This function takes a query object and validate and assign
|
||||
fact data to it. Browse object from Tiny ERP"""
|
||||
cube = self.cube.validate(schema)
|
||||
self.object = cube
|
||||
if not self.object:
|
||||
raise "Cube '%s' not found in the schema '%s' !"%(cube.name, schema.name)
|
||||
self.slicer.validate(cube)
|
||||
|
||||
for axis in self.axis:
|
||||
axis.validate(cube)
|
||||
for dimension in cube.dimension_ids:
|
||||
pass
|
||||
return True,cube
|
||||
|
||||
def __repr__(self):
|
||||
res = '<olap.query ['+str(self.cube)+']\n'
|
||||
for l in self.axis:
|
||||
res+= '\tAxis: '+str(l)+'\n'
|
||||
res+= '\tSlicer:\n'+str(self.slicer)+'\n'
|
||||
res += '>'
|
||||
return res
|
||||
|
||||
def log(self,cr,uid,cube,query,context={}):
|
||||
if not context==False:
|
||||
log_ids = pooler.get_pool(cr.dbname).get('olap.query.logs').search( cr, uid, [('query','=', query), ('user_id','=', uid)])
|
||||
if log_ids:
|
||||
count = pooler.get_pool(cr.dbname).get('olap.query.logs').browse(cr, uid, log_ids, context)[0]
|
||||
pooler.get_pool(cr.dbname).get('olap.query.logs').write(cr, uid, log_ids, {'count':count.count+1})
|
||||
|
||||
else:
|
||||
logentry={}
|
||||
logentry['user_id']=uid
|
||||
logentry['cube_id']=cube.id
|
||||
logentry['query']=query
|
||||
logentry['time']= str(datetime.datetime.now())
|
||||
logentry['result_size']=0
|
||||
logentry['count']=1
|
||||
logentry['schema_id'] = cube.schema_id.id
|
||||
log_id = pooler.get_pool(cr.dbname).get('olap.query.logs').create(cr,uid,logentry)
|
||||
# count = pooler.get_pool(cr.dbname).get('olap.query.logs').browse(cr, uid, log_id, context)
|
||||
# pooler.get_pool(cr.dbname).get('olap.query.logs').write(cr, uid, log_id, {'count':count.count+1})
|
||||
return log_id
|
||||
return -1
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
import sqlalchemy
|
||||
import common
|
||||
|
||||
class slicer(object):
|
||||
def __init__(self, slicer):
|
||||
self.slicer = slicer
|
||||
|
||||
def validate(self, cube):
|
||||
self.object = cube
|
||||
for slicer in self.slicer:
|
||||
slicer.validate(cube)
|
||||
|
||||
def __repr__(self):
|
||||
res = '\t<olap.slicer\n'
|
||||
res += str(self.slicer)
|
||||
res += '\t>'
|
||||
return res
|
||||
|
||||
#
|
||||
# Output:
|
||||
# a list of grouped values that can be computed at once
|
||||
# a group is defined by elements having the same query
|
||||
#
|
||||
# [
|
||||
# {
|
||||
# 'level': ["Time","2008","Q1"],
|
||||
# 'value': '1er Trim 2008',
|
||||
# 'query': SQLAlchemy query object
|
||||
# }
|
||||
# ]
|
||||
#
|
||||
def run(self, metadata):
|
||||
print '*'*40
|
||||
print self.slicer
|
||||
result = []
|
||||
for slicer_line in self.slicer:
|
||||
res = slicer_line.run(metadata)
|
||||
result += slicer_line.run(metadata)
|
||||
return result
|
||||
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,270 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
import locale
|
||||
import mdx_input
|
||||
import sqlalchemy
|
||||
from sqlalchemy import *
|
||||
import common
|
||||
import slicer
|
||||
import datetime
|
||||
import pooler
|
||||
import copy
|
||||
import pyparsing
|
||||
from pyparsing import *
|
||||
|
||||
class warehouse(object):
|
||||
def create_table(self, connection, table_name, data):
|
||||
measures = data[0].keys()
|
||||
measures.pop(measures.index('name'))
|
||||
engine = create_engine(connection, echo=False)
|
||||
metadata = MetaData()
|
||||
tab = Table(str(table_name), metadata,
|
||||
Column('name', String(100)),
|
||||
Column('parent_id', String(100)),
|
||||
Column('id', String(100))
|
||||
)
|
||||
for msr in measures:
|
||||
colmn = Column(msr, String(100))
|
||||
tab.append_column(colmn)
|
||||
|
||||
metadata.create_all(engine)
|
||||
result = engine.execute(tab.insert(), data)
|
||||
return {}
|
||||
|
||||
def log(self,cr,uid,cube,query,data,connection,context={}):
|
||||
if not context==False:
|
||||
log_ids = pooler.get_pool(cr.dbname).get('olap.query.logs').search( cr, uid, [('query','=', query), ('user_id','=', uid)])
|
||||
if log_ids:
|
||||
count = pooler.get_pool(cr.dbname).get('olap.query.logs').browse(cr, uid, log_ids, context)[0]
|
||||
counter = count.count + 1
|
||||
table_name = ''
|
||||
if counter>=3:
|
||||
if len(data[0]) == 2:
|
||||
rows = data[0][0]
|
||||
columns = data[0][1]
|
||||
datas = data[1]
|
||||
result = []
|
||||
|
||||
parent_list = [ rw[0] for rw in rows]
|
||||
|
||||
for element in range(len(rows)):
|
||||
res = {}
|
||||
check_element = rows[element][0][:rows[element][0].index(rows[element][1])]
|
||||
if check_element:
|
||||
res['parent_id'] = str(parent_list.index(check_element))
|
||||
res['id'] = str(element)
|
||||
else:
|
||||
res['parent_id'] = str(None)
|
||||
res['id'] = str(element)
|
||||
res['name'] = str(rows[element][1])
|
||||
for col in range(len(columns)):
|
||||
col_elem = columns[col][0][:columns[col][0].index(columns[col][1])+1]
|
||||
c_element = '.'.join(map(lambda x: str(x), col_elem))
|
||||
res[c_element] = str(datas[element][col][0])
|
||||
result.append(res)
|
||||
table_name = cube.name+'_'+str(count.id)+'_'+str(counter)
|
||||
self.create_table(connection,table_name, result)
|
||||
elif len(data[0]) == 3:
|
||||
print "Its for Pages:>>>>>>>>>"
|
||||
pooler.get_pool(cr.dbname).get('olap.query.logs').write(cr, uid, log_ids, {'count':counter, 'table_name': table_name})
|
||||
return True
|
||||
else:
|
||||
logentry={}
|
||||
logentry['user_id']=uid
|
||||
logentry['cube_id']=cube.id
|
||||
logentry['query']=query
|
||||
logentry['time']= str(datetime.datetime.now())
|
||||
logentry['result_size']=0
|
||||
logentry['count']=1
|
||||
logentry['schema_id'] = cube.schema_id.id
|
||||
log_id = pooler.get_pool(cr.dbname).get('olap.query.logs').create(cr,uid,logentry)
|
||||
return log_id
|
||||
return -1
|
||||
|
||||
def run(self, currency, qry_obj):
|
||||
schema = qry_obj.schema_id
|
||||
table_name = str(qry_obj.table_name)
|
||||
connection = schema.database_id.connection_url
|
||||
engine = create_engine(connection, echo=False)
|
||||
metadata = MetaData(engine)
|
||||
metadata.create_all(engine)
|
||||
tab = Table(table_name, metadata, autoload=True, autoload_with=engine)
|
||||
total_columns = [c.name for c in tab.columns]
|
||||
columns = []
|
||||
cols = []
|
||||
for c in tab.columns:
|
||||
if not c.name.__contains__('name') and not c.name.__contains__('id') and not c.name.__contains__('parent_id'):
|
||||
columns.append(c.name)
|
||||
cols.append((c.name.split('.'), str(c.name.split('.')[1])))
|
||||
result = tab.select().execute()
|
||||
res = result.fetchall()
|
||||
rows = []
|
||||
# dt = [[[]] * len(columns)] * len(res)
|
||||
for r in range(len(res)):
|
||||
if res[r][1] == str(None):
|
||||
rows.append(([str(res[r][0])], str(res[r][0])))
|
||||
else:
|
||||
rows.append(([str(res[int(res[r][1])][0]),str(res[r][0])], str(res[r][0])))
|
||||
|
||||
data = []
|
||||
for r in range(len(res)):
|
||||
data.append(res[r][3:])
|
||||
|
||||
datas = []
|
||||
for dd in range(len(data)):
|
||||
datas.append([])
|
||||
for d in range(len(data[dd])):
|
||||
datas[dd].append([str(data[dd][d])])
|
||||
|
||||
final_result = ([rows, cols], datas)
|
||||
return final_result
|
||||
|
||||
def match_table(self, cr, uid,request, context):
|
||||
qry_obj = pooler.get_pool(cr.dbname).get('olap.query.logs')
|
||||
result = self.parse_query(request)
|
||||
qry = result[1][0]
|
||||
qry_axis = result[0]
|
||||
qry_id = qry_obj.search(cr, uid, [('query','=',str(qry))])
|
||||
result = ()
|
||||
if qry_id:
|
||||
qry = qry_obj.browse(cr, uid, qry_id)[0]
|
||||
schema = qry.schema_id
|
||||
if qry.table_name !='':
|
||||
total_rows = []
|
||||
total_cols = []
|
||||
data = []
|
||||
table_name = str(qry.table_name)
|
||||
connection = schema.database_id.connection_url
|
||||
engine = create_engine(connection, echo=False)
|
||||
metadata = MetaData(engine)
|
||||
metadata.create_all(engine)
|
||||
tab = Table(table_name, metadata, autoload=True, autoload_with=engine)
|
||||
total_columns = [c.name for c in tab.columns]
|
||||
res = tab.select().execute().fetchall()
|
||||
for val in range(len(res)):
|
||||
for row in range(len(res[val])):
|
||||
if total_columns[row]!='parent_id' and total_columns[row]!='id':
|
||||
if total_columns[row] == 'name':
|
||||
total_rows.append((str(res[val][row]).split("."), str(res[val][row]).split(".")[-1]))
|
||||
else:
|
||||
total_cols.append((str(total_columns[row]).split("."), str(total_columns[row]).split(".")[-1]))
|
||||
data.append([[str(res[val][row])]])
|
||||
res_1 = []
|
||||
res_1.append(total_rows)
|
||||
res_1.append(total_cols)
|
||||
result = (res_1, data)
|
||||
return result
|
||||
|
||||
def parse_query(self, query):
|
||||
result = []
|
||||
lrbrack, rrbrack = map( Suppress, "()" )
|
||||
comma = Suppress( "," )
|
||||
leftCurlBr, rightCurlBr = map( Suppress, "{}" )
|
||||
dot = Suppress( "." )
|
||||
crossToken = Literal( "crossjoin" ).suppress()
|
||||
selectToken = Keyword( "select", caseless = True ).suppress()
|
||||
fromToken = Keyword( "from", caseless = True ).suppress()
|
||||
whereToken = Keyword( "where", caseless = True ).suppress()
|
||||
|
||||
scalar = Word( alphanums + "_" + " " + "-" + "+")
|
||||
cube = Word( alphas + '_' )
|
||||
level_scalar = Word( alphanums + "_" + " " )
|
||||
level_filter = Suppress( "[" ) + level_scalar + Suppress( "]" )
|
||||
level_function = Keyword( "children", caseless = True )
|
||||
level_item = level_filter | level_function
|
||||
levels = Group( level_item + Optional( dot + delimitedList( level_item, ".", combine = False ) ) )
|
||||
axis_parser = delimitedList( levels, ",", combine = False )
|
||||
where_parse = lrbrack + Group( delimitedList( levels , ",", combine = False ) ) + rrbrack
|
||||
|
||||
cross_parser = leftCurlBr + levels + rightCurlBr
|
||||
crossx = Forward()
|
||||
cross_mdx = crossx | leftCurlBr + axis_parser + rightCurlBr
|
||||
crossx << ( crossToken + lrbrack + cross_mdx + comma + Group( cross_parser.setResultsName( "cross" ) ) + rrbrack )
|
||||
|
||||
rowsmdx = leftCurlBr + axis_parser + rightCurlBr
|
||||
colsmdx = leftCurlBr + axis_parser + rightCurlBr
|
||||
pagemdx = leftCurlBr + axis_parser + rightCurlBr
|
||||
row_mdx_axis = rowsmdx | crossx
|
||||
col_mdx_axis = colsmdx | crossx
|
||||
row_names = ["rows", "columns", "pages"]
|
||||
onToken = Keyword( "on", caseless = True ).suppress()
|
||||
page_name = oneOf( ' '.join( row_names ) ).suppress()
|
||||
|
||||
query_parser = selectToken + Group( row_mdx_axis ) + onToken + page_name + Optional( comma + Group( col_mdx_axis ) + onToken + page_name ) \
|
||||
+ Optional( comma + Group( pagemdx ) + onToken + page_name )\
|
||||
+ fromToken + cube.suppress() + Optional( whereToken + Group(where_parse ))
|
||||
qr = query_parser.parseString(query)
|
||||
axes = [[],[], []]
|
||||
crossjoins=[[],[],[]]
|
||||
ax = 0
|
||||
for items in qr:
|
||||
for i in items:
|
||||
# if ax == 2:
|
||||
# if len( items ) > 1:
|
||||
# for t in i:
|
||||
# conditions.append( list(t) )
|
||||
# else:
|
||||
# conditions.append( list(i))
|
||||
if i.cross:
|
||||
if i[0][-1] == 'children':
|
||||
crossjoins[ax].append( '.'.join(map(lambda x: "[" + x +"]",i[0][:-1]))+".children")
|
||||
else:
|
||||
crossjoins[ax].append( '.'.join(map(lambda x: "[" + x +"]",i[0])))
|
||||
else:
|
||||
if i[-1] == 'children':
|
||||
axes[ax].append( '.'.join(map(lambda x: "[" + x +"]",i[:-1]))+".children")
|
||||
else:
|
||||
axes[ax].append( '.'.join(map(lambda x: "[" + x +"]",i)))
|
||||
ax = ax + 1
|
||||
|
||||
result.append(axes)
|
||||
result.append(crossjoins)
|
||||
qry_list = [[], []]
|
||||
t_qry = []
|
||||
new_query = ''
|
||||
|
||||
for x in range(len(axes)):
|
||||
qry_select = 'select {'
|
||||
if x == 0:
|
||||
rs = axes[x][:-1]
|
||||
if rs:
|
||||
t_qry.append(rs)
|
||||
rs_axis = ','.join(rs)
|
||||
new_query = qry_select + rs_axis + '} on rows,'
|
||||
elif x == 1:
|
||||
cs_axis = ','.join(axes[x])
|
||||
if cs_axis:
|
||||
t_qry.append(cs_axis)
|
||||
new_query = new_query + ' {' + cs_axis + '} on columns from Sales'
|
||||
|
||||
qry_list[0].append(t_qry)
|
||||
qry_list[1].append(new_query)
|
||||
|
||||
# else:
|
||||
# print "pages"
|
||||
return qry_list
|
||||
|
|
@ -0,0 +1,701 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--
|
||||
|
||||
Wizard view for the load data
|
||||
|
||||
-->
|
||||
<record id="bi_load_db_form" model="ir.ui.view">
|
||||
<field name="name">bi.load.db.form</field>
|
||||
<field name="model">bi.load.db.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Load Database Tables">
|
||||
<label align="0.0" string="We will load the complete structure of the database by introspection, so that you will be able to work on it, and specify a better structure according to your reporting needs." colspan="4" />
|
||||
<newline/>
|
||||
<label align="0.0" string="After having loaded the structure, you will be able to hide/show or rename tables and columns to simplify end-users interface. The following database will be loaded:" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="fact_table" />
|
||||
<field name="db_name" />
|
||||
<newline/>
|
||||
<button name="action_cancel" string="Cancel" type="object" colspan="2"/>
|
||||
<button name="action_load" string="Load Data Structure" type="object" colspan="2"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="act_bi_load_db_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Load database Structure</field>
|
||||
<field name="res_model">bi.load.db.wizard</field>
|
||||
<field name="src_model">olap.schema</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="auto_refresh" eval="1"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!--
|
||||
Wizard For Olap Warehouse
|
||||
-->
|
||||
<record id="view_warehouse_bi" model="ir.ui.view">
|
||||
<field name="name">Olap Warehouse</field>
|
||||
<field name="model">olap.warehouse.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Warehouse">
|
||||
<group colspan="16">
|
||||
<separator string="Query" colspan="16"/>
|
||||
<field name="query" nolabel="1" colspan="16"/>
|
||||
<button string="Ok" name="action_ok" colspan="16" type="object" icon='gtk-ok'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_olap_warehouse" model="ir.actions.act_window">
|
||||
<field name="name">Olap Warehouse</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">olap.warehouse.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Warehouse"
|
||||
action="action_olap_warehouse"
|
||||
id="menu_bi_warehouse"
|
||||
sequence="51"
|
||||
parent="base.next_id_50"
|
||||
/>
|
||||
<!--
|
||||
|
||||
Wizard View for the parameters wizard
|
||||
-->
|
||||
|
||||
<record id="view_config_bi" model="ir.ui.view">
|
||||
<field name="name">Parameters Configuration</field>
|
||||
<field name="model">olap.parameters.config.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Parameters Configure">
|
||||
<separator string="BI Web Client." colspan="4"/>
|
||||
<label string="This wizard will automatically configure the web client for BI." align="0.0" colspan="4"/>
|
||||
<field name="host_name" colspan="4"/>
|
||||
<field name="host_port" colspan="4"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<label string="" colspan="2"/>
|
||||
<group col="4" colspan="2">
|
||||
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
|
||||
<button name="action_config" string="Configure" icon='gtk-ok' type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_config_bi_parameters" model="ir.actions.act_window">
|
||||
<field name="name">Parameters Configuration</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">olap.parameters.config.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Server Parameters"
|
||||
action="action_config_bi_parameters"
|
||||
id="menu_bi_server_parameters"
|
||||
sequence="50"
|
||||
parent="base.next_id_50"
|
||||
/>
|
||||
<record model="ir.actions.todo" id="config_auto_directory">
|
||||
<field name="name">Server Parameters Configuration</field>
|
||||
<field name="note">This wizard will configure the URL of the web client</field>
|
||||
<field name="action_id" ref="action_config_bi_parameters"/>
|
||||
</record>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
Wizard view for the Auto Configuring the data
|
||||
|
||||
-->
|
||||
|
||||
<record id="bi_auto_configure_form" model="ir.ui.view">
|
||||
<field name="name">bi.auto.configure.form</field>
|
||||
<field name="model">bi.auto.configure.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Auto Congifuring Tables">
|
||||
<label align="0.0" string="This will Auto Configure Application. This will help to increase the readability of the tables and columns by giving it meaningful and easy to comprehend name. You can hides particular data and columns by reconfiguring the structure option." colspan="4" />
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<newline/>
|
||||
<button name="action_cancel" string="Cancel" type="object" colspan="2"/>
|
||||
<button name="action_load" string="Auto Configure Structure" type="object" colspan="2"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="act_bi_auto_configure" model="ir.actions.act_window">
|
||||
<field name="name">Auto Configuration</field>
|
||||
<field name="res_model">bi.auto.configure.wizard</field>
|
||||
<field name="src_model">olap.schema</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="auto_refresh" eval="1"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Schema
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_schema_tree">
|
||||
<field name="name">olap.schema.tree</field>
|
||||
<field name="model">olap.schema</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap Schema">
|
||||
<field name="name"/>
|
||||
<field name="database_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_schema_form">
|
||||
<field name="name">olap.schema.form</field>
|
||||
<field name="model">olap.schema</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap Schema">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="database_id" select="2" colspan="4"/>
|
||||
<field name="loaded" colspan="3"/>
|
||||
<button name="%(act_bi_load_db_wizard)d" string="Reload Structure" type="action" states="done"/>
|
||||
<field name="configure" colspan="3"/>
|
||||
<button name="%(bi_load_configuration_table)d" string="ReConfigure Structure" type="action" states="done"/>
|
||||
<!-- <button string="Configure Manually" name="dbconfigure" states="dbload" target="new"/>-->
|
||||
<field name="ready" select="2" colspan="3"/>
|
||||
<field name="note" colspan="4"/>
|
||||
<field name="state" select="2" colspan="2" />
|
||||
<group colspan="2">
|
||||
<button string="Connect to Database" name="dbconnect" states="none"/>
|
||||
<button string="Load Database Structure" name="%(act_bi_load_db_wizard)d" type="action" states="dbconnect" target="new" />
|
||||
<button string="Configure Manually" name="dbconfigure" states="dbload"/>
|
||||
<button string="Mark as Configured" name="dbready" states="dbconfigure"/>
|
||||
</group>
|
||||
<separator string="Auto Application Configuration" colspan="4"/>
|
||||
<field name="app_detect" nolabel="1" colspan="3"/>
|
||||
<button string="Configure Automatically " name="%(act_bi_auto_configure)d" type="action" states="dbload" target="new"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_schema_form">
|
||||
<field name="name">Olap Schemas</field>
|
||||
<field name="res_model">olap.schema</field>
|
||||
<field name="view_type">form</field>
|
||||
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Schema"
|
||||
action="action_olap_schema_form"
|
||||
id="menu_action_olap_schema_form"
|
||||
parent="menu_bi_conf_cubes"/>
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Cubes Table
|
||||
# ------------------------------------------------------------------
|
||||
<record model="ir.ui.view" id="view_olap_cube_table_form">
|
||||
<field name="name">olap.cube.table.form</field>
|
||||
<field name="model">olap.cube.table</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap cube_table" >
|
||||
<field name="name" select="2"/>
|
||||
<field name="column_link_id" context="{'fk':True,'dim_x':context.get('d_id',False)}"/>
|
||||
<newline/>
|
||||
<separator colspan="2" string="Joined Tables"/>
|
||||
<field invisible="True" name="line_ids" nolabel="1">
|
||||
<form string="Database Tables">
|
||||
<field name="table_id"/>
|
||||
<field name="field_id"/>
|
||||
</form>
|
||||
<tree string="Database Tables">
|
||||
<field name="table_id"/>
|
||||
<field name="field_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="available_table_ids" colspan="4" nolabel="1" readonly="0" domain="[('available_table_ids','in',available_table_ids)]" context="{'flag':True,'master_dim':context.get('d_id',False),'master_schema':context.get('parent_schema_id',False),'link_col':column_link_id}">
|
||||
<tree string="Database Tables">
|
||||
<field name="related_to" string="Joined Table"/>
|
||||
<field name="name"/>
|
||||
<field name="table_id" />
|
||||
<field name="primary_key" />
|
||||
</tree>
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_olap_cube_table_form">
|
||||
<field name="name">Olap Cube Tables</field>
|
||||
<field name="res_model">olap.cube.table</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Cubes Table"
|
||||
parent = "menu_bi_conf_cubes"
|
||||
action="action_olap_cube_table_form"
|
||||
id="menu_action_olap_cube_table_form"/>
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Cubes
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_cube_tree">
|
||||
<field name="name">olap.cube.tree</field>
|
||||
<field name="model">olap.cube</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap cube">
|
||||
<field name="name"/>
|
||||
<field name="table_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_cube_form">
|
||||
<field name="name">olap.cube.form</field>
|
||||
<field name="model">olap.cube</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap cube">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="schema_id" select="1" attrs="{'readonly':[('schema_id','!=','')]}"/>
|
||||
<field name="query_log" select="2"/>
|
||||
<field name="table_id" colspan="4" context="{'parent_schema_id':schema_id}"/>
|
||||
|
||||
<!--<separator colspan="4" string="Dimensions"/>
|
||||
<field name="dimension_ids" colspan="4" nolabel="1"/>
|
||||
<separator colspan="4" string="Measures"/>
|
||||
<field name="measure_ids" colspan="4" nolabel="1"/>-->
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_cube_form">
|
||||
<field name="name">Olap Cubes</field>
|
||||
<field name="res_model">olap.cube</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Cubes"
|
||||
parent ="menu_bi_conf_cubes"
|
||||
action="action_olap_cube_form"
|
||||
id="menu_action_olap_cube_form"/>
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Dimensions
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_dimension_tree">
|
||||
<field name="name">olap.dimension.tree</field>
|
||||
<field name="model">olap.dimension</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap dimension">
|
||||
<field name="name"/>
|
||||
<field name="cube_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_dimension_form">
|
||||
<field name="name">olap.dimension.form</field>
|
||||
<field name="model">olap.dimension</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap dimension">
|
||||
<field name="name" select="1"/>
|
||||
<field name="cube_id" select="1" attrs="{'readonly':[('cube_id','!=','')]}"/>
|
||||
<!-- <field name="cube_id" on_change="onchange_cube_id(cube_id)" select="1" attrs="{'readonly':[('cube_id','!=','')]}"/>
|
||||
<field name="foreign_key_table" select="2"/>
|
||||
<field name="foreign_key" select="2"/>
|
||||
<separator colspan="4" string="Select In These Tables For Foreign Keys"/>
|
||||
<field name="available_foreign_table_ids" nolabel="1" colspan="4" readonly="0">
|
||||
<tree string="Database Tables">
|
||||
<button string="Mark as Foreign Table" name="mark_foreign" context="{'parent_id':parent.id,'parent_name':parent.name,'parent_cube':parent.cube_id,'reload':1}" type="object"/>
|
||||
<field name="table_id" />
|
||||
<field name="name" string="Link Column"/>
|
||||
</tree>
|
||||
</field>
|
||||
<separator colspan="4" string="Hierarchies"/>
|
||||
<field name="hierarchy_ids" colspan="4" nolabel="1"/>-->
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_dimension_form">
|
||||
<field name="name">Olap Dimensions</field>
|
||||
<field name="res_model">olap.dimension</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Dimension"
|
||||
parent = "menu_bi_conf_cubes"
|
||||
action="action_olap_dimension_form"
|
||||
id="menu_action_olap_dimension_form"/>
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Hierarchies
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_hierarchy_tree">
|
||||
<field name="name">olap.hierarchy.tree</field>
|
||||
<field name="model">olap.hierarchy</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap hierarchy">
|
||||
<field name="name"/>
|
||||
<field name="dimension_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_hierarchy_form">
|
||||
<field name="name">olap.hierarchy.form</field>
|
||||
<field name="model">olap.hierarchy</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap hierarchy">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="dimension_id" select="1" attrs="{'readonly':[('dimension_id','!=','')]}"/>
|
||||
<!-- <field name="field_name" select="2"/>-->
|
||||
<field name="sequence"/>
|
||||
<field name="table_id" select="2" colspan="4" context="{'d_id':dimension_id}"/>
|
||||
<!-- <separator string="Levels" colspan="4"/>
|
||||
<field name="level_ids" colspan="4" nolabel="1"/>-->
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_hierarchy_form">
|
||||
<field name="name">Olap Hierarchies</field>
|
||||
<field name="res_model">olap.hierarchy</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Hierarchy"
|
||||
parent = "menu_bi_conf_cubes"
|
||||
action="action_olap_hierarchy_form"
|
||||
id="menu_action_olap_hierarchy_form"/>
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Levels
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_level_tree">
|
||||
<field name="name">olap.level.tree</field>
|
||||
<field name="model">olap.level</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap Level">
|
||||
<field name="name"/>
|
||||
<field name="column_name"/>
|
||||
<field name="column_id_name" invisible="True"/>
|
||||
<field name="type"/>
|
||||
<field name="table_name" invisible="True"/>
|
||||
<field name="sequence"/>
|
||||
<field name="hierarchy_id"/>
|
||||
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_level_form">
|
||||
<field name="name">olap.level.form</field>
|
||||
<field name="model">olap.level</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap level">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="column_name" select="1" on_change="onchange_column_name(column_name)" context="{'filter_cols_hier':hierarchy_id}"/>
|
||||
<field name="column_id_name" select="1"/>
|
||||
<field name="type" select="1"/>
|
||||
<field name="table_name" select="1"/>
|
||||
<field name="sequence"/>
|
||||
<!-- <field name="hierarchy_id" select="1"/>-->
|
||||
<field name="hierarchy_id" select="1" attrs="{'readonly':[('hierarchy_id','!=','')]}"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_level_form">
|
||||
<field name="name">Olap Level</field>
|
||||
<field name="res_model">olap.level</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Level"
|
||||
parent = "menu_bi_conf_cubes"
|
||||
action="action_olap_level_form"
|
||||
id="menu_action_olap_level_form"/>
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Measure
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_measure_tree">
|
||||
<field name="name">olap.measure.tree</field>
|
||||
<field name="model">olap.measure</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap measure">
|
||||
<field name="name"/>
|
||||
<field name="cube_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_measure_form">
|
||||
<field name="name">olap.measure.form</field>
|
||||
<field name="model">olap.measure</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap measure">
|
||||
<field name="name" select="1"/>
|
||||
<field name="cube_id" select="1" attrs="{'readonly':[('cube_id','!=','')]}"/>
|
||||
<field name="value_column_id_name" invisible="True"/>
|
||||
<field name="table_name" invisible="True"/>
|
||||
<field name="measure_type"/>
|
||||
|
||||
<!-- <notebook colspan="4">
|
||||
<page string="Fact Table Column" >
|
||||
<newline/>
|
||||
<field name="value_column" select="1" on_change="onchange_measure_name(value_column)" context="{'filter_cols_cube':cube_id}"/>
|
||||
<field name="agregator" select="2"/>
|
||||
<field name="formatstring" select="2"/>
|
||||
</page>
|
||||
<page string="SQL Expression" attrs="{'invisible':[('measure_type','!=','sql_expr')]}">
|
||||
<field name="value_sql" colspan="4" select="2"/>
|
||||
<field name="datatype" select="2"/>
|
||||
</page>
|
||||
</notebook>
|
||||
-->
|
||||
|
||||
<group colspan="4" attrs="{'invisible':[('measure_type','!=','fact_column')]}">
|
||||
<newline/>
|
||||
<field name="value_column" select="1" attrs="{'required':[('measure_type','=','fact_column')]}" on_change="onchange_measure_name(value_column)" context="{'filter_cols_cube':cube_id}"/>
|
||||
<field name="agregator" select="2"/>
|
||||
<field name="formatstring" select="2"/>
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible':[('measure_type','!=','sql_expr')]}">
|
||||
<newline/>
|
||||
<field name="value_sql" colspan="4" select="2" attrs="{'required':[('measure_type','=','sql_expr')]}"/>
|
||||
<field name="datatype" select="2"/>
|
||||
</group>
|
||||
</form>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_measure_form">
|
||||
<field name="name">Olap Measures</field>
|
||||
<field name="res_model">olap.measure</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Measures"
|
||||
parent = "menu_bi_conf_cubes"
|
||||
action="action_olap_measure_form"
|
||||
id="menu_action_olap_measure_form"/>
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Olap Saved Query
|
||||
# ------------------------------------------------------------------
|
||||
<record model="ir.ui.view" id="view_olap_saved_query_form_tree">
|
||||
<field name="name">olap.saved.query.tree</field>
|
||||
<field name="model">olap.saved.query</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap Saved Query">
|
||||
<field name="name"/>
|
||||
<field name="cube_id"/>
|
||||
<field name="mdx_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="query"/>
|
||||
<field name="time"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_saved_query_form_mdx">
|
||||
<field name="name">olap.saved.query.mdx</field>
|
||||
<field name="model">olap.saved.query</field>
|
||||
<field name="type">mdx</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap Saved Query">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="query"/>
|
||||
<field name="cube_id"/>
|
||||
<field name="mdx_id"/>
|
||||
<field name="axis_keys" readonly="True"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_saved_query_form">
|
||||
<field name="name">olap.saved.query.form</field>
|
||||
<field name="model">olap.saved.query</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap Saved Query">
|
||||
<field name="name" select="1" readonly="True"/>
|
||||
<field name="query" select="1" colspan="4" readonly="True"/>
|
||||
<field name="user_id" readonly="True"/>
|
||||
<field name="cube_id" select="2" readonly="True"/>
|
||||
<field name="mdx_id" select="2" readonly="True"/>
|
||||
<field name="schema_id" select="2" readonly="True"/>
|
||||
<field name="axis_keys" readonly="True"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_saved_query_form">
|
||||
<field name="name">Olap Saved Query</field>
|
||||
<field name="res_model">olap.saved.query</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,mdx</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Olap Saved Query"
|
||||
parent = "menu_bi_conf_tools"
|
||||
action="action_olap_saved_query_form"
|
||||
id="menu_action_olap_saved_query_form"/>
|
||||
|
||||
<!--
|
||||
|
||||
All Logs
|
||||
|
||||
-->
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_query_logs_tree">
|
||||
<field name="name">olap.query.logs</field>
|
||||
<field name="model">olap.query.logs</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="All Logs">
|
||||
<field name="user_id"/>
|
||||
<field name="query"/>
|
||||
<field name="cube_id"/>
|
||||
<field name="schema_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_query_logs_form">
|
||||
<field name="name">olap.query.logs.form</field>
|
||||
<field name="model">olap.query.logs</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="All Logs">
|
||||
<field name="query" colspan="4" select="1" readonly="True"/>
|
||||
<field name="time" select="2" readonly="True"/>
|
||||
<field name="result_size" select="2" readonly="True"/>
|
||||
<field name="cube_id" select="2" readonly="True"/>
|
||||
<field name="count" readonly="True"/>
|
||||
<field name="schema_id" readonly="True"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_query_logs_form">
|
||||
<field name="name">All Logs</field>
|
||||
<field name="res_model">olap.query.logs</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="All Logs"
|
||||
action="action_olap_query_logs_form"
|
||||
id="menu_action_olap_query_logs_form"
|
||||
parent="menu_bi_conf_tools"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
All Logs / My logs
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_query_logs_my_tree">
|
||||
<field name="name">olap.query.logs</field>
|
||||
<field name="model">olap.query.logs</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="My Logs">
|
||||
<field name="user_id"/>
|
||||
<field name="query"/>
|
||||
<field name="cube_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_query_logs_my_tree">
|
||||
<field name="name">olap.query.logs</field>
|
||||
<field name="model">olap.query.logs</field>
|
||||
<field name="type">mdx</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="My Logs">
|
||||
<field name="user_id"/>
|
||||
<field name="query"/>
|
||||
<field name="cube_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_query_logs_my_form">
|
||||
<field name="name">olap.query.logs.form</field>
|
||||
<field name="model">olap.query.logs</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="My Logs">
|
||||
<field name="user_id" select="1" readonly="True"/>
|
||||
<!-- domain="[('uid','=',uid)]"
|
||||
/> -->
|
||||
<field name="query" select="1" readonly="True"/>
|
||||
<field name="time" select="2" readonly="True"/>
|
||||
<field name="result_size" select="2" readonly="True"/>
|
||||
<field name="cube_id" select="2" readonly="True"/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_olap_query_logs_my_form">
|
||||
<field name="name">My Logs</field>
|
||||
<field name="res_model">olap.query.logs</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,mdx</field>
|
||||
<field name="domain">[('user_id','=',uid)]</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="My Logs"
|
||||
action="action_olap_query_logs_my_form"
|
||||
id="menu_action_olap_query_logs_my_form"
|
||||
parent="menu_action_olap_query_logs_form"/>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
Clear All Logs
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
Clear My logs
|
||||
|
||||
-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="workflow" id="wkf_schema">
|
||||
<field name="name">olap.schema</field>
|
||||
<field name="osv">olap.schema</field>
|
||||
<field name="on_create">True</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.activity" id="act_none">
|
||||
<field name="wkf_id" ref="wkf_schema"/>
|
||||
<field name="flow_start">True</field>
|
||||
<field name="name">none</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.activity" id="act_dbconnect">
|
||||
<field name="wkf_id" ref="wkf_schema"/>
|
||||
<field name="name">dbconnect</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_dbconnect()</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.activity" id="act_dbload">
|
||||
<field name="wkf_id" ref="wkf_schema"/>
|
||||
<field name="name">dbload</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_dbload()</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.activity" id="act_dbconfigure">
|
||||
<field name="wkf_id" ref="wkf_schema"/>
|
||||
<field name="name">dbconfigure</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_dbconfigure()</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.activity" id="act_dbready">
|
||||
<field name="wkf_id" ref="wkf_schema"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="name">dbready</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_dbready()</field>
|
||||
</record>
|
||||
<!--
|
||||
<record model="workflow.activity" id="act_dbdone">
|
||||
<field name="wkf_id" ref="wkf_schema"/>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="name">db_done</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_done()</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
|
||||
<record model="workflow.transition" id="trans_none_dbconnect">
|
||||
<field name="act_from" ref="act_none"/>
|
||||
<field name="act_to" ref="act_dbconnect"/>
|
||||
<field name="signal">dbconnect</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.transition" id="trans_dbconnect_dbload">
|
||||
<field name="act_from" ref="act_dbconnect"/>
|
||||
<field name="act_to" ref="act_dbload"/>
|
||||
<field name="signal">dbload</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.transition" id="trans_dbload_dbconfigure">
|
||||
<field name="act_from" ref="act_dbload"/>
|
||||
<field name="act_to" ref="act_dbconfigure"/>
|
||||
<field name="signal">dbconfigure</field>
|
||||
</record>
|
||||
|
||||
<record model="workflow.transition" id="trans_dbconfigure_dbready">
|
||||
<field name="act_from" ref="act_dbconfigure"/>
|
||||
<field name="act_to" ref="act_dbready"/>
|
||||
<field name="signal">dbready</field>
|
||||
</record>
|
||||
<!--
|
||||
<record model="workflow.transition" id="trans_dbready_done">
|
||||
<field name="act_from" ref="act_dbready"/>
|
||||
<field name="act_to" ref="act_dbdone"/>
|
||||
<field name="signal">dbdone</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="True">
|
||||
|
||||
<record model="olap.fact.database" id="fact_database_terp">
|
||||
<field name="name">Tiny ERP database</field>
|
||||
<field name="db_name">terp</field>
|
||||
<field name="db_login">postgres</field>
|
||||
<field name="db_password">postgres</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.tables" id="database_table_res_partner">
|
||||
<field name="name">res_partner</field>
|
||||
<field name="table_db_name">res_partner</field>
|
||||
<field name="fact_database_id" ref="fact_database_terp"/>
|
||||
<field name="active">True</field>
|
||||
|
||||
</record>
|
||||
|
||||
<record model="olap.database.tables" id="database_table_res_user">
|
||||
<field name="name">res_users</field>
|
||||
<field name="table_db_name">res_users</field>
|
||||
<field name="fact_database_id" ref="fact_database_terp"/>
|
||||
<field name="active">True</field>
|
||||
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="columns_res_partner_date">
|
||||
<field name="name">date</field>
|
||||
<field name="column_db_name">date</field>
|
||||
<field name="type">date</field>
|
||||
<field name="table_id" ref="database_table_res_partner"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="columns_res_user_create_uid">
|
||||
<field name="name">create_uid</field>
|
||||
<field name="column_db_name">create_uid</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="database_table_res_user"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="columns_res_user_id">
|
||||
<field name="name">id</field>
|
||||
<field name="column_db_name">id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="database_table_res_user"/>
|
||||
<field name="primary_key">True</field>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="columns_res_partner_id">
|
||||
<field name="name">id</field>
|
||||
<field name="column_db_name">id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="database_table_res_partner"/>
|
||||
<field name="primary_key">True</field>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="columns_res_user_name">
|
||||
<field name="name">name</field>
|
||||
<field name="column_db_name">name</field>
|
||||
<field name="type">varchar</field>
|
||||
<field name="table_id" ref="database_table_res_user"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="columns_res_partner_credit_limit">
|
||||
<field name="name">credit_limit</field>
|
||||
<field name="column_db_name">credit_limit</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="database_table_res_partner"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.database.columns" id="columns_res_partner_user_id">
|
||||
<field name="name">user_id</field>
|
||||
<field name="column_db_name">user_id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="database_table_res_partner"/>
|
||||
<field name="related_to" ref="database_table_res_user"></field>
|
||||
<field name="active">True</field>
|
||||
|
||||
</record>
|
||||
<record model="olap.schema" id="schema_main">
|
||||
<field name="name">tinyerp</field>
|
||||
<field name="state">none</field>
|
||||
<field name="database_id" ref="fact_database_terp"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.cube.table" id="table_res_partner">
|
||||
<field name="name">Partner</field>
|
||||
<field name="schema_id" ref="schema_main"/>
|
||||
<field name="column_link_id" ref="columns_res_partner_id"/>
|
||||
</record>
|
||||
<record model="olap.cube.table" id="table_res_user">
|
||||
<field name="name">Partner(User)</field>
|
||||
<field name="schema_id" ref="schema_main"/>
|
||||
<field name="column_link_id" ref="columns_res_partner_user_id"/>
|
||||
</record>
|
||||
<record model="olap.cube" id="cube_partner">
|
||||
<field name="name">Partner</field>
|
||||
<field name="table_id" ref="table_res_partner"/>
|
||||
<field name="schema_id" ref="schema_main"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.dimension" id="dimension_date">
|
||||
<field name="name">Date</field>
|
||||
<field name="cube_id" ref="cube_partner"/>
|
||||
</record>
|
||||
<record model="olap.hierarchy" id="hierarchy_date">
|
||||
<field name="name">Date</field>
|
||||
<field name="dimension_id" ref="dimension_date"/>
|
||||
<field name="primary_key_table">res_partner</field>
|
||||
<field name="table_id" ref="table_res_partner"/>
|
||||
</record>
|
||||
<record model="olap.level" id="hierarchy_level_date">
|
||||
<field name="name">Date</field>
|
||||
<field name="column_name" ref="columns_res_partner_date"></field>
|
||||
<field name="column_id_name">date</field>
|
||||
<field name="type">date_year</field>
|
||||
<field name="table_name">res_partner</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_date"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.dimension" id="dimension_user">
|
||||
<field name="name">User</field>
|
||||
<field name="cube_id" ref="cube_partner"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.hierarchy" id="hierarchy_user">
|
||||
<field name="name">User</field>
|
||||
<field name="dimension_id" ref="dimension_user"/>
|
||||
<field name="primary_key_table">res_users</field>
|
||||
<field name="table_id" ref="table_res_user"/>
|
||||
</record>
|
||||
<record model="olap.level" id="hierarchy_user_level">
|
||||
<field name="name">Name</field>
|
||||
<field name="column_id_name">name</field>
|
||||
<field name="column_name" ref="columns_res_user_name"></field>
|
||||
<field name="table_name">res_users</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_user"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.measure" id="measure_credit_limit">
|
||||
<field name="name">Credit Limit</field>
|
||||
<field name="cube_id" ref="cube_partner"/>
|
||||
<field name="value_column" ref="columns_res_partner_credit_limit"></field>
|
||||
<field name="value_column_id_name">credit_limit</field>
|
||||
<field name="table_name">res_partner</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.measure" id="measure_count">
|
||||
<field name="name">Count</field>
|
||||
<field name="cube_id" ref="cube_partner"/>
|
||||
<field name="value_column" ref="columns_res_partner_id"></field>
|
||||
<field name="value_column_id_name">id</field>
|
||||
<field name="table_name">res_partner</field>
|
||||
<field name="agregator">count</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.application" id="application_openerp">
|
||||
<field name="name">OpenERP</field>
|
||||
<field name="query">select * from res_users</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,345 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Fact databases
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_fact_database_tree">
|
||||
<field name="name">olap.fact.database.tree</field>
|
||||
<field name="model">olap.fact.database</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap fact database">
|
||||
<field name="name"/>
|
||||
<field name="db_name"/>
|
||||
<field name="type"/>
|
||||
<field name="loaded"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_fact_database_form">
|
||||
<field name="name">olap.fact.database.form</field>
|
||||
<field name="model">olap.fact.database</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Fact database">
|
||||
<notebook>
|
||||
<page string="Information">
|
||||
<separator string="General information" colspan="4"/>
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="db_name" select="2"/>
|
||||
<field name="type" select="2"/>
|
||||
<separator string="Connection parameters" colspan="4"/>
|
||||
<field name="connection_type"/>
|
||||
<newline/>
|
||||
<field name="db_host"/>
|
||||
<field name="db_port"/>
|
||||
<field name="db_login"/>
|
||||
<field name="db_password" password="True"/>
|
||||
<field name="loaded"/>
|
||||
<separator string="Connection url" colspan="4"/>
|
||||
<field name="connection_url" nolabel="1" colspan="2"/>
|
||||
<!--
|
||||
<button name="test_connection" string="Test Connection" type="object" colspan="2"/>
|
||||
-->
|
||||
<button name="%(bi_test_connection)d" string="Test Connection" type="action" colspan="2"/>
|
||||
</page>
|
||||
<page string="Tables">
|
||||
<field name="table_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_olap_fact_database_form">
|
||||
<field name="name">Fact Databases</field>
|
||||
<field name="res_model">olap.fact.database</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Databases"
|
||||
action="action_view_olap_fact_database_form"
|
||||
id="menu_view_olap_fact_database_form"
|
||||
parent="menu_bi_conf_fact"/>
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Fact Database Tables
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_database_tables_tree">
|
||||
<field name="name">olap.database.tables.tree</field>
|
||||
<field name="model">olap.database.tables</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap database tables">
|
||||
<field name="name"/>
|
||||
<field name="table_db_name"/>
|
||||
<field name="fact_database_id" select="2"/>
|
||||
<field name="active"/>
|
||||
<field name="hide"/>
|
||||
<!-- <button name="show_col_view" string="Columns" type="object"/>-->
|
||||
<!--<button string="Columns_wiz" name="%(bi_load_column)d" type="action"/>-->
|
||||
<button name="hide_col" string="Hide" type="object"/>
|
||||
<button name="show_col" string="Show" type="object"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_database_tables_form">
|
||||
<field name="name">olap.database.tables.form</field>
|
||||
<field name="model">olap.database.tables</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Database tables">
|
||||
<field name="name" select="1" colspan="2"/>
|
||||
<field name="table_db_name"/>
|
||||
<field name="columns" colspan="4" mode="tree" nolabel="1">
|
||||
<tree string="Olap database columns">
|
||||
<field name="name"/>
|
||||
<field name="column_db_name"/>
|
||||
<field name="type"/>
|
||||
<field name="table_id"/>
|
||||
<field name="primary_key"/>
|
||||
<field name="related_to"/>
|
||||
<field name="active"/>
|
||||
<field name="hide"/>
|
||||
<button name="hide_col" string="Hide" type="object"/>
|
||||
<button name="show_col" string="Show" type="object"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="fact_database_id" select="1" colspan="2"/>
|
||||
<field name="active"/>
|
||||
<field name="hide"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_olap_database_tables_form">
|
||||
<field name="name">Database Tables</field>
|
||||
<field name="res_model">olap.database.tables</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Tables"
|
||||
action="action_view_olap_database_tables_form"
|
||||
id="menu_view_olap_database_tables_form"
|
||||
parent="menu_bi_conf_fact"/>
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Fact Database Columns
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_database_columns_tree">
|
||||
<field name="name">olap.database.columns.tree</field>
|
||||
<field name="model">olap.database.columns</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority">2</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap database columns">
|
||||
<field name="name"/>
|
||||
<field name="column_db_name"/>
|
||||
<field name="type"/>
|
||||
<field name="table_id"/>
|
||||
<field name="primary_key"/>
|
||||
<field name="related_to"/>
|
||||
<field name="active"/>
|
||||
<field name="hide"/>
|
||||
<button name="hide_col" string="Hide" type="object"/>
|
||||
<button name="show_col" string="Show" type="object"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_database_columns_tree_m20">
|
||||
<field name="name">olap.database.columns.tree.m20</field>
|
||||
<field name="model">olap.database.columns</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap database columns">
|
||||
<field name="name"/>
|
||||
<field name="column_db_name"/>
|
||||
<field name="table_id"/>
|
||||
<field name="related_to"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_database_columns_form">
|
||||
<field name="name">olap.database.columns.form</field>
|
||||
<field name="model">olap.database.columns</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Database columns">
|
||||
<field name="name" select="1" colspan="2"/>
|
||||
<field name="column_db_name"/>
|
||||
<field name="type"/>
|
||||
<field name="table_id" select="1" colspan="2"/>
|
||||
<field name="primary_key"/>
|
||||
<field name="related_to"/>
|
||||
<field name="active"/>
|
||||
<field name="hide"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_olap_database_columns_form">
|
||||
<field name="name">Database Columns</field>
|
||||
<field name="res_model">olap.database.columns</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_view_olap_database_columns_form">
|
||||
<field name="name">Database Columns</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="res_model">olap.database.columns</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_olap_database_columns_tree"></field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Columns"
|
||||
action="action_view_olap_database_columns_form"
|
||||
id="menu_view_olap_database_columns_form"
|
||||
parent="menu_bi_conf_fact"/>
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Olap Application
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_application_tree">
|
||||
<field name="name">olap.application.tree</field>
|
||||
<field name="model">olap.application</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap Application">
|
||||
<field name="name"/>
|
||||
<field name="query"/>
|
||||
<field name="table_ids"/>
|
||||
<field name="field_ids"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_application_form">
|
||||
<field name="name">olap.application.form</field>
|
||||
<field name="model">olap.application</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap Application">
|
||||
<newline/>
|
||||
<field name="name" select="1" colspan="2"/>
|
||||
<field name="query" select="1" colspan="2"/>
|
||||
<field name="table_ids" select="1" colspan="4" nolabel="1"/>
|
||||
<field name="field_ids" select="1" colspan="4" nolabel="1" rowspan="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_olap_application_form">
|
||||
<field name="name">Olap Applicatiion</field>
|
||||
<field name="res_model">olap.application</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Application"
|
||||
action="action_view_olap_application_form"
|
||||
id="menu_view_olap_application_form"
|
||||
parent="menu_bi_conf_known_application"/>
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Olap Application table
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_application_table_tree">
|
||||
<field name="name">olap.application.table.tree</field>
|
||||
<field name="model">olap.application.table</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap Application Table">
|
||||
<field name="name"/>
|
||||
<field name="table_name"/>
|
||||
<field name="is_hidden"/>
|
||||
<field name="application_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_application_table_form">
|
||||
<field name="name">olap.application.table.form</field>
|
||||
<field name="model">olap.application.table</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap Application Table">
|
||||
<newline/>
|
||||
<field name="name" select="1" colspan="2"/>
|
||||
<field name="table_name" select="1" />
|
||||
<field name="is_hidden" select="1" colspan="2" />
|
||||
<field name="application_id" select="1" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_olap_application_table_form">
|
||||
<field name="name">Olap Applicatiion Table</field>
|
||||
<field name="res_model">olap.application.table</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Application Table"
|
||||
action="action_view_olap_application_table_form"
|
||||
id="menu_view_olap_application_table_form"
|
||||
parent="menu_bi_conf_known_application"/>
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Olap Application Field
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="view_olap_application_field_tree">
|
||||
<field name="name">olap.application.field.tree</field>
|
||||
<field name="model">olap.application.field</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Olap Application Field">
|
||||
<field name="name"/>
|
||||
<field name="table_name"/>
|
||||
<field name="field_name"/>
|
||||
<field name="is_hidden" />
|
||||
<field name="application_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_olap_application_field_form">
|
||||
<field name="name">olap.application.field.form</field>
|
||||
<field name="model">olap.application.field</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Olap Application Field">
|
||||
<newline/>
|
||||
<field name="name" select="1" colspan="2"/>
|
||||
<field name="field_name" select="1" />
|
||||
<field name="table_name" select="1" />
|
||||
<newline/>
|
||||
<field name="is_hidden" select="1" colspan="2"/>
|
||||
<field name="application_id" select="1" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_olap_application_field_form">
|
||||
<field name="name">Olap Applicatiion Field</field>
|
||||
<field name="res_model">olap.application.field</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Application Field"
|
||||
action="action_view_olap_application_field_form"
|
||||
id="menu_view_olap_application_field_form"
|
||||
parent="menu_bi_conf_known_application"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,155 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="access_olap_application" model="ir.model.access">
|
||||
<field name="name">Olap Application</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.application')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_application_field" model="ir.model.access">
|
||||
<field name="name">Olap Application Field</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.application.field')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_application_table" model="ir.model.access">
|
||||
<field name="name">Olap Application Table</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.application.table')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_cube" model="ir.model.access">
|
||||
<field name="name">Olap Cube</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.cube')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_cube_table" model="ir.model.access">
|
||||
<field name="name">Olap Cube Table</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.cube.table')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_cube_table_line" model="ir.model.access">
|
||||
<field name="name">Olap Cube Table Line</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.cube.table.line')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_database_columns" model="ir.model.access">
|
||||
<field name="name">Olap Database Columns</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.database.columns')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_database_tables" model="ir.model.access">
|
||||
<field name="name">Olap Database Tables</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.database.tables')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_dimension" model="ir.model.access">
|
||||
<field name="name">Olap Dimension</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.dimension')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_fact_database" model="ir.model.access">
|
||||
<field name="name">Olap Fact Database</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.fact.database')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_hierarchy" model="ir.model.access">
|
||||
<field name="name">Olap Hierarchy</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.hierarchy')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_level" model="ir.model.access">
|
||||
<field name="name">Olap Level</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.level')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_schema" model="ir.model.access">
|
||||
<field name="name">Olap Schema</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.schema')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_measure" model="ir.model.access">
|
||||
<field name="name">Olap Measure</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.measure')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_olap_query_logs" model="ir.model.access">
|
||||
<field name="name">Olap Query Logs</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'olap.query.logs')]"/>
|
||||
<field name="group_id" ref="base.group_system"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<!-- <menuitem-->
|
||||
<!-- name="Businesss Intelligence"-->
|
||||
<!-- id="menu_bi"-->
|
||||
<!-- icon="terp-account" parent="base.next_id_50"/>-->
|
||||
|
||||
<menuitem icon="terp-graph" id="base.reporting_menu" name="Reporting"/>
|
||||
<menuitem
|
||||
id="base.next_id_50"
|
||||
name="Configuration"
|
||||
parent="base.reporting_menu"
|
||||
groups="base.group_system"
|
||||
sequence="3"/>
|
||||
<menuitem
|
||||
name="Custom Reports" id="base.menu_custom_reports"
|
||||
parent="base.reporting_menu" sequence="1"/>
|
||||
<menuitem
|
||||
name="Businesss Intelligence Configuration"
|
||||
id="menu_bi_configuration"
|
||||
parent="base.next_id_50" sequence="1"/>
|
||||
|
||||
<menuitem
|
||||
name="Fact Databases"
|
||||
sequence="10"
|
||||
id="menu_bi_conf_fact"
|
||||
parent="menu_bi_configuration"/>
|
||||
|
||||
<menuitem
|
||||
name="Known Application"
|
||||
sequence="20"
|
||||
id="menu_bi_conf_known_application"
|
||||
parent="menu_bi_configuration"/>
|
||||
|
||||
<menuitem
|
||||
name="Olap Cubes"
|
||||
sequence="30"
|
||||
id="menu_bi_conf_cubes"
|
||||
parent="menu_bi_configuration"/>
|
||||
|
||||
<menuitem
|
||||
name="Tools"
|
||||
sequence="40"
|
||||
id="menu_bi_conf_tools"
|
||||
parent="menu_bi_configuration"/>
|
||||
|
||||
|
||||
<record model="ir.actions.url" id="menu_url_cube_browser">
|
||||
<field name="name">name_menu_url_cube_browser</field>
|
||||
<field name="url">http://localhost:8080/browser</field>
|
||||
</record>
|
||||
<menuitem name="Cube Browser" id="menu_browser_url" type="url" action="menu_url_cube_browser" parent="base.menu_custom_reports" sequence="1"/>
|
||||
|
||||
<record model="ir.actions.url" id="menu_url_cube_designer">
|
||||
<field name="name">name_menu_url_cube_designer</field>
|
||||
<field name="url">http://localhost:8080/designer</field>
|
||||
</record>
|
||||
<menuitem name="Cube Designer" sequence="60" action="menu_url_cube_designer" type="url" id="menu_designer_url" parent="base.next_id_50"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<wizard
|
||||
string="Query Builder"
|
||||
model="olap.schema"
|
||||
name="olap.query_builder"
|
||||
menu= "False"
|
||||
multi="True"
|
||||
id="bi_conf_cube_query_builder"/>
|
||||
<!-- <menuitem name="Query Builder" action="bi_conf_cube_query_builder" type="wizard" id="menu_bi_conf_cube_query_builder" sequence="40" parent="menu_bi_conf_tools"/>
|
||||
-->
|
||||
|
||||
<wizard
|
||||
string="Load Tables"
|
||||
model="olap.schema"
|
||||
name="olap.load.table"
|
||||
menu= "False"
|
||||
multi="True"
|
||||
id="bi_menu_olap_load_table"/>
|
||||
|
||||
|
||||
<wizard
|
||||
string="Load Tables"
|
||||
model="olap.schema"
|
||||
name="olap.load.table"
|
||||
menu= "False"
|
||||
multi="True"
|
||||
id="bi_menu_olap_load_table"/>
|
||||
|
||||
<wizard
|
||||
string="Open Configuration"
|
||||
model="olap.schema"
|
||||
name="olap.load.configuration.table"
|
||||
menu= "False"
|
||||
multi="True"
|
||||
id="bi_load_configuration_table"/>
|
||||
|
||||
<wizard
|
||||
string="Configure from Application"
|
||||
model="olap.schema"
|
||||
name="olap.application.configuration"
|
||||
menu="False"
|
||||
multi="True"
|
||||
id="bi_application_configuration"/>
|
||||
|
||||
<wizard
|
||||
string="Test Connection"
|
||||
model="olap.fact.database"
|
||||
name="olap.fact.database.test_connection"
|
||||
menu="False"
|
||||
id="bi_test_connection"/>
|
||||
|
||||
<wizard
|
||||
string="Open Columns"
|
||||
model="olap.database.columns"
|
||||
name="olap.load.column"
|
||||
menu= "False"
|
||||
multi="True"
|
||||
id="bi_load_column"/>
|
||||
|
||||
<wizard
|
||||
string="Clear Logs"
|
||||
model="olap.query.logs"
|
||||
name="olap.query.logs.clear"
|
||||
menu="True"
|
||||
id="bi_clear_logs"/>
|
||||
<menuitem name="Clear Logs" action="bi_clear_logs" type="wizard" id="menu_bi_clear_logs" sequence="30" parent="menu_bi_conf_tools"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,34 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard_query_builder
|
||||
import wizard_load_data
|
||||
import wizard_load_configured_table
|
||||
import wizard_clear_logs
|
||||
import wizard_application_configure
|
||||
import wizard_load_columns
|
||||
import wizard_test_connection
|
|
@ -0,0 +1,194 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
from osv import osv
|
||||
import netsvc
|
||||
|
||||
info = '''<?xml version="1.0"?>
|
||||
<form string="Auto Configure">
|
||||
<label string="Your database structure (Open ERP) has been sucessfully configured."/>
|
||||
</form>'''
|
||||
|
||||
form1 = '''<?xml version="1.0"?>
|
||||
<form string=" Auto Configure ">
|
||||
<label string="This will Auto Configure Application"/>
|
||||
</form>'''
|
||||
|
||||
class wizard_application_configure(wizard.interface):
|
||||
|
||||
def configure_application(self,cr,uid,data,context):
|
||||
|
||||
vals={}
|
||||
apptabnew_vals={}
|
||||
appfieldnew_vals={}
|
||||
|
||||
ids=pooler.get_pool(cr.dbname).get('olap.schema').browse(cr,uid,data['id'])
|
||||
|
||||
if ids.app_detect == "Unknown Application":
|
||||
raise wizard.except_wizard('Warning', 'The Application is Unknown, we can not configure it automatically.')
|
||||
|
||||
else:
|
||||
app_objs = pooler.get_pool(cr.dbname).get('olap.application')
|
||||
app_ids = app_objs.search(cr, uid, [])
|
||||
app_res = app_objs.browse(cr,uid, app_ids)
|
||||
app_id=''
|
||||
for x_app in app_res:
|
||||
app_id = x_app['id']
|
||||
|
||||
apptab_objs = pooler.get_pool(cr.dbname).get('olap.application.table')
|
||||
apptab_ids = apptab_objs.search(cr, uid, [])
|
||||
apptab_res = apptab_objs.browse(cr,uid, apptab_ids)
|
||||
apptab_name=[]
|
||||
for aptab in apptab_res:
|
||||
apptab_name.append(aptab.name)
|
||||
|
||||
appfield_objs = pooler.get_pool(cr.dbname).get('olap.application.field')
|
||||
appfield_ids = appfield_objs.search(cr, uid, [])
|
||||
appfield_res = appfield_objs.browse(cr,uid, appfield_ids)
|
||||
appcol_name=[]
|
||||
for apcol in appfield_res:
|
||||
appcol_name.append(apcol.name)
|
||||
|
||||
|
||||
apptab_objs = pooler.get_pool(cr.dbname).get('olap.application.table')
|
||||
apptab_ids = apptab_objs.search(cr, uid, [])
|
||||
apptab_res = apptab_objs.browse(cr,uid, apptab_ids)
|
||||
# apptab_data_res = apptab_objs.read(cr,uid, apptab_ids,[])[0]
|
||||
|
||||
apptab_name=[]
|
||||
map_apptab_name_id={}
|
||||
for aptab in apptab_res:
|
||||
apptab_name.append(aptab.name)
|
||||
map_apptab_name_id[aptab.table_name]=aptab
|
||||
|
||||
appfield_objs = pooler.get_pool(cr.dbname).get('olap.application.field')
|
||||
appfield_ids = appfield_objs.search(cr, uid, [])
|
||||
appfield_res = appfield_objs.browse(cr,uid, appfield_ids)
|
||||
appfield_data_res = appfield_objs.read(cr,uid, appfield_ids,[])
|
||||
|
||||
appcol_name=[]
|
||||
for apcol in appfield_res:
|
||||
appcol_name.append(apcol.name)
|
||||
|
||||
id_tables=pooler.get_pool(cr.dbname).get('olap.database.tables').search(cr,uid,[('fact_database_id','=',ids.database_id.id),('table_db_name','not in',['inherit','res_roles','user_rule_group_rel','res_roles_users_rel','group_rule_group_rel'])])
|
||||
tables=pooler.get_pool(cr.dbname).get('olap.database.tables').read(cr,uid,id_tables,[])
|
||||
|
||||
for tables in tables:
|
||||
if not(tables['table_db_name'].startswith('ir') or tables['table_db_name'].startswith('wkf') or tables['table_db_name'].startswith('res_groups')):
|
||||
vals={}
|
||||
if len(apptab_ids)==0 and (tables['table_db_name'] not in apptab_name):
|
||||
vals['table_name']=tables['table_db_name']
|
||||
vals['name']=(" ").join(map(lambda x:x.capitalize(),tables['name'].split("_")))
|
||||
vals['is_hidden']=tables['hide']
|
||||
vals['application_id']=app_id
|
||||
apptab_new_obj=apptab_objs.create(cr,uid,vals)
|
||||
else:
|
||||
if map_apptab_name_id.has_key(tables['table_db_name']):
|
||||
app_table = map_apptab_name_id[tables['table_db_name']]
|
||||
if ((app_table['table_name']==tables['table_db_name']) and not (app_table['table_name']==tables['name'])):
|
||||
vals['name']=aptable_obj.table_name
|
||||
vals['hide']=aptable_obj.is_hidden
|
||||
tables_obj_new=apptab_objs.write(cr,uid,tables['id'],vals)
|
||||
else:
|
||||
vals['table_name']=tables['table_db_name']
|
||||
vals['name']=(" ").join(map(lambda x:x.capitalize(),tables['name'].split("_")))
|
||||
vals['is_hidden']=tables['hide']
|
||||
vals['application_id']=app_id
|
||||
apptab_new_obj=apptab_objs.create(cr,uid,vals)
|
||||
|
||||
id_columns=pooler.get_pool(cr.dbname).get('olap.database.columns').search(cr,uid,[('table_id','in',id_tables)])
|
||||
columns=pooler.get_pool(cr.dbname).get('olap.database.columns').read(cr,uid,id_columns,[])
|
||||
for columns in columns:
|
||||
vals={}
|
||||
if len(appfield_ids) == 0 and (columns['column_db_name'] not in appcol_name):
|
||||
vals['field_name']=columns['column_db_name']
|
||||
vals['table_name']=columns['table_id'][1]
|
||||
vals['name']=(" ").join(map(lambda x:x.capitalize(),columns['name'].split("_")))
|
||||
vals['is_hidden']=columns['hide']
|
||||
vals['application_id']=x_app['id']
|
||||
appfield_new_obj=appfield_objs.create(cr,uid,vals)
|
||||
else:
|
||||
if map_apptab_name_id.has_key(columns['table_id'][1]):
|
||||
table_id_write = map_apptab_name_id[columns['table_id'][1]]
|
||||
filter_column=filter(lambda x: columns['column_db_name']==x['field_name'] and columns['table_id'][1]==x['table_name'],appfield_data_res)
|
||||
vals['name']=(" ").join(map(lambda x:x.capitalize(),columns['name'].split("_")))
|
||||
vals['is_hidden']=columns['hide']
|
||||
appfield_new_obj=appfield_objs.write(cr,uid,filter_column[0]['id'],vals)
|
||||
else:
|
||||
vals['field_name']=columns['column_db_name']
|
||||
vals['table_name']=columns['table_id'][1]
|
||||
vals['name']=(" ").join(map(lambda x:x.capitalize(),columns['name'].split("_")))
|
||||
vals['is_hidden']=columns['hide']
|
||||
vals['application_id']=x_app['id']
|
||||
appfield_new_obj=appfield_objs.create(cr,uid,vals)
|
||||
|
||||
|
||||
database_tables = pooler.get_pool(cr.dbname).get('olap.database.tables')
|
||||
id_tables=database_tables.search(cr,uid,[('fact_database_id','=',ids.database_id.id)])
|
||||
tables=database_tables.read(cr,uid,id_tables,[])
|
||||
make_id=[]
|
||||
for table in tables:
|
||||
vals={}
|
||||
if (table['table_db_name'].startswith('ir') or table['table_db_name'].startswith('wkf')) or (table['table_db_name'].startswith('res_groups')) or (table['table_db_name'] in ['inherit','res_roles','user_rule_group_rel','res_roles_users_rel','group_rule_group_rel']):
|
||||
vals['hide']=True
|
||||
vals['active']=False
|
||||
make_id.append(table['id'])
|
||||
database_tables.write(cr,uid,table['id'],vals)
|
||||
|
||||
database_columns=pooler.get_pool(cr.dbname).get('olap.database.columns')
|
||||
id_columns=database_columns.search(cr,uid,[('table_id','in',make_id)])
|
||||
columns=database_columns.read(cr,uid,id_columns,[])
|
||||
for col in columns:
|
||||
val={}
|
||||
vals['hide']=True
|
||||
vals['active']=False
|
||||
database_columns.write(cr,uid,col['id'],vals)
|
||||
|
||||
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
wf_service.trg_validate(uid, 'olap.schema', data['id'], 'dbconfigure', cr)
|
||||
return {}
|
||||
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':form1, 'fields':{}, 'state':[('configure','Configure'),('end','Cancel')]}
|
||||
},
|
||||
'configure': {
|
||||
'actions': [configure_application],
|
||||
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','Ok')]}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
||||
wizard_application_configure('olap.application.configuration')
|
||||
# vim: ts=4 sts=4 sw=4 si et
|
|
@ -0,0 +1,83 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
from osv import osv
|
||||
|
||||
|
||||
info = '''<?xml version="1.0"?>
|
||||
<form string="Load Data">
|
||||
<label string="Logs Cleared successfully"/>
|
||||
</form>'''
|
||||
|
||||
form1 = '''<?xml version="1.0"?>
|
||||
<form string=" To Load Data">
|
||||
<field name='user_name'/>
|
||||
</form>'''
|
||||
|
||||
field1 = {
|
||||
# 'account_id': {'string':"Analytic Account", 'type':'many2one', 'relation':'account.analytic.account', 'required':True, 'domain':"[('type','=','normal')]"},
|
||||
'user_name': {'string':'User', 'type':'char','size':'64', 'required':True, 'readonly':True},
|
||||
# 'db_name': {'string':'Database Name', 'type':'char','size':'64', 'required':True, 'readonly':True},
|
||||
|
||||
}
|
||||
|
||||
def clear_logs(self,cr,uid,part,context={}):
|
||||
ids=pooler.get_pool(cr.dbname).get('olap.query.logs').search(cr,uid,[('user_id','=',uid)])
|
||||
pooler.get_pool(cr.dbname).get('olap.query.logs').unlink(cr, uid,ids,context)
|
||||
return {}
|
||||
|
||||
def _getdata(self,cr,uid,part,context={}):
|
||||
ids=pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid)
|
||||
part['form']['user_name']=ids['name']
|
||||
# part['form']['db_name']=lines.database_id.db_name
|
||||
return part['form']
|
||||
|
||||
class wizard_clear_logs(wizard.interface):
|
||||
|
||||
states = {
|
||||
|
||||
'init': {
|
||||
'actions': [_getdata],
|
||||
'result': {'type':'form','arch':form1, 'fields':field1, 'state':[('end','Cancel'),('ok','Clear Logs')]}
|
||||
},
|
||||
|
||||
'ok': {
|
||||
'actions': [clear_logs],
|
||||
'result': {'type':'form','arch':info,'fields':{}, 'state':[('end','Ok')]}
|
||||
},
|
||||
|
||||
'info': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','Ok')]}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
wizard_clear_logs('olap.query.logs.clear')
|
|
@ -0,0 +1,55 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
class wizard_load_columns(wizard.interface):
|
||||
def _get_table_data(self, cr, uid, data, context={}):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
ids_cols=pool_obj.get('olap.database.columns').search(cr, uid, ([('table_id','=',data['id'])]),context={})
|
||||
model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_olap_database_columns_form')],context={})
|
||||
resource_id = pool_obj.get('ir.model.data').read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,ids_cols))+"])]",
|
||||
'name': 'Database Columns',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'olap.database.columns',
|
||||
'views': [(False,'tree'),(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'action' ,'action':_get_table_data,'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
wizard_load_columns('olap.load.column')
|
|
@ -0,0 +1,67 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import netsvc
|
||||
|
||||
class wizard_load_configured_table(wizard.interface):
|
||||
def _get_table_data(self, cr, uid, data, context={}):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
|
||||
# vals={}
|
||||
# vals['configure']=True
|
||||
# vals['state']='dbconfigure'
|
||||
# pooler.get_pool(cr.dbname).get('olap.schema').write(cr,uid,data['id'],vals)
|
||||
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
wf_service.trg_validate(uid, 'olap.schema', data['id'], 'dbconfigure', cr)
|
||||
|
||||
lines=pool_obj.get('olap.schema').read(cr, uid, data['id'],context={})
|
||||
fact_ids=pool_obj.get('olap.database.tables').search(cr, uid, ([('fact_database_id','=',lines['database_id'][0])]),context={})
|
||||
model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_olap_database_tables_form')],context={})
|
||||
resource_id = pool_obj.get('ir.model.data').read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,fact_ids))+"])]",
|
||||
'name': 'Database Tables',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'olap.database.tables',
|
||||
'views': [(False,'tree'),(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'action' ,'action':_get_table_data,'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
wizard_load_configured_table('olap.load.configuration.table')
|
|
@ -0,0 +1,406 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
import psycopg2
|
||||
import time
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import netsvc
|
||||
|
||||
info = '''<?xml version="1.0"?>
|
||||
<form string="Load Data">
|
||||
<label string="Your database structure has been correctly loaded"/>
|
||||
</form>'''
|
||||
|
||||
form1 = '''<?xml version="1.0"?>
|
||||
|
||||
<form string="Load Database Structure">
|
||||
|
||||
<label align="0.0" string="We will load the complete structure of the database by introspection,
|
||||
so that you will be able to work on it, and specify a better structure
|
||||
according to your reporting needs." colspan="4" />
|
||||
<newline/>
|
||||
<label align="0.0" string="After having loaded the structure, you will be able to hide/show or
|
||||
rename tables and columns to simplify end-users interface. The following database
|
||||
will be loaded:" colspan="4"/>
|
||||
<field align="0.0" name='fact_table'/>
|
||||
<newline/>
|
||||
<field align="0.0" name='db_name' colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
field1 = {
|
||||
'fact_table': {'string':'Fact Name', 'type':'char','size':'64', 'required':True, 'readonly':True},
|
||||
'db_name': {'string':'Database Name', 'type':'char','size':'64', 'required':True, 'readonly':True},
|
||||
}
|
||||
|
||||
def olap_db_connect(self,cr,uid,part,context={}):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
lines=pool.get('olap.schema').browse(cr, uid, part['id'],context)
|
||||
id_db=lines.database_id.id
|
||||
type = lines.database_id.type
|
||||
db_name = lines.database_id.db_name
|
||||
tobj = pool.get('olap.database.tables')
|
||||
tcol = pool.get('olap.database.columns')
|
||||
if type == 'postgres':
|
||||
host = lines.database_id.db_host and "host=%s" % lines.database_id.db_host or ''
|
||||
port = lines.database_id.db_port and "port=%s" % lines.database_id.db_port or ''
|
||||
name = lines.database_id.db_name and "dbname=%s" % lines.database_id.db_name or ''
|
||||
user = lines.database_id.db_login and "user=%s" % lines.database_id.db_login or ''
|
||||
password = lines.database_id.db_password and "password=%s" % lines.database_id.db_password or ''
|
||||
tdb = psycopg2.connect('%s %s %s %s %s' % (host, port, name, user, password))
|
||||
cr_db = tdb.cursor()
|
||||
cr.execute('select table_db_name,id from olap_database_tables where fact_database_id=%d', (id_db,))
|
||||
tables = dict(cr.fetchall())
|
||||
tables_id = map(lambda x: str(tables[x]),tables)
|
||||
cols={}
|
||||
if tables_id:
|
||||
cr.execute('select column_db_name,id,table_id from olap_database_columns where table_id in (' + ','.join(tables_id) +')')
|
||||
else:
|
||||
cr.execute('select column_db_name,id,table_id from olap_database_columns')
|
||||
|
||||
for data in cr.fetchall():
|
||||
cols[str(data[1])]=(data[0],int(data[2]))
|
||||
|
||||
print 'Creating / Updating Tables...'
|
||||
cr_db.execute("select table_name, table_catalog from INFORMATION_SCHEMA.tables as a where a.table_schema = 'public'")
|
||||
for table in cr_db.fetchall():
|
||||
val = {
|
||||
'fact_database_id':id_db,
|
||||
'table_db_name':table[0]
|
||||
}
|
||||
|
||||
if table[0] in tables.keys():
|
||||
table_id=tobj.write(cr,uid,[tables[table[0]]], val, context)
|
||||
else:
|
||||
val['name']=table[0]
|
||||
tables[val['name']] = tobj.create(cr,uid,val, context)
|
||||
print 'Creating / Updating Columns...'
|
||||
cr_db.execute("""SELECT
|
||||
table_name, column_name, udt_name
|
||||
from
|
||||
INFORMATION_SCHEMA.columns
|
||||
WHERE table_schema = 'public'""")
|
||||
|
||||
for col in cr_db.fetchall():
|
||||
val={
|
||||
'table_id': tables[col[0]],
|
||||
'column_db_name': col[1],
|
||||
'type': col[2],
|
||||
}
|
||||
|
||||
id_made=filter(lambda x:(int(cols[x][1])==int(tables[col[0]])),cols)
|
||||
if col[1] in cols.keys() and col[0] in tables.keys()and id_made:
|
||||
col_id=tcol.write(cr,uid,cols[tables[str(col[0])]], val, context)
|
||||
else:
|
||||
val['name']=col[1]
|
||||
id_made = tcol.create(cr,uid,val, context)
|
||||
cols[str(id_made)] = (val['name'],int(val['table_id']))
|
||||
print 'Creating / Updating Constraints...'
|
||||
cr_db.execute("""select
|
||||
table_name,column_name
|
||||
from
|
||||
INFORMATION_schema.key_column_usage
|
||||
where
|
||||
constraint_name in (
|
||||
select constraint_name from INFORMATION_SCHEMA .table_constraints
|
||||
where
|
||||
constraint_type = 'PRIMARY KEY')""")
|
||||
print "Updating the Primary Key Constraint"
|
||||
for constraint in cr_db.fetchall():
|
||||
val={
|
||||
'primary_key':True
|
||||
}
|
||||
|
||||
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[0]])and(constraint[1]==cols[x][0])),cols)
|
||||
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
|
||||
print "Updating the Foreign key constraint"
|
||||
cr_db.execute("""select
|
||||
constraint_name,table_name
|
||||
from
|
||||
INFORMATION_schema.constraint_column_usage
|
||||
where
|
||||
constraint_name in (
|
||||
select constraint_name from INFORMATION_SCHEMA.table_constraints
|
||||
where
|
||||
constraint_type = 'FOREIGN KEY')""")
|
||||
for_key=dict(cr_db.fetchall())
|
||||
|
||||
cr_db.execute("""select
|
||||
table_name,column_name,constraint_name
|
||||
from
|
||||
INFORMATION_schema.key_column_usage
|
||||
where
|
||||
constraint_name in (
|
||||
select constraint_name from INFORMATION_SCHEMA.table_constraints
|
||||
where
|
||||
constraint_type = 'FOREIGN KEY')""")
|
||||
|
||||
for constraint in cr_db.fetchall():
|
||||
val={
|
||||
'related_to':tables[for_key[constraint[2]]]
|
||||
}
|
||||
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[0]])and (constraint[1]==cols[x][0])),cols)
|
||||
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
|
||||
|
||||
|
||||
elif type =='mysql':
|
||||
try:
|
||||
import MySQLdb
|
||||
host = lines.database_id.db_host or ''
|
||||
port = lines.database_id.db_port or ''
|
||||
db = lines.database_id.db_name or ''
|
||||
user = lines.database_id.db_login or ''
|
||||
passwd = lines.database_id.db_password or ''
|
||||
tdb = MySQLdb.connect(host = host,port = port, db = db, user = user, passwd = passwd)
|
||||
|
||||
except Exception, e:
|
||||
raise osv.except_osv('MySQLdb Packages Not Installed.',e )
|
||||
|
||||
cr_db = tdb.cursor()
|
||||
cr.execute('select table_db_name,id from olap_database_tables where fact_database_id=%d', (id_db,))
|
||||
tables = dict(cr.fetchall())
|
||||
tables_id = map(lambda x: str(tables[x]),tables)
|
||||
cols={}
|
||||
if tables_id:
|
||||
cr.execute('select column_db_name,id,table_id from olap_database_columns where table_id in (' + ','.join(tables_id) +')')
|
||||
else:
|
||||
cr.execute('select column_db_name,id,table_id from olap_database_columns')
|
||||
|
||||
for data in cr.fetchall():
|
||||
cols[str(data[1])]=(data[0],int(data[2]))
|
||||
cr_db.execute("select table_name, table_catalog from INFORMATION_SCHEMA.tables where table_schema =%s",(db_name))
|
||||
|
||||
for table in cr_db.fetchall():
|
||||
val = {
|
||||
'fact_database_id':id_db,
|
||||
'table_db_name':table[0]
|
||||
}
|
||||
|
||||
if table[0] in tables.keys():
|
||||
table_id=tobj.write(cr,uid,[tables[table[0]]], val, context)
|
||||
|
||||
else:
|
||||
val['name']=table[0]
|
||||
tables[val['name']] = tobj.create(cr,uid,val, context)
|
||||
cr_db.execute("""SELECT
|
||||
table_name, column_name, data_type
|
||||
from
|
||||
INFORMATION_SCHEMA.columns
|
||||
WHERE table_schema = %s""",(db_name))
|
||||
|
||||
for col in cr_db.fetchall():
|
||||
|
||||
val={
|
||||
'table_id': tables[col[0]],
|
||||
'column_db_name': col[1],
|
||||
'type': col[2],
|
||||
}
|
||||
|
||||
id_made=filter(lambda x:(int(cols[x][1])==int(tables[col[0]])),cols)
|
||||
if col[1] in cols.keys() and col[0] in tables.keys()and id_made:
|
||||
col_id=tcol.write(cr,uid,cols[tables[str(col[0])]], val, context)
|
||||
else:
|
||||
val['name']=col[1]
|
||||
id_made = tcol.create(cr,uid,val, context)
|
||||
cols[str(id_made)] = (val['name'],int(val['table_id']))
|
||||
|
||||
cr_db.execute("""select
|
||||
REFERENCED_COLUMN_NAME,REFERENCED_TABLE_NAME,COLUMN_NAME,TABLE_NAME
|
||||
from
|
||||
INFORMATION_schema.key_column_usage
|
||||
where table_schema= %s and
|
||||
constraint_name in (
|
||||
select constraint_name from INFORMATION_SCHEMA .table_constraints
|
||||
where
|
||||
constraint_type in('PRIMARY KEY','FOREIGN KEY'))
|
||||
""",(db_name))
|
||||
|
||||
for constraint in cr_db.fetchall():
|
||||
|
||||
if constraint[0]:
|
||||
val={
|
||||
'related_to':tables[constraint[1]]
|
||||
}
|
||||
else:
|
||||
|
||||
val={
|
||||
'primary_key':True
|
||||
}
|
||||
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[3]])and(constraint[2]==cols[x][0])),cols)
|
||||
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
|
||||
|
||||
elif type == 'oracle':
|
||||
try:
|
||||
import cx_Oracle
|
||||
host = lines.database_id.db_host or ''
|
||||
port = lines.database_id.db_port or ''
|
||||
db = lines.database_id.db_name or ''
|
||||
user = lines.database_id.db_login.upper() or ''
|
||||
passwd = lines.database_id.db_password or ''
|
||||
tdb = cx_Oracle.connect(user, passwrd, host)
|
||||
|
||||
except Exception, e:
|
||||
raise osv.except_osv('cx_Oracle Packages Not Installed.',e )
|
||||
|
||||
cr_db = tdb.cursor()
|
||||
cr.execute('select table_db_name,id from olap_database_tables where fact_database_id=%d', (id_db,))
|
||||
tables = dict(cr.fetchall())
|
||||
tables_id = map(lambda x: str(tables[x]),tables)
|
||||
cols={}
|
||||
if tables_id:
|
||||
cr.execute('select column_db_name,id,table_id from olap_database_columns where table_id in (' + ','.join(tables_id) +')')
|
||||
else:
|
||||
cr.execute('select column_db_name,id,table_id from olap_database_columns')
|
||||
|
||||
for data in cr.fetchall():
|
||||
cols[str(data[1])]=(data[0],int(data[2]))
|
||||
|
||||
cr_db.execute("select table_name from all_tables where owner =%s",(user))
|
||||
temp = cr_db.fetchall()
|
||||
for table in temp:
|
||||
val = {
|
||||
'fact_database_id':id_db,
|
||||
'table_db_name':table[0]
|
||||
}
|
||||
|
||||
if table[0] in tables.keys():
|
||||
table_id=tobj.write(cr,uid,[tables[table[0]]], val, context)
|
||||
|
||||
else:
|
||||
val['name']=table[0]
|
||||
tables[val['name']] = tobj.create(cr,uid,val, context)
|
||||
|
||||
cr_db.execute("""SELECT
|
||||
table_name, column_name, data_type
|
||||
from
|
||||
all_tab_columns
|
||||
WHERE owner = %s""",(user))
|
||||
temp = cr_db.fetchall()
|
||||
for col in temp:
|
||||
if col[2]=='NUMBER':
|
||||
type_col='numeric'
|
||||
elif col[2]=='DATE':
|
||||
type_col='date'
|
||||
elif col[2]=='VARCHAR2':
|
||||
type_col='varchar'
|
||||
else:
|
||||
type_col=col[2]
|
||||
val={
|
||||
'table_id': tables[col[0]],
|
||||
'column_db_name': col[1],
|
||||
'type': type_col,
|
||||
}
|
||||
|
||||
id_made=filter(lambda x:(int(cols[x][1])==int(tables[col[0]])),cols)
|
||||
if col[1] in cols.keys() and col[0] in tables.keys()and id_made:
|
||||
col_id=tcol.write(cr,uid,cols[tables[str(col[0])]], val, context)
|
||||
else:
|
||||
val['name']=col[1]
|
||||
id_made = tcol.create(cr,uid,val, context)
|
||||
cols[str(id_made)] = (val['name'],int(val['table_id']))
|
||||
|
||||
cr_db.execute("""select
|
||||
table_name,column_name,constraint_name
|
||||
from
|
||||
all_cons_columns
|
||||
where
|
||||
constraint_name in (
|
||||
select constraint_name from all_constraints
|
||||
where
|
||||
constraint_type = 'P' and owner= %s)
|
||||
""",(user))
|
||||
temp = cr_db.fetchall()
|
||||
pk_table = {}
|
||||
for constraint in temp:
|
||||
val={
|
||||
'primary_key' : True
|
||||
}
|
||||
pk_table[constraint[2]] = constraint[0]
|
||||
|
||||
id_to_write=filter(lambda x : (int(cols[x][1])==int(tables[constraint[0]])and(constraint[1]==cols[x][0])),cols)
|
||||
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
|
||||
|
||||
cr_db.execute("""select
|
||||
constraint_name,r_constraint_name from all_constraints
|
||||
where
|
||||
constraint_type = 'R' and owner = %s
|
||||
""",(user))
|
||||
constraints_map={}
|
||||
for data in cr_db.fetchall():
|
||||
constraints_map[data[0]]=data[1]
|
||||
|
||||
cr_db.execute("""select
|
||||
table_name,column_name,constraint_name
|
||||
from
|
||||
all_cons_columns
|
||||
where
|
||||
constraint_name in (
|
||||
select constraint_name from all_constraints
|
||||
where
|
||||
constraint_type = 'R' and owner = %s)
|
||||
""",(user))
|
||||
|
||||
|
||||
temp = cr_db.fetchall()
|
||||
for constraint in temp:
|
||||
rel_constraint_name=constraints_map[constraint[2]]
|
||||
req_table = pk_table[rel_constraint_name]
|
||||
val={
|
||||
'related_to' : tables[req_table]
|
||||
}
|
||||
id_to_write=filter(lambda x:(int(cols[x][1])==int(tables[constraint[0]])and (constraint[1]==cols[x][0])),cols)
|
||||
col_id=tcol.write(cr,uid,int(id_to_write[0]),val,context)
|
||||
|
||||
pooler.get_pool(cr.dbname).get('olap.fact.database').write(cr,uid,[id_db],{'loaded':True})
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
wf_service.trg_validate(uid, 'olap.schema', part['id'], 'dbload', cr)
|
||||
return {}
|
||||
|
||||
def _getdata(self,cr,uid,part,context={}):
|
||||
lines=pooler.get_pool(cr.dbname).get('olap.schema').browse(cr, uid, part['id'],context)
|
||||
part['form']['fact_table']=lines.database_id.name
|
||||
part['form']['db_name']=lines.database_id.db_name
|
||||
return part['form']
|
||||
|
||||
class wizard_data_loader(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_getdata],
|
||||
'result': {'type':'form','arch':form1, 'fields':field1, 'state':[('end','Cancel'),('ok','Load Database Structure')]}
|
||||
},
|
||||
'ok': {
|
||||
'actions': [olap_db_connect],
|
||||
'result': {'type':'form','arch':info,'fields':{}, 'state':[('end','Continue and Configure Structure')]}
|
||||
},
|
||||
'info': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','Ok')]}
|
||||
},
|
||||
}
|
||||
wizard_data_loader('olap.load.table')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,240 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import threading
|
||||
import pooler
|
||||
from osv import osv
|
||||
import optparse
|
||||
import xmlrpclib
|
||||
import time
|
||||
|
||||
import netsvc
|
||||
|
||||
|
||||
|
||||
class Log:
|
||||
def __init__(self):
|
||||
self.content= ""
|
||||
self.error= False
|
||||
def add(self,s,error=True):
|
||||
self.content= self.content + s
|
||||
if error:
|
||||
self.error= error
|
||||
def __call__(self):
|
||||
return self.content
|
||||
|
||||
|
||||
def get_cube(self, cr, uid, context):
|
||||
pool = pooler.get_pool(cr.dbname).get('olap.cube')
|
||||
ids = pool.search(cr, uid, [])
|
||||
res = pool.read(cr, uid, ids, ['schema_id','name'], context)
|
||||
res=[(r['schema_id'], r['name']) for r in res]
|
||||
|
||||
return res
|
||||
|
||||
def get_details(self, cr, uid,data, context):
|
||||
"""
|
||||
To Fetch dimension of selected schema
|
||||
"""
|
||||
pool = pooler.get_pool(cr.dbname).get('olap.cube')
|
||||
|
||||
search_id=data['form']['cube_schema'][0]
|
||||
|
||||
ids=pool.search(cr,uid,[('schema_id','=',search_id)])
|
||||
|
||||
"""
|
||||
ids now have the cube id from schema user selected
|
||||
"""
|
||||
|
||||
"""
|
||||
To Fetch hiearchy of selected schema
|
||||
"""
|
||||
pool = pooler.get_pool(cr.dbname).get('olap.dimension')
|
||||
|
||||
id_dimension=pool.search(cr,uid,[('cube_id','=',ids[0])])
|
||||
res=pool.read(cr,uid,id_dimension,['id','name'],context)
|
||||
log_d=Log()
|
||||
for r in res:
|
||||
log_d.add(r['name'])
|
||||
log_d.add("\n")
|
||||
|
||||
|
||||
"""
|
||||
To Fetch hiearchy id
|
||||
"""
|
||||
pool=pooler.get_pool(cr.dbname).get('olap.hierarchy')
|
||||
|
||||
id_hierarchy=pool.search(cr,uid,[('dimension_id','in',tuple(id_dimension))])
|
||||
res=pool.read(cr,uid,id_hierarchy,['id','name'],context)
|
||||
log_h=Log()
|
||||
for r in res:
|
||||
log_h.add(r['name'])
|
||||
log_h.add("\n")
|
||||
|
||||
|
||||
|
||||
"""
|
||||
To fetch level id
|
||||
"""
|
||||
pool=pooler.get_pool(cr.dbname).get('olap.level')
|
||||
id_level=pool.search(cr,uid,[('hierarchy_id','in',tuple(id_hierarchy))])
|
||||
res=pool.read(cr,uid,id_level,['id','name'],context)
|
||||
log_l=Log()
|
||||
for r in res:
|
||||
log_l.add(r['name'])
|
||||
log_l.add("\n")
|
||||
|
||||
"""
|
||||
To fetch measures id
|
||||
"""
|
||||
pool=pooler.get_pool(cr.dbname).get('olap.measure')
|
||||
id_level=pool.search(cr,uid,[('cube_id','in',tuple(ids))])
|
||||
res=pool.read(cr,uid,id_level,['id','name'],context)
|
||||
log_m=Log()
|
||||
for r in res:
|
||||
log_m.add(r['name'])
|
||||
log_m.add("\n")
|
||||
|
||||
|
||||
return {'hierarchy':log_h(),'dimension':log_d(),'level':log_l(),'measure':log_m()}
|
||||
|
||||
|
||||
|
||||
|
||||
query_builder_form = """<?xml version="1.0"?>
|
||||
<form string="Query Builder">
|
||||
<field name="dimension"/>
|
||||
<field name="hierarchy"/>
|
||||
<field name="level"/>
|
||||
<field name="measure"/>
|
||||
<field name="mdx_query" colspan="4" height="100" width="800"/>
|
||||
<field name="mdx_query_output" colspan="4" height="100" width="800"/>
|
||||
</form>"""
|
||||
query_builder_fields={
|
||||
|
||||
|
||||
'dimension':{'string':'Dimension','type':'text'},
|
||||
'hierarchy':{'string':'Hiearchy','type':'text'},
|
||||
'level':{'string':'Level','type':'text'},
|
||||
'measure':{'string':'Measure','type':'text'},
|
||||
'mdx_query':{'string':'MDX Query','type':'text'},
|
||||
'mdx_query_output':{'string':'MDX Query Output','type':'text'},
|
||||
}
|
||||
|
||||
query_builder_fetch_form = """<?xml version="1.0"?>
|
||||
<form string="Cube Fetcher">
|
||||
<field name="cube_schema"/>
|
||||
</form>"""
|
||||
|
||||
query_builder_fetch_fields = {
|
||||
'cube_schema':{'string':'Select Cube','type':'selection','selection':get_cube},
|
||||
}
|
||||
|
||||
|
||||
|
||||
def _execute_mdx(self, cr, uid, data, context):
|
||||
|
||||
log=Log()
|
||||
|
||||
pool = pooler.get_pool(cr.dbname).get('olap.schema')
|
||||
ids = pool.search(cr, uid, [('database_id','=',data['form']['cube_schema'][0])])
|
||||
res1 = pool.read(cr, uid, ids,['name'], context)
|
||||
|
||||
"""
|
||||
doing same using request method of olap.schema
|
||||
creating the object of olpa.schema and using its request method for parsing the query
|
||||
"""
|
||||
r=data['form']['mdx_query']
|
||||
n=res1[0]['name']
|
||||
service=netsvc.LocalService("object_proxy")
|
||||
axis,data1=service.execute(cr.dbname,uid,'olap.schema','request',n,r,context={})
|
||||
output=''
|
||||
|
||||
COLSPAN = 18
|
||||
ROWSPAN = 18
|
||||
if len(axis)>1:
|
||||
for i in range(8):
|
||||
ok = False
|
||||
for x in axis[1]:
|
||||
if len(x[0])==i:
|
||||
ok = True
|
||||
if not ok:
|
||||
continue
|
||||
#print ' '*COLSPAN,
|
||||
output =' '*COLSPAN
|
||||
log.add(output)
|
||||
# print (('%-'+str(ROWSPAN)+'s ' ) * len(axis[1])) % tuple(map(lambda x: str(len(x[0])==i and x[1] or ''),axis[1]))
|
||||
output=(('%-'+str(ROWSPAN)+'s ' ) * len(axis[1])) % tuple(map(lambda x: str(len(x[0])==i and x[1] or ''),axis[1]))
|
||||
log.add(output)
|
||||
|
||||
for col in data1:
|
||||
x=(' '*(len(axis[0][0][0])-1)*2)
|
||||
print "--------------------------------------",x
|
||||
temp=(axis[0].pop(0)[1])
|
||||
print "--------------------------------------",temp
|
||||
# print ('%-'+str(COLSPAN)+'s')% (' '*(len(axis[0][0][0])-1)*2 + (temp),),
|
||||
output =('%-'+str(COLSPAN)+'s')% (str(x)+str(temp))
|
||||
log.add("\n")
|
||||
log.add(output)
|
||||
#output=(temp)
|
||||
|
||||
for row in col:
|
||||
if row==[False]:
|
||||
# print ('%-'+str(ROWSPAN)+'s')%('',),
|
||||
output=('%-'+str(ROWSPAN)+'s')%('')
|
||||
log.add(output)
|
||||
|
||||
else:
|
||||
# print ('%-'+str(ROWSPAN)+'s')%(row,),
|
||||
output=('%-'+str(ROWSPAN)+'s')%(row)
|
||||
log.add(output)
|
||||
#print
|
||||
log.add("\n")
|
||||
return {'mdx_query_output':log()}
|
||||
|
||||
class wizard_query_builder(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type':'form', 'arch':query_builder_fetch_form, 'fields':query_builder_fetch_fields, 'state':[('ok', 'Fetch Data')]}
|
||||
},
|
||||
'ok':{
|
||||
'actions' : [get_details],
|
||||
'result' : {'type':'form', 'arch':query_builder_form, 'fields':query_builder_fields, 'state':[('back','Change cube'),('exec', 'Execute'),('end', 'Cancel')]}
|
||||
},
|
||||
|
||||
'exec': {
|
||||
'actions': [_execute_mdx],
|
||||
'result': {'type':'form','arch':query_builder_form,'fields':query_builder_fields,'state':[('back','Change cube'),('exec', 'Execute'),('end', 'Cancel')]},
|
||||
},
|
||||
'back':{
|
||||
'actions':[],
|
||||
'result':{'type':'form','arch':query_builder_fetch_form,'fields':query_builder_fetch_fields,'state':[('ok', 'Fetch Data')]},
|
||||
},
|
||||
}
|
||||
wizard_query_builder('olap.query_builder')
|
|
@ -0,0 +1,52 @@
|
|||
import psycopg2
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import netsvc
|
||||
from tools.misc import UpdateableStr, UpdateableDict
|
||||
|
||||
|
||||
_connection_arch = UpdateableStr()
|
||||
|
||||
def _test_connection(self,cr,uid,part,context={}):
|
||||
lines=pooler.get_pool(cr.dbname).get('olap.fact.database').browse(cr, uid, part['id'],context)
|
||||
host = lines.db_host
|
||||
port = lines.db_port
|
||||
db_name = lines.db_name
|
||||
user = lines.db_login
|
||||
password = lines.db_password
|
||||
type = lines.type
|
||||
return_str = "Connection Successful"
|
||||
try:
|
||||
if type == 'postgres':
|
||||
tdb = psycopg2.connect('host=%s port=%s dbname=%s user=%s password=%s' % (host, port, db_name, user, password))
|
||||
|
||||
elif type == 'mysql':
|
||||
import MySQLdb
|
||||
tdb = MySQLdb.connect(host = host,port = port, db = db_name, user = user, passwd = password)
|
||||
|
||||
|
||||
elif type == 'oracle':
|
||||
import cx_Oracle
|
||||
tdb = cx_Oracle.connect(user, password, host)
|
||||
|
||||
except Exception, e:
|
||||
return_str = e.message
|
||||
|
||||
_arch = ['''<?xml version="1.0"?>''', '''<form string="Connection Status">''']
|
||||
_arch.append('''<label string='%s' />''' % (return_str))
|
||||
_arch.append('''</form>''')
|
||||
_connection_arch.string = '\n'.join(_arch)
|
||||
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
class wizard_test_connection(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_test_connection],
|
||||
'result': {'type':'form', 'arch': _connection_arch, 'fields':{}, 'state':[('end','Ok')]}
|
||||
},
|
||||
}
|
||||
wizard_test_connection('olap.fact.database.test_connection')
|
|
@ -0,0 +1,22 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import olap_crm
|
|
@ -0,0 +1,37 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name" : "olap_crm",
|
||||
"version" : "0.1",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://www.openerp.com",
|
||||
"depends" : ["olap"],
|
||||
"category" : "Generic Modules/Olap",
|
||||
"description": """
|
||||
Sale module will load the data in olap tables
|
||||
""",
|
||||
"init_xml" : ['olap_data.xml'],
|
||||
"update_xml" :[],
|
||||
"demo_xml" : ['olap_crm.xml'],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * olap_crm
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 05:29:03+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 05:29:03+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: olap_crm
|
||||
#: model:ir.module.module,description:olap_crm.module_meta_information
|
||||
msgid "\n"
|
||||
" Sale module will load the data in olap tables\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_crm
|
||||
#: model:ir.module.module,shortdesc:olap_crm.module_meta_information
|
||||
msgid "olap_crm"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * olap_crm
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 05:29:03+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 05:29:03+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: olap_crm
|
||||
#: model:ir.module.module,description:olap_crm.module_meta_information
|
||||
msgid "\n"
|
||||
" Sale module will load the data in olap tables\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_crm
|
||||
#: model:ir.module.module,shortdesc:olap_crm.module_meta_information
|
||||
msgid "olap_crm"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,462 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="True">
|
||||
|
||||
<!--
|
||||
CUSTOM CUBE FOR CRM
|
||||
-->
|
||||
|
||||
<record model="olap.fact.database" id="fact_databases_BI">
|
||||
<field name="name">Open ERP CRM Database</field>
|
||||
<field name="db_name">crm</field>
|
||||
<field name="db_login">postgres</field>
|
||||
<field name="db_password">postgres</field>
|
||||
</record>
|
||||
<!--
|
||||
Schema
|
||||
-->
|
||||
<record model="olap.schema" id="schema_crm">
|
||||
<field name="name">OpenERPCRM</field>
|
||||
<field name="state">none</field>
|
||||
<field name="database_id" ref="fact_databases_BI"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Adding the database tables and database columns to be used and making up the of the
|
||||
cube table and cube table line
|
||||
-->
|
||||
|
||||
|
||||
<!-- Olap Database Tables -->
|
||||
<record model="olap.database.tables" id="table_crm_case">
|
||||
<field name="name">crm_case</field>
|
||||
<field name="table_db_name">crm_case</field>
|
||||
<field name="fact_database_id" ref="fact_databases_BI"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.tables" id="table_crm_case_categ">
|
||||
<field name="name">crm_case_categ</field>
|
||||
<field name="table_db_name">crm_case_categ</field>
|
||||
<field name="fact_database_id" ref="fact_databases_BI"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.tables" id="table_crm_case_stage">
|
||||
<field name="name">crm_case_stage</field>
|
||||
<field name="table_db_name">crm_case_stage</field>
|
||||
<field name="fact_database_id" ref="fact_databases_BI"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.tables" id="table_res_partner">
|
||||
<field name="name">res_partner</field>
|
||||
<field name="table_db_name">res_partner</field>
|
||||
<field name="fact_database_id" ref="fact_databases_BI"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.tables" id="table_crm_case_section">
|
||||
<field name="name">crm_case_section</field>
|
||||
<field name="table_db_name">crm_case_section</field>
|
||||
<field name="fact_database_id" ref="fact_databases_BI"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.tables" id="table_res_partner_canal">
|
||||
<field name="name">res_partner_canal</field>
|
||||
<field name="table_db_name">res_partner_canal</field>
|
||||
<field name="fact_database_id" ref="fact_databases_BI"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<!-- Olap Database Columns -->
|
||||
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_id">
|
||||
<field name="name">id</field>
|
||||
<field name="column_db_name">id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="primary_key">True</field>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="crm_case_planned_revenue">
|
||||
<field name="name">planned_revenue</field>
|
||||
<field name="column_db_name">planned_revenue</field>
|
||||
<field name="type">float8</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="crm_case_partner_id">
|
||||
<field name="name">parnter_id</field>
|
||||
<field name="column_db_name">partner_id</field>
|
||||
<field name="type">float8</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="active">True</field>
|
||||
<field name="related_to" ref="table_res_partner"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_planned_cost">
|
||||
<field name="name">id</field>
|
||||
<field name="column_db_name">id</field>
|
||||
<field name="type">float8</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="crm_case_probability">
|
||||
<field name="name">probability</field>
|
||||
<field name="column_db_name">probability</field>
|
||||
<field name="type">float8</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="crm_case_state">
|
||||
<field name="name">state</field>
|
||||
<field name="column_db_name">state</field>
|
||||
<field name="type">varchar</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="res_partner_canal_name">
|
||||
<field name="name">name</field>
|
||||
<field name="column_db_name">name</field>
|
||||
<field name="type">varchar</field>
|
||||
<field name="table_id" ref="table_res_partner_canal"/>
|
||||
<field name="active">True</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_categ_id">
|
||||
<field name="name">categ_id</field>
|
||||
<field name="column_db_name">categ_id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="related_to" ref="table_crm_case_categ"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_partner_id">
|
||||
<field name="name">partner_id</field>
|
||||
<field name="column_db_name">partner_id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="related_to" ref="table_res_partner"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_canal_id">
|
||||
<field name="name">canal_id</field>
|
||||
<field name="column_db_name">canal_id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="related_to" ref="table_res_partner_canal"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.database.columns" id="res_partner_name">
|
||||
<field name="name">name</field>
|
||||
<field name="column_db_name">name</field>
|
||||
<field name="type">varchar</field>
|
||||
<field name="table_id" ref="table_res_partner"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_section_name">
|
||||
<field name="name">name</field>
|
||||
<field name="column_db_name">name</field>
|
||||
<field name="type">varchar</field>
|
||||
<field name="table_id" ref="table_crm_case_section"/>
|
||||
</record>
|
||||
<record model="olap.database.columns" id="crm_case_stage_name">
|
||||
<field name="name">name</field>
|
||||
<field name="column_db_name">name</field>
|
||||
<field name="type">varchar</field>
|
||||
<field name="table_id" ref="table_crm_case_stage"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_stage_id">
|
||||
<field name="name">stage_id</field>
|
||||
<field name="column_db_name">stage_id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="related_to" ref="table_crm_case_stage"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_stage_section_id">
|
||||
<field name="name">section_id</field>
|
||||
<field name="column_db_name">section_id</field>
|
||||
<field name="type">int4</field>
|
||||
<field name="table_id" ref="table_crm_case_stage"/>
|
||||
<field name="related_to" ref="table_crm_case_section"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.database.columns" id="crm_case_categ_name">
|
||||
<field name="name">name</field>
|
||||
<field name="column_db_name">name</field>
|
||||
<field name="type">varchar</field>
|
||||
<field name="table_id" ref="table_crm_case_categ"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!-- Cube-->
|
||||
|
||||
<!-- Cube Table -->
|
||||
<record model="olap.cube.table" id="crm_cube_table">
|
||||
<field name="name">crm_cube</field>
|
||||
<field name='schema_id' ref='schema_crm'/>
|
||||
<field name='column_link_id' ref='crm_case_id'/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.cube.table" id="crm_cube_section_table">
|
||||
<field name="name">crm_cube_section</field>
|
||||
<field name='schema_id' ref='schema_crm'/>
|
||||
<field name='column_link_id' ref='crm_case_stage_id'/>
|
||||
</record>
|
||||
|
||||
<record model="olap.cube.table" id="crm_cube_stage_table">
|
||||
<field name="name">crm_cube_stage_parnter</field>
|
||||
<field name='schema_id' ref='schema_crm'/>
|
||||
<field name='column_link_id' ref='crm_case_stage_id'/>
|
||||
</record>
|
||||
<record model="olap.cube.table" id="crm_cube_parnter_table">
|
||||
<field name="name">crm_cube_parnter</field>
|
||||
<field name='schema_id' ref='schema_crm'/>
|
||||
<field name='column_link_id' ref='crm_case_partner_id'/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.cube.table" id="crm_cube_categ_table">
|
||||
<field name="name">crm_cube_categ</field>
|
||||
<field name='schema_id' ref='schema_crm'/>
|
||||
<field name='column_link_id' ref='crm_case_categ_id'/>
|
||||
</record>
|
||||
|
||||
<record model="olap.cube.table" id="crm_cube_channel_table">
|
||||
<field name="name">crm_cube_channel</field>
|
||||
<field name='schema_id' ref='schema_crm'/>
|
||||
<field name='column_link_id' ref='crm_case_canal_id'/>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Cube Table Line -->
|
||||
<record model="olap.cube.table.line" id="crm_cube_table_line">
|
||||
<field name="field_id" ref="crm_case_categ_id"/>
|
||||
<field name="table_id" ref="table_crm_case"/>
|
||||
<field name="cube_table_id" ref="crm_cube_table"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.cube.table.line" id="crm_section_table_line">
|
||||
<field name="field_id" ref="crm_case_stage_section_id"/>
|
||||
<field name="table_id" ref="table_crm_case_stage"/>
|
||||
<field name="cube_table_id" ref="crm_cube_section_table"/>
|
||||
</record>
|
||||
<!-- Cube -->
|
||||
|
||||
<record model="olap.cube" id="cube_crm">
|
||||
<field name="name">CRM</field>
|
||||
<field name="table_id" ref="crm_cube_table"/>
|
||||
<field name="schema_id" ref="schema_crm"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
DIMENSION Sections
|
||||
|
||||
-->
|
||||
|
||||
<record model="olap.dimension" id="dimension_crm_section">
|
||||
<field name="name">Sections</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.hierarchy" id="hierarchy_crm_section">
|
||||
<field name="name">Sections</field>
|
||||
<field name="dimension_id" ref="dimension_crm_section"/>
|
||||
<field name="table_id" ref="crm_cube_section_table"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.level" id="level_crm_section">
|
||||
<field name="name">Sections</field>
|
||||
<field name="column_name" ref="crm_case_section_name"></field>
|
||||
<field name="column_id_name">name</field>
|
||||
<field name="table_name">crm_case_section</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_crm_section"/>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.level" id="level_crm_section_seq_2">
|
||||
<field name="name">States</field>
|
||||
<field name="column_name" ref="crm_case_stage_name"></field>
|
||||
<field name="column_id_name">name</field>
|
||||
<field name="table_name">crm_case_stage</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_crm_section"/>
|
||||
<field name="sequence">2</field>
|
||||
</record>
|
||||
|
||||
<!-- Dimension State-->
|
||||
|
||||
<record model="olap.dimension" id="dimension_crm_state">
|
||||
<field name="name">States</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.hierarchy" id="hierarchy_crm_state">
|
||||
<field name="name">States</field>
|
||||
<field name="dimension_id" ref="dimension_crm_state"/>
|
||||
<field name="table_id" ref="crm_cube_table"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.level" id="level_crm_section">
|
||||
<field name="name">States</field>
|
||||
<field name="column_name" ref="crm_case_state"></field>
|
||||
<field name="column_id_name">state</field>
|
||||
<field name="table_name">crm_case</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_crm_state"/>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.level" id="level_crm_section_seq_2">
|
||||
<field name="name">States</field>
|
||||
<field name="column_name" ref="crm_case_stage_name"></field>
|
||||
<field name="column_id_name">name</field>
|
||||
<field name="table_name">crm_case_stage</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_crm_section"/>
|
||||
<field name="sequence">2</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Category
|
||||
-->
|
||||
<record model="olap.dimension" id="dimension_crm_category">
|
||||
<field name="name">Category</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.hierarchy" id="hierarchy_crm_category">
|
||||
<field name="name">Category</field>
|
||||
<field name="dimension_id" ref="dimension_crm_category"/>
|
||||
<field name="primary_key_table">crm_case</field>
|
||||
<field name="table_id" ref="crm_cube_categ_table"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.level" id="level_crm_categorys">
|
||||
<field name="name">name</field>
|
||||
<field name="column_name" ref="crm_case_categ_name"></field>
|
||||
<field name="column_id_name">name</field>
|
||||
<field name="table_name">crm_case_categ</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_crm_category"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Customer
|
||||
-->
|
||||
<record model="olap.dimension" id="dimension_crm_customer">
|
||||
<field name="name">Customer</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.hierarchy" id="hierarchy_crm_customer">
|
||||
<field name="name">Customer</field>
|
||||
<field name="dimension_id" ref="dimension_crm_customer"/>
|
||||
<field name="primary_key_table">crm_case</field>
|
||||
<field name="table_id" ref="crm_cube_parnter_table"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.level" id="level_crm_category">
|
||||
<field name="name">name</field>
|
||||
<field name="column_name" ref="res_partner_name"></field>
|
||||
<field name="column_id_name">name</field>
|
||||
<field name="table_name">res_partner</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_crm_customer"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record model="olap.dimension" id="dimension_crm_channel">
|
||||
<field name="name">Channels</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="olap.hierarchy" id="hierarchy_crm_channel">
|
||||
<field name="name">Channel</field>
|
||||
<field name="dimension_id" ref="dimension_crm_channel"/>
|
||||
<field name="table_id" ref="crm_cube_channel_table"/>
|
||||
</record>
|
||||
|
||||
<record model="olap.level" id="level_crm_channel">
|
||||
<field name="name">Channel</field>
|
||||
<field name="column_name" ref="res_partner_canal_name"></field>
|
||||
<field name="column_id_name">name</field>
|
||||
<field name="table_name">res_partner_canal</field>
|
||||
<field name="hierarchy_id" ref="hierarchy_crm_channel"/>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Measures
|
||||
-->
|
||||
|
||||
<record model="olap.measure" id="measure_crm_total_cases">
|
||||
<field name="name">Total Cases</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
<field name="measure_type">sql_expr</field>
|
||||
<field name="value_sql">count(crm_case.id)</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.measure" id="measure_crm_avg_planned_cost">
|
||||
<field name="name">Average Planned Revenue</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
<field name="measure_type">sql_expr</field>
|
||||
<field name="value_sql">avg(crm_case.planned_revenue)</field>
|
||||
<field name="formatstring">cr_postfix_comma</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.measure" id="measure_crm_avg_planned_revenue">
|
||||
<field name="name">Average Planned Cost</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
<field name="measure_type">sql_expr</field>
|
||||
<field name="value_sql">avg(crm_case.planned_cost)</field>
|
||||
<field name="formatstring">cr_postfix_comma</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.measure" id="measure_planned_revenue">
|
||||
<field name="name">Planned Revenue</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
<field name="value_column" ref="crm_case_planned_cost"></field>
|
||||
<field name="value_column_id_name">planned_cost</field>
|
||||
<field name="table_name">crm_case</field>
|
||||
<field name="agregator">sum</field>
|
||||
<field name="formatstring">cr_postfix_comma</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.measure" id="measure_planned_revenue">
|
||||
<field name="name">Planned Revenue</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
<field name="value_column" ref="crm_case_planned_revenue"></field>
|
||||
<field name="value_column_id_name">planned_revenue</field>
|
||||
<field name="table_name">crm_case</field>
|
||||
<field name="agregator">sum</field>
|
||||
</record>
|
||||
|
||||
<record model="olap.measure" id="measure_probability">
|
||||
<field name="name">Probability</field>
|
||||
<field name="cube_id" ref="cube_crm"/>
|
||||
<field name="value_column" ref="crm_case_probability"></field>
|
||||
<field name="value_column_id_name">probability</field>
|
||||
<field name="table_name">crm_case</field>
|
||||
<field name="agregator">sum</field>
|
||||
</record>
|
||||
d
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,23 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import olap_extract
|
||||
import wizard_olap_extract
|
|
@ -0,0 +1,37 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name" : "Module to extracts the schema structure",
|
||||
"version" : "0.1",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://www.openerp.com",
|
||||
"depends" : ["olap"],
|
||||
"category" : "Generic Modules/Olap",
|
||||
"description": """
|
||||
Extracts the schema structure.
|
||||
""",
|
||||
"init_xml" : [],
|
||||
"update_xml" : ["olap_extract_wizard.xml"],
|
||||
"demo_xml" : [],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * olap_extract
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 05:29:21+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 05:29:21+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: olap_extract
|
||||
#: model:ir.module.module,shortdesc:olap_extract.module_meta_information
|
||||
msgid "olap_extract"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_button:olap.extract.schema,init,ok:0
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: model:ir.actions.wizard,name:olap_extract.bi_olap_extract_schema
|
||||
msgid "Olap Extract"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: model:ir.module.module,description:olap_extract.module_meta_information
|
||||
msgid "\n"
|
||||
" Extracts the schema structure.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_field:olap.extract.schema,init,module_name:0
|
||||
msgid "Module Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_button:olap.extract.schema,init,end:0
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_view:olap.extract.schema,init:0
|
||||
msgid "New Module Name"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * olap_extract
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 05:29:21+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 05:29:21+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: olap_extract
|
||||
#: model:ir.module.module,shortdesc:olap_extract.module_meta_information
|
||||
msgid "olap_extract"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_button:olap.extract.schema,init,ok:0
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: model:ir.actions.wizard,name:olap_extract.bi_olap_extract_schema
|
||||
msgid "Olap Extract"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: model:ir.module.module,description:olap_extract.module_meta_information
|
||||
msgid "\n"
|
||||
" Extracts the schema structure.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_field:olap.extract.schema,init,module_name:0
|
||||
msgid "Module Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_button:olap.extract.schema,init,end:0
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_extract
|
||||
#: wizard_view:olap.extract.schema,init:0
|
||||
msgid "New Module Name"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
string="Olap Extract"
|
||||
model="olap.schema"
|
||||
name="olap.extract.schema"
|
||||
menu= "True"
|
||||
id="bi_olap_extract_schema"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,249 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
import csv
|
||||
import os
|
||||
import time
|
||||
import netsvc
|
||||
import zipfile
|
||||
|
||||
|
||||
form1 = '''<?xml version="1.0"?>
|
||||
<form string="New Module Name">
|
||||
<field name='module_name'/>
|
||||
</form>'''
|
||||
|
||||
field1 = {
|
||||
'module_name': {'string':'Module Name', 'type':'char','size':'64', 'required':True},
|
||||
}
|
||||
|
||||
|
||||
class wizard_olap_extract(wizard.interface):
|
||||
|
||||
def zipper(self,zipname,filename,mode="a"):
|
||||
z = zipfile.ZipFile(zipname+".zip", mode)
|
||||
z.write(filename)
|
||||
print "\n",z.printdir()
|
||||
|
||||
|
||||
def write_csv(self,filename,content=[]):
|
||||
fid = open(filename, 'w')
|
||||
if fid == -1:
|
||||
print 'File: temp.csv not found or could not be opened'
|
||||
return False
|
||||
else:
|
||||
writer=csv.writer(fid, 'TINY',delimiter=',')
|
||||
for row in content:
|
||||
writer.writerow(row)
|
||||
fid.close
|
||||
return True
|
||||
|
||||
def table_depth(self,cr,uid,list=[],context={}):
|
||||
|
||||
res={}
|
||||
templeft={}
|
||||
tempright={}
|
||||
for table_id in list:
|
||||
lines=pooler.get_pool(cr.dbname).get('olap.cube.table').browse(cr, uid,table_id,context)
|
||||
res[str(lines.id)] = ["cubetable_"+str(lines.id),lines.name and lines.name or '',lines.table_alias and lines.table_alias or '',lines.key_left and lines.key_left or '',lines.key_right and lines.key_right or '',lines.table_left_id.id and "cubetable_"+str(lines.table_left_id.id) or '',lines.table_right_id.id and "cubetable_"+str(lines.table_right_id.id) or '']
|
||||
if(lines.table_left_id.id):
|
||||
templeft = self.table_depth(cr,uid,[lines.table_left_id.id],context)
|
||||
|
||||
if templeft:
|
||||
for temp in templeft:
|
||||
if not res.has_key(temp):
|
||||
res[temp]= templeft[temp]
|
||||
|
||||
|
||||
if(lines.table_right_id.id):
|
||||
tempright = self.table_depth(cr,uid,[lines.table_right_id.id],context)
|
||||
|
||||
if tempright:
|
||||
for temp in tempright:
|
||||
if not res.has_key(temp):
|
||||
res[temp]= tempright[temp]
|
||||
return res
|
||||
|
||||
|
||||
def _extract_schema(self, cr, uid, data, context={}):
|
||||
|
||||
_name = data['form']['module_name']
|
||||
_modulename = "olap_"+_name
|
||||
|
||||
dirname = _modulename
|
||||
if not os.path.isdir("./addons/" + dirname + "/"):
|
||||
os.mkdir("./addons/" + dirname + "/")
|
||||
|
||||
os.chdir("./addons/"+dirname)
|
||||
|
||||
_init = "import %s" % _modulename
|
||||
f = open("__init__.py","w")
|
||||
f.write(_init)
|
||||
f.close()
|
||||
self.zipper(_modulename, "__init__.py","w")
|
||||
|
||||
_init_files = {
|
||||
"1":"olap.fact.database.csv",
|
||||
"2":"olap.schema.csv",
|
||||
"5":"olap.cube.table.csv",
|
||||
"6":"olap.cube.csv",
|
||||
"7":"olap.dimension.csv",
|
||||
"8":"olap.hierarchy.csv",
|
||||
"9":"olap.level.csv",
|
||||
"10":"olap.measure.csv"
|
||||
}
|
||||
_init_xml = """"%(1)s",
|
||||
"%(2)s",
|
||||
"%(5)s",
|
||||
"%(6)s",
|
||||
"%(7)s",
|
||||
"%(8)s",
|
||||
"%(9)s",
|
||||
"%(10)s",
|
||||
""" % _init_files
|
||||
|
||||
data['modulename'] = _modulename
|
||||
data['init_xml'] = _init_xml
|
||||
|
||||
_terp= """{
|
||||
"name" : "%(modulename)s",
|
||||
"version" : "0.1",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://tinyerp.com/",
|
||||
"depends" : ["olap"],
|
||||
"category" : "Generic Modules/Others",
|
||||
"description": "Module will load the data in olap tables",
|
||||
"init_xml" :[
|
||||
%(init_xml)s
|
||||
],
|
||||
"update_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}"""%data
|
||||
|
||||
f = open("__terp__.py","w")
|
||||
f.write(_terp)
|
||||
f.close()
|
||||
self.zipper(_modulename, "__terp__.py")
|
||||
|
||||
|
||||
schema_id = data['id']
|
||||
|
||||
lines=pooler.get_pool(cr.dbname).get('olap.schema').browse(cr, uid, schema_id,context)
|
||||
|
||||
_extract=[]
|
||||
_extract.append(['id','name','db_name','db_login','db_password'])
|
||||
_extract.append(["db_"+str(lines.database_id.id),lines.database_id.name,lines.database_id.db_name,lines.database_id.db_login,lines.database_id.db_password])
|
||||
self.write_csv('olap.fact.database.csv',_extract)
|
||||
self.zipper(_modulename, "olap.fact.database.csv")
|
||||
|
||||
_extract=[]
|
||||
_extract.append(['id','name','database_id:id','loaded','configure','ready','state','note'])
|
||||
_extract.append(["schema_"+str(lines.id),lines.name,"db_"+str(lines.database_id.id),lines.loaded and lines.loaded or '',lines.configure and lines.configure or '', lines.ready and lines.ready or '',lines.state,lines.note and lines.note or ''])
|
||||
self.write_csv('olap.schema.csv',_extract)
|
||||
self.zipper(_modulename, "olap.schema.csv")
|
||||
|
||||
cube_ids = lines.cube_ids
|
||||
_extractcubes=[]
|
||||
_extractcubes.append(['id','name','table_id:id','schema_id:id'])
|
||||
|
||||
_extractmeasures=[]
|
||||
_extractmeasures.append(['id','name','cube_id:id','value_column','value_sql','agregator','datatype','formatstring'])
|
||||
|
||||
_extractdimension=[]
|
||||
_extractdimension.append(['id','name','foreign_key','foreign_key_table','cube_id:id'])
|
||||
|
||||
_extracthiers=[]
|
||||
_extracthiers.append(['id','name','primary_key','primary_key_table','field_name','member_all','member_default','sequence','type','dimension_id:id','table_id:id'])
|
||||
|
||||
_extractlevels=[]
|
||||
_extractlevels.append(['id','name','column_name','column_id_name','type','table_name','sequence','hierarchy_id:id'])
|
||||
|
||||
_cube_table_ids = []
|
||||
for cube in cube_ids:
|
||||
_extractcubes.append(["cube_"+str(cube.id),cube.name,"cubetable_"+str(cube.table_id.id),"schema_"+str(cube.schema_id.id)])
|
||||
_cube_table_ids.append(cube.table_id.id)
|
||||
|
||||
measure_ids = cube.measure_ids
|
||||
for measure in measure_ids:
|
||||
_extractmeasures.append(["msr_"+str(measure.id),measure.name,"cube_"+str(measure.cube_id.id),measure.value_column and measure.value_column or '',measure.value_sql and measure.value_sql or '',measure.agregator,measure.datatype and measure.datatype or '',measure.formatstring])
|
||||
|
||||
dimension_ids = cube.dimension_ids
|
||||
for dimension in dimension_ids:
|
||||
_extractdimension.append(["dim_"+str(dimension.id),dimension.name,dimension.foreign_key and dimension.foreign_key or '',dimension.foreign_key_table and dimension.foreign_key_table or '',"cube_"+str(dimension.cube_id.id)])
|
||||
|
||||
hiers_ids = dimension.hierarchy_ids
|
||||
for hier in hiers_ids:
|
||||
_extracthiers.append(["hier_"+str(hier.id),hier.name,hier.primary_key,hier.primary_key_table and hier.primary_key_table or '',hier.field_name,hier.member_all,hier.member_default,hier.sequence,hier.type,"dim_"+str(hier.dimension_id.id),"cubetable_"+str(hier.table_id.id)])
|
||||
_cube_table_ids.append(hier.table_id.id)
|
||||
|
||||
level_ids = hier.level_ids
|
||||
for level in level_ids:
|
||||
_extractlevels.append(["lvl_"+str(level.id),level.name,level.column_name,level.column_id_name,level.type,level.table_name,level.sequence,"hier_"+str(level.hierarchy_id.id)])
|
||||
|
||||
res={}
|
||||
_extract=[]
|
||||
_extract.append(['id','name','table_alias','key_left','key_right','table_left_id:id','table_right_id:id'])
|
||||
res = self.table_depth(cr,uid,_cube_table_ids,context)
|
||||
key = res.keys()
|
||||
key = map(lambda x: int(x),key)
|
||||
key.sort()
|
||||
|
||||
for k in key:
|
||||
_extract.append(res[str(k)])
|
||||
|
||||
self.write_csv('olap.cube.csv',_extractcubes)
|
||||
self.zipper(_modulename, "olap.cube.csv")
|
||||
|
||||
self.write_csv('olap.measure.csv',_extractmeasures)
|
||||
self.zipper(_modulename, "olap.measure.csv")
|
||||
|
||||
self.write_csv('olap.dimension.csv',_extractdimension)
|
||||
self.zipper(_modulename, "olap.dimension.csv")
|
||||
|
||||
self.write_csv('olap.hierarchy.csv',_extracthiers)
|
||||
self.zipper(_modulename, "olap.hierarchy.csv")
|
||||
|
||||
self.write_csv('olap.level.csv',_extractlevels)
|
||||
self.zipper(_modulename, "olap.level.csv")
|
||||
|
||||
self.write_csv('olap.cube.table.csv',_extract)
|
||||
self.zipper(_modulename, "olap.cube.table.csv")
|
||||
|
||||
return {}
|
||||
|
||||
states = {
|
||||
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form','arch':form1, 'fields':field1, 'state':[('end','Cancel'),('ok','OK')]}
|
||||
},
|
||||
|
||||
'ok' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'action' ,'action':_extract_schema,'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
wizard_olap_extract('olap.extract.schema')
|
|
@ -0,0 +1,22 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import olap_sale
|
|
@ -0,0 +1,37 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name" : "Load Sale Module data in Olap Tables",
|
||||
"version" : "0.1",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://www.openerp.com",
|
||||
"depends" : ["olap"],
|
||||
"category" : "Generic Modules/Olap",
|
||||
"description": """
|
||||
Sale module will load the data in olap tables
|
||||
""",
|
||||
"init_xml" : ['olap_data.xml'],
|
||||
"update_xml" :[],
|
||||
"demo_xml" : ['olap_sale.xml'],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * olap_sale
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 05:29:36+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 05:29:36+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: olap_sale
|
||||
#: model:ir.module.module,description:olap_sale.module_meta_information
|
||||
msgid "\n"
|
||||
" Sale module will load the data in olap tables\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_sale
|
||||
#: model:ir.module.module,shortdesc:olap_sale.module_meta_information
|
||||
msgid "olap_sale"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * olap_sale
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 05:29:36+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 05:29:36+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: olap_sale
|
||||
#: model:ir.module.module,description:olap_sale.module_meta_information
|
||||
msgid "\n"
|
||||
" Sale module will load the data in olap tables\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: olap_sale
|
||||
#: model:ir.module.module,shortdesc:olap_sale.module_meta_information
|
||||
msgid "olap_sale"
|
||||
msgstr ""
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue