mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[PORT] base_transaction_id to 9.0
- Reactivate module - move files in views and models dirs - create README.rst from description - make list of contributors - remove change for invoice created on picking as it doesn't exist anymore in Odoo Community - move overrides in bank statement as logic moved in move lines - adapt view inheritance to not depends on string attribute - Fix definition of javascript customization in reconciliation - Fix display transaction_ref label on move line view - Fix move proposition for reconcile. search with transaction_ref - Use short headers - Update README for bug tracking
This commit is contained in:
committed by
Iryna Vyshnevska
parent
ded3ea9a7f
commit
500c478dae
55
base_transaction_id/README.rst
Normal file
55
base_transaction_id/README.rst
Normal file
@@ -0,0 +1,55 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
|
||||
============================================
|
||||
Base transaction id for financial institutes
|
||||
============================================
|
||||
|
||||
Adds transaction id to invoice and sale models and views.
|
||||
|
||||
On Sales order, you can specify the transaction ID used
|
||||
for the payment and it will be propagated to the invoice (even if made from packing).
|
||||
This is mostly used for e-commerce handling.
|
||||
|
||||
You can then add a mapping on that SO field to save the e-commerce financial
|
||||
Transaction ID into the Odoo sale order field.
|
||||
|
||||
The main purpose is to ease the reconciliation process and be able to find the partner
|
||||
when importing the bank statement.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/bank-statement-reconcile/issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smashing it by providing a detailed and welcomed feedback.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
||||
* Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
|
||||
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
|
||||
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
|
||||
* Pedro Baeza <pedro.baezo@gmail.com>
|
||||
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://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.
|
||||
@@ -1,26 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Yannick Vaucher (Camptocamp)
|
||||
# Copyright 2012 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 . import invoice
|
||||
from . import sale
|
||||
from . import stock
|
||||
from . import account_move
|
||||
from . import account_bank_statement
|
||||
# -*- coding: utf-8 -*# -*- coding: utf-8 -*-
|
||||
# © 2012-2015 Yannick Vaucher (Camptocamp)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import models
|
||||
|
||||
@@ -1,26 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Yannick Vaucher (Camptocamp)
|
||||
# Copyright 2012 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# -*- coding: utf-8 -*# -*- coding: utf-8 -*-
|
||||
# © 2012 Yannick Vaucher (Camptocamp)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{'name': 'Base transaction id for financial institutes',
|
||||
'version': '8.0.1.0.0',
|
||||
'version': '9.0.1.0.0',
|
||||
'author': "Camptocamp,Odoo Community Association (OCA)",
|
||||
'maintainer': 'Camptocamp',
|
||||
'category': 'Hidden/Dependency',
|
||||
@@ -30,23 +12,11 @@
|
||||
'stock_account',
|
||||
'sale_stock',
|
||||
],
|
||||
'description': """
|
||||
Adds transaction id to invoice and sale models and views.
|
||||
On Sales order, you can specify the transaction ID used
|
||||
for the payment and it will be propagated to the invoice
|
||||
(even if made from packing).
|
||||
This is mostly used for e-commerce handling.
|
||||
You can then add a mapping on that SO field to save
|
||||
the e-commerce financial Transaction ID into the
|
||||
OpenERP sale order field.
|
||||
The main purpose is to ease the reconciliation process and
|
||||
be able to find the partner when importing the bank statement.
|
||||
""",
|
||||
'website': 'http://www.openerp.com',
|
||||
'data': [
|
||||
'invoice_view.xml',
|
||||
'sale_view.xml',
|
||||
'account_move_line_view.xml',
|
||||
'views/invoice.xml',
|
||||
'views/sale.xml',
|
||||
'views/account_move_line.xml',
|
||||
'views/base_transaction_id.xml',
|
||||
],
|
||||
'test': [],
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Guewen Baconnier
|
||||
# Copyright 2014 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 import orm
|
||||
|
||||
|
||||
class account_bank_statement_line(orm.Model):
|
||||
|
||||
_inherit = 'account.bank.statement.line'
|
||||
|
||||
def _domain_move_lines_for_reconciliation(self, cr, uid, st_line,
|
||||
excluded_ids=None, str=False,
|
||||
additional_domain=None,
|
||||
context=None):
|
||||
_super = super(account_bank_statement_line, self)
|
||||
_get_domain = _super._domain_move_lines_for_reconciliation
|
||||
domain = _get_domain(cr, uid, st_line, excluded_ids=excluded_ids,
|
||||
str=str, additional_domain=additional_domain,
|
||||
context=context)
|
||||
if not str and str != '/':
|
||||
return domain
|
||||
domain = domain[:]
|
||||
domain.insert(-1, '|')
|
||||
domain.append(('transaction_ref', 'ilike', str))
|
||||
return domain
|
||||
|
||||
def _domain_reconciliation_proposition(self, cr, uid, st_line,
|
||||
excluded_ids=None, context=None):
|
||||
_super = super(account_bank_statement_line, self)
|
||||
_get_domain = _super._domain_reconciliation_proposition
|
||||
domain = _get_domain(cr, uid, st_line, excluded_ids=excluded_ids,
|
||||
context=context)
|
||||
new_domain = []
|
||||
for criterion in domain:
|
||||
if len(criterion) == 3:
|
||||
field, op, value = criterion
|
||||
if (field, op) == ('ref', '='):
|
||||
new_domain += [
|
||||
'|',
|
||||
('transaction_ref', '=', value),
|
||||
]
|
||||
new_domain.append(criterion)
|
||||
return new_domain
|
||||
@@ -1,56 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Guewen Baconnier
|
||||
# Copyright 2014 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 import orm, fields
|
||||
|
||||
|
||||
class account_move_line(orm.Model):
|
||||
_inherit = 'account.move.line'
|
||||
|
||||
_columns = {
|
||||
'transaction_ref': fields.char('Transaction Ref.',
|
||||
select=True),
|
||||
}
|
||||
|
||||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default['transaction_ref'] = False
|
||||
_super = super(account_move_line, self)
|
||||
return _super.copy_data(cr, uid, id, default=default, context=context)
|
||||
|
||||
def prepare_move_lines_for_reconciliation_widget(self, cr, uid, lines,
|
||||
target_currency=False,
|
||||
target_date=False,
|
||||
context=None):
|
||||
_super = super(account_move_line, self)
|
||||
prepare = _super.prepare_move_lines_for_reconciliation_widget
|
||||
prepared_lines = []
|
||||
for line in lines:
|
||||
# The super method loop over the lines and returns a list of
|
||||
# prepared lines. Here we'll have 1 line per call to super.
|
||||
# If we called super on the whole list, we would need to
|
||||
# browse again the lines, or match the 'lines' vs
|
||||
# 'prepared_lines' to update the transaction_ref.
|
||||
vals = prepare(cr, uid, [line], target_currency=target_currency,
|
||||
target_date=target_date, context=context)[0]
|
||||
vals['transaction_ref'] = line.transaction_ref
|
||||
prepared_lines.append(vals)
|
||||
return prepared_lines
|
||||
7
base_transaction_id/models/__init__.py
Normal file
7
base_transaction_id/models/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- coding: utf-8 -*# -*- coding: utf-8 -*-
|
||||
# © 2012-2015 Yannick Vaucher (Camptocamp)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import invoice
|
||||
from . import sale
|
||||
from . import account_move
|
||||
from . import account_bank_statement_line
|
||||
25
base_transaction_id/models/account_bank_statement_line.py
Normal file
25
base_transaction_id/models/account_bank_statement_line.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Yannick Vaucher (Camptocamp)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from openerp import api, models
|
||||
|
||||
|
||||
class AccountBankStatementLine(models.Model):
|
||||
|
||||
_inherit = 'account.bank.statement.line'
|
||||
|
||||
@api.multi
|
||||
def get_reconciliation_proposition(self, excluded_ids=None):
|
||||
""" Look for transaction_ref to give them as proposition move line """
|
||||
if self.name:
|
||||
# If the transaction has no partner, look for match in payable and
|
||||
# receivable account anyway
|
||||
overlook_partner = not self.partner_id
|
||||
domain = [('transaction_ref', 'ilike', self.name)]
|
||||
match_recs = self.get_move_lines_for_reconciliation(
|
||||
excluded_ids=excluded_ids, limit=2, additional_domain=domain,
|
||||
overlook_partner=overlook_partner)
|
||||
if match_recs and len(match_recs) == 1:
|
||||
return match_recs
|
||||
_super = super(AccountBankStatementLine, self)
|
||||
return _super.get_reconciliation_proposition(excluded_ids=excluded_ids)
|
||||
46
base_transaction_id/models/account_move.py
Normal file
46
base_transaction_id/models/account_move.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2014 Guewen Baconnier (Camptocamp)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from openerp import models, fields, api
|
||||
from openerp.osv import expression
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = 'account.move.line'
|
||||
|
||||
transaction_ref = fields.Char(
|
||||
'Transaction Ref.',
|
||||
index=True,
|
||||
copy=False
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def prepare_move_lines_for_reconciliation_widget(self,
|
||||
target_currency=False,
|
||||
target_date=False):
|
||||
prepared_lines = []
|
||||
for line in self:
|
||||
_super = super(AccountMoveLine, line)
|
||||
# The super method loop over the lines and returns a list of
|
||||
# prepared lines. Here we'll have 1 line per call to super.
|
||||
# If we called super on the whole list, we would need to
|
||||
# browse again the lines, or match the 'lines' vs
|
||||
# 'prepared_lines' to update the transaction_ref.
|
||||
vals = _super.prepare_move_lines_for_reconciliation_widget(
|
||||
target_currency=target_currency,
|
||||
target_date=target_date)[0]
|
||||
vals['transaction_ref'] = line.transaction_ref
|
||||
prepared_lines.append(vals)
|
||||
return prepared_lines
|
||||
|
||||
@api.model
|
||||
def domain_move_lines_for_reconciliation(self, excluded_ids=None,
|
||||
str=False):
|
||||
""" Add transaction_ref in search of move lines"""
|
||||
_super = super(AccountMoveLine, self)
|
||||
_get_domain = _super.domain_move_lines_for_reconciliation
|
||||
domain = _get_domain(excluded_ids=excluded_ids, str=str)
|
||||
if not str and str != '/':
|
||||
return domain
|
||||
domain_trans_ref = [('transaction_ref', 'ilike', str)]
|
||||
return expression.OR([domain, domain_trans_ref])
|
||||
@@ -1,24 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Nicolas Bessi
|
||||
# Copyright 2011-2012 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# © 2011-2012 Nicolas Bessi (Camptocamp)
|
||||
# © 2012-2015 Yannick Vaucher (Camptocamp)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
22
base_transaction_id/models/sale.py
Normal file
22
base_transaction_id/models/sale.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2011-2012 Nicolas Bessi (Camptocamp)
|
||||
# © 2012-2015 Yannick Vaucher (Camptocamp)
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
transaction_id = fields.Char(
|
||||
'Transaction ID',
|
||||
required=False,
|
||||
copy=False,
|
||||
help="Transaction id from the financial institute"
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def _prepare_invoice(self):
|
||||
""" Propagate the transaction_id from the sale order to the invoice """
|
||||
invoice_vals = super(SaleOrder, self)._prepare_invoice()
|
||||
invoice_vals['transaction_id'] = self.transaction_id
|
||||
return invoice_vals
|
||||
@@ -1,48 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Nicolas Bessi
|
||||
# Copyright 2011-2012 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 import orm, fields
|
||||
|
||||
|
||||
class SaleOrder(orm.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
_columns = {
|
||||
'transaction_id': fields.char(
|
||||
'Transaction ID',
|
||||
required=False,
|
||||
help="Transaction id from the financial institute"),
|
||||
}
|
||||
|
||||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default['transaction_id'] = False
|
||||
_super = super(SaleOrder, self)
|
||||
return _super.copy_data(cr, uid, id, default=default, context=context)
|
||||
|
||||
def _prepare_invoice(self, cr, uid, order, lines, context=None):
|
||||
""" Propagate the transaction_id from the sale order to the invoice """
|
||||
_super = super(SaleOrder, self)
|
||||
invoice_vals = _super._prepare_invoice(cr, uid, order, lines,
|
||||
context=context)
|
||||
invoice_vals['transaction_id'] = order.transaction_id
|
||||
return invoice_vals
|
||||
@@ -1,11 +1,14 @@
|
||||
openerp.base_transaction_id = function (instance) {
|
||||
odoo.define('base_transaction_id.base_transaction_id', function (require) {
|
||||
|
||||
instance.web.account.bankStatementReconciliationLine.include({
|
||||
decorateMoveLine: function(line, currency_id) {
|
||||
this._super(line, currency_id);
|
||||
var AccountReconciliation = require('account.reconciliation');
|
||||
|
||||
AccountReconciliation.bankStatementReconciliation.include({
|
||||
decorateMoveLine: function(line) {
|
||||
this._super(line);
|
||||
if (line.transaction_ref) {
|
||||
line.q_label += ' (' + line.transaction_ref + ')';
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Nicolas Bessi
|
||||
# Copyright 2011-2012 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 import orm
|
||||
|
||||
|
||||
class StockPicking(orm.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
def _create_invoice_from_picking(self, cr, uid, picking, vals,
|
||||
context=None):
|
||||
""" Propagate the transaction ID from sale to invoice """
|
||||
vals['transaction_id'] = picking.sale_id.transaction_id
|
||||
_super = super(StockPicking, self)
|
||||
return _super._create_invoice_from_picking(cr, uid, picking, vals,
|
||||
context=context)
|
||||
@@ -6,9 +6,9 @@
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group string="Reconciliation" position="inside">
|
||||
<xpath expr="//field[@name='reconciled']/.." position="after">
|
||||
<field name="transaction_ref"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
Reference in New Issue
Block a user