[IMP] account_analytic_analysis: added an option to set the template field mandatory on contracts

bzr revid: qdp-launchpad@openerp.com-20121129160847-k4dr5hd4dh2y3gcw
This commit is contained in:
Quentin (OpenERP) 2012-11-29 17:08:47 +01:00
parent a520d65e87
commit dc298cd336
7 changed files with 76 additions and 3 deletions

View File

@ -21,6 +21,7 @@
import account_analytic_analysis
import cron_account_analytic_account
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -40,6 +40,7 @@ Adds menu to show relevant information to each manager.You can also view the rep
'account_analytic_analysis_view.xml',
'account_analytic_analysis_menu.xml',
'account_analytic_analysis_cron.xml',
'res_config_view.xml',
],
'css': [
'static/src/css/analytic.css'

View File

@ -147,6 +147,18 @@
</field>
</record>
<record id="view_account_analytic_account_template_required" model="ir.ui.view">
<field name="name">account.analytic.account.form.template.required</field>
<field name="model">account.analytic.account</field>
<field name="groups_id" eval="[(6, 0, [ref('group_template_required')])]"/>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="arch" type="xml">
<field name="template_id" position="attributes">
<attribute name="required">True</attribute>
</field>
</field>
</record>
<record id="template_of_contract_action" model="ir.actions.act_window">
<field name="name">Template of Contract</field>
<field name="type">ir.actions.act_window</field>

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# 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 fields, osv
class sale_configuration(osv.osv_memory):
_inherit = 'sale.config.settings'
_columns = {
'group_template_required': fields.boolean("Mandatory use of templates.",
implied_group='account_analytic_analysis.group_template_required',
help="Allows you to set the template field as required when creating an analytic account or a contract."),
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_sales_config" model="ir.ui.view">
<field name="name">sale settings</field>
<field name="model">sale.config.settings</field>
<field name="inherit_id" ref="sale.view_sales_config"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='module_analytic_user_function']" position="inside">
<div>
<field name="group_template_required" class="oe_inline"/>
<label for="group_template_required"/>
</div>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -6,5 +6,12 @@
<field eval="[(4,ref('sale.group_analytic_accounting'))]" name="groups_id"/>
</record>
<record id="group_template_required" model="res.groups">
<field name="name">Mandatory use of templates in contracts</field>
<field name="category_id" ref="base.module_category_sales_management"/>
<field name="comment">the field template of the analytic accounts and contracts will be required.</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
</record>
</data>
</openerp>
</openerp>

View File

@ -86,13 +86,13 @@
your customer.
</p>
<group>
<label for="id" string="Contract Feature"/>
<label for="id" string="Contract Features"/>
<div>
<div>
<field name="module_account_analytic_analysis" on_change="onchange_timesheet(module_account_analytic_analysis)" class="oe_inline"/>
<label for="module_account_analytic_analysis"/>
</div>
<div attrs="{'invisible':[('module_account_analytic_analysis','=',False)]}">
<div name="module_analytic_user_function" attrs="{'invisible':[('module_account_analytic_analysis','=',False)]}">
<field name="module_analytic_user_function" class="oe_inline"/>
<label for="module_analytic_user_function"/>
</div>