[IMP] move 'structured' reference type to account_banking_payment_export

This commit is contained in:
Stéphane Bidoul
2014-09-30 18:09:49 +02:00
parent 9c9826ee4b
commit 3eddb643f1
3 changed files with 36 additions and 29 deletions

View File

@@ -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
)
}

View File

@@ -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

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 ACSONE SA (<http://acsone.eu>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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