summaryrefslogtreecommitdiff
path: root/addons/crm_iap_lead
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2020-05-04 09:18:39 +0000
committerThibault Delavallée <tde@odoo.com>2020-08-18 11:41:59 +0000
commitfcd10b3691c2291f224ac5083395edf0f00fc9ee (patch)
treeb9b7535bf820959eb6e311bf72e9352dc4c1da4a /addons/crm_iap_lead
parent14a73fa1dffc50295e59cdaa4db2a8427cfcb040 (diff)
[REF] iap, various: reorganize IAP module organization
PURPOSE Clean and improve IAP tools integration in Odoo. Introduce bridge modules to extract common features, notably for CRM and Partner. SPECIFICATIONS In this commit we reorganize IAP module to better understand its content and ease future cleaning * have models separated from tools; * rename some tools to find their grep. An iap_ prefix is added to ensure we don't clash with other global functions or methods; * perform some linting; To provide backward compatibility support we keep some import in init file of IAP addon. Standard code is about to be updated but we want to avoid too much issues when migrating code to 13.5 . Compatibility layer will be removed after v14 final freeze. LINKS Task ID-2248367 Community PR odoo/odoo#53214 Enterprise PR odoo/enterprise#11258 Upgrade PR odoo/upgrade#1363 IAP PR odoo/iap-apps#191
Diffstat (limited to 'addons/crm_iap_lead')
-rw-r--r--addons/crm_iap_lead/models/crm_iap_lead_mining_request.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/crm_iap_lead/models/crm_iap_lead_mining_request.py b/addons/crm_iap_lead/models/crm_iap_lead_mining_request.py
index f3bedd5905a..4179861e343 100644
--- a/addons/crm_iap_lead/models/crm_iap_lead_mining_request.py
+++ b/addons/crm_iap_lead/models/crm_iap_lead_mining_request.py
@@ -4,8 +4,7 @@
import logging
from odoo import api, fields, models, _
-from odoo.exceptions import ValidationError
-from odoo.addons.iap import jsonrpc, InsufficientCreditError
+from odoo.addons.iap.tools import iap_tools
_logger = logging.getLogger(__name__)
@@ -180,9 +179,9 @@ class CRMLeadMiningRequest(models.Model):
'data': server_payload
}
try:
- response = jsonrpc(endpoint, params=params, timeout=300)
+ response = iap_tools.iap_jsonrpc(endpoint, params=params, timeout=300)
return response['data']
- except InsufficientCreditError as e:
+ except iap_tools.InsufficientCreditError as e:
self.error = 'Insufficient credits. Recharge your account and retry.'
self.state = 'error'
self._cr.commit()