From b5df6a43338422359ac16b8c771610990d9f8163 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Fri, 15 May 2026 16:07:06 +0000 Subject: [PATCH] Remove E-Taxes Obligation Pact doctype and its loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- invoice_az/client/company.js | 21 +---- invoice_az/company_api.py | 52 +----------- .../e_taxes_obligation_pact/__init__.py | 0 .../e_taxes_obligation_pact.json | 80 ------------------- .../e_taxes_obligation_pact.py | 8 -- .../test_e_taxes_obligation_pact.py | 16 ---- .../e_taxes_presented_certificate.json | 4 +- 7 files changed, 4 insertions(+), 177 deletions(-) delete mode 100644 invoice_az/invoice_az/doctype/e_taxes_obligation_pact/__init__.py delete mode 100644 invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.json delete mode 100644 invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.py delete mode 100644 invoice_az/invoice_az/doctype/e_taxes_obligation_pact/test_e_taxes_obligation_pact.py diff --git a/invoice_az/client/company.js b/invoice_az/client/company.js index 95a141c..9ef5abf 100644 --- a/invoice_az/client/company.js +++ b/invoice_az/client/company.js @@ -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...') diff --git a/invoice_az/company_api.py b/invoice_az/company_api.py index 5f2d133..7a817eb 100644 --- a/invoice_az/company_api.py +++ b/invoice_az/company_api.py @@ -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"], } diff --git a/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/__init__.py b/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.json b/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.json deleted file mode 100644 index 988876b..0000000 --- a/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.json +++ /dev/null @@ -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" -} diff --git a/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.py b/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.py deleted file mode 100644 index 5b40edb..0000000 --- a/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/e_taxes_obligation_pact.py +++ /dev/null @@ -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 diff --git a/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/test_e_taxes_obligation_pact.py b/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/test_e_taxes_obligation_pact.py deleted file mode 100644 index faad80a..0000000 --- a/invoice_az/invoice_az/doctype/e_taxes_obligation_pact/test_e_taxes_obligation_pact.py +++ /dev/null @@ -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 diff --git a/invoice_az/invoice_az/doctype/e_taxes_presented_certificate/e_taxes_presented_certificate.json b/invoice_az/invoice_az/doctype/e_taxes_presented_certificate/e_taxes_presented_certificate.json index e23bf6e..399bbf0 100644 --- a/invoice_az/invoice_az/doctype/e_taxes_presented_certificate/e_taxes_presented_certificate.json +++ b/invoice_az/invoice_az/doctype/e_taxes_presented_certificate/e_taxes_presented_certificate.json @@ -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 }, {