From 1c6e11b071ad500f7e9b681631f5fc81a1fd6421 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Tue, 15 May 2012 13:52:10 +0200 Subject: [PATCH] [ADD] mod base_transaction_id (lp:c2c-financial-addons/6.1 rev 24.1.5) --- base_transaction_id/__init__.py | 23 ++++++++++++++++ base_transaction_id/__openerp__.py | 40 ++++++++++++++++++++++++++++ base_transaction_id/invoice.py | 35 ++++++++++++++++++++++++ base_transaction_id/invoice_view.xml | 30 +++++++++++++++++++++ base_transaction_id/sale.py | 39 +++++++++++++++++++++++++++ base_transaction_id/sale_view.xml | 21 +++++++++++++++ 6 files changed, 188 insertions(+) create mode 100644 base_transaction_id/__init__.py create mode 100644 base_transaction_id/__openerp__.py create mode 100644 base_transaction_id/invoice.py create mode 100644 base_transaction_id/invoice_view.xml create mode 100644 base_transaction_id/sale.py create mode 100644 base_transaction_id/sale_view.xml diff --git a/base_transaction_id/__init__.py b/base_transaction_id/__init__.py new file mode 100644 index 00000000..2f307604 --- /dev/null +++ b/base_transaction_id/__init__.py @@ -0,0 +1,23 @@ +# -*- 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 . +# +############################################################################## + +from . import invoice +from . import sale diff --git a/base_transaction_id/__openerp__.py b/base_transaction_id/__openerp__.py new file mode 100644 index 00000000..cfbfe4b9 --- /dev/null +++ b/base_transaction_id/__openerp__.py @@ -0,0 +1,40 @@ +# -*- 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 . +# +############################################################################## + +{'name': 'Base transaction id for financial institutes', + 'version': '1.0', + 'author': 'Camptocamp', + 'maintainer': 'Camptocamp', + 'category': 'Hidden/Dependency', + 'complexity': 'easy', #easy, normal, expert + 'depends': ['account', 'sale'], + 'description': """Adds transaction id to invoice and sale models and views""", + 'website': 'http://www.openerp.com', + 'init_xml': [], + 'update_xml': ['invoice_view.xml', 'sale_view.xml'], + 'demo_xml': [], + 'test': [], + 'installable': True, + 'images': [], + 'auto_install': False, + 'license': 'AGPL-3', + 'active': False, +} diff --git a/base_transaction_id/invoice.py b/base_transaction_id/invoice.py new file mode 100644 index 00000000..26a7f3ae --- /dev/null +++ b/base_transaction_id/invoice.py @@ -0,0 +1,35 @@ +# -*- 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 . +# +############################################################################## + +from osv import fields, osv +from tools.translate import _ + +class AccountInvoice(osv.osv): + _inherit = 'account.invoice' + _columns = { + 'transaction_id':fields.char( + 'Transaction id', + size=128, + required=False, + select=1, + help="Transction id from the financial institute" + ), + } diff --git a/base_transaction_id/invoice_view.xml b/base_transaction_id/invoice_view.xml new file mode 100644 index 00000000..2953720a --- /dev/null +++ b/base_transaction_id/invoice_view.xml @@ -0,0 +1,30 @@ + + + + + customer.invoice.transaction.inherit + account.invoice + + form + + + + + + + + + + + account.invoice.tree.inherit + account.invoice + + form + + + + + + + + diff --git a/base_transaction_id/sale.py b/base_transaction_id/sale.py new file mode 100644 index 00000000..62330e2c --- /dev/null +++ b/base_transaction_id/sale.py @@ -0,0 +1,39 @@ +# -*- 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 . +# +############################################################################## + +from osv import fields, osv + +class SaleOrder(osv.osv): + _inherit = 'sale.order' + _columns = { + 'transaction_id':fields.char('Transaction id', size=128,required=False, + help="Transction id from the financial institute"), + } + + + def _prepare_invoice(self, cursor, uid, order, lines, context=None): + #we put the transaction id in the generated invoices + if context is None: + context = {} + invoice_vals = super(SaleOrder, self)._prepare_invoice(cursor, uid, order, lines, context) + invoice_vals.update({ + 'transaction_id': order.transaction_id}) + return invoice_vals diff --git a/base_transaction_id/sale_view.xml b/base_transaction_id/sale_view.xml new file mode 100644 index 00000000..512cac8c --- /dev/null +++ b/base_transaction_id/sale_view.xml @@ -0,0 +1,21 @@ + + + + sale.order.form.transaction + sale.order + form + + + + + + + + + + \ No newline at end of file