Commit Graph

75 Commits

Author SHA1 Message Date
Ali f622a4ce2a feat: Company Data Loading + Tax Policy reference lists
Adds a "Data Loading" dialog on Company form that pulls 6 types of
taxpayer reference data from E-Taxes into dedicated doctypes, plus
in-form summary tables inside the Tax Policy tab.

New DocTypes (all with company link, Accounts User read-only,
System Manager full CRUD):
- E-Taxes Object (taxpayer registered locations)
- E-Taxes Cash Register (kassa aparatları with object FK)
- E-Taxes POS Terminal (with auto-derived object from registration number)
- E-Taxes Bank Account
- E-Taxes Obligation Pact (sazişlər / oil fields)
- E-Taxes Presented Certificate (with sazis_code FK to Obligation Pact)

Backend (invoice_az/company_api.py):
- 6 per-doctype loaders + shared _auth_headers / _etaxes_request helpers
  implementing CLAUDE.md §10 401-retry-once pattern
- Cash Register / POS Terminal loaders walk the hasMore pagination
- load_company_data_bulk enqueues a background job that runs selected
  loaders sequentially and streams progress over Socket.IO
  (company_data_loading_progress / _complete events)
- get_company_reference_list exposes first N rows per doctype for the
  Tax Policy tab tables

Frontend (invoice_az/client/company.js):
- Full ETaxes auth module inlined (CLAUDE.md §2) so ASAN Imza re-auth
  works from Company form without relying on other forms' state
- "Data Loading" button opens a dialog of checkboxes (DATA_LOADERS
  declarative array) — one bulk call, one floating show_progress bar
- Six reference tables rendered inside Tax Policy tab sections,
  pattern copied from e-taxes_settings (card-section + Refresh +
  "View All" only when total > rows)

CLAUDE.md:
- Rewrote §3 backend template with 401 retry + explicit commit
- Added §10–§16: 401 auto-refresh, two response shapes,
  db.commit() standard, log title convention, frontend unauthorized
  handling, field naming for reference vs fixture doctypes,
  Socket.IO background job pattern

hooks.py:
- Register client/company.js under doctype_js["Company"]

.gitignore:
- Exclude *.har (may contain Bearer tokens / PII)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 13:59:29 +00:00
Ali 64961e4108 feat: switch all imports to Socket.IO background jobs for better performance
Replace sequential AJAX calls with frappe.enqueue + publish_realtime for:
- Sales Order import (sales_api.py + sales_order.js)
- Purchase Order import (api.py + purchase_order.js)
- Sales Invoice import (api.py + sales_invoice.js)
- VAT Operations import (vat_api.py + journal_entry.js)
- AMAS Employee import (amas_api.py + employee.js)

Also remove "Certificates retrieved successfully" msgprint from asan_login.js

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 13:47:08 +00:00
Ali cdb6739308 cleanup: remove Test API buttons from sales invoice, add filterable badges in journal entry
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 19:10:29 +04:00
Ali c561371a16 fix: allow sending invoice without customer object selection
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 14:50:33 +04:00
Ali 10be61958c fix: vat18 should be item amount subject to VAT, make objectName optional
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 14:34:11 +04:00
Ali a7e6d697c5 debug: log raw e-taxes payload to Error Log before sending
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 14:13:52 +04:00
Ali 731f020d6d fix: use vat_amount instead of vat_18_percent_with_amount for e-taxes vat18 field
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 14:02:57 +04:00
Ali 1121908352 fix: send correct VAT amount to e-taxes instead of total with VAT
vat_18_percent_with_amount stores the total INCLUDING VAT (e.g. 118),
but the e-taxes API vat18 field expects just the tax amount (e.g. 18).
Also calculates net cost/pricePerUnit for VAT-inclusive pricing (ƏDV daxil 18%).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:50:19 +04:00
Ali d3775786a3 fix: respect data loading checkboxes in reference data loading
Checkbox values (load_items, load_units, load_customers, load_suppliers)
were collected in the dialog but never passed through the loading pipeline,
causing all data types to always be created regardless of user selection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:40:46 +04:00
Ali dca5a13de3 fixed bug with employee_number 2026-03-07 03:25:36 +04:00
Ali c28c968710 removed all backup files 2026-03-03 17:44:48 +04:00
Ali 408e55d709 e-taxes settings is single doctype now 2026-03-03 17:40:05 +04:00
Ali 49d974f366 e-taxes settings is single doctype now 2026-03-03 17:32:33 +04:00
Ali 2ba3a97227 e-taxes settings is single doctype now 2026-03-03 17:15:45 +04:00
Ali 331aabe1d7 e-taxes settings is single doctype now 2026-03-03 17:10:12 +04:00
Ali 5ee0badd00 e-taxes settings is single doctype now 2026-03-03 17:03:52 +04:00
Ali 0b46271628 e-taxes settings is single doctype now 2026-03-03 16:52:15 +04:00
Ali d78781d9b8 e-taxes settings is single doctype now 2026-03-03 16:45:58 +04:00
Ali 74bd74b7ba e-taxes settings is single doctype now 2026-03-03 16:32:44 +04:00
Ali 61ec366149 e-taxes settings is single doctype now 2026-03-03 16:25:39 +04:00
Ali 639d580c19 e-taxes settings is single doctype now 2026-03-03 16:17:07 +04:00
Ali 7969b96d87 bug fixes 2026-02-13 17:14:14 +04:00
Ali 0fd5399b7f added relogin to emas and other 2026-02-13 00:30:31 +04:00
Ali 72cf279a64 refactor: rename EMAS to AMAS throughout application
This commit renames all references from "emas" to "amas" in the invoice_az application, including:

