[FIX] l10n_eg_edi_eta: fix the url within the qr code on the egyptian invoice
The URL computed by Odoo was not mathing the URL computed by the ETA system. The previous endpoint used was https://api.invoicing.eta.gov.eg instead of https://invoicing.eta.gov.eg. Also the url contained '/search/' which should not be there. Correct format should be https://invoicing.eta.gov.eg/documents/id/share/long_id closes odoo/odoo#113937 X-original-commit: 70f6199401cfde0cdb7864910f9e8e14117981b6 Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
@@ -18,6 +18,8 @@ _logger = logging.getLogger(__name__)
|
||||
ETA_DOMAINS = {
|
||||
'preproduction': 'https://api.preprod.invoicing.eta.gov.eg',
|
||||
'production': 'https://api.invoicing.eta.gov.eg',
|
||||
'invoice.preproduction': 'https://preprod.invoicing.eta.gov.eg/',
|
||||
'invoice.production': 'https://invoicing.eta.gov.eg',
|
||||
'token.preproduction': 'https://id.preprod.eta.gov.eg',
|
||||
'token.production': 'https://id.eta.gov.eg',
|
||||
}
|
||||
@@ -41,6 +43,10 @@ class L10nEgHTTPAdapter(requests.adapters.HTTPAdapter):
|
||||
class AccountEdiFormat(models.Model):
|
||||
_inherit = 'account.edi.format'
|
||||
|
||||
@api.model
|
||||
def _l10n_eg_get_eta_qr_domain(self, production_enviroment=False):
|
||||
return production_enviroment and ETA_DOMAINS['invoice.production'] or ETA_DOMAINS['invoice.preproduction']
|
||||
|
||||
@api.model
|
||||
def _l10n_eg_get_eta_api_domain(self, production_enviroment=False):
|
||||
return production_enviroment and ETA_DOMAINS['production'] or ETA_DOMAINS['preproduction']
|
||||
|
||||
@@ -43,8 +43,8 @@ class AccountMove(models.Model):
|
||||
for move in self:
|
||||
if move.invoice_date and move.l10n_eg_uuid and move.l10n_eg_long_id:
|
||||
is_prod = move.company_id.l10n_eg_production_env
|
||||
base_url = self.env['account.edi.format']._l10n_eg_get_eta_api_domain(production_enviroment=is_prod)
|
||||
qr_code_str = '%s/documents/search/%s/share/%s' % (base_url, move.l10n_eg_uuid, move.l10n_eg_long_id)
|
||||
base_url = self.env['account.edi.format']._l10n_eg_get_eta_qr_domain(production_enviroment=is_prod)
|
||||
qr_code_str = '%s/documents/%s/share/%s' % (base_url, move.l10n_eg_uuid, move.l10n_eg_long_id)
|
||||
move.l10n_eg_qr_code = qr_code_str
|
||||
else:
|
||||
move.l10n_eg_qr_code = ''
|
||||
|
||||
Reference in New Issue
Block a user