mirror of
https://github.com/bringout/oca-ocb-l10n_asia-pacific.git
synced 2026-04-27 06:42:04 +02:00
19.0 vanilla
This commit is contained in:
parent
7dc55599c6
commit
7f43bbbfcc
650 changed files with 45260 additions and 33436 deletions
30
odoo-bringout-oca-ocb-l10n_in/l10n_in/models/iap_account.py
Normal file
30
odoo-bringout-oca-ocb-l10n_in/l10n_in/models/iap_account.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from odoo import api, models
|
||||
from odoo.addons.iap import jsonrpc
|
||||
|
||||
DEFAULT_IAP_ENDPOINT = "https://l10n-in-edi.api.odoo.com"
|
||||
DEFAULT_IAP_TEST_ENDPOINT = "https://l10n-in-edi-demo.api.odoo.com"
|
||||
IAP_SERVICE_NAME = 'l10n_in_edi'
|
||||
TEST_GST_NUMBER = '24FANCY1234AAZA'
|
||||
|
||||
|
||||
class IapAccount(models.Model):
|
||||
_inherit = 'iap.account'
|
||||
|
||||
@api.model
|
||||
def _l10n_in_connect_to_server(self, is_production, params, url_path, config_parameter, timeout=25):
|
||||
IrConfigParam = self.env['ir.config_parameter'].sudo()
|
||||
user_token = self.get(IAP_SERVICE_NAME)
|
||||
params.update({
|
||||
"dbuuid": IrConfigParam.get_param("database.uuid"),
|
||||
"account_token": user_token.sudo().account_token,
|
||||
})
|
||||
gsp_provider = IrConfigParam.get_param("l10n_in.gsp_provider")
|
||||
if gsp_provider:
|
||||
params.update({"gsp_provider": gsp_provider})
|
||||
if params.get('gstin') == TEST_GST_NUMBER:
|
||||
default_endpoint = DEFAULT_IAP_TEST_ENDPOINT
|
||||
else:
|
||||
default_endpoint = DEFAULT_IAP_ENDPOINT if is_production else DEFAULT_IAP_TEST_ENDPOINT
|
||||
endpoint = IrConfigParam.get_param(config_parameter, default_endpoint)
|
||||
url = "%s%s" % (endpoint, url_path)
|
||||
return jsonrpc(url, params=params, timeout=timeout)
|
||||
Loading…
Add table
Add a link
Reference in a new issue