diff --git a/account_payment_transaction_id/__init__.py b/account_payment_transaction_id/__init__.py
new file mode 100644
index 00000000..d564ba5d
--- /dev/null
+++ b/account_payment_transaction_id/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import account_payment
diff --git a/account_payment_transaction_id/__openerp__.py b/account_payment_transaction_id/__openerp__.py
new file mode 100644
index 00000000..32f735a2
--- /dev/null
+++ b/account_payment_transaction_id/__openerp__.py
@@ -0,0 +1,40 @@
+# -*- 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 .
+#
+##############################################################################
+
+
+{'name': 'Account Payment - Transaction ID',
+ 'version': 'version',
+ 'author': 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'license': 'AGPL-3',
+ 'category': 'Hidden',
+ 'depends': ['base_transaction_id',
+ 'account_payment',
+ ],
+ 'description': """
+Compatibility module between Account Payment and Base Transaction ID
+ """,
+ 'website': 'http://www.camptocamp.com',
+ 'data': [],
+ 'test': [],
+ 'installable': True,
+ 'auto_install': True,
+}
diff --git a/account_payment_transaction_id/account_payment.py b/account_payment_transaction_id/account_payment.py
new file mode 100644
index 00000000..1ddfe268
--- /dev/null
+++ b/account_payment_transaction_id/account_payment.py
@@ -0,0 +1,62 @@
+# -*- 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 .
+#
+##############################################################################
+
+from openerp.osv import orm
+
+
+class payment_line(orm.Model):
+ _inherit = 'payment.line'
+
+ def _update_transaction_id(self, cr, uid, ids, context=None):
+ """ Update the bank statement line's transaction id
+
+ When the payment line is linked with a bank statement line,
+ copy the transaction id of the related move line.
+
+ """
+ if isinstance(ids, (int, long)):
+ ids = [ids]
+ for line in self.browse(cr, uid, ids, context=context):
+ if not line.move_line_id:
+ continue
+ if not line.bank_statement_line_id:
+ continue
+ stat_trans_id = line.bank_statement_line_id.transaction_id
+ move_trans_id = line.move_line_id.transaction_ref
+ if stat_trans_id != move_trans_id:
+ line.bank_statement_line_id.write(
+ {'transaction_id': move_trans_id}
+ )
+
+ def create(self, cr, uid, vals, context=None):
+ line_id = super(payment_line, self).create(cr, uid, vals,
+ context=context)
+ if vals.get('bank_statement_line_id'):
+ self._update_transaction_id(cr, uid, [line_id], context=context)
+ return line_id
+
+ def write(self, cr, uid, ids, vals, context=None):
+ result = super(payment_line, self).write(cr, uid, ids, vals,
+ context=context)
+ if vals.get('bank_statement_line_id'):
+ self._update_transaction_id(cr, uid, ids, context=context)
+ return result
+