[IMP] Cleaned wizards in swiss accounting

bzr revid: nicolas.vanhoren@openerp.com-20101027094313-25motoux4bghwmi3
This commit is contained in:
nvi-openerp 2010-10-27 11:43:13 +02:00
parent 076315c04a
commit 67a4d79dd2
7 changed files with 1 additions and 408 deletions

View File

@ -87,9 +87,7 @@ TODO :
"company_view.xml",
"account_invoice.xml",
"bank_view.xml",
"account_journal_view.xml",
'wizard.xml',
'tax_template_view.xml',
'security/ir.model.access.csv',
],
'test' : [

View File

@ -1,56 +0,0 @@
<openerp>
<data>
<record id="view_account_journal_form_todo" model="ir.ui.view">
<field name="name">account.journal.todo.form</field>
<field name="model">account.journal.todo</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Account Journal Configuration</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Configure Your Account Journal System</attribute>
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">Set accounts on financial journals defined by CamptoCamp l10n_ch module</attribute>
<attribute name="width">150</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>15</attribute>
<attribute name='string'></attribute>
</xpath>
<group string="res_config_contents" position="replace">
<field name="name" select="1"/>
<group colspan="4">
<separator colspan="4" string="The accounts linked to the account journals"/>
<field name="default_credit_account_id" select="1"
on_change="on_change_credit(name, default_credit_account_id)"/>
<field name="default_debit_account_id" select="1"
on_change="on_change_debit(name, default_debit_account_id)"/>
</group>
</group>
<xpath expr="//button[@name='action_next']" position="attributes">
<attribute name="string">Next</attribute>
</xpath>
</data>
</field>
</record>
<record id="action_config_journal" model="ir.actions.act_window">
<field name="name">Finalize your Journal</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.journal.todo</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_account_journal_form_todo"/>
<field name="target">new</field>
</record>
<record id="action_config_journal_todo" model="ir.actions.todo">
<field name="action_id" ref="action_config_journal"/>
<field name="sequence">5</field>
<field name="restart">onskip</field>
</record>
</data>
</openerp>

View File

@ -1,3 +1 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"account_tax_todo","account.tax.template.todo","model_account_tax_template_todo","base.group_system",1,1,1,1
"account_tax_todo_erp","account.tax.template.todo","model_account_tax_template_todo","base.group_erp_manager",1,1,1,1
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
account_tax_todo account.tax.template.todo model_account_tax_template_todo base.group_system 1 1 1 1
account_tax_todo_erp account.tax.template.todo model_account_tax_template_todo base.group_erp_manager 1 1 1 1

View File

@ -1,48 +0,0 @@
<!-- #!/usr/bin/env python2.3
#
# tax_template_view.xml
#
# Created by Nicolas Bessi on 12.02.09.
# Copyright (c) 2010 CamptoCamp. All rights reserved.
# -->
<openerp>
<data>
<record id="view_tax_template_form_todo" model="ir.ui.view">
<field name="name">account.tax.template.todo</field>
<field name="model">account.tax.template.todo</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account tax template">
<group colspan="4" col="6">
<field name="name" select="1"/>
</group>
<separator colspan="4" string="The accounts linked to the tax template"/>
<field name="account_collected_id"
on_change="on_change_collected(name, account_collected_id)" select="1"/>
<field name="account_paid_id"
on_change="on_change_paid(name, account_paid_id)" select="1"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" name="action_cancel" string="Cancel" type="object"/>
<button icon="gtk-ok" name="action_new" string="Next" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_config_tax" model="ir.actions.act_window">
<field name="name">Configure Journal</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.tax.template.todo</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_tax_template_form_todo"/>
<field name="target">new</field>
</record>
<record id="action_config_tax_todo" model="ir.actions.todo">
<field name="name">Finalize your tax configuration</field>
<field name="note">Set account on financial taxes defined by
Camptocamp l10n_ch_c2c_pcg module</field>
<field name="action_id" ref="action_config_tax"/>
<field name="sequence">5</field>
</record>
</data>
</openerp>

View File

@ -30,10 +30,8 @@
#
##############################################################################
import config
import create_dta
import bvr_report
import bvr_import
import journal_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,168 +0,0 @@
# -*- encoding: utf-8 -*-
# config.py
#
# Created by Nicolas Bessi on 12.02.09.
# Copyright (c) 2010 CamptoCamp. 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.
#
#
# Created by Nicolas Bessi on 12.02.09.
# Copyright (c) 2010 CamptoCamp. All rights reserved.
#
from osv import fields, osv
class TaxTemplate(osv.osv):
"""Creat account.journal.todo class in order
to add configuration wizzard"""
_name = "account.tax.template.todo"
def _get_tax(self, cursor, uid, ctx):
"""will find the standardtaxes"""
if not self.__dict__.has_key('_inner_steps') :
self._inner_steps = 0
ids = self.pool.get('account.tax.template').search( cursor, uid, [])
if self._inner_steps == 'done' :
return False
return ids[self._inner_steps]
def _get_collected(self, cursor, uid, ctx):
"""will find the tax tempaltes for collected"""
if not self.__dict__.has_key('_inner_steps') :
self._inner_steps = 0
if self._inner_steps == 'done' :
return False
ids = self.pool.get('account.tax.template').search(cursor, uid, [])
resid = self.pool.get('account.tax.template').browse(
cursor,
uid,
ids[self._inner_steps]
).account_collected_id.id
return resid
def _get_paid(self, cursor, uid, ctx):
"""will find the payment tax"""
if not self.__dict__.has_key('_inner_steps') :
self._inner_steps = 0
if self._inner_steps == 'done' :
return False
ids = self.pool.get('account.tax.template').search(cursor, uid, [])
resid = self.pool.get('account.tax.template').browse(
cursor,
uid,
ids[self._inner_steps]
).account_paid_id.id
return resid
_columns = {
'name': fields.many2one(
'account.tax.template',
'Tax to set',
readonly=True,
help="The tax template you are currently editing"
),
'account_collected_id':fields.many2one(
'account.account.template',
'Invoice Tax Account',
help="You can set \
here the invoice tax account"
),
'account_paid_id':fields.many2one(
'account.account.template',
'Refund Tax Account',
help="You can set \
here the refund tax account"
),
}
_defaults = {
'name': _get_tax,
'account_collected_id':_get_collected,
'account_paid_id':_get_paid,
}
def on_change_collected(self, cursor, uid, wizid, tax, account) :
if account :
self.pool.get('account.tax.template').write(
cursor,
uid,
tax,
vals={
'account_collected_id': account,
}
)
return {}
def on_change_paid(self, cursor, uid, wizid, tax, account) :
if account :
self.pool.get('account.tax.template').write(
cursor,
uid,
tax,
vals={
'account_paid_id': account,
}
)
return {}
def action_cancel(self, cursor, uid, ids, context=None):
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target':'new',
}
def action_new(self, cursor, uid, ids, context=None):
jids = self.pool.get('account.tax.template').search(cursor, uid, [])
if self._inner_steps < len(jids)-1 :
self._inner_steps += 1
else :
self._inner_steps = 'done'
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'account.tax.template.todo',
'view_id':self.pool.get('ir.ui.view').search(
cursor,
uid,
[('name','=','view_account_journal_form_todo')]
),
'type': 'ir.actions.act_window',
'target':'new',
}
TaxTemplate()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,129 +0,0 @@
# -*- coding: utf-8 -*-
#
# journal_config.py
# l10n_ch
#
# Created by Nicolas Bessi based on Credric Krier contribution
#
# Copyright (c) 2009 CamptoCamp. 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.
#
##############################################################################
from osv import fields, osv
class Journal(osv.osv_memory):
"""Create account.journal.todo in order to add configuration wizzard"""
_name ="account.journal.todo"
_inherit = 'res.config'
def _get_journal(self, cr, uid, ctx):
if not self.__dict__.has_key('_inner_steps') :
self._inner_steps = 0
ids = self.pool.get('account.journal').search(cr,uid,[])
if self._inner_steps == 'done' :
return False
return ids[self._inner_steps]
def _get_debit(self, cr, uid, ctx):
if not self.__dict__.has_key('_inner_steps') :
self._inner_steps = 0
if self._inner_steps == 'done' :
return False
ids = self.pool.get('account.journal').search(cr,uid,[])
return self.pool.get('account.journal').browse(
cr,
uid,
ids[self._inner_steps]
).default_debit_account_id.id
def _get_credit(self, cr, uid, ctx):
if not self.__dict__.has_key('_inner_steps') :
self._inner_steps = 0
if self._inner_steps == 'done' :
return False
ids = self.pool.get('account.journal').search(cr,uid,[])
return self.pool.get('account.journal').browse(
cr,
uid,
ids[self._inner_steps]
).default_credit_account_id.id
_columns={
'name': fields.many2one(
'account.journal',
'Journal to set',
readonly=True,
help="The currenty edited account journal"
),
'default_credit_account_id': fields.many2one(
'account.account', 'Default Credit Account',
domain="[('type','!=','view')]",
help="The Default Credit Account of the account journal"
),
'default_debit_account_id': fields.many2one(
'account.account',
'Default Debit Account',
domain="[('type','!=','view')]",
help="The Default Debit Account of the account journal"
),
}
_defaults = {
'name': _get_journal,
'default_debit_account_id':_get_debit,
'default_credit_account_id':_get_credit,
}
def on_change_debit(self, cr, uid, id, journal, account) :
if account :
self.pool.get('account.journal').write(
cr, uid, journal,
vals={'default_debit_account_id': account,}
)
return {}
def on_change_credit(self, cr, uid, id, journal, account) :
if account :
self.pool.get('account.journal').write(
cr, uid, journal,
vals={'default_credit_account_id': account,}
)
return {}
def execute(self,cr,uid,ids,context=None):
jids = self.pool.get('account.journal').search(cr, uid, [])
if self._inner_steps < len(jids)-1:
self._inner_steps += 1
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'account.journal.todo',
'view_id': self.pool.get('ir.ui.view')\
.search(cr, uid, [('name','=','account.journal.todo.form')]),
'type': 'ir.actions.act_window',
'target': 'new',
}
Journal()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: