mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
Copy sale_agreement_id from invoice to refund
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# 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):
|
class AccountInvoice(models.Model):
|
||||||
@@ -13,3 +13,14 @@ class AccountInvoice(models.Model):
|
|||||||
'sale.agreement', string='Sale Agreement', ondelete='restrict',
|
'sale.agreement', string='Sale Agreement', ondelete='restrict',
|
||||||
readonly=True, states={'draft': [('readonly', False)]},
|
readonly=True, states={'draft': [('readonly', False)]},
|
||||||
track_visibility='onchange')
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user