mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[WIP] start fix for period on move.
This commit is contained in:
committed by
Stefan Rijnhart
parent
e1f5dcdbeb
commit
98fb49aea2
4
bank_transaction_period_fix/README.rst
Normal file
4
bank_transaction_period_fix/README.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Make sure that when reconciliation moves are generated for a bank
|
||||
transaction, that the period for the moves is determined from the transaction
|
||||
(bank statement line), and not from the bank statement period.
|
||||
|
||||
30
bank_transaction_period_fix/__init__.py
Normal file
30
bank_transaction_period_fix/__init__.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""Import python modules."""
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Therp BV - http://therp.nl.
|
||||
# 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 EduSense BV
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import model
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
37
bank_transaction_period_fix/__openerp__.py
Normal file
37
bank_transaction_period_fix/__openerp__.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Therp BV - http://therp.nl.
|
||||
# All Rights Reserved
|
||||
#
|
||||
# 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': 'Account banking fix to use transaction date to determine period',
|
||||
'version': '1.0',
|
||||
'author': 'Therp BV',
|
||||
'category': 'Banking addons',
|
||||
'complexity': 'easy',
|
||||
'depends': [
|
||||
'account',
|
||||
],
|
||||
'website': 'https://github.com/OCA/bank-statement-import',
|
||||
'data': [],
|
||||
'test': [],
|
||||
'installable': True,
|
||||
'images': [],
|
||||
'auto_install': False,
|
||||
'license': 'AGPL-3',
|
||||
}
|
||||
31
bank_transaction_period_fix/model/__init__.py
Normal file
31
bank_transaction_period_fix/model/__init__.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""Import python modules extending orm models."""
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Therp BV - http://therp.nl.
|
||||
# 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 EduSense BV
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import account_bank_statement_line
|
||||
from . import account_move_line
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Extend account.bank.statement.line to use transaction date in moves."""
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Therp BV - http://therp.nl.
|
||||
# All Rights Reserved
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.osv import orm
|
||||
|
||||
|
||||
class AccountBankStatementLine(orm.Model):
|
||||
"""Extend account.bank.statement.line to use transaction date in moves."""
|
||||
_inherit = 'account.bank.statement.line'
|
||||
|
||||
def process_reconciliation(
|
||||
self, cr, uid, id, mv_line_dicts, context=None):
|
||||
"""Put marker in context to use period from date in move line."""
|
||||
ctx = context.copy() or {}
|
||||
ctx['override_period_from_date'] = True
|
||||
return super(AccountBankStatementLine, self).process_reconciliation(
|
||||
cr, uid, id, mv_line_dicts, context=ctx)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
41
bank_transaction_period_fix/model/account_move_line.py
Normal file
41
bank_transaction_period_fix/model/account_move_line.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Extend account.move.line to use date for period, when requested."""
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Therp BV - http://therp.nl.
|
||||
# All Rights Reserved
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.osv import orm
|
||||
|
||||
|
||||
class AccountMoveLine(orm.Model):
|
||||
"""Extend account.move.line to use date for period, when requested."""
|
||||
_inherit = 'account.move.line'
|
||||
|
||||
def create(self, cr, uid, vals, context=None, check=True):
|
||||
"""If requested, override period from date."""
|
||||
ctx = context.copy() or {}
|
||||
if (('override_period_from_date' in ctx or
|
||||
'period_id' not in vals) and 'date' in vals):
|
||||
period_model = self.pool['account.period']
|
||||
period_ids = period_search
|
||||
## BE CAREFULL, ALSO CHECK COMPANY
|
||||
vals['period_id'] = period_ids[0]
|
||||
return super(AccountMoveLine, self).create(
|
||||
cr, uid, vals, context=context, check=check)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
Reference in New Issue
Block a user