[ADD]:-added 'account_sequence' module to maintain internal sequence number on the accounting entries

bzr revid: mtr@mtr-20101103082639-xd4a0pwkabqit2t7
This commit is contained in:
mtr 2010-11-03 13:56:39 +05:30
parent d32f945515
commit f0c123111c
6 changed files with 189 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# -*- 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/>.
#
##############################################################################
import account_sequence
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,39 @@
# -*- 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/>.
#
##############################################################################
{
'name': 'Sequence Numbering',
'version': '1.1',
'category': 'Generic Modules/Accounting',
'description': """
This module maintains internal sequence number for accounting entries.
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['account'],
'init_xml': [],
'update_xml': ['account_sequence_data.xml','account_sequence.xml'],
'demo_xml': ['account_sequence_minimal.xml'],
'installable': True,
'active': False,
'certificate': '',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# 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 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
class account_move(osv.osv):
_inherit = 'account.move'
_columns = {
'internal_sequence_number': fields.char('Internal Sequence Number', size=64, readonly=True),
}
def post(self, cr, uid, ids, context=None):
obj_sequence = self.pool.get('ir.sequence')
res = super(account_move, self).post(cr, uid, ids, context)
for line in self.browse(cr, uid, ids):
if line.journal_id.internal_sequence:
c = {'fiscalyear_id': line.period_id.fiscalyear_id.id}
seq_no = obj_sequence.get_id(cr, uid, line.journal_id.internal_sequence.id, context=c)
if seq_no:
self.write(cr, uid, [line.id], {'internal_sequence_number':seq_no})
return res
account_move()
class account_journal(osv.osv):
_inherit = "account.journal"
_columns = {
'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence'),
}
account_journal()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_move_form_inherit" model="ir.ui.view">
<field name="name">account.move.form.inherit</field>
<field name="model">account.move</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<field name="to_check" position="after">
<field name="internal_sequence_number"/>
</field>
</field>
</record>
<record id="view_account_journal_form_inherit" model="ir.ui.view">
<field name="name">account.journal.form.inherit</field>
<field name="model">account.journal</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="code" position="after">
<field name="internal_sequence"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--Account Journal Internal Sequences-->
<record id="internal_sequence_journal" model="ir.sequence">
<field name="name">Internal Sequence Journal</field>
<field name="code">account.journal</field>
<field name="number_next">1</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account.sales_journal" model="account.journal">
<field name="internal_sequence" ref="internal_sequence_journal"/>
</record>
<record id="account.refund_sales_journal" model="account.journal">
<field name="internal_sequence" ref="internal_sequence_journal"/>
</record>
<record id="account.expenses_journal" model="account.journal">
<field name="internal_sequence" ref="internal_sequence_journal"/>
</record>
<record id="account.refund_expenses_journal" model="account.journal">
<field name="internal_sequence" ref="internal_sequence_journal"/>
</record>
<record id="account.bank_journal" model="account.journal">
<field name="internal_sequence" ref="internal_sequence_journal"/>
</record>
<record id="account.check_journal" model="account.journal">
<field name="internal_sequence" ref="internal_sequence_journal"/>
</record>
<record id="account.cash_journal" model="account.journal">
<field name="internal_sequence" ref="internal_sequence_journal"/>
</record>
</data>
</openerp>