From 7c725518de333228ddc9514e83775a993f713b4d Mon Sep 17 00:00:00 2001 From: houssine Date: Tue, 16 Apr 2019 14:55:26 +0200 Subject: [PATCH] [IMP] override the domain when refund is from release_capital_request --- easy_my_coop/wizard/__init__.py | 1 + easy_my_coop/wizard/account_invoice_refund.py | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 easy_my_coop/wizard/account_invoice_refund.py diff --git a/easy_my_coop/wizard/__init__.py b/easy_my_coop/wizard/__init__.py index 7141024..14f2e54 100644 --- a/easy_my_coop/wizard/__init__.py +++ b/easy_my_coop/wizard/__init__.py @@ -3,3 +3,4 @@ from . import create_subscription_from_partner from . import update_partner_info from . import validate_subscription_request from . import update_share_line +from . import account_invoice_refund diff --git a/easy_my_coop/wizard/account_invoice_refund.py b/easy_my_coop/wizard/account_invoice_refund.py new file mode 100644 index 0000000..8e26a7f --- /dev/null +++ b/easy_my_coop/wizard/account_invoice_refund.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from openerp import api, models + + +class AccountInvoiceRefund(models.TransientModel): + + _inherit = "account.invoice.refund" + + @api.multi + def compute_refund(self, mode='refund'): + result = super(AccountInvoiceRefund, self).compute_refund(mode) + context = dict(self._context or {}) + + inv = self.env['account.invoice'].browse(context.get('active_ids')) + if inv.release_capital_request: + domain = result['domain'] + t = ('release_capital_request', '=', True) + out = [t if e[0] == t[0] else e for e in domain] + result['domain'] = out + return result