diff --git a/addons/account_sequence/__init__.py b/addons/account_sequence/__init__.py index 535fb766048..b6707106d4b 100644 --- a/addons/account_sequence/__init__.py +++ b/addons/account_sequence/__init__.py @@ -20,5 +20,6 @@ ############################################################################## import account_sequence +import account_sequence_installer # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_sequence/__openerp__.py b/addons/account_sequence/__openerp__.py index 966cbcbc8ca..1e3f91a7876 100644 --- a/addons/account_sequence/__openerp__.py +++ b/addons/account_sequence/__openerp__.py @@ -30,7 +30,11 @@ 'website': 'http://www.openerp.com', 'depends': ['account'], 'init_xml': [], - 'update_xml': ['account_sequence_data.xml','account_sequence.xml'], + 'update_xml': [ + 'account_sequence_data.xml', + 'account_sequence_installer_view.xml', + 'account_sequence.xml' + ], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py index 309bf3bc803..82d416e84ca 100644 --- a/addons/account_sequence/account_sequence.py +++ b/addons/account_sequence/account_sequence.py @@ -46,7 +46,7 @@ class account_journal(osv.osv): _inherit = "account.journal" _columns = { - 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence'), + 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used to maintain the internal number for the journal entries related to this journal."), } account_journal() @@ -57,5 +57,7 @@ class account_move_line(osv.osv): _columns = { 'internal_sequence_number': fields.related('move_id','internal_sequence_number', type='char', relation='account.move', help='Internal Sequence Number', string='Internal Number'), } + account_move_line() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py new file mode 100644 index 00000000000..5375ee6fae3 --- /dev/null +++ b/addons/account_sequence/account_sequence_installer.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +from osv import fields, osv + +class account_sequence_installer(osv.osv_memory): + _name = 'account.sequence.installer' + _inherit = 'res.config.installer' + + _columns = { + 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used on Journals to maintain internal number for accounting entries."), + } + + def _get_internal_sequence(self, cr, uid, context=None): + result = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_sequence', 'internal_sequence_journal') + return result and result[1] or False + + def execute(self, cr, uid, ids, context=None): + if context is None: + context = {} + jou_obj = self.pool.get('account.journal') + obj_sequence = self.pool.get('ir.sequence') + record = self.browse(cr, uid, ids)[0] + j_ids = [] + res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context) + journal_ids = jou_obj.search(cr, uid, [], context=context) + for journal in jou_obj.browse(cr, uid, journal_ids): + if not journal.internal_sequence: + j_ids.append(journal.id) + if j_ids: + jou_obj.write(cr, uid, j_ids, {'internal_sequence': record.internal_sequence.id}) + return res + + _defaults = { + 'internal_sequence': _get_internal_sequence + } + +account_sequence_installer() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_sequence/account_sequence_installer_view.xml b/addons/account_sequence/account_sequence_installer_view.xml new file mode 100644 index 00000000000..a4808a2c858 --- /dev/null +++ b/addons/account_sequence/account_sequence_installer_view.xml @@ -0,0 +1,51 @@ + + + + + + account.sequence.installer.view + account.sequence.installer + form + + + +
+ Account Sequence Application Configuration +
+ + Configure Your Account Sequence Application + + + + + + You can enhance the Account Sequence Application by installing . + + + + + + Configure + +
+
+
+ + + Account Sequence Application Configuration + ir.actions.act_window + account.sequence.installer + + form + form + new + + + + + 3 + always + + +
+