mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[MRG] account_statement_ext
Statement ext collide with voucher for some on change. As it almost impossible to have a finance installation without voucher, we may add voucher as a dependence on statement ext in order to fix on change, and silent unwanted voucher behavior. We also add the right periode computation for each line in the voucher, as it was previously done in the account_statement_ext_voucher. We mark also this one as deprecated.
This commit is contained in:
@@ -22,3 +22,4 @@
|
|||||||
import statement
|
import statement
|
||||||
import report
|
import report
|
||||||
import account
|
import account
|
||||||
|
import voucher
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# Author: Nicolas Bessi, Joel Grand-Guillaume
|
# Author: Nicolas Bessi, Joel Grand-Guillaume
|
||||||
# Copyright 2011-2012 Camptocamp SA
|
# Copyright 2011-2013 Camptocamp SA
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
@@ -20,14 +20,15 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
{'name': "Bank statement extension and profiles",
|
{'name': "Bank statement extension and profiles",
|
||||||
'version': '1.1',
|
'version': '1.2.0',
|
||||||
'author': 'Camptocamp',
|
'author': 'Camptocamp',
|
||||||
'maintainer': 'Camptocamp',
|
'maintainer': 'Camptocamp',
|
||||||
'category': 'Finance',
|
'category': 'Finance',
|
||||||
'complexity': 'normal',
|
'complexity': 'normal',
|
||||||
'depends': [
|
'depends': [
|
||||||
'account',
|
'account',
|
||||||
'report_webkit'
|
'report_webkit',
|
||||||
|
'account_voucher'
|
||||||
],
|
],
|
||||||
'description': """
|
'description': """
|
||||||
Improve the basic bank statement, by adding various new features,
|
Improve the basic bank statement, by adding various new features,
|
||||||
@@ -62,6 +63,8 @@
|
|||||||
all the erronous line in a same popup instead of raising and crashing on every step.
|
all the erronous line in a same popup instead of raising and crashing on every step.
|
||||||
|
|
||||||
4) Remove the period on the bank statement, and compute it for each line based on their date instead.
|
4) Remove the period on the bank statement, and compute it for each line based on their date instead.
|
||||||
|
It also adds this feature in the voucher in order to compute the period correctly.
|
||||||
|
|
||||||
|
|
||||||
5) Cancelling a bank statement is much more easy and will cancel all related entries, unreconcile them,
|
5) Cancelling a bank statement is much more easy and will cancel all related entries, unreconcile them,
|
||||||
and finally delete them.
|
and finally delete them.
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ class AccountBankSatementLine(Model):
|
|||||||
res['account_id'] = receiv_account
|
res['account_id'] = receiv_account
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def onchange_partner_id(self, cr, uid, ids, partner_id, profile_id, context=None):
|
def onchange_partner_id(self, cr, uid, ids, partner_id, profile_id=None, context=None):
|
||||||
"""
|
"""
|
||||||
Override of the basic method as we need to pass the profile_id in the on_change_type
|
Override of the basic method as we need to pass the profile_id in the on_change_type
|
||||||
call.
|
call.
|
||||||
@@ -571,7 +571,9 @@ class AccountBankSatementLine(Model):
|
|||||||
type = 'customer'
|
type = 'customer'
|
||||||
res_type = self.onchange_type(cr, uid, ids, partner_id, type, profile_id, context=context) # Chg
|
res_type = self.onchange_type(cr, uid, ids, partner_id, type, profile_id, context=context) # Chg
|
||||||
if res_type['value'] and res_type['value'].get('account_id', False):
|
if res_type['value'] and res_type['value'].get('account_id', False):
|
||||||
return {'value': {'type': type, 'account_id': res_type['value']['account_id']}}
|
return {'value': {'type': type,
|
||||||
|
'account_id': res_type['value']['account_id'],
|
||||||
|
'voucher_id': False}}
|
||||||
return {'value': {'type': type}}
|
return {'value': {'type': type}}
|
||||||
|
|
||||||
def onchange_type(self, cr, uid, line_id, partner_id, type, profile_id, context=None):
|
def onchange_type(self, cr, uid, line_id, partner_id, type, profile_id, context=None):
|
||||||
|
|||||||
49
account_statement_ext/voucher.py
Normal file
49
account_statement_ext/voucher.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Author: Joel Grand-Guillaume
|
||||||
|
# Copyright 2011-2013 Camptocamp SA
|
||||||
|
#
|
||||||
|
# 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.orm import Model
|
||||||
|
|
||||||
|
|
||||||
|
class AccountVoucher(Model):
|
||||||
|
|
||||||
|
_inherit = 'account.voucher'
|
||||||
|
|
||||||
|
def _get_period(self, cr, uid, context=None):
|
||||||
|
"""If period not in context, take it from the move lines"""
|
||||||
|
if not context.get('period_id') and context.get('move_line_ids'):
|
||||||
|
res = self.pool.get('account.move.line').browse(
|
||||||
|
cr, uid, context.get('move_line_ids'), context=context)[0].period_id.id
|
||||||
|
context['period_id'] = res
|
||||||
|
elif context.get('date'):
|
||||||
|
periods = self.pool.get('account.period').find(
|
||||||
|
cr, uid, dt=context['date'], context=context)
|
||||||
|
if periods:
|
||||||
|
context['period_id'] = periods[0]
|
||||||
|
return super(AccountVoucher, self)._get_period(cr, uid, context)
|
||||||
|
|
||||||
|
def create(self, cr, uid, values, context=None):
|
||||||
|
"""If no period defined in values, ask it from moves."""
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
|
if not values.get('period_id'):
|
||||||
|
ctx = dict(context, date=values.get('date'))
|
||||||
|
values['period_id'] = self._get_period(cr, uid, ctx)
|
||||||
|
return super(AccountVoucher, self).create(cr, uid, values, context)
|
||||||
@@ -18,5 +18,3 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import statement_voucher
|
|
||||||
|
|||||||
@@ -30,8 +30,12 @@
|
|||||||
'account_voucher'
|
'account_voucher'
|
||||||
],
|
],
|
||||||
'description': """
|
'description': """
|
||||||
This module is only needed when using account_bank_statement_ext with voucher in order to compute the period
|
This module is deprecated. It was only needed when using account_bank_statement_ext with voucher in order to compute the period
|
||||||
correctly. This is mainly because with account_bank_statement_ext, the period is computed for each line.
|
correctly. This is mainly because with account_bank_statement_ext, the period is computed for each line.
|
||||||
|
|
||||||
|
Now, we include this in the account_statement_ext module and added a dependencies on account_voucher (mainly cause we can't get
|
||||||
|
rid of the voucher in version 7.0).
|
||||||
|
|
||||||
""",
|
""",
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'http://www.camptocamp.com',
|
||||||
'init_xml': [],
|
'init_xml': [],
|
||||||
@@ -40,9 +44,9 @@
|
|||||||
],
|
],
|
||||||
'demo_xml': [],
|
'demo_xml': [],
|
||||||
'test': [],
|
'test': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
'images': [],
|
'images': [],
|
||||||
'auto_install': True,
|
'auto_install': False,
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<openerp>
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<record id="account_voucher.view_bank_statement_form_invoice" model="ir.ui.view">
|
|
||||||
<field name="name">account.bank.statement.invoice.form.inherit</field>
|
|
||||||
<field name="model">account.bank.statement</field>
|
|
||||||
<field name="type">form</field>
|
|
||||||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="currency" invisible="1" position="after">
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</openerp>
|
|
||||||
Reference in New Issue
Block a user