From 3eddb643f165850db87b3ea41076988dd66439d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Tue, 30 Sep 2014 18:09:49 +0200 Subject: [PATCH] [IMP] move 'structured' reference type to account_banking_payment_export --- .../account_banking/account_banking.py | 29 --------------- .../models/__init__.py | 1 + .../models/account_invoice.py | 35 +++++++++++++++++++ 3 files changed, 36 insertions(+), 29 deletions(-) create mode 100644 account_banking_payment_export/models/account_invoice.py diff --git a/__unported__/account_banking/account_banking.py b/__unported__/account_banking/account_banking.py index 829befc29..13d91242e 100644 --- a/__unported__/account_banking/account_banking.py +++ b/__unported__/account_banking/account_banking.py @@ -621,22 +621,6 @@ class account_bank_statement_line(orm.Model): class invoice(orm.Model): - ''' - Create other reference types as well. - - Descendant classes can extend this function to add more reference - types, ie. - - def _get_reference_type(self, cr, uid, context=None): - return super(my_class, self)._get_reference_type(cr, uid, - context=context) + [('my_ref', _('My reference')] - - Don't forget to redefine the column "reference_type" as below or - your method will never be triggered. - - TODO: move 'structured' part to account_banking_payment module - where it belongs - ''' _inherit = 'account.invoice' def test_undo_paid(self, cr, uid, ids, context=None): @@ -649,16 +633,3 @@ class invoice(orm.Model): return False return True - def _get_reference_type(self, cr, uid, context=None): - ''' - Return the list of reference types - ''' - return [('none', _('Free Reference')), - ('structured', _('Structured Reference')), - ] - - _columns = { - 'reference_type': fields.selection(_get_reference_type, - 'Reference Type', required=True - ) - } diff --git a/account_banking_payment_export/models/__init__.py b/account_banking_payment_export/models/__init__.py index 2f044680a..58f25e448 100644 --- a/account_banking_payment_export/models/__init__.py +++ b/account_banking_payment_export/models/__init__.py @@ -3,3 +3,4 @@ from . import account_payment from . import payment_mode from . import payment_mode_type from . import account_move_line +from . import account_invoice diff --git a/account_banking_payment_export/models/account_invoice.py b/account_banking_payment_export/models/account_invoice.py new file mode 100644 index 000000000..89da3b71b --- /dev/null +++ b/account_banking_payment_export/models/account_invoice.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2014 ACSONE SA (). +# +# All other contributions are (C) by their respective contributors +# +# All Rights Reserved +# +# 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 import api, models, _ + + +class AccountInvoice(models.Model): + _inherit = 'account.invoice' + + @api.model + def _get_reference_type(self): + rt = super(AccountInvoice, self)._get_reference_type() + rt.append(('structured', _('Structured Reference'))) + return rt