Files
rma/crm_claim_rma/wizards/account_invoice_refund.py
2015-11-12 10:22:45 -04:30

45 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2015 Vauxoo
# Copyright 2015 Eezee-It, MONK Software
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
# Benoît Guillot, Joel Grand-Guillaume, Leonardo Donelli,
# Osval Reyes
#
# 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, fields, models
class AccountInvoiceRefund(models.TransientModel):
_inherit = "account.invoice.refund"
def _default_description(self):
return self.env.context.get('description', '')
description = fields.Char(default=_default_description)
@api.multi
def compute_refund(self, mode='refund'):
self.ensure_one()
invoice_ids = self.env.context.get('invoice_ids', [])
if invoice_ids:
self = self.with_context(active_ids=invoice_ids)
return super(AccountInvoiceRefund, self).compute_refund(mode=mode)