[FIX] regarding comment from Alexandre Fayolle @ camptocamp

This commit is contained in:
Vincent Renaville
2013-01-14 11:57:17 +01:00
parent e92f023fa2
commit 57e73c7da0
8 changed files with 173 additions and 100 deletions

View File

@@ -6,49 +6,35 @@
#
# Author : Vincent Renaville (Camptocamp)
#
# 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 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 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 Affero General Public License for more details.
#
# 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.
# 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 time
from osv import fields, osv
from openerp.osv.orm import TransientModel, fields
from tools.translate import _
import decimal_precision as dp
class account_bank_statement(osv.osv):
class account_bank_statement(TransientModel):
_inherit = "account.bank.statement"
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
return_value = super(account_bank_statement,self).create_move_from_st_line(cr, uid, st_line_id, company_currency_id, st_line_number, context)
move_ids = super(account_bank_statement,self).create_move_from_st_line(cr, uid, st_line_id, company_currency_id, st_line_number, context)
## We receive the move created for the bank statement, we set it to draft
if return_value:
cr.execute('UPDATE account_move '\
'SET state=%s '\
'WHERE id = %s', ('draft', (return_value),))
return return_value
account_bank_statement()
if move_ids:
move_obj = self.pool.get('account.move')
move_obj.write(cr, uid, move_ids, {'state': 'draft'}, context=context)
return move_ids
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: