Remove E-Taxes Obligation Pact doctype and its loader
Drops the obl-pact-list integration entirely: the doctype directory, loader/bulk-loader entries, REFERENCE_SECTIONS row, reference-list allow-list entry, and the existence-check guard on Presented Certificate's sazis_code. sazis_code is now a plain Data field — no Link target to validate against. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
69f2acec86
commit
b5df6a4333
|
|
@ -618,17 +618,6 @@ const REFERENCE_SECTIONS = [
|
|||
{ label: 'Bank Name', field: 'bank_name' }
|
||||
]
|
||||
},
|
||||
{
|
||||
doctype: 'E-Taxes Obligation Pact',
|
||||
html_fieldname: 'obligation_pacts_list_html',
|
||||
list_route: '/app/e-taxes-obligation-pact',
|
||||
columns: [
|
||||
{ label: 'Code', field: 'code', link_to_item: true },
|
||||
{ label: 'Name', field: 'name_az' },
|
||||
{ label: 'Validity', field: 'validity_date', format: 'date' },
|
||||
{ label: 'Expire', field: 'expire_date', format: 'date' }
|
||||
]
|
||||
},
|
||||
{
|
||||
doctype: 'E-Taxes Presented Certificate',
|
||||
html_fieldname: 'presented_certificates_list_html',
|
||||
|
|
@ -818,18 +807,10 @@ const DATA_LOADERS = [
|
|||
method: 'invoice_az.company_api.load_company_bank_accounts',
|
||||
freezeMessage: __('Loading bank accounts from E-Taxes...')
|
||||
},
|
||||
{
|
||||
key: 'load_obligation_pacts',
|
||||
label: __('Load Obligation Pacts (Sazişlər)'),
|
||||
description: __('Load sub-contractor obligation pacts (oil fields / sazişlər) from E-Taxes'),
|
||||
default: 1,
|
||||
method: 'invoice_az.company_api.load_company_obligation_pacts',
|
||||
freezeMessage: __('Loading obligation pacts from E-Taxes...')
|
||||
},
|
||||
{
|
||||
key: 'load_presented_certificates',
|
||||
label: __('Load Presented Certificates'),
|
||||
description: __('Load presented/accepted e-certificates from E-Taxes. Requires obligation pacts for links to resolve.'),
|
||||
description: __('Load presented/accepted e-certificates from E-Taxes.'),
|
||||
default: 1,
|
||||
method: 'invoice_az.company_api.load_company_presented_certificates',
|
||||
freezeMessage: __('Loading presented certificates from E-Taxes...')
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ OBJECT_LIST_URL = f"{BASE_URL}/api/po/profile/public/v1/object/list"
|
|||
CASH_REGISTER_LIST_URL = f"{BASE_URL}/api/po/profile/public/v2/profile/cashRegister/list"
|
||||
POS_TERMINAL_LIST_URL = f"{BASE_URL}/api/po/profile/public/v2/profile/posTerminal/list"
|
||||
BANK_ACCOUNT_LIST_URL = f"{BASE_URL}/api/po/profile/public/v1/profile/bankAccount/list"
|
||||
OBL_PACT_LIST_URL = f"{BASE_URL}/api/po/edi-legal/public/v1/application/sub-contractor/obl-pact-list"
|
||||
PRESENTED_CERT_LIST_URL = f"{BASE_URL}/api/po/edi-legal/public/v1/application/contractor/presented-accepted-e-certificates"
|
||||
|
||||
PAGE_SIZE = 200
|
||||
|
|
@ -485,56 +484,9 @@ def load_company_bank_accounts(company):
|
|||
# ======= OBLIGATION PACTS (sub-contractor obl-pact-list) =======
|
||||
|
||||
@frappe.whitelist()
|
||||
def load_company_obligation_pacts(company):
|
||||
"""Load obligation pacts (sazişlər — oil fields/agreements) from E-Taxes."""
|
||||
try:
|
||||
record_etaxes_activity()
|
||||
|
||||
if not company or not frappe.db.exists("Company", company):
|
||||
return {"success": False, "message": f"Company '{company}' not found."}
|
||||
|
||||
headers, err = _auth_headers()
|
||||
if err:
|
||||
return err
|
||||
|
||||
response, err = _etaxes_request("GET", OBL_PACT_LIST_URL, headers)
|
||||
if err:
|
||||
return err
|
||||
|
||||
data = response.json() or {}
|
||||
pacts = data.get("oblPacts") or []
|
||||
|
||||
created, updated = 0, 0
|
||||
for item in pacts:
|
||||
pact = item.get("oblPact") or {}
|
||||
code = pact.get("code")
|
||||
if not code:
|
||||
continue
|
||||
values = {
|
||||
"name_az": _get(pact, "name", "az"),
|
||||
"validity_date": _safe_date(item.get("validityDate")),
|
||||
"expire_date": _safe_date(item.get("expireDate")),
|
||||
"company": company,
|
||||
}
|
||||
c, u = _upsert("E-Taxes Obligation Pact", code, values, "code")
|
||||
created += c
|
||||
updated += u
|
||||
|
||||
frappe.db.commit()
|
||||
return _summarize(created, updated, len(pacts), "Obligation pacts loaded")
|
||||
|
||||
except Exception as e:
|
||||
frappe.log_error(
|
||||
f"Unexpected error: {e}\n{frappe.get_traceback()}",
|
||||
"E-Taxes Obligation Pact Load",
|
||||
)
|
||||
return {"success": False, "message": f"Error: {e}"}
|
||||
|
||||
|
||||
# ======= PRESENTED / ACCEPTED E-CERTIFICATES =======
|
||||
|
||||
def _map_certificate(cert, company):
|
||||
sazis_code = cert.get("sazisKodu")
|
||||
return {
|
||||
"cert_no": cert.get("certNo"),
|
||||
"cert_category": cert.get("certCategory"),
|
||||
|
|
@ -543,7 +495,7 @@ def _map_certificate(cert, company):
|
|||
"taxpayer_full_name": cert.get("taxPayerFullName"),
|
||||
"voen": cert.get("voen"),
|
||||
"sazis_name": cert.get("sazisName"),
|
||||
"sazis_code": sazis_code if sazis_code and frappe.db.exists("E-Taxes Obligation Pact", sazis_code) else None,
|
||||
"sazis_code": cert.get("sazisKodu") or None,
|
||||
"contract_start_date": _parse_compact_date(cert.get("contractStartDate")),
|
||||
"contract_end_date": _parse_compact_date(cert.get("contractEndDate")),
|
||||
"cert_start_date": _parse_compact_date(cert.get("certStartDate")),
|
||||
|
|
@ -646,7 +598,6 @@ def _process_company_data_bulk(company, selections, user):
|
|||
"load_cash_registers": (load_company_cash_registers, "Cash Registers"),
|
||||
"load_pos_terminals": (load_company_pos_terminals, "POS Terminals"),
|
||||
"load_bank_accounts": (load_company_bank_accounts, "Bank Accounts"),
|
||||
"load_obligation_pacts": (load_company_obligation_pacts, "Obligation Pacts"),
|
||||
"load_presented_certificates": (load_company_presented_certificates, "Presented Certificates"),
|
||||
}
|
||||
|
||||
|
|
@ -716,7 +667,6 @@ _REFERENCE_LIST_FIELDS = {
|
|||
"E-Taxes Cash Register": ["name", "number", "model", "ecash_status", "object", "installed_at"],
|
||||
"E-Taxes POS Terminal": ["name", "registration_number", "serial_number", "status", "registration_date"],
|
||||
"E-Taxes Bank Account": ["name", "number", "currency", "status", "bank_name"],
|
||||
"E-Taxes Obligation Pact": ["name", "code", "name_az", "validity_date", "expire_date"],
|
||||
"E-Taxes Presented Certificate": ["name", "cert_no", "taxpayer_full_name", "cert_category"],
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,80 +0,0 @@
|
|||
{
|
||||
"actions": [],
|
||||
"autoname": "field:code",
|
||||
"creation": "2026-04-21 12:00:00",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"code",
|
||||
"name_az",
|
||||
"validity_date",
|
||||
"expire_date",
|
||||
"company_section",
|
||||
"company"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "code",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Code",
|
||||
"length": 40,
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "name_az",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Name (AZ)",
|
||||
"length": 500,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "validity_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Validity Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "expire_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Expire Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "company_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Link"
|
||||
},
|
||||
{
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_standard_filter": 1,
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2026-04-21 12:00:00",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Invoice Az",
|
||||
"name": "E-Taxes Obligation Pact",
|
||||
"naming_rule": "By fieldname",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{"create": 1, "delete": 1, "email": 1, "export": 1, "print": 1, "read": 1, "report": 1, "role": "System Manager", "share": 1, "write": 1},
|
||||
{"create": 1, "email": 1, "export": 1, "print": 1, "read": 1, "report": 1, "role": "Accounts User", "share": 1, "write": 1}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"track_changes": 1,
|
||||
"title_field": "name_az"
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# Copyright (c) 2025, Jey ERP and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class ETaxesObligationPact(Document):
|
||||
pass
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
# Copyright (c) 2025, Jey ERP and Contributors
|
||||
# See license.txt
|
||||
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = []
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = []
|
||||
|
||||
|
||||
class UnitTestETaxesObligationPact(UnitTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTestETaxesObligationPact(IntegrationTestCase):
|
||||
pass
|
||||
|
|
@ -101,10 +101,10 @@
|
|||
},
|
||||
{
|
||||
"fieldname": "sazis_code",
|
||||
"fieldtype": "Link",
|
||||
"fieldtype": "Data",
|
||||
"in_standard_filter": 1,
|
||||
"label": "Agreement Code",
|
||||
"options": "E-Taxes Obligation Pact",
|
||||
"length": 40,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue