From 2847f14dc7f0d3bfdfe5c6f80b69cef26f17b426 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 10 Apr 2014 18:26:19 +0200 Subject: [PATCH] Add module account_invoice_sale_link. --- account_invoice_sale_link/__init__.py | 23 ++++++++++ account_invoice_sale_link/__openerp__.py | 44 ++++++++++++++++++++ account_invoice_sale_link/account_invoice.py | 36 ++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 account_invoice_sale_link/__init__.py create mode 100644 account_invoice_sale_link/__openerp__.py create mode 100644 account_invoice_sale_link/account_invoice.py diff --git a/account_invoice_sale_link/__init__.py b/account_invoice_sale_link/__init__.py new file mode 100644 index 0000000..66a42ee --- /dev/null +++ b/account_invoice_sale_link/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Invoice Sale Link module for OpenERP +# Copyright (C) 2013 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 account_invoice diff --git a/account_invoice_sale_link/__openerp__.py b/account_invoice_sale_link/__openerp__.py new file mode 100644 index 0000000..58d2d7f --- /dev/null +++ b/account_invoice_sale_link/__openerp__.py @@ -0,0 +1,44 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Invoice Sale Link module for OpenERP +# Copyright (C) 2013 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 Invoice Sale Link', + 'version': '0.1', + 'category': 'Accounting & Finance', + 'license': 'AGPL-3', + 'summary': 'Add the reverse link from invoices to sale orders', + 'description': """ +Account Invoice Sale Link +========================= + +On the customer invoice report, you usually need to display the customer order number. For that, you need to have the link from invoices to sale orders, and this link is not available in the official addons. + +Please contact Alexis de Lattre from Akretion for any help or question about this module. + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['sale'], + 'data': [], + 'installable': True, + 'active': False, +} diff --git a/account_invoice_sale_link/account_invoice.py b/account_invoice_sale_link/account_invoice.py new file mode 100644 index 0000000..41c4e93 --- /dev/null +++ b/account_invoice_sale_link/account_invoice.py @@ -0,0 +1,36 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Invoice Sale Link module for OpenERP +# Copyright (C) 2013 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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, fields + + +class account_invoice(orm.Model): + _inherit = 'account.invoice' + + _columns = { + # This is the reverse link of the field 'invoice_ids' of sale.order + # defined in addons/sale/sale.py + 'sale_ids': fields.many2many( + 'sale.order', 'sale_order_invoice_rel', 'invoice_id', + 'order_id', 'Sale Orders', readonly=True, + help="This is the list of sale orders related to this invoice."), + }