From 7342a10b3d7f1f15e1562054148724e2274385ab Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 20 Dec 2018 14:56:06 +0100 Subject: [PATCH] [IMP] validate multiple subscription request at once --- easy_my_coop/wizard/__init__.py | 1 + easy_my_coop/wizard/validate_subscription_request.py | 10 ++++++---- easy_my_coop/wizard/validate_subscription_request.xml | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/easy_my_coop/wizard/__init__.py b/easy_my_coop/wizard/__init__.py index 9f536af..63034ca 100644 --- a/easy_my_coop/wizard/__init__.py +++ b/easy_my_coop/wizard/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- from . import create_subscription_from_partner from . import update_partner_info +from . import validate_subscription_request diff --git a/easy_my_coop/wizard/validate_subscription_request.py b/easy_my_coop/wizard/validate_subscription_request.py index 3a2dbb5..212ca0e 100644 --- a/easy_my_coop/wizard/validate_subscription_request.py +++ b/easy_my_coop/wizard/validate_subscription_request.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models, _ -from openerp.exceptions import UserError +from openerp import api, models class ValidateSubscriptionRequest(models.TransientModel): @@ -10,8 +9,11 @@ class ValidateSubscriptionRequest(models.TransientModel): @api.multi def validate(self): + selected_requests = self.env['subscription.request'].browse( + self._context.get('active_ids')) + subscription_requests = selected_requests.filtered( + lambda record: record.state in ['draft', 'waiting']) - subscription_requests = self.filtered(lambda record: record.state in ['draft', 'waiting']) for subscription_request in subscription_requests: - subscription_request.validate_subscription_request + subscription_request.validate_subscription_request() return True diff --git a/easy_my_coop/wizard/validate_subscription_request.xml b/easy_my_coop/wizard/validate_subscription_request.xml index d952da9..37deeb6 100644 --- a/easy_my_coop/wizard/validate_subscription_request.xml +++ b/easy_my_coop/wizard/validate_subscription_request.xml @@ -18,7 +18,7 @@ - Update Cooperator Info + Validate subscription request ir.actions.act_window validate.subscription.request form @@ -28,8 +28,8 @@ - - Subscription Request + + Validate subscription Request client_action_multi action