[FIX] Style improvements in move_period_from_transaction_date.

This commit is contained in:
Ronald Portier (Therp BV)
2015-04-13 11:27:05 +02:00
committed by Stefan Rijnhart
parent b746ffffd4
commit 3bf7b3faa5
4 changed files with 36 additions and 8 deletions

View File

@@ -1,4 +1,33 @@
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.
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Module name
===========
This module was written to 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.
Contributors
------------
* Stefan Rijnhart <stefan@therp.nl>
* Ronald Portier <ronald@therp.nl>
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.

View File

@@ -21,9 +21,8 @@
{
'name': 'Use bank transaction (line) date to determine move period',
'version': '1.0',
'author': 'Therp BV',
'author': 'Therp BV, Odoo Community Association (OCA)',
'category': 'Banking addons',
'complexity': 'easy',
'depends': [
'account',
],

View File

@@ -27,11 +27,11 @@ class AccountBankStatementLine(orm.Model):
_inherit = 'account.bank.statement.line'
def process_reconciliation(
self, cr, uid, id, mv_line_dicts, context=None):
self, cr, uid, statement_line_id, mv_line_dicts, context=None):
"""Put marker in context to use period from date in move line."""
ctx = context and context.copy() or {}
ctx['override_period_from_date'] = True
return super(AccountBankStatementLine, self).process_reconciliation(
cr, uid, id, mv_line_dicts, context=ctx)
cr, uid, statement_line_id, mv_line_dicts, context=ctx)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -32,7 +32,7 @@ class AccountMoveLine(orm.Model):
if (('override_period_from_date' in context or
'period_id' not in vals) and 'date' in vals):
period_model = self.pool['account.period']
search_date = 'date' in vals and vals['date'] or None
search_date = vals.get('date')
period_ids = period_model.find(
cr, uid, dt=search_date, context=context)
if period_ids: