1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# Copyright (C) 2004-2010 Pexego Sistemas Informáticos. All Rights Reserved
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
##############################################################################
21
Extensions to the bank statements to add analytical accounting features.
25
"Borja López Soilán (Pexego) <borjals@pexego.es>"
28
from osv import osv, fields
31
class bank_statement(osv.osv):
33
Extend the bank statement to add the analytic account when creating
36
_inherit = 'account.bank.statement'
38
def button_confirm(self, cr, uid, ids, context={}):
40
Extend the button confirm action, to add the analytic account references
41
to the account move lines being created.
43
super(bank_statement, self).button_confirm(cr, uid, ids, context=context)
44
aml_facade = self.pool.get('account.move.line')
45
for st in self.browse(cr, uid, ids, context):
46
for st_line in st.line_ids:
47
if st_line.analytic_account_id:
48
for move in st_line.move_ids:
49
for line in move.line_id:
50
if line.account_id == st_line.account_id:
51
aml_facade.write(cr, uid, [line.id], {
52
'analytic_account_id': st_line.analytic_account_id.id
59
class bank_statement_line(osv.osv):
61
Extend the bank statement to add the analytic account reference.
63
_inherit = 'account.bank.statement.line'
66
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'),