|
|
@ -3,7 +3,7 @@ |
|
|
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com> |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
from odoo import models, fields |
|
|
|
from odoo import models, fields, api |
|
|
|
|
|
|
|
|
|
|
|
class AccountInvoice(models.Model): |
|
|
@ -13,3 +13,14 @@ class AccountInvoice(models.Model): |
|
|
|
'sale.agreement', string='Sale Agreement', ondelete='restrict', |
|
|
|
readonly=True, states={'draft': [('readonly', False)]}, |
|
|
|
track_visibility='onchange') |
|
|
|
|
|
|
|
@api.model |
|
|
|
def _prepare_refund( |
|
|
|
self, invoice, date_invoice=None, date=None, description=None, |
|
|
|
journal_id=None): |
|
|
|
values = super(AccountInvoice, self)._prepare_refund( |
|
|
|
invoice, date_invoice=date_invoice, date=date, |
|
|
|
description=description, journal_id=journal_id) |
|
|
|
if invoice.sale_agreement_id: |
|
|
|
values['sale_agreement_id'] = invoice.sale_agreement_id.id |
|
|
|
return values |