Skip to content
Snippets Groups Projects
Commit 597e0c56b932 authored by Alexandre Allouche's avatar Alexandre Allouche
Browse files

INIT

parents
No related branches found
No related tags found
No related merge requests found
syntax: glob
**/*.pyc
*.pyc
*.swp
.tmp*
*.egg-info
dist/*
build/*
lib/*
*.orig
*.log
.settings/*
data/*
storage/*
.project
.idea
.pydevproject
*.db
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 XCG Consulting (www.xcg-consulting.fr)
#
# 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 analytic_code
import analytic_dimension
import analytic_structure
# -*- coding: utf-8 -*-
##############################################################################
#
# Account Analytic Online, for OpenERP
# Copyright (C) 2013 XCG Consulting (www.xcg-consulting.fr)
#
# 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" : "Analytic Structure",
"version" : "0.1",
"author" : "XCG Consulting",
"category": 'Dependency',
"description": """
This module allows to use several analytic dimensions through a structure related
to an object model.
==================================================================================
""",
'website': 'http://www.openerp-experts.com',
"depends" : ['base'],
"data": [
'analytic_dimension.xml',
],
#'demo_xml': [],
'test': [],
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 XCG Consulting (www.xcg-consulting.fr)
#
# 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 openerp.osv import fields, osv
from openerp.tools.translate import _
class analytic_code(osv.Model):
_name = "analytic.code"
_columns = dict(
name=fields.char("Name", size=128, translate=True, required=True),
nd_id=fields.many2one(
"analytic.dimension", ondelete="restrict"),
nd_name=fields.related('nd_id', 'name', type="char", string="Dimension Name", store=False),
)
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 XCG Consulting (www.xcg-consulting.fr)
#
# 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 openerp.osv import fields, osv
from openerp.tools.translate import _
class analytic_dimension(osv.Model):
_name = "analytic.dimension"
_columns = dict(
name=fields.char("Name", size=128, translate=True, required=True),
validated=fields.boolean("Validated"),
nc_ids=fields.one2many("analytic.code", "nd_id"),
ns_id=fields.one2many("analytic.structure", "nd_id"),
)
_sql_constraints = [
('unique_name', 'unique(name)', 'name must be unique'),
]
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_analytic_dimension" model="ir.ui.view">
<field name="name">analytic.dimension.view.form</field>
<field name="model">analytic.dimension</field>
<field name="arch" type="xml">
<form string="Analytic Dimension" version="7.0">
<label for="name" class="oe_edit_only" string="Dimension Name"/>
<h1>
<field name="name" class="oe_inline" placeholder="Dimension Name" style="width: 6em"/>
</h1>
<group colspan="4" col="4">
<field name="validated"/>
<newline />
<field name="nc_ids" string="ANCs">
<tree string="Analysis Codes" editable="bottom">
<field name="name"/>
</tree>
<form string="Analysis Codes" version="7.0">
<field name="name"/>
</form>
</field>
</group>
</form>
</field>
</record>
<record id="action_analytic_dimension" model="ir.actions.act_window">
<field name="name">Analytic Dimension</field>
<field name="res_model">analytic.dimension</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Analytical Dimensions (AND) for your system.
</p>
</field>
</record>
<record id="view_analytic_structure" model="ir.ui.view">
<field name="name">analytic.structure.view.form</field>
<field name="model">analytic.structure</field>
<field name="arch" type="xml">
<form string="Analytic Structure" version="7.0">
<label for="model_name" class="oe_edit_only" string="Target Model Name"/>
<h1>
<field name="model_name" class="oe_inline" placeholder="Target Model Name" style="width: 6em"/>
</h1>
<group colspan="4" col="4">
<field name="nd_id"/>
<newline />
<field name="ordering"/>
</group>
</form>
</field>
</record>
<record id="tree_analytic_structure" model="ir.ui.view">
<field name="name">analytic.structure.view.tree</field>
<field name="model">analytic.structure</field>
<field name="arch" type="xml">
<tree string="Analytic Structure">
<field name="model_name" placeholder="Target Model Name"/>
<field name="nd_id"/>
<field name="ordering"/>
</tree>
</field>
</record>
<record id="action_analytic_structure" model="ir.actions.act_window">
<field name="name">Analytic Structure</field>
<field name="res_model">analytic.structure</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Define Analytical Structure (ANS) for objects in your system.
</p>
</field>
</record>
<!-- we add our config entries to the accounting configuration menu -->
<menuitem id="menu_analytic_config_root" name="Analytic" parent="base.menu_custom" sequence="5" />
<menuitem id="menu_analytic_dimension" name="Dimensions" parent="menu_analytic_config_root" sequence="10" action="action_analytic_dimension" />
<menuitem id="menu_analytic_structure" name="Structure" parent="menu_analytic_config_root" sequence="15" action="action_analytic_structure" />
</data>
</openerp>
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 XCG Consulting (www.xcg-consulting.fr)
#
# 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 openerp.osv import fields, osv
from openerp.tools.translate import _
ORDER_SELECTION = (
('1', 'Analysis 1'),
('2', 'Analysis 2'),
('3', 'Analysis 3'),
('4', 'Analysis 4'),
('5', 'Analysis 5')
)
class analytic_structure(osv.Model):
_name = "analytic.structure"
_columns = dict(
model_name=fields.char("Object", size=128, required=True, select="1"),
nd_id=fields.many2one(
"analytic.dimension", "Related Dimension", ondelete="restrict", required=True, select="1",
domain=[('ns_id', '=', None)]),
ordering=fields.selection(ORDER_SELECTION, 'Analysis slot', required=True),
)
_sql_constraints = [
('unique_ordering', 'unique(model_name,ordering)', 'One dimension per Analysis slot per object'),
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment