mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
Simplify some methods, work with recordset instead of ids when possible, use @api.one, follow naming guidelines, ... Also fixes an error introduced in the previous-to-last commit regarding the custom exceptions.
42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
##############################################################################
|
|
#
|
|
# 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
|
|
#
|
|
# 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 models, fields, api
|
|
|
|
|
|
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.one
|
|
def compute_refund(self, mode='refund'):
|
|
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)
|