[ADD] account: Added config files.
bzr revid: uco@tinyerp.com-20120307124301-ey6qvcafb3uibuqy
This commit is contained in:
parent
a86051c046
commit
5128b93091
|
@ -37,4 +37,5 @@ import ir_sequence
|
|||
import company
|
||||
import res_currency
|
||||
import edi
|
||||
import res_config
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -125,7 +125,8 @@ module named account_voucher.
|
|||
'board_account_view.xml',
|
||||
"edi/invoice_action_data.xml",
|
||||
"account_bank_view.xml",
|
||||
"account_pre_install.yml"
|
||||
"account_pre_install.yml",
|
||||
"res_config_view.xml",
|
||||
],
|
||||
'demo_xml': [
|
||||
'demo/account_demo.xml',
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 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 operator import itemgetter
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class account_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
def _get_charts(self, cr, uid, context=None):
|
||||
modules = self.pool.get('ir.module.module')
|
||||
# Looking for the module with the 'Account Charts' category
|
||||
category_name, category_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'module_category_localization_account_charts')
|
||||
ids = modules.search(cr, uid, [('category_id', '=', category_id)], context=context)
|
||||
charts = list(
|
||||
sorted(((m.name, m.shortdesc)
|
||||
for m in modules.browse(cr, uid, ids, context=context)),
|
||||
key=itemgetter(1)))
|
||||
charts.insert(0, ('configurable', 'Generic Chart Of Accounts'))
|
||||
return charts
|
||||
|
||||
_columns = {
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'currency_id': fields.many2one('res.currency','Main Currency'),
|
||||
'sale_tax': fields.float('Default Sale Tax'),
|
||||
'purchase_tax': fields.float('Default Purchase Tax'),
|
||||
'charts': fields.selection(_get_charts, 'Chart of Accounts',
|
||||
required=True,
|
||||
help="Installs localized accounting charts to match as closely as "
|
||||
"possible the accounting needs of your company based on your "
|
||||
"country."),
|
||||
'chart_template_id': fields.many2one('account.chart.template', 'Chart Template'),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year'),
|
||||
'paypal_account': fields.char("Your Paypal Account", size=128, help="Paypal username (usually email) for receiving online payments."),
|
||||
'company_footer': fields.char("Footer of Reports", size=128),
|
||||
'customer_invoice_sequence_prefix': fields.char('Invoice Sequence', size=64),
|
||||
'customer_invoice_sequence_padding': fields.integer('Invoice Sequence Padding'),
|
||||
'customer_refund_sequence_prefix': fields.char('Refund Sequence', size=64),
|
||||
'customer_refund_sequence_padding': fields.integer('Refund Sequence Padding'),
|
||||
'supplier_invoice_sequence_prefix': fields.char('Supplier Invoice Sequence', size=64),
|
||||
'supplier_invoice_sequence_padding': fields.integer('Supplier Invoice Sequence Padding'),
|
||||
'supplier_refund_sequence_prefix': fields.char('Supplier Refund Sequence', size=64),
|
||||
'supplier_refund_sequence_padding': fields.integer('Supplier Refund Sequence Padding'),
|
||||
|
||||
'module_account_check_writing': fields.boolean('Support check writings'),
|
||||
'module_account_accountant': fields.boolean('Accountant Features'),
|
||||
'module_account_asset': fields.boolean('Assets Management'),
|
||||
'module_account_budget': fields.boolean('Budgets Management'),
|
||||
'module_account_payment': fields.boolean('Supplier Payment Orders'),
|
||||
'module_account_voucher': fields.boolean('Manage Customer Payments'),
|
||||
'module_account_followup': fields.boolean('Customer Follow-Ups'),
|
||||
'module_account_analytic_plans': fields.boolean('Support Multiple Analytic Plans'),
|
||||
'module_account_analytic_default': fields.boolean('Rules for Analytic Assignation'),
|
||||
'module_account_invoice_layout': fields.boolean('Allow notes and subtotals'),
|
||||
|
||||
'group_analytic_account_for_sales': fields.boolean('Analytic Accounting for Sales'),
|
||||
'group_analytic_account_for_purchase': fields.boolean('Analytic Accounting for Purchase'),
|
||||
'group_dates_periods': fields.boolean('Allow dates/periods'),
|
||||
'group_proforma_invoices': fields.boolean('Allow Pro-forma Invoices'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
|
||||
'currency_id': lambda s, cr, uid, c: s.pool.get('res.currency').search(cr, uid, [])[0],
|
||||
'charts': 'configurable',
|
||||
}
|
||||
|
||||
def _check_default_tax(self, cr, uid, context=None):
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
taxes = {}
|
||||
for tax in ir_values_obj.get(cr, uid, 'default', False, ['product.product']):
|
||||
if tax[1] == 'taxes_id':
|
||||
taxes.update({'taxes_id': tax[2]})
|
||||
if tax[1] == 'supplier_taxes_id':
|
||||
taxes.update({'supplier_taxes_id': tax[2]})
|
||||
return taxes
|
||||
return False
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
chart_template_obj = self.pool.get('account.chart.template')
|
||||
res = super(account_configuration, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update({'sale_tax': 15.0, 'purchase_tax': 15.0})
|
||||
taxes = self._check_default_tax(cr, uid, context)
|
||||
chart_template_ids = chart_template_obj.search(cr, uid, [('visible', '=', True)], context=context)
|
||||
if chart_template_ids:
|
||||
res.update({'chart_template_id': chart_template_ids[0]})
|
||||
if taxes:
|
||||
sale_tax_id = taxes.get('taxes_id')
|
||||
res.update({'sale_tax': sale_tax_id and sale_tax_id[0]})
|
||||
purchase_tax_id = taxes.get('supplier_taxes_id')
|
||||
res.update({'purchase_tax': purchase_tax_id and purchase_tax_id[0]})
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
res = super(account_configuration, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
|
||||
if self._check_default_tax(cr, uid, context) and taxes:
|
||||
if res['fields'].get('sale_tax') and res['fields'].get('purchase_tax'):
|
||||
res['fields']['sale_tax'] = {'domain': [], 'views': {}, 'context': {}, 'selectable': True, 'type': 'many2one', 'relation': 'account.tax', 'string': 'Default Sale Tax'}
|
||||
res['fields']['purchase_tax'] = {'domain': [], 'views': {}, 'context': {}, 'selectable': True, 'type': 'many2one', 'relation': 'account.tax', 'string': 'Default Purchase Tax'}
|
||||
return res
|
||||
|
||||
account_configuration()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_config" model="ir.ui.view">
|
||||
<field name="name">Accounting Application</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.view_res_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<form position="replace">
|
||||
<form string="Accounting Applications">
|
||||
<field name="chart_template_id" invisible="1"/>
|
||||
<group col="4" colspan="4" string="Warning" attrs="{'invisible': [('chart_template_id','!=',False)]}">
|
||||
<label string="You have no chart of accounts or taxes defined for this company. Select a chart of account to proceed." colspan="4"/>
|
||||
<field name="charts"/>
|
||||
<button name="%(action_account_configuration_installer)d" string="Install Chart of Account" icon="gtk-execute" type="action"/>
|
||||
</group>
|
||||
<field name="fiscalyear_id" invisible="1"/>
|
||||
<group col="4" colspan="4" string="Warning" attrs="{'invisible': [('fiscalyear_id','!=',False)]}">
|
||||
<label string="You have no fiscal year/period open for this date." colspan="4"/>
|
||||
|
||||
</group>
|
||||
<field name="company_id" widget="selection"/>
|
||||
<separator string="Accounting Configuration" colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<group col="2" colspan="2">
|
||||
<field name="sale_tax"/>
|
||||
<field name="module_account_accountant"/>
|
||||
<field name="module_account_asset"/>
|
||||
<field name="group_dates_periods"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<field name="purchase_tax"/>
|
||||
<field name="currency_id" widget="selection"/>
|
||||
<field name="module_account_budget"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Customer Invoices" colspan="2"/>
|
||||
<group col="4" colspan="2">
|
||||
<field name="customer_invoice_sequence_prefix"/>
|
||||
<field name="customer_invoice_sequence_padding" nolabel="1"/>
|
||||
</group>
|
||||
<group col="4" colspan="2">
|
||||
<field name="customer_refund_sequence_prefix"/>
|
||||
<field name="customer_refund_sequence_padding" nolabel="1"/>
|
||||
</group>
|
||||
<field name="module_account_invoice_layout"/>
|
||||
<newline/>
|
||||
<field name="module_account_voucher"/>
|
||||
<newline/>
|
||||
<field name="module_account_followup"/>
|
||||
<newline/>
|
||||
<field name="group_proforma_invoices"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Supplier Invoices" colspan="2"/>
|
||||
<group col="4" colspan="2">
|
||||
<field name="supplier_invoice_sequence_prefix"/>
|
||||
<field name="supplier_invoice_sequence_padding" nolabel="1" colspan="1"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col="4" colspan="2">
|
||||
<field name="supplier_refund_sequence_prefix"/>
|
||||
<field name="supplier_refund_sequence_padding" nolabel="1"/>
|
||||
</group>
|
||||
<field name="module_account_payment"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Electronic Payments" colspan="2"/>
|
||||
<field name="paypal_account"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Bank & Cash" colspan="2"/>
|
||||
<field name="company_footer"/>
|
||||
<newline/>
|
||||
<label string="Setup your bank accounts: "/>
|
||||
<button name="%(action_bank_tree)d" string="Setup Your Bank Accounts" icon="gtk-execute" type="action"/>
|
||||
<newline/>
|
||||
<field name="module_account_check_writing"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Analytic Accounting" colspan="2"/>
|
||||
<field name="group_analytic_account_for_sales"/>
|
||||
<newline/>
|
||||
<field name="group_analytic_account_for_purchase"/>
|
||||
<newline/>
|
||||
<field name="module_account_analytic_plans"/>
|
||||
<newline/>
|
||||
<field name="module_account_analytic_default"/>
|
||||
</group>
|
||||
</form>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_config" model="ir.actions.act_window">
|
||||
<field name="name">Configure Accounting Application</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.config.settings</field>
|
||||
<field name="view_id" ref="view_account_config"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_account_config" name="Accounting" parent="base.menu_config" sequence="4" action="action_account_config"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -15,6 +15,30 @@
|
|||
<field name="category_id" ref="base.module_category_accounting_and_finance"/>
|
||||
<field name="implied_ids" eval="[(4, ref('group_account_user'))]"/>
|
||||
</record>
|
||||
<record id="base.group_analytic_account_for_sales" model="res.groups">
|
||||
<field name="name">Analytic Accounting for Sales</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
<record id="base.group_analytic_account_for_purchase" model="res.groups">
|
||||
<field name="name">Analytic Accounting for Purchase</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
<record id="base.group_dates_periods" model="res.groups">
|
||||
<field name="name">Dates and Periods</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
<record id="base.group_proforma_invoices" model="res.groups">
|
||||
<field name="name">Pro-forma Invoices</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
<record id="base.group_user" model="res.groups">
|
||||
<field name="implied_ids" eval="[(6,0,[
|
||||
ref('base.group_analytic_account_for_sales'),
|
||||
ref('base.group_analytic_account_for_purchase'),
|
||||
ref('base.group_dates_periods'),
|
||||
ref('base.group_proforma_invoices'),
|
||||
])]"/>
|
||||
</record>
|
||||
|
||||
<record id="account_move_comp_rule" model="ir.rule">
|
||||
<field name="name">Account Entry</field>
|
||||
|
|
Loading…
Reference in New Issue