**DocType Changes:**
- Renamed DocType: "Emas Employees" → "Amas Employees"
- Updated autoname: EMAS-EMP-{####} → AMAS-EMP-{####}
- Updated Python class: EmasEmployees → AmasEmployees

**Files Renamed:**
- invoice_az/emas_api.py → amas_api.py
- client/emas_employees.js → amas_employees.js
- doctype/emas_employees/ → amas_employees/ (entire directory)

**Code Updates:**
- Python: All EMAS_ constants → AMAS_ constants
- Python: All emas_ functions → amas_ functions
- JavaScript: All emas references → amas references
- API paths: invoice_az.emas_api → invoice_az.amas_api

**Database Migration:**
- Asan Login fields renamed:
  - emas_section → amas_section
  - emas_auth_status → amas_auth_status
  - emas_account_name → amas_account_name
  - emas_account_number → amas_account_number
  - column_break_emas → column_break_amas
  - emas_account_oid → amas_account_oid
  - emas_last_activity → amas_last_activity
  - emas_session → amas_session
  - emas_csrf_token → amas_csrf_token

**Preserved (Not Changed):**
- User-facing text with "ƏMAS" (Azerbaijani ə character)
- API requirements: ":eroom:emas", "domain": "emas"
- Report ID: "emasValidEmploymentContractOnline"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 13:48:29 +04:00
Ali aa2cab8b22 chore: remove unnecessary bundle file and old docs
- Remove invoice_az.bundle.js (not needed, app uses doctype_js)
- Remove OPTIMIZATION_SUMMARY.md (outdated)
- Remove claude.md (replaced by CLAUDE.md)

The patches.txt file is sufficient to make the app recognizable by Frappe.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 14:21:12 +04:00
Ali 27c4c0aaa4 fix: resolve build errors in invoice_az app
Fixed two critical issues preventing app installation:
1. Removed non-existent e_taxes_parties_list.js from hooks.py
2. Added missing patches.txt file (required for Frappe app detection)
3. Added minimal bundle.js file to satisfy build system

Without patches.txt, the app was not recognized as a valid Frappe app,
causing esbuild to fail with "paths[0] must be of type string" error.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 14:18:44 +04:00
Ali c917a94e6e fixed classification code being in wrong module 2026-02-10 20:55:01 +04:00
Ali 002b317958 added emas integration and emas employees 2026-02-10 17:53:47 +04:00
Ali 95f685a3a7 bug fix 2026-01-30 20:55:41 +04:00
Ali 70731f7b02 bug fix 2026-01-30 20:50:26 +04:00
Ali 061a71f93d bug fix 2026-01-30 20:38:24 +04:00
Ali 44bed2e82f added purchase invoice act sending 2026-01-29 16:49:01 +04:00
Ali 4879dcc94c Added purchase invoice sending (act) 2026-01-27 20:16:12 +04:00
Ali f1ae840d88 added create if not mapped 2026-01-22 20:30:37 +04:00
Ali c037dfe45c fixed bug with tittle and other 2026-01-21 19:38:10 +04:00
Ali 6ef03d2319 Added expense/income to e-taxes mapping duplicate check 2026-01-20 23:15:08 +04:00
Ali 9a3c705b4e Added expense/income to je list and added load as draft check 2026-01-20 20:20:44 +04:00
Ali 0ef93e4b36 added expense/income to mappings 2026-01-20 16:19:45 +04:00
Ali b3acbfa6e9 fixed fixtures 2026-01-14 23:15:42 +04:00
Ali c87e50fed5 added more fucntionality in journal entry import 2026-01-14 23:00:55 +04:00
Ali 4ed778e567 added import from etaxes to journal entry, with all bugfixes 2026-01-13 22:31:30 +04:00
Ali bd9bf9e2cc added invoice sending to etaxes 2025-12-19 15:39:51 +04:00
Ali 0896971525 added eqm codes to items and etaxes items 2025-09-22 20:57:36 +04:00
Ali 6df36695db fixed invoices date 2025-09-08 21:52:04 +04:00
Ali f0c19854fe Fixed bugs, added new tabs and subtabs, load from everywhere and etc 2025-07-23 12:39:40 +04:00
Ali 85f37a3f67 Parties got separated to customers and suppliers 2025-07-15 17:19:29 +04:00
Ali 295dfb2267 improved items searching code 2025-07-11 15:31:48 +04:00
Ali 94659173f6 fixed a lot of bugs, but some still unfixed 2025-07-10 14:49:30 +04:00
Ali a198d2a59b fixed bug with sales order not importing 2025-07-08 20:14:02 +04:00
Ali 70bf3dd2a3 updated ui and bugfixes 2025-07-08 18:58:06 +04:00