This question has been flagged
1 Reply
5609 Views

In the account.invoice.refund which is a wizard I had added a boolean field 'is_refund' how could I get the value of this field from wizard to the invoice forum when creating a refund from the invoice form

Help me please

Avatar
Discard
Best Answer

Hello Jihen,


Try below code.


class AccountInvoice(models.Model):

    _inherit = "account.invoice"

    is_refund = fields.Boolean('Is Refund')


class AccountInvoiceRefund(models.Model):

    _inherit = "account.invoice.refund"

    is_refund = fields.Boolean('Is Refund')


    @api.multi

    def invoice_refund(self):

        result = super(AccountInvoiceRefund, self).invoice_refund()

        invoice_obj = self.env['account.invoice'].browse(self._context.get('active_id'))

        invoice_obj.is_refund = self.is_refund

        return result


Hope it will helps you.

Thanks,

Avatar
Discard
Author

Thanks a lot