mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Merge remote-tracking branch 'origin/9.0' into 9.0-account-transaction-base-import
This commit is contained in:
@@ -8,9 +8,12 @@ cache: pip
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- pov-wkhtmltopdf
|
||||
packages:
|
||||
- expect-dev # provides unbuffer utility
|
||||
- python-lxml # because pip installation is slow
|
||||
- wkhtmltopdf
|
||||
|
||||
env:
|
||||
global:
|
||||
|
||||
@@ -24,6 +24,12 @@ __Version 7.0 and earlier :__
|
||||
|
||||
|
||||
[//]: # (addons)
|
||||
Available addons
|
||||
----------------
|
||||
addon | version | summary
|
||||
--- | --- | ---
|
||||
[base_transaction_id](base_transaction_id/) | 9.0.1.0.0 | Base transaction id for financial institutes
|
||||
|
||||
Unported addons
|
||||
---------------
|
||||
addon | version | summary
|
||||
@@ -53,6 +59,5 @@ addon | version | summary
|
||||
[account_statement_so_completion](account_statement_so_completion/) | 0.1 (unported) | Bank statement Sale Order completion
|
||||
[account_statement_transactionid_completion](account_statement_transactionid_completion/) | 1.0 (unported) | Bank statement completion from transaction ID
|
||||
[account_statement_transactionid_import](account_statement_transactionid_import/) | 1.0 (unported) | Bank statement transactionID import
|
||||
[base_transaction_id](base_transaction_id/) | 8.0.1.0.0 (unported) | Base transaction id for financial institutes
|
||||
|
||||
[//]: # (end addons)
|
||||
|
||||
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,27 +12,15 @@
|
||||
'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': [],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
'images': [],
|
||||
'auto_install': False,
|
||||
'license': 'AGPL-3',
|
||||
|
||||
@@ -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
|
||||
69
base_transaction_id/i18n/de.po
Normal file
69
base_transaction_id/i18n/de.po
Normal file
@@ -0,0 +1,69 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_transaction_id
|
||||
#
|
||||
# Translators:
|
||||
# Rudolf Schnapka <rs@techno-flex.de>, 2015
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: bank-statement-reconcile (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-10-14 09:25+0000\n"
|
||||
"PO-Revision-Date: 2015-11-25 08:30+0000\n"
|
||||
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
|
||||
"Language-Team: German (http://www.transifex.com/oca/OCA-bank-statement-reconcile-8-0/language/de/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: de\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_account_bank_statement_line
|
||||
msgid "Bank Statement Line"
|
||||
msgstr "Kontoauszugzeile"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_account_invoice
|
||||
msgid "Invoice"
|
||||
msgstr "Rechnung"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_account_move_line
|
||||
msgid "Journal Items"
|
||||
msgstr "Journalposten"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_stock_picking
|
||||
msgid "Picking List"
|
||||
msgstr "Kommissionierschein"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: view:account.move.line:base_transaction_id.view_move_line_form
|
||||
msgid "Reconciliation"
|
||||
msgstr "Ausgleich"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr "Verkaufsauftrag"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: field:account.invoice,transaction_id:0 field:sale.order,transaction_id:0
|
||||
msgid "Transaction ID"
|
||||
msgstr "Transaktionskennung"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: help:account.invoice,transaction_id:0
|
||||
msgid "Transaction ID from the financial institute"
|
||||
msgstr "Transaktionskennung des Kreditinstituts"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: field:account.move.line,transaction_ref:0
|
||||
msgid "Transaction Ref."
|
||||
msgstr "Transaktionsreferenz"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: help:sale.order,transaction_id:0
|
||||
msgid "Transaction id from the financial institute"
|
||||
msgstr "Transaktionskennung des Kreditinstituts"
|
||||
68
base_transaction_id/i18n/it.po
Normal file
68
base_transaction_id/i18n/it.po
Normal file
@@ -0,0 +1,68 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_transaction_id
|
||||
#
|
||||
# Translators:
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: bank-statement-reconcile (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-10-14 09:25+0000\n"
|
||||
"PO-Revision-Date: 2015-07-22 06:46+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: Italian (http://www.transifex.com/oca/OCA-bank-statement-reconcile-8-0/language/it/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: it\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_account_bank_statement_line
|
||||
msgid "Bank Statement Line"
|
||||
msgstr "Linea estratto conto"
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_account_invoice
|
||||
msgid "Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_account_move_line
|
||||
msgid "Journal Items"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_stock_picking
|
||||
msgid "Picking List"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: view:account.move.line:base_transaction_id.view_move_line_form
|
||||
msgid "Reconciliation"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: model:ir.model,name:base_transaction_id.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: field:account.invoice,transaction_id:0 field:sale.order,transaction_id:0
|
||||
msgid "Transaction ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: help:account.invoice,transaction_id:0
|
||||
msgid "Transaction ID from the financial institute"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: field:account.move.line,transaction_ref:0
|
||||
msgid "Transaction Ref."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_transaction_id
|
||||
#: help:sale.order,transaction_id:0
|
||||
msgid "Transaction id from the financial institute"
|
||||
msgstr ""
|
||||
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