Compare commits

..

2297 Commits

Author SHA1 Message Date
Ankush Menat
265bc4eb6f fix: Add authorization checks on internal functions 2026-06-08 14:49:23 +05:30
MochaMind
1e238678d8 chore: update POT file (#55692) 2026-06-07 23:28:33 +00:00
Jatin3128
bb36e956ac fix(subscription): bill on creation and keep status in sync with invoices (#55615) 2026-06-08 04:24:56 +05:30
Raffael Meyer
5641f37381 ci: add review comments on gettext files (#55699) 2026-06-07 22:11:45 +00:00
Nabin Hait
577a79471b Merge pull request #55688 from nabinhait/pi-services
refactor(accounts): extract Purchase Invoice services
2026-06-07 23:28:11 +05:30
Nabin Hait
c2e472b03c refactor(accounts): extract Purchase Invoice BillingStatusService
Move PR billing sync and provisional-entry cancellation into
accounts/doctype/purchase_invoice/services/billing_status.py:

- update_billing_status_in_pr, get_pr_details_billed_amt and
  cancel_provisional_entries move into the service (internal-only;
  on_submit/on_cancel and make_gl_entries repointed)
- the service imports the shared allocation helpers from
  purchase_receipt/services/billing_status.py (PR owns the shared
  buying billing logic)
- also repoints the validate_expense_account call in
  validate_for_repost missed in the ExpenseAccountService commit

No behaviour change.
2026-06-07 23:02:43 +05:30
Nabin Hait
e5f9698055 refactor(accounts): extract Purchase Invoice ExpenseAccountService
Move expense-account resolution into
accounts/doctype/purchase_invoice/services/expense_account.py:

- set_expense_account stays as a controller delegator (dispatched from
  accounts_controller.py) and force_set_against_expense_account stays
  (called by repost_accounting_ledger)
- validate_expense_account and set_against_expense_account move into the
  service; validate() repointed (the unused force kwarg on
  set_against_expense_account is dropped with the method)

Pre-existing raw SQL (SRBNB-booked-in-PR check) moved verbatim.
No behaviour change.
2026-06-07 23:02:43 +05:30
Nabin Hait
e45b027a22 Merge pull request #55687 from nabinhait/pr-services
refactor(stock): extract Purchase Receipt services
2026-06-07 22:40:31 +05:30
Nabin Hait
78cc06f127 Merge pull request #55101 from Abdeali099/fix-blank-cell-period-column
fix: handle blank rows in financial statement formatter
2026-06-07 22:27:50 +05:30
Nabin Hait
00646b7ed3 Merge pull request #54684 from AhmedAbokhatwa/profit-loss-report
fix(profit-loss-report): handle zero base values and prevent null% display
2026-06-07 22:25:57 +05:30
Nabin Hait
9267bd9eea Merge pull request #55686 from nabinhait/po-services
refactor(buying): extract Purchase Order services
2026-06-07 22:20:31 +05:30
Nabin Hait
298d3d9016 Merge pull request #55685 from nabinhait/dn-services
refactor(stock): extract Delivery Note services
2026-06-07 22:17:47 +05:30
Nabin Hait
a9f0ec83a4 Merge pull request #55684 from nabinhait/so-services
refactor(selling): extract Sales Order services
2026-06-07 22:16:24 +05:30
Nabin Hait
f33de37da0 refactor(stock): extract Purchase Receipt StockReservationService
Move stock reservation on PR submission into
stock/doctype/purchase_receipt/services/stock_reservation.py:

- reserve_stock, reserve_stock_for_sales_order,
  reserve_stock_for_production_plan and get_production_plan_references
  move into the service (internal-only; on_submit repointed)
- delegates to the Sales Order controller contract
  (create_stock_reservation_entries) and the shared StockReservation
  class

No behaviour change.
2026-06-07 09:55:15 +05:30
Nabin Hait
2a6d9be18a refactor(stock): extract Purchase Receipt ProvisionalAccountingService
Move provisional accounting for non-stock items into
stock/doctype/purchase_receipt/services/provisional_accounting.py:

- add_provisional_gl_entry stays as a controller delegator (called as a
  doc method by both the PR and PI GL composers)
- validate_provisional_expense_account moves into the service;
  validate() repointed

No behaviour change.
2026-06-07 09:54:28 +05:30
Nabin Hait
d1765e85aa refactor(stock): extract Purchase Receipt BillingStatusService
Move PR↔PI billed-amount allocation into
stock/doctype/purchase_receipt/services/billing_status.py. Purchase
Receipt owns the shared buying billing logic; Purchase Invoice imports
from the service module:

- update_billing_status stays as a controller delegator (called by
  Purchase Invoice flows and v13 patches)
- the module-function family moves verbatim:
  update_billed_amount_based_on_po, update_billing_percentage,
  get_billed_amount_against_pr/_po,
  get_purchase_receipts_against_po_details,
  get_billed_qty_amount_against_purchase_receipt/_order,
  adjust_incoming_rate_for_pr, get_item_wise_returned_qty
- imports repointed in purchase_invoice.py (top-level + lazy) and
  patches/v15_0/recalculate_amount_difference_field.py

No behaviour change.
2026-06-07 09:53:37 +05:30
Nabin Hait
3df8e7bfe6 refactor(buying): extract Purchase Order StatusService
Move status transitions and receiving progress into
buying/doctype/purchase_order/services/status.py:

- update_status (module-level whitelisted wrapper + list view) and
  update_receiving_percentage (called by child_item_update) stay as
  controller delegators
- check_modified_date moves into the service (internal to update_status)

No behaviour change.
2026-06-07 09:46:28 +05:30
Nabin Hait
f7460f7be3 refactor(buying): extract Purchase Order DropShipService
Move drop-ship item handling into
buying/doctype/purchase_order/services/drop_ship.py:

- update_dropship_received_qty stays as a whitelisted controller
  delegator (called from purchase_order.js)
- update_delivered_qty_in_sales_order, has_drop_ship_item and
  set_received_qty_to_zero_for_drop_ship_items move into the service
  (internal-only; on_cancel and the module-level update_status wrapper
  repointed)

No behaviour change.
2026-06-07 09:45:38 +05:30
Nabin Hait
920abdc0e2 refactor(buying): extract Purchase Order SubcontractingService
Move subcontracting integration into
buying/doctype/purchase_order/services/subcontracting.py:

- set_service_items_for_finished_goods (called by production plan
  work-order planning) and can_update_items (onload + child_item_update)
  stay as controller delegators
- validate_fg_item_for_subcontracting, auto_create_subcontracting_order
  and update_subcontracting_order_status move into the service;
  validate(), on_submit and update_status repointed

No behaviour change.
2026-06-07 09:44:59 +05:30
Nabin Hait
e0e3dcc8bf refactor(stock): extract Delivery Note PackingService
Move packing slip / product bundle handling into
stock/doctype/delivery_note/services/packing.py:

- validate_packed_qty stays as a controller delegator (called via
  hasattr contract in accounts/utils.py); has_unpacked_items stays
  for onload/JS
- get_product_bundle_list and cancel_packing_slips move into the
  service (internal-only; on_cancel repointed)

Pre-existing raw SQL in cancel_packing_slips moved verbatim.
No behaviour change.
2026-06-07 09:34:21 +05:30
Nabin Hait
9d020365e0 refactor(stock): extract Delivery Note BillingStatusService
Move billing status tracking and return invoicing into
stock/doctype/delivery_note/services/billing_status.py:

- update_status and update_billing_status stay as controller delegators
  (whitelisted update_delivery_note_status wrapper, v13 patches and
  Sales Invoice call them)
- make_return_invoice moves into the service (internal to on_submit)
- the update_billed_amount_based_on_so module function moves to the
  service module; the sales_invoice.py import is repointed
- drops stale Document/DocType/Abs imports

Pre-existing raw SQL in update_billed_amount_based_on_so moved verbatim.
No behaviour change.
2026-06-07 09:33:57 +05:30
Nabin Hait
0f876c10aa refactor(selling): extract Sales Order SubcontractingService
Move subcontracting (inward) integration into
selling/doctype/sales_order/services/subcontracting.py:

- can_update_items stays as a controller delegator (onload data +
  child_item_update.py caller)
- validate_fg_item_for_subcontracting and
  update_subcontracting_order_status move into the service; validate()
  and StatusService.update_status repointed

No behaviour change.
2026-06-06 23:13:52 +05:30
Nabin Hait
7f3ddfb3a1 refactor(selling): extract Sales Order DeliveryScheduleService
Move delivery schedule management into
selling/doctype/sales_order/services/delivery_schedule.py:

- get_delivery_schedule and create_delivery_schedule stay as whitelisted
  controller delegators (called from sales_order.js)
- update_delivery_date_based_on_schedule, delete_delivery_schedule_items
  and delete_removed_delivery_schedule_items move into the service
  (internal-only; on_submit/on_cancel repointed)

No behaviour change.
2026-06-06 23:13:12 +05:30
Nabin Hait
268d98d5f7 refactor(selling): extract Sales Order StatusService
Move status computation and progress tracking into
selling/doctype/sales_order/services/status.py:

- update_status, update_delivery_status, update_picking_status and
  set_indicator stay as controller delegators (whitelisted wrapper,
  purchase_order/pick_list/child_item_update callers, portal contract)
- check_modified_date moves into the service (internal to update_status)
- the billing/delivery/advance status defaults in validate() move to
  StatusService.set_default_statuses()

No behaviour change.
2026-06-06 23:12:28 +05:30
Nabin Hait
1be84112a7 refactor(selling): extract Sales Order StockReservationService
Move stock reservation logic out of the Sales Order controller into
selling/doctype/sales_order/services/stock_reservation.py:

- validate_reserved_stock, enable_auto_reserve_stock and the
  get_unreserved_qty module function move into the service (internal-only,
  callers repointed; stock_reservation_entry.py import updated)
- has_unreserved_stock, create/cancel_stock_reservation_entries and
  update_reserved_qty stay on the controller as thin delegators
  (whitelisted/JS-reachable or called from selling_controller and
  child_item_update)

No behaviour change.
2026-06-06 23:08:03 +05:30
Nabin Hait
fcff212eec Merge pull request #55679 from nabinhait/email-options-in-appointment
fix: set options Email for customer_email field in appointment
2026-06-06 21:11:53 +05:30
Nabin Hait
9b1157c914 fix: set options Email for customer_email field in appointment 2026-06-06 20:41:16 +05:30
Diptanil Saha
0ba2961103 fix: updated role based permission for terms and conditions doctype (#55674) 2026-06-06 11:44:08 +00:00
rohitwaghchaure
859d4caae4 Merge pull request #55661 from rohitwaghchaure/fixed-naming-series-issue
fix: naming series issue
2026-06-05 20:43:15 +05:30
Rohit Waghchaure
3a50056968 fix: naming series issue 2026-06-05 18:52:18 +05:30
rohitwaghchaure
e1f6bb70bc Merge pull request #55651 from rohitwaghchaure/fixed-rename-files
refactor: rename files
2026-06-05 15:56:37 +05:30
Nabin Hait
734fe874f2 Merge pull request #55647 from nabinhait/stock-controller-refactoring
refactor(stock): extract StockController into focused services
2026-06-05 15:52:00 +05:30
Khushi Rawat
5aab5502f0 feat: add side-by-side defaults comparison view in item defaults grid (#55017)
* feat: add side-by-side defaults comparison view in item defaults grid

* fix: coderabbit suggested changes

* fix: change label of the fields

* fix: description design
2026-06-05 15:43:57 +05:30
Khushi Rawat
5873f55cf0 feat: item prices list view (#54853)
* feat: add item prices tab to Item doctype

* feat: item form pricing tab

* fix: remove action button for edit item price

* fix: prevent stale item price rendering after form navigation

* fix: remove stale call to deleted edit_prices_button function

* fix: item price list fixes

* fix: show filtered price list

* fix: show filtered price list
2026-06-05 15:42:18 +05:30
Mihir Kandoi
df03524b19 [codex] Show in-transit status for add-to-transit Stock Entries (#55644) 2026-06-05 10:08:22 +00:00
Rohit Waghchaure
18dbc7887b refactor: rename files 2026-06-05 15:29:41 +05:30
Diptanil Saha
7c6b13a838 chore: remove unused whitelisted method from project (#55648) 2026-06-05 09:52:58 +00:00
Nabin Hait
7d72d21bbe refactor(stock): add _service suffix to serial_batch_bundle and quality_inspection modules
Consistent service-module naming: serial_batch_bundle_service.py /
quality_inspection_service.py (matching stock_ledger_service.py). Importers updated;
engine-module imports (stock.serial_batch_bundle) untouched.
2026-06-05 15:16:41 +05:30
rohitwaghchaure
62fdc4c457 Merge pull request #55646 from rohitwaghchaure/fixed-fields-issue
fix: positional argument issue
2026-06-05 15:10:41 +05:30
Nabin Hait
b41eb6876a refactor(stock): rename stock_ledger service module to stock_ledger_service
Avoids basename collision with the core SLE engine erpnext/stock/stock_ledger.py
(the service even imports make_sl_entries from it). File now maps 1:1 to its class,
StockLedgerService.
2026-06-05 14:59:41 +05:30
Nabin Hait
9bb71e5ec4 chore(stock): remove ledger characterization scaffolding
Phase 0 golden-master safety net for the stock_controller refactor. It served its
purpose (every extraction verified byte-identical GL + Stock Ledger output) and is
removed before shipping, mirroring the earlier GL characterization cleanup.
2026-06-05 14:45:09 +05:30
Nabin Hait
c5ff1009b2 refactor: relocate ledger_preview to controllers (cross-cutting, not stock-only)
The preview feature serves both accounts and stock vouchers (SI/PI/PE + DN/PR/SE)
and its show_*_preview entry points live in controllers/stock_controller, so the
cohesive GL+SLE preview module belongs in controllers/, not stock/services/. Pure
move + import-path update; GL and stock previews stay together (shared get_columns/
get_data formatters; read-side, kept out of the write-path services).

Verified: ledger snapshots green; module resolves at new path.
2026-06-05 14:41:58 +05:30
Rohit Waghchaure
ff2b9a99e7 fix: missing fields issue 2026-06-05 14:41:42 +05:30
Nabin Hait
b82b2c2ebd refactor(stock): use central erpnext/exceptions.py for stock exceptions
Merge the stock exceptions into the existing app-wide erpnext/exceptions.py (under a
'# stock' section) instead of a separate erpnext/stock/exceptions.py, matching the
established convention. stock_controller still re-exports them for backward
compatibility; services import from erpnext.exceptions.

Verified: ledger snapshots, quality inspection suite, stock_entry batch-expiry stay green.
2026-06-05 14:34:27 +05:30
Nabin Hait
8db05fc4da refactor(stock): drop 7 in-repo-only StockController delegators
Remove the delegators whose only callers were in-repo StockController subclasses,
repointing every caller to the owning service / free function:

- validate_warehouse_of_sabb, validate_duplicate_serial_and_batch_bundle,
  validate_serialized_batch, clean_serial_nos -> SerialBatchBundleService
- update_inventory_dimensions -> StockLedgerService
- validate_putaway_capacity -> putaway_rule.validate_putaway_capacity (free fn)
- set_landed_cost_voucher_amount -> landed_cost_voucher.set_landed_cost_voucher_amount

Callers repointed: StockController.validate() (base), StockEntry.validate(),
StockReconciliation (validate + reconciliation SLE build), BuyingController.validate(),
and the Landed Cost Voucher submit (doc.set_landed_cost_voucher_amount on the receipt).

Verified green: ledger snapshots, stock_entry (91), stock_reconciliation (34),
landed_cost_voucher (15), subcontracting_receipt (32), delivery_note (71).
2026-06-05 13:32:04 +05:30
Nabin Hait
6a064765d1 refactor(stock): drop zero-caller StockController delegators
Re-audited the kept delegators for true external callers. Two had none:
- has_landed_cost_amount: no caller anywhere (the landed_cost_voucher.py free
  function is what the composers use) — pure dead delegator, removed.
- validate_internal_transfer: only StockController.validate() called it; inline that
  one hook to StockInternalTransferService(self).validate_internal_transfer() and
  remove the delegator.

All other kept delegators have real external/subclass/run_method callers and remain
as the stock extension contract.

Verified: ledger snapshots + DN/PR internal-transfer suites stay green.
2026-06-05 12:46:09 +05:30
Nabin Hait
78d5fbaca4 refactor(stock): address layering/robustness review findings (#8, #9, #10)
#8 ledger_preview: wrap the submit-in-memory dry run in a savepoint inside
get_accounting_ledger_preview / get_stock_ledger_preview and roll back to it in a
finally, so the preview never persists entries regardless of caller (previously
only the whitelisted show_*_preview wrappers' full rollback made it safe).

#9 exceptions: move BatchExpiredError and the QualityInspection* errors into a new
erpnext/stock/exceptions.py and re-export them from stock_controller for backward
compatibility (job_card and tests still import from the controller; identity is
preserved). Services now import from the neutral module instead of back from the
controller they were extracted out of.

#10 quality inspection: extract the duplicated doctype->inspection-field map into a
single INSPECTION_FIELDNAME_MAP constant in the service, consumed by both
validate_inspection and check_item_quality_inspection.

Verified: ledger snapshots, quality inspection suite, stock_entry batch-expiry test
stay green; preview smoke-tested to persist nothing and not roll back the caller.
2026-06-05 12:29:55 +05:30
Nabin Hait
3dba21f814 refactor(stock): pass inter_company_reference as an argument
validate_internal_transfer_qty stashed the value on a name-mangled instance
attribute (self.__inter_company_reference) that get_item_wise_inter_transfer_qty
read back, creating an implicit call-ordering contract: calling the latter on a
fresh service without the former first raised AttributeError. Compute it as a local
and pass it as a method argument, removing the hidden cross-method state.

Verified: ledger snapshots + PR internal-transfer suite stay green.
2026-06-05 12:19:52 +05:30
Nabin Hait
f4705fd5a8 refactor(stock): remove dead get_serialized_items method
get_serialized_items had zero callers anywhere (Python, JS, run_method) on develop
and after the refactor; it was relocated into SerialBatchBundleService by mistake
instead of being dropped. Delete it — also removes a raw frappe.db.sql_list query
that duplicated the ORM helper get_serial_or_batch_items.
2026-06-05 12:17:54 +05:30
Nabin Hait
f1f66bdf2f perf(stock): cache is_serial_batch_item via Item document cache
The @frappe.request_cache decorator keyed on `self`, which after the service
extraction is a transient SerialBatchBundleService built per delegated call, so the
request-wide dedup was lost and dead instances were pinned in request_cache. Use
frappe.get_cached_value on the Item instead: caching is keyed by the item (request-
local + redis), effective regardless of service-instance churn, and the redundant
frappe.db.exists query is dropped.

Verified: ledger snapshots + serial and batch bundle suite stay green.
2026-06-05 12:12:36 +05:30
Nabin Hait
a02ef40a5b test(stock): harden ledger characterization harness
Address code-review findings on the Phase-0 safety net:
- Per-test savepoint/rollback isolation so cumulative SLE fields
  (qty_after_transaction, stock_value, valuation_rate) are deterministic
  regardless of test order or leftover state (were order-coupled before).
- Backdate prerequisite stock to PREREQUISITE_DATE so balances are positive and
  independent of the wall-clock date.
- Capture has_serial_and_batch_bundle (boolean linkage, not the volatile docname)
  so a dropped serial/batch bundle link is caught.
- Add pr_batch_item and pr_serial_item scenarios to exercise SerialBatchBundleService
  (the largest extraction, previously uncovered).

Goldens regenerated. Verified deterministic across repeated assert runs.
2026-06-05 11:44:25 +05:30
Nabin Hait
1a4b61a822 fix(stock): skip disabled Putaway Rules in capacity validation
validate_putaway_capacity selected the 'disable' field but checked rule.get('disabled')
(always None), so disabled rules still enforced capacity and could wrongly raise
'Over Receipt'. Use the correct 'disable' key. Pre-existing bug surfaced during the
stock_controller refactor review.
2026-06-05 11:44:22 +05:30
Mihir Kandoi
34a0aa2ee9 fix: work order status should be in process if material transfer is s… (#55641) 2026-06-05 05:34:43 +00:00
Mihir Kandoi
e2a1f6057d feat: show non stock items and secondary items in work order (#55631)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 22:43:47 +05:30
Pandiyan P
34d128d752 fix: prevent selling items from sample retention warehouse (#55613)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-06-04 16:30:57 +00:00
Mihir Kandoi
d6a201ed4a feat: create sales invoice from pick list (#55594)
* feat: create sales invoice from pick list

* test: cover sales invoice creation from pick list

* fix: require update stock for pick list invoices

* fix: return SI should not bother with pick list
2026-06-04 15:49:19 +00:00
rohitwaghchaure
0a07fb3a4e Merge pull request #55625 from rohitwaghchaure/fixed-job-card-refactor
refactor: job card py file
2026-06-04 19:45:08 +05:30
Shllokkk
9cecf2e6f9 refactor: convert rfq_transaction_list to query builder (#55497) 2026-06-04 19:36:40 +05:30
Nabin Hait
d1fd91a542 refactor(stock): extract ledger preview helpers to ledger_preview module
Move the read-side GL/SLE preview helpers (get_accounting_ledger_preview,
get_stock_ledger_preview, get_sl_entries_for_preview, get_gl_entries_for_preview,
get_columns, get_data) into erpnext/stock/services/ledger_preview.py. The
whitelisted show_accounting_ledger_preview / show_stock_ledger_preview entry points
stay in stock_controller (client JS hardcodes their dotted path) and call the
relocated helpers.

Behaviour-preserving: ledger characterization snapshots stay green.
2026-06-04 16:51:17 +05:30
Nabin Hait
8e41e75d89 refactor(stock): relocate landed-cost and putaway logic to owning doctypes
These clusters are really other doctypes' logic parked on StockController, so they
move next to the doctype that owns them rather than into a stock service:

- set_landed_cost_voucher_amount / get_item_account_wise_lcv_entries /
  has_landed_cost_amount -> landed_cost_voucher.py (free functions). Controller keeps
  thin delegators (called as doc.X from 4 GL composers, buying_controller and the LCV
  doctype).
- validate_putaway_capacity -> putaway_rule.py (free function, next to
  get_available_putaway_capacity it already used). Controller keeps a delegator
  (validate hook + Stock Entry/Reconciliation); prepare_over_receipt_message becomes a
  private helper there.

Drops now-unused Sum/defaultdict imports from stock_controller.

Behaviour-preserving: ledger snapshots, putaway and landed-cost suites stay green.
2026-06-04 16:22:38 +05:30
Nabin Hait
7c2406077a refactor(stock): extract StockInternalTransferService from StockController
Move internal-transfer warehouse/currency/packed-item/over-receipt-qty validation
into erpnext/stock/services/internal_transfer.py as a delegating service. This is
the stock-side counterpart to accounts/services/internal_transfer.py (party/rate/
pricing). validate_internal_transfer keeps a controller delegator (validate hook);
the other 7 methods are internal-only. The is_internal_transfer() predicate is
already consolidated on AccountsController.

Behaviour-preserving: ledger snapshots + DN/PR internal-transfer suites stay green.
2026-06-04 16:05:42 +05:30
Nabin Hait
926bdf5a20 refactor(stock): extract QualityInspectionService from StockController
Move quality-inspection validation (validate_inspection + validate_qi_presence/
submission/rejection) into erpnext/stock/services/quality_inspection.py as a
delegating service. validate_inspection keeps a controller delegator (called from
validate() and 3 other doctypes); the three row-level helpers are internal-only.
The whitelisted module fns check_item_quality_inspection / make_quality_inspections
stay in stock_controller (stable endpoint paths).

Behaviour-preserving: ledger snapshots + quality inspection suite stay green.
2026-06-04 15:54:34 +05:30
Nabin Hait
b447cbc3c1 refactor(stock): move GL-building helpers onto BaseStockGLComposer
Relocate get_voucher_details, check_expense_account and get_debit_field_precision
from StockController to BaseStockGLComposer, where they are only used (by compose()
and AssetCapitalizationGLComposer). Call sites flipped from doc.X to self.X.

Inventory-account resolution (get_inventory_account_map/_dict, etc.) stays on the
controller: it is a doc-contract method called as doc.X from non-stock-composer code
(PI controller/composer, accounts/utils, repost_accounting_ledger), so it cannot fold
into BaseStockGLComposer. make_gl_entries / make_gl_entries_on_cancel / add_gl_entry
likewise stay (contract entry points).

Behaviour-preserving: ledger snapshots, subcontracting receipt and asset
capitalization suites stay green.
2026-06-04 15:50:32 +05:30
Nabin Hait
4affdd51f6 refactor(stock): extract StockLedgerService from StockController
Move SLE building and reposting (get_sl_entries, update_inventory_dimensions,
get_stock_ledger_details, get_items_and_warehouses, make_sl_entries,
repost_future_sle_and_gle) into erpnext/stock/services/stock_ledger.py as a
delegating service. All six keep thin controller delegators (each has external
callers). The repost helper *functions* stay module-level in stock_controller
(imported widely); the service calls them. Also drop import orphaned by this and
the prior bundle extraction.

Behaviour-preserving: ledger characterization snapshots and the repost item
valuation suite stay green.
2026-06-04 15:35:04 +05:30
Nabin Hait
a26d8d448c refactor(stock): extract SerialBatchBundleService from StockController
Move serial & batch bundle handling (creation, validation, return bundles,
teardown) out of StockController into erpnext/stock/services/serial_batch_bundle.py
as a delegating service. The controller keeps thin delegators for the 10 methods
reached from other doctypes or run_method; the 12 internal-only helpers live in
the service. make_bundle_for_material_transfer stays a module fn in stock_controller
(imported by stock/serial_batch_bundle.py).

Behaviour-preserving: ledger characterization snapshots and the full Serial and
Batch Bundle test suite stay green.
2026-06-04 15:00:44 +05:30
Nabin Hait
700a7fdad3 test(stock): add ledger characterization snapshots
Phase 0 safety net for the stock_controller service refactor. Captures the
combined GL + Stock Ledger output of representative stock vouchers (DN, Stock
Entry, Stock Reconciliation, Purchase Receipt incl. returns/taxes) as golden
snapshots, so later phases can prove ledger behaviour stays byte-identical while
stock_controller is split into services.

Run: bench --site <site> run-tests --module erpnext.stock.test_ledger_characterization
Regenerate goldens: REGEN_LEDGER_SNAPSHOTS=1 (after intentional changes only).
2026-06-04 14:45:21 +05:30
Rohit Waghchaure
ca310693ff refactor: job card codebase 2026-06-04 13:29:19 +05:30
ruthra kumar
e842812ba5 Merge pull request #55536 from frappe/fix-quotation-to-crm-deal
fix: allow CRM Deal as Quotation To for CRM integration
2026-06-04 11:51:48 +05:30
rohitwaghchaure
5289752c5f Merge pull request #55596 from rohitwaghchaure/refactor-manufacturing-related-files
refactor: split manufacturing related files into mapper + services modules
2026-06-04 00:40:35 +05:30
Rohit Waghchaure
3757544359 refactor: split manufacturing related files into mapper + services modules 2026-06-04 00:16:37 +05:30
Nabin Hait
51fee2d602 Merge pull request #55327 from nabinhait/erpnext-refactoring
refactor: ERPNext file structure refactoring [WIP]
2026-06-03 21:53:18 +05:30
Jatin3128
d54db2e0ca fix(subscription): correct billing/deferred bugs and tighten guards (#55554) 2026-06-03 21:26:27 +05:30
Antoine Maas
cb84678198 fix: duplicating a Customer/Supplier shouldn't inherit the source's primary contact and address (#55421)
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2026-06-03 21:04:12 +05:30
Pandiyan P
40bcf6e3b6 fix(selling): consider delivered qty (#55597) 2026-06-03 21:03:33 +05:30
Nikhil Kothari
3294490040 feat(banking): PDF statement importer and overriding column mapping (#55559)
* feat(banking): PDF statement importer

* feat(banking): allow users to override column mapping

* fix: store pending page images in flags
2026-06-03 19:48:14 +05:30
Khushi Rawat
855eeb1078 Merge pull request #54983 from Shllokkk/standard-letter-heads
feat: Standard letter heads for DocTypes and Reports
2026-06-03 18:22:52 +05:30
Nabin Hait
ef8cc166c1 ci: move nosemgrep to def line for asset_repair.on_cancel
frappe-modifying-but-not-comitting anchors on the method definition, so the
suppression must sit on the def line (matching the convention used elsewhere
in the codebase); inner-line comments did not suppress it.
2026-06-03 17:57:24 +05:30
Nishka Gosalia
3c5cb8d579 Merge pull request #55470 from nishkagosalia/accounts-settings-cleanup
fix(UX): Accounts settings cleanup
2026-06-03 17:54:48 +05:30
Nabin Hait
5adeca44da fix: linter issue 2026-06-03 17:45:47 +05:30
Nikhil Kothari
371b5c7593 fix: spelling of Payment Reconciliation in sidebar (#55599) 2026-06-03 12:11:07 +00:00
Nabin Hait
c271826130 chore(accounts): remove GL characterization scaffolding
The golden-master snapshots, capture harness, characterization test, and
refactor spec existed to prove the accounts refactor preserved GL output.
All 29 characterization tests pass against the merged code, so the
scaffolding has served its purpose and is removed before merge.

Removes:
- erpnext/accounts/gl_snapshot.py
- erpnext/accounts/gl_snapshots/ (29 snapshots)
- erpnext/accounts/test_gl_characterization.py
- specs/accounts_refactor_spec.md
2026-06-03 16:43:33 +05:30
Nabin Hait
4c6f33000b ci: silence false-positive semgrep findings on relocated code
Both patterns are unchanged from develop but newly appear in the diff
because the refactoring relocated them:

- purchase_order/mapper.make_purchase_invoice_from_portal: portal flow
  needs commit before redirect (matches develop behaviour)
- asset_repair.on_cancel: ignore_linked_doctypes is a runtime cancel flag,
  not a persisted field
2026-06-03 16:23:30 +05:30
Nishka Gosalia
635d291b62 Merge pull request #55309 from nishkagosalia/stock-settings-form-cleanup
fix(UX):stock settings form cleanup
2026-06-03 16:04:08 +05:30
Nabin Hait
092d8f771c fix: update references to relocated mapper functions and POS wrapper
After moving mapping functions into per-doctype mapper.py modules and POS
logic into POSService, several call sites still referenced the old
locations, breaking import/collection in CI:

- bulk_transaction: import mapper modules for make_* transitions
- test_purchase_order / test_purchase_receipt / test_stock_entry: import
  make_purchase_receipt, make_purchase_invoice, make_inter_company_purchase_receipt
  and make_stock_entry from their mapper modules
- order.html: point portal API URL to purchase_order.mapper
- sales_invoice: add validate_full_payment delegating wrapper (called by POSInvoice)
2026-06-03 15:50:06 +05:30
Mihir Kandoi
4ee8bbb06b refactor: minor problems in production plan (#55577) 2026-06-03 15:21:59 +05:30
Nabin Hait
53dfef8030 Merge branch 'develop' of https://github.com/frappe/erpnext into erpnext-refactoring 2026-06-03 15:20:49 +05:30
Loic Oberle
d2d28c9e03 refactor(accounting): replace sql with qb in diverse accounting-related files (#55416) 2026-06-03 15:19:24 +05:30
Nishka Gosalia
8b916b40ee Merge pull request #55591 from nishkagosalia/st-70386
fix: item report view
2026-06-03 15:05:08 +05:30
nishkagosalia
bca917380d fix: item report view 2026-06-03 14:54:40 +05:30
Khushi Rawat
64a3be8163 fix: only fetch enabled letterheads 2026-06-03 14:14:46 +05:30
Khushi Rawat
3337b47182 Merge branch 'develop' into standard-letter-heads 2026-06-03 14:11:35 +05:30
Nabin Hait
dfe3280737 Merge remote-tracking branch 'upstream/develop' into erpnext-refactoring
# Conflicts:
#	erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
#	erpnext/accounts/doctype/sales_invoice/sales_invoice.py
#	erpnext/buying/doctype/purchase_order/purchase_order.py
#	erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
#	erpnext/controllers/accounts_controller.py
#	erpnext/selling/doctype/sales_order/sales_order.py
#	erpnext/selling/doctype/sales_order/test_sales_order.py
#	erpnext/stock/doctype/delivery_note/delivery_note.py
#	erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
#	erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
2026-06-03 13:23:03 +05:30
nishkagosalia
8a8b89e5dd fix(UX): Accounts settings cleanup 2026-06-03 13:13:39 +05:30
Shllokkk
a75693a81f fix: minor fixes in report print formats (#55151) 2026-06-03 13:13:04 +05:30
Pandiyan P
d0d9411700 fix(accounts): include asset items in purchase receipt validation (#55150) 2026-06-03 13:11:50 +05:30
Pandiyan P
c4d28a2612 fix(stock): set stock received but not billed account for purchase (#55149) 2026-06-03 13:10:26 +05:30
Abdeali Chharchhodawala
6c46692cc4 fix: add custom dimensions filters in Gross and Net profit report (#55110) 2026-06-03 13:08:45 +05:30
Antoine Maas
68b8ba7235 regional(setup): add 0% and 6% VAT rates for Belgium (#54719) 2026-06-03 13:05:13 +05:30
Nabin Hait
e0c285e27e refactor(gl): move make_discount_gl_entries onto SalesInvoiceGLComposer
It is Sales-Invoice-specific GL assembly and was the only TaxService
method called by the composer. Move it to SalesInvoiceGLComposer (verbatim),
call it as self.make_discount_gl_entries, drop the now-unused composer-level
TaxService local and the orphaned get_account_currency import in taxes.py.
2026-06-03 13:00:50 +05:30
Ankush Menat
b72cde73ba fix: Add likely missing escaps (#55574) 2026-06-03 07:28:05 +00:00
Lakshit Jain
260cec3b86 fix: prevent leakage of party-derived fields in cross doctype transactions (#55336)
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2026-06-03 07:26:37 +00:00
Nabin Hait
cfed16ab6c refactor(gl): give SI and PI their own precision-loss GL entry method
Remove the doctype-branching make_precision_loss_gl_entry from
exchange_gain_loss.py (and its accounts_controller wrapper); add a
dedicated method to each of SalesInvoiceGLComposer and
PurchaseInvoiceGLComposer. The SI variant now passes 'Sales Invoice'
as the round-off voucher type (output-equivalent) and the throwaway
return value no longer shadows the gettext _ helper.
2026-06-03 12:45:58 +05:30
Nabin Hait
d8760b76a8 refactor(sales_invoice): drop loyalty delegation shims, call LoyaltyService directly
The make_/delete_/apply_loyalty_points methods on SalesInvoice only existed
as an inheritance surface for POSInvoice (self.X()). Route all callers
through LoyaltyService(doc).X() directly, consistent with how related-doc
cases already worked, and remove the three forwarding methods.
2026-06-03 12:40:46 +05:30
nishkagosalia
0b4e20ae98 fix(UX): stock settings form cleanup 2026-06-03 12:38:32 +05:30
Loic Oberle
a2a2e1020b refactor(sales_invoice): replace sql with qb in get_mode_of_payments_… (#55376) 2026-06-03 06:57:08 +00:00
Arshad Qureshi
86726bbd85 fix(buying): honour over delivery/receipt allowance in PR mapper (#55247) 2026-06-03 06:52:48 +00:00
mergify[bot]
8164782263 feat: add New Zealand chart of accounts (backport #55478) (#55571)
Co-authored-by: Imesha Sudasingha <imesha.sudasingha@gmail.com>
2026-06-03 12:11:28 +05:30
Shllokkk
0c61ad4e6d Avoid status updation for purchase invoice from paid to unpaid by issuing a paid debit note against it (#54382) 2026-06-03 12:04:19 +05:30
Shubh Doshi
5074597d00 perf: batch status check for on-hold/closed documents, remove N+1 queries (#54798) 2026-06-03 11:50:49 +05:30
Loic Oberle
42383c3f36 refactor(sales_invoice): replace sql with qb in delete_loyalty_point_… (#55379) 2026-06-03 11:29:04 +05:30
Mihir Kandoi
3b2f2168d0 Merge pull request #55375 from loicdokos/refactor/sales_invoice-get_mode_of_payment_info
refactor(sales_invoice): replace sql with qb in get_mode_of_payment_info
2026-06-03 11:27:31 +05:30
Luis Mendoza
36dc196a1d fix: prevent double rounding in inclusive tax calculations (#52512)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2026-06-03 11:09:42 +05:30
Nabin Hait
04443ae29e Merge upstream/develop into erpnext-refactoring
Resolve 4 conflicts from Phase 7 service/mapper extraction vs upstream:
- asset.py: take extraction; repoint dangling make_asset_movement JS to mapper
- job_card: port upstream field_no_map(naming_series) into mapper.make_subcontracting_po
- sales_order: port upstream rows-index fix into mapper.make_delivery_note
- sales_invoice (Phase 7): take service delegations; port upstream SQL->QB/ORM
  changes for get_warehouse, get_all_mode_of_payments, get_discounting_status,
  clear_unallocated_mode_of_payments, and set_pos_fields(POS DN skip) into services
2026-06-03 11:05:01 +05:30
Vishnu Priya Baskaran
da82ac86b5 fix payment schedule discount date when no discount is applied (#55462) 2026-06-03 10:56:19 +05:30
Shllokkk
efb8336bf8 fix: remove ignore_permissions from get_party_details signature (#55491) 2026-06-03 10:51:44 +05:30
Khushi Rawat
b1882dc83a Merge pull request #55562 from khushi8112/budget-variance-cost-center-hierarchy
fix: aggregate child cost center data in Budget Variance Report
2026-06-03 03:17:57 +05:30
khushi8112
41884cfd2a refactor: replace db.sql with frappe.qb 2026-06-03 02:48:56 +05:30
Khushi Rawat
48700a8aa3 Merge pull request #54840 from Hemil-Sangani/fix/budget-variance-report-filter
fix: add company filter to Budget Against dimension options
2026-06-03 02:30:52 +05:30
khushi8112
c34eeee096 fix: move Company filter at the start 2026-06-03 02:14:14 +05:30
Raffael Meyer
016b64df6d fix(item): format integer numeric variant attributes without decimals (#55561) 2026-06-02 22:42:32 +02:00
khushi8112
cd7fa56ec4 fix: aggregate child cost center data in Budget Variance Report 2026-06-03 02:02:03 +05:30
Raffael Meyer
e94bd51764 perf(transaction): exit early before backend query (#55556) 2026-06-02 20:24:10 +02:00
rohitwaghchaure
e1ea14b135 Merge pull request #54785 from aerele/fix/support-#67579
fix(stock): add validation for work order serial nos and batch nos
2026-06-02 18:06:42 +05:30
ruthra kumar
7afe5d4ee3 Merge pull request #54974 from Soham-ambibuzz/philipinnes_localization_coa_v2
feat: added cost of goods sold
2026-06-02 17:23:48 +05:30
Khushi Rawat
d154796c82 Merge pull request #55484 from khushi8112/accounting-dashboard-number-cards-fiscal-year
fix: use fiscal year instead of calendar year in accounting dashboard number cards
2026-06-02 16:54:32 +05:30
ruthra kumar
d6f9e4ac3f Merge pull request #54979 from rtdany10/ppr-adv-error
fix(ppr): make default_advance_account optional
2026-06-02 15:36:04 +05:30
Khushi Rawat
10c18ca801 Merge pull request #55539 from khushi8112/warn-before-cancel-reconciled-payment-entry
feat(payment-entry): warn user before cancelling reconciled payment entry
2026-06-02 15:29:15 +05:30
Mihir Kandoi
0a49403838 fix: unable to submit subcontracted job card (#55537) 2026-06-02 09:18:42 +00:00
khushi8112
f0ba54d957 feat(payment-entry): warn user before cancelling reconciled payment entry 2026-06-02 14:47:39 +05:30
Loïc Oberle
7ee7c4253b fix(sales_invoice): switch parent and child doctype
Switch the parent and child doctype in sales_invoice.py
2026-06-02 10:42:19 +02:00
shahzeelahmed
519dc0b958 fix: include CRM Deal in quotation to filters 2026-06-02 12:39:29 +05:30
Mihir Kandoi
85be72a403 fix: minor improvements to web templates, banking page and CI workflow (#55525)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 08:26:23 +05:30
Mihir Kandoi
78f9434d14 refactor: resolve regression-safe CodeQL code-quality findings (#55531)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 08:25:32 +05:30
Rushabh Mehta
4611dd1c36 Merge pull request #55532 from rmehta/feat/build-and-upload-assets
feat: build and upload assets to GitHub Releases
2026-06-02 07:37:30 +05:30
Rushabh Mehta
6ac050e624 feat: build and upload assets to GitHub Releases 2026-06-02 06:45:10 +05:30
Diptanil Saha
71fcda5ab7 fix(pos): escape html output in pos page templates (#55527)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 00:43:08 +05:30
Diptanil Saha
86f6a8154d Revert "ci(crowdin): mapped zh-TW with zh_TW" (#55524) 2026-06-01 16:50:12 +00:00
Diptanil Saha
97ec7f8837 ci(crowdin): mapped zh-TW with zh_TW (#55520) 2026-06-01 16:21:20 +00:00
rohitwaghchaure
ba477412ea Merge pull request #55415 from aerele/fix/support-#68706
fix(stock): allow to create quality inspection after purchase/delivery
2026-06-01 21:43:24 +05:30
MochaMind
7b7732531f fix: sync translations from crowdin (#55464) 2026-06-01 21:38:59 +05:30
Diptanil Saha
56f89cc392 chore(serial_and_batch_bundle): remove update_serial_or_batch method (#55481) 2026-06-01 21:23:32 +05:30
Gajendra Nishad
57dbac712f fix(je): preserve account on duplicate row when party row exists (#55180) 2026-06-01 18:41:19 +05:30
Nabin Hait
530e587bf2 refactor: use mapper paths directly, drop re-export shims
Repoint all JS method strings and Python imports for mapper functions
across 18 doctypes from the doctype module to its mapper module, and
remove the now-unused re-export shims from each doctype file (keeping
only names used internally).
2026-06-01 18:17:56 +05:30
Diptanil Saha
24b28b4d29 fix(pos): escape item data on pos item selector (#55503) 2026-06-01 16:57:35 +05:30
Nikhil Kothari
65b87ec045 fix(banking): miscellaneous bug fixes (#55492)
* fix(banking): correct usage of hooks in rule action

* fix(banking): apply ESLint rules for hooks

* fix(banking): add lazy imports and code-splitting
2026-06-01 10:36:48 +00:00
rohitwaghchaure
fbe6754b55 Merge pull request #55480 from mihir-kandoi/nonetype-manufacturing-error
fix: NoneType reference error in Stock Entry
2026-06-01 15:20:00 +05:30
ruthra kumar
ed43880a7d Merge pull request #55495 from ruthra-kumar/opening_bal_bug_in_process_pcv
fix: opening bal double counting in Process Period Closing Voucher
2026-06-01 15:01:36 +05:30
ruthra kumar
7f2af123ee test: prevent double counting of opening balances 2026-06-01 14:29:05 +05:30
Mihir Kandoi
8314c22aa6 fix: NoneType reference error in Stock Entry 2026-06-01 13:48:44 +05:30
khushi8112
c68918bc18 fix: set a fallback value if no fiscal year set 2026-06-01 13:13:29 +05:30
ruthra kumar
cfeffbb354 refactor: color coded status in list view 2026-06-01 12:51:04 +05:30
khushi8112
e8fff2fdad fix: use fiscal year instead of calendar year in accounting dashboard number cards 2026-06-01 12:47:31 +05:30
Ankush Menat
dd1d2925d5 fix: check perm for account (#55479) 2026-06-01 07:04:38 +00:00
Mihir Kandoi
3deab36d2e fix: remove old subcontracting flow references in BOM (#55477) 2026-06-01 06:56:58 +00:00
ruthra kumar
1960c81619 refactor: tabbed view for process period closing voucher 2026-06-01 12:17:44 +05:30
ruthra kumar
a2b8334046 refactor: only consider non-opening balance for Balance sheet accounts 2026-06-01 12:13:49 +05:30
Mihir Kandoi
dbcfac839c chore: rename type field to secondary_item_type (#55469) 2026-06-01 05:54:59 +00:00
Mihir Kandoi
1c94c42b28 fix: pick correct name when creating user from RFQ (#55468) 2026-06-01 05:36:46 +00:00
Sudharsanan11
e003fe4de0 fix(stock): add warning message to notify the user to configure the inspection 2026-06-01 10:37:29 +05:30
Sudharsanan11
c6a88ab1d2 fix(stock): allow to create quality inspection after purchase/delivery 2026-06-01 10:37:25 +05:30
Diptanil Saha
45d9af9430 fix(pos): preserve contacts and enforce permissions in set_customer_info (#55463) 2026-06-01 04:30:01 +05:30
Khushi Rawat
32594c97c6 Merge pull request #55461 from khushi8112/supplier-master-form-cleanup
fix: supplier master form cleanup
2026-06-01 02:58:57 +05:30
khushi8112
515983e016 fix: supplier status in list view 2026-06-01 02:32:36 +05:30
khushi8112
820c0caf88 fix: supplier master form cleanup 2026-06-01 02:06:42 +05:30
Diptanil Saha
876f403500 fix(issue): check permission before issue status modification (#55458) 2026-05-31 22:07:28 +05:30
Diptanil Saha
a7e2daff7e fix(book_appointment): when scheduling is disabled, block API endpoints (#55455) 2026-05-31 15:31:44 +00:00
Diptanil Saha
0f2d9cea6a refactor: task_info portal pages (#55448) 2026-05-31 14:54:37 +00:00
MochaMind
2a39b95e2b chore: update POT file (#55452) 2026-05-31 15:06:32 +02:00
Diptanil Saha
925f39e819 refactor(pos_profile): migrating raw sql to qb in set_defaults (#55447) 2026-05-31 09:24:55 +00:00
Nabin Hait
498cd2b371 refactor(sales_invoice): extract non-GL services (Phase 7)
Split the sales_invoice.py monolith into focused service modules under
sales_invoice/services/:

- fixed_assets.py      — FixedAssetService (depreciation, disposal, split)
- inter_company.py     — validate/link/unlink inter-company docs
- loyalty.py           — LoyaltyService (earn, redeem, delete points)
- pos.py               — POSService + POS free functions
- status.py            — StatusService + is_overdue / get_discounting_status
- timesheet_billing.py — TimesheetBillingService

Lifecycle hooks (validate/on_submit/on_cancel) call services directly;
no thin shims. The 7 methods POS Invoice calls via self.* are kept on
the class with an explicit comment. @frappe.whitelist() doc-methods and
framework hooks (set_status, set_indicator) stay on the class.

sales_invoice.py: 2156 → 1205 lines. All 29 snapshot + 121 SI tests green.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 12:52:26 +05:30
MochaMind
be7df9d416 fix: sync translations from crowdin (#55427) 2026-05-31 12:43:17 +05:30
Sudharsanan Ashok
4ef17c9c1b fix(stock): change qb to qb get_query to fix filter issues (#55443) 2026-05-31 12:21:22 +05:30
Raffael Meyer
f2e7d90688 chore(Bank Statement Import): mark as out of beta (#55442) 2026-05-30 20:17:36 +00:00
Raffael Meyer
aed957e7d1 chore: mark as out of beta (#55439) 2026-05-30 18:58:05 +00:00
mh35
b8bb57cec9 fix(regional): Japanese CT Rate (#54998) 2026-05-30 15:33:49 +00:00
Diptanil Saha
9758eb868d fix(quotation): made customer contact column visible (#55433) 2026-05-30 18:38:11 +05:30
MochaMind
a4fd593e7d fix: sync translations from crowdin (#55361) 2026-05-29 23:04:14 +05:30
rohitwaghchaure
bfcedaf667 Merge pull request #55417 from rohitwaghchaure/fixed-support-69655
fix: billing address does not belongs to the company error
2026-05-29 22:53:16 +05:30
Diptanil Saha
3b44419a7f ci: configure upstream fetch refspec so git fetch creates tracking refs (#55422)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 16:16:43 +00:00
Diptanil Saha
1ae46b54b2 ci: split sync into orchestrator + per-branch runners, generalise for any app (#55414)
* ci: re-fetch before push to avoid force-push on translations_hotfix

If upstream/translations_hotfix moved forward while the script was
running (e.g., a concurrent run or manual push), git push would fail
with "behind remote". Re-fetch right before pushing and merge any new
remote commits with -X ours so our .po changes and the main.pot from
${HOTFIX_BRANCH} (set by the initial -X theirs merge) are preserved
without needing a force-push.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: define HOTFIX_BRANCH once as job env; pass it to sync script

version-16-hotfix is now declared as env.HOTFIX_BRANCH at the job level
so the checkout ref and the script argument both derive from the same
value. Quoting the GITHUB_WORKSPACE path guards against spaces on
self-hosted runners.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: define HOTFIX_BRANCH as job env and pass to sync script via env

Declares version-16-hotfix once as env.HOTFIX_BRANCH at the job level
so the checkout ref and the script both derive from the same value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: read HOTFIX_BRANCH from env instead of hardcoding in script

Removes the hardcoded branch name from the script; reads it from the
HOTFIX_BRANCH env var set by the workflow. Fails immediately with a
clear message if the var is not set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: use ls-remote to check branch existence instead of swallowing fetch errors

Replace `git fetch ... 2>/dev/null || true` + `git rev-parse --verify`
with `git ls-remote --exit-code --heads upstream translations_hotfix`.
ls-remote queries the remote directly so the check is never based on
stale local state, and real failures (auth, network) propagate through
set -e instead of being silently ignored. Applied to both the initial
branch setup and the pre-push re-fetch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: rewrite orchestrator to dispatch runner per hotfix branch via matrix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: add per-branch runner workflow for hotfix translation sync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: generalise sync script to use APP_NAME and GITHUB_REPOSITORY

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: remove push trigger from runner workflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: rename working branch to sync_translations_{hotfix_branch}

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 20:13:45 +05:30
Rohit Waghchaure
9df07b367a fix: billing address does not belongs to the company error 2026-05-29 19:17:34 +05:30
Loic Oberle
618045ec98 refactor(sales_invoice): replace sql with qb in get_all_mode_of_payments (#55377) 2026-05-29 17:34:20 +05:30
Loic Oberle
94828e743d refactor(sales_invoice): replace sql with qb in update_billing_status… (#55380) 2026-05-29 17:30:41 +05:30
Nabin Hait
c324c823fb fix(purchase_order): re-export get_mapped_subcontracting_order for test compatibility 2026-05-29 16:56:40 +05:30
Khushi Rawat
46f4f79889 Merge pull request #55341 from khushi8112/customer-master-from-cleanup
fix: customer master form cleanup
2026-05-29 16:29:06 +05:30
khushi8112
059f560017 fix: add customer type in the list view 2026-05-29 15:33:50 +05:30
Khushi Rawat
24fabe6893 Merge pull request #55397 from khushi8112/item-master-list-view
fix: item master list view UI cleanup
2026-05-29 15:02:11 +05:30
Diptanil Saha
621c1c595a ci: fix branch base and per-language commits in sync-hotfix-translations (#55405)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 14:48:03 +05:30
Loic Oberle
eb638d8f3a refactor(sales_invoice): Replace SQL with orm in get_company_abbr (#55384) 2026-05-29 13:58:51 +05:30
Loic Oberle
9b1229f4cd refactor(sales_invoice): replace sql with orm in clear_unallocated_mo… (#55383) 2026-05-29 13:58:10 +05:30
Nabin Hait
516406c25b fix(purchase_order): re-export get_mapped_purchase_invoice for test compatibility 2026-05-29 13:39:35 +05:30
Nabin Hait
61da2302ba refactor(asset): move mapping functions to mapper.py 2026-05-29 13:38:00 +05:30
Loic Oberle
d4f8c033fc refactor(account): Replace the SQL queries with qb and the frappe ORM (#55396) 2026-05-29 13:33:02 +05:30
Loic Oberle
3e9c4aefaf refactor(sales_invoice): replace sql with qb in validate_proj_cust (#55382) 2026-05-29 13:30:45 +05:30
Loic Oberle
f846c55c01 refactor(sales_invoice): replace sql with qb in get_warehouse (#55381) 2026-05-29 13:29:10 +05:30
Nabin Hait
35ac7155e8 refactor(subcontracting_receipt): move mapping functions to mapper.py 2026-05-29 13:28:37 +05:30
Nabin Hait
28c3d24b86 refactor(lead): move mapping functions to mapper.py 2026-05-29 13:26:31 +05:30
Nabin Hait
9b85773757 refactor(opportunity): move mapping functions to mapper.py 2026-05-29 13:23:56 +05:30
Nabin Hait
341fad04c9 refactor(job_card): move mapping functions to mapper.py 2026-05-29 13:20:50 +05:30
Nabin Hait
0a4fa5e35e refactor(work_order): move mapping functions to mapper.py 2026-05-29 13:11:38 +05:30
Nabin Hait
f9d67ebb1e refactor(purchase_invoice): move mapping functions to mapper.py 2026-05-29 13:04:08 +05:30
Nabin Hait
7b456c6405 refactor(sales_invoice): move mapping functions to mapper.py 2026-05-29 13:01:38 +05:30
Nishka Gosalia
03a7e5b6a3 Merge pull request #55400 from nishkagosalia/gh-55292
fix: Make Distributed Discount Amount field read only
2026-05-29 12:59:31 +05:30
Nabin Hait
92983255b3 refactor(pick_list): move mapping functions to mapper.py 2026-05-29 12:45:32 +05:30
Nabin Hait
7b9f61e058 refactor(material_request): move mapping functions to mapper.py 2026-05-29 12:41:44 +05:30
Nishka Gosalia
2e97f36f61 Merge pull request #55399 from nishkagosalia/gh-55104-fix
fix: over order allowance setting fix
2026-05-29 12:37:27 +05:30
Nabin Hait
0968adafc8 refactor(purchase_receipt): move mapping functions to mapper.py 2026-05-29 12:36:08 +05:30
Nabin Hait
220b6fe572 refactor(delivery_note): re-export make_inter_company_transaction 2026-05-29 12:33:42 +05:30
Nabin Hait
8192d70f83 refactor(delivery_note): move mapping functions to mapper.py 2026-05-29 12:32:57 +05:30
Nabin Hait
2cf51a0367 refactor(request_for_quotation): move mapping functions to mapper.py 2026-05-29 12:26:55 +05:30
nishkagosalia
512c95529e fix: Make Distributed Discount Amount field read only 2026-05-29 12:24:47 +05:30
Nabin Hait
01e7224210 refactor(supplier_quotation): move mapping functions to mapper.py 2026-05-29 12:23:31 +05:30
Nabin Hait
18d1a88a64 refactor(purchase_order): move mapping functions to mapper.py 2026-05-29 12:22:17 +05:30
Nabin Hait
cfd37f22db refactor(customer): move mapping functions to mapper.py 2026-05-29 12:19:09 +05:30
Nabin Hait
cfff10463c refactor(quotation): move mapping functions to mapper.py 2026-05-29 12:16:53 +05:30
Nabin Hait
25e3d6042a refactor(sales_order): move mapping functions to mapper.py
Separates all make_*/create_* document-creation functions from the
SalesOrder controller into a dedicated mapper.py for better separation
of concerns. Re-exports from sales_order.py preserve backward compat.
2026-05-29 12:14:27 +05:30
nishkagosalia
30011963bc fix: over order allowance setting fix 2026-05-29 12:09:19 +05:30
MochaMind
5d9ec20dff chore: update POT file (#55352) 2026-05-29 11:01:44 +05:30
Nabin Hait
0a02727638 fix: move ignore_linked_doctypes assignment to on_cancel in AssetRepair
Semgrep rule frappe-modifying-but-not-comitting-other-method flags
setting self.ignore_linked_doctypes inside make_gl_entries() instead
of in the calling on_cancel method. Follows the same pattern used by
AssetCapitalization.
2026-05-29 04:03:30 +05:30
khushi8112
69ee7e93d8 fix: item master list view UI cleanup 2026-05-29 02:25:38 +05:30
Nabin Hait
a12d666037 refactor: extract child item update cluster into ChildItemUpdater service
accounts/services/child_item_update.py:
- ChildItemUpdater class with update() entry point encapsulating all
  the logic from the old update_child_qty_rate free function; nested
  closures (check_doc_permissions, validate_workflow_conditions,
  validate_quantity_and_rate, validate_fg_item_for_subcontracting)
  become private methods on the class
- update_child_qty_rate kept as @frappe.whitelist() thin wrapper;
  re-exported from accounts_controller.py so the JS whitelist path
  "erpnext.controllers.accounts_controller.update_child_qty_rate"
  and test imports continue to work
- Free functions: set_order_defaults, validate_child_on_delete,
  update_bin_on_delete, validate_and_delete_children, get_allow_zero_qty,
  get_child_item_change_state, is_child_item_unchanged,
  update_child_item_rate_and_discount, update_child_item_uom_and_weight,
  check_if_child_table_updated

accounts_controller.py drops from ~2356 to ~1796 lines.
2026-05-28 20:38:25 +05:30
Nabin Hait
c7b4806117 refactor: extract party validation and inter-company logic into service classes
- accounts/services/party_validation.py: PartyValidator class with
  single validate() entry point covering party frozen/disabled check,
  party accounts, currency, party account currency, address/contact,
  and company-linked addresses. AccountsController.get_party() kept
  as a shim (called by advances and payment_schedule services).

- accounts/services/internal_transfer.py: InternalTransferService
  class with validate() (reference + transaction rate + pricing/tax
  disablers), set_account() for unrealized P&L, is_internal_transfer(),
  process_common_party_accounting(), and get_common_party_link().
  Shims retained on AccountsController for the three methods called
  by selling/buying/stock controllers and GL composers.

accounts_controller.py drops from ~2722 to ~2356 lines.
2026-05-28 20:10:45 +05:30
Khushi Rawat
fd7a97f424 Merge pull request #55385 from frappe/revert-55360-validate-pe-cancel-on-bank-reconciliation
Revert "fix: block cancellation if reconciled with a Bank Transaction"
2026-05-28 17:45:54 +05:30
rohitwaghchaure
15d71ccc0b Merge pull request #55302 from rohitwaghchaure/fixed-stock-entry-bom-issue
fix: 'NoneType' object has no attribute 'material_transferred_for_manufacturing'
2026-05-28 17:18:56 +05:30
Nabin Hait
6c1ac51d7a refactor: convert payment schedule and billing validation to service objects
Introduce PaymentScheduleService and BillingValidationService classes so
call sites read PaymentScheduleService(doc).set_payment_schedule() instead
of the opaque self.set_payment_schedule() shim. Removes 15 shim methods
from AccountsController and updates all 11 call sites across the codebase.
2026-05-28 17:13:23 +05:30
Nabin Hait
8aaa3a72ef refactor: convert tax cluster to TaxService class in taxes.py
Replaces the shim+free-function pattern with a TaxService class so
callers like TaxService(self).set_taxes() make the source location
explicit. Class lives in taxes.py above the existing free functions.
Deletes the intermediate tax_service.py. Updates AccountsController,
sales_invoice, pos_invoice, subscription, and both GL composers to
call TaxService directly.
2026-05-28 16:53:03 +05:30
rohitwaghchaure
feee40b30a Merge pull request #55323 from aerele/fix/support-#68170
fix(stock): change valuation rate column label in stock ledger entry/report
2026-05-28 16:46:09 +05:30
archielister
e7c695e0ac fix(stock): get_actual_qty during cancellations (#55388) 2026-05-28 16:45:50 +05:30
Rohit Waghchaure
f4516a2a7c fix: 'NoneType' object has no attribute 'material_transferred_for_manufacturing' 2026-05-28 16:45:32 +05:30
Loic Oberle
e1bfffb72c refactor(sales_invoice): replace sql with qb in get_discounting_status (#55378) 2026-05-28 16:43:17 +05:30
Loic Oberle
ead0c14a12 refactor(sales_invoice): replace sql with qb in check_if_reutrn_invoi… (#55374) 2026-05-28 16:36:46 +05:30
Khushi Rawat
75e9cd9e8f Revert "fix: block cancellation if reconciled with a Bank Transaction" 2026-05-28 15:19:42 +05:30
Nishka Gosalia
774756c3f4 Merge pull request #55367 from nishkagosalia/gh-55050
fix(UX): Move title field to More Info
2026-05-28 15:08:54 +05:30
Mihir Kandoi
10384b3b2e fix: new bom version should not recalculate operations through routing (#55370) 2026-05-28 09:29:37 +00:00
nishkagosalia
34c24b86fa fix(UX): Move title field to More Info 2026-05-28 14:38:08 +05:30
Loïc Oberle
2c0f6c50df refactor(sales_invoice): replace sql with qb in get_mode_of_payment_info
Replace sql with query builder to ensure compatibility with postgres

Contribution made on behalf of Orange SA
2026-05-28 10:52:46 +02:00
Nishka Gosalia
acb10299db Merge pull request #55340 from nishkagosalia/gh-55106
feat: over order allowance setting
2026-05-28 14:18:33 +05:30
nishkagosalia
355d71dbd2 feat: over order allowance setting 2026-05-28 12:54:45 +05:30
Nabin Hait
0ee0d6f0c5 refactor: extract tax cluster from AccountsController into services/taxes.py
Moves set_taxes, is_pos_profile_changed, set_taxes_and_charges,
append_taxes_from_master, append_taxes_from_item_tax_template,
get_tax_row, set_other_charges, validate_enabled_taxes_and_charges,
validate_tax_account_company, get_tax_map, get_amount_and_base_amount,
get_tax_amounts, and make_discount_gl_entries into free functions in
accounts/services/taxes.py. AccountsController retains thin shims.
Removes now-unused parse_json import.
2026-05-28 12:32:04 +05:30
Khushi Rawat
49567bff78 Merge pull request #55360 from khushi8112/validate-pe-cancel-on-bank-reconciliation
fix: block cancellation if reconciled with a Bank Transaction
2026-05-28 11:26:22 +05:30
khushi8112
63ff92cb7c fix: test case 2026-05-28 01:49:56 +05:30
khushi8112
6f5852eabf fix: block cancellation if reconciled with a Bank Transaction 2026-05-28 01:27:05 +05:30
Khushi Rawat
c90a33cba1 Merge pull request #55137 from khushi8112/sales-analytics-report
fix: use get_query instead of get_all for data fetching
2026-05-28 00:45:51 +05:30
Nabin Hait
bb803a8f82 refactor: extract billing, payment schedule, and exchange gain/loss into services
Move billing validation, payment schedule, and exchange gain/loss logic from
AccountsController into dedicated service modules under accounts/services/.
AccountsController retains thin shim methods that delegate to the services.
2026-05-27 23:42:50 +05:30
Diptanil Saha
fcb87b437e ci: add node setup on sync translations to version 16 hotfix (#55355) 2026-05-27 23:34:10 +05:30
Nabin Hait
983d80f7c5 refactor(accounts): merge gl_entry_builder.py into base_gl_composer.py
The free functions (get_gl_dict, add_gl_entry, get_voucher_subtype, etc.) live
in the same module as BaseGLComposer — they are all about building GL entries,
so there is no reason to split them across two files. Removes gl_entry_builder.py
and updates all import references to base_gl_composer.
2026-05-27 22:32:06 +05:30
Nabin Hait
cba6a31497 refactor(accounts): extract get_gl_dict and add_gl_entry into gl_entry_builder.py
Move the get_gl_dict/add_gl_entry logic from AccountsController/StockController
into free functions in accounts/services/gl_entry_builder.py with doc as first arg.
BaseGLComposer gains get_gl_dict and add_gl_entry methods that delegate to the free
functions — GL composers now call self.get_gl_dict/self.add_gl_entry directly
without going through the doc. AccountsController and StockController keep thin
shims for backward compatibility with unrefactored callers.

Also move update_gl_dict_with_regional_fields and update_gl_dict_with_app_based_fields
to gl_entry_builder.py, re-exporting them from accounts_controller.py to avoid a
circular import.
2026-05-27 21:46:16 +05:30
Diptanil Saha
7561ad4666 ci: sync translations from develop to version-16-hotfix (#55348)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 20:50:03 +05:30
Diptanil Saha
1b076d0ccc fix: render HTML labels in open payment requests link dropdown (#55315) 2026-05-27 20:09:28 +05:30
Sudharsanan11
9ad046109c test(stock): add test to validate the reserved serial/batch nos for fg items 2026-05-27 17:32:19 +05:30
khushi8112
6f6e17188f fix: customer master form cleanup 2026-05-27 17:07:46 +05:30
Lakshit Jain
1bcc214367 Merge pull request #55330 from ljain112/fix-tds-none
fix(tds): treat NULL and empty-string tax_withholding_group as equivalent
2026-05-27 16:54:03 +05:30
Lakshit Jain
dee4e94576 Merge pull request #55333 from ljain112/fix-financial-template-closing-bal
fix(custom_financial_template): sum account closing balances across dimensions
2026-05-27 16:53:34 +05:30
Nabin Hait
29261c5fc2 refactor(accounts): extract tax helpers into accounts/services/taxes.py
Move validate_conversion_rate, validate_taxes_and_charges, validate_account_head,
validate_cost_center, validate_inclusive_tax, set_balance_in_account_currency,
set_child_tax_template_and_map, add_taxes_from_tax_template, merge_taxes,
get_tax_rate, get_default_taxes_and_charges, and get_taxes_and_charges out of
accounts_controller into a dedicated accounts/services/taxes.py module.

Re-export all symbols from accounts_controller for backward compatibility.
2026-05-27 16:28:02 +05:30
Nabin Hait
58c90ad651 refactor(accounts): extract advance payment logic into accounts/services/advances.py
Moves all advance-related query and management logic out of the 4500-line
AccountsController into a dedicated module-level service:
- get_advance_journal_entries, get_advance_payment_entries,
  get_advance_payment_entries_for_regional, get_common_query
- set_advances, get_advance_entries, validate_advance_entries,
  set_advance_gain_or_loss, calculate_total_advance_from_ledger,
  set_total_advance_paid, set_advance_payment_status,
  delink_advance_entries, create_advance_and_reconcile

AccountsController methods become thin shims; module-level functions in
accounts_controller.py are replaced with re-exports for backward
compatibility. payment_reconciliation.py updated to import directly from
the new service.

All 29 GL snapshots, 121 SI tests, 53 PE tests, and 37 payment
reconciliation tests pass.
2026-05-27 15:55:28 +05:30
Nabin Hait
8783689ec5 refactor(accounts): GL composer pattern for SCR, AssetCapitalization, AssetRepair
Extracts get_gl_entries logic from SubcontractingReceipt,
AssetCapitalization, and AssetRepair into dedicated GL composer classes
under each doctype's services/ package. Each composer follows the
established BaseGLComposer / BaseStockGLComposer pattern, and the
original get_gl_entries becomes a 3-line shim.

- SubcontractingReceiptGLComposer(BaseStockGLComposer): moves
  make_item_gl_entries and make_item_gl_entries_for_lcv
- AssetCapitalizationGLComposer(BaseStockGLComposer): moves
  get_gl_entries_for_consumed_{stock,asset,service}_items and
  get_gl_entries_for_target_item; inventory_account_map/sle_map/precision
  become composer instance attributes
- AssetRepairGLComposer(BaseGLComposer): moves
  get_gl_entries_for_repair_cost and get_gl_entries_for_consumed_items
  (AR inherits AccountsController, not StockController)

All 29 GL snapshot tests and existing doctype test suites (32 SCR,
5 AC, 18 AR) pass.
2026-05-27 15:34:54 +05:30
Nabin Hait
8d3efe287e refactor: introduce PurchaseReceiptGLComposer
purchase_receipt/services/gl_composer.py → PurchaseReceiptGLComposer(BaseStockGLComposer).
compose() orchestrates the four builder steps: _make_item_gl_entries,
_make_tax_gl_entries, set_gl_entry_for_purchase_expense (stays on doc),
update_regional_gl_entries (module-level).

_make_item_gl_entries preserves the original closure structure (six inner
functions: make_item_asset_inward_gl_entry, make_stock_received_but_not_billed_entry,
make_landed_cost_gl_entries, make_amount_difference_entry,
make_sub_contracting_gl_entries, make_divisional_loss_gl_entry); all doc
calls go through self.doc.  _make_tax_gl_entries is a direct port.

Helpers that stay on the document: add_provisional_gl_entry (public —
PI composer calls it via purchase_receipt_doc.add_provisional_gl_entry),
add_gl_entry, get_item_account_wise_lcv_entries, update_assets,
is_landed_cost_booked_for_any_item.

PurchaseReceipt.get_gl_entries is now a 3-line shim; make_item_gl_entries
and make_tax_gl_entries removed from the class.

Verified: 29 GL snapshots byte-identical on test-erpnext-v17;
101 PR tests green on test-site-ai.
2026-05-27 15:17:34 +05:30
Nabin Hait
b63e1fd796 test: add Purchase Receipt GL snapshots
Extends the Phase-0 characterization suite with 3 PR scenarios:
  pr_basic, pr_with_taxes, pr_return — all using _Test Company with
  perpetual inventory (TCP1) so stock-received GL entries are produced.

Also refreshes se_material_issue.json (cumulative stock on test-erpnext-v17
shifted the outgoing valuation rate). 29 snapshots total, all green.
2026-05-27 15:17:00 +05:30
Nabin Hait
18188cb1b2 refactor: introduce StockEntryGLComposer and StockReconciliationGLComposer
Stock Entry
  stock_entry/services/gl_composer.py → StockEntryGLComposer(BaseStockGLComposer)
  compose() calls super().compose() for the base warehouse↔expense GL pairs,
  then adds additional-cost entries (_build_additional_cost_per_item_account +
  _append_additional_cost_gl_entries) and LCV adjustments (_append_lcv_gl_entries).
  get_item_account_wise_lcv_entries stays on StockController (called via self.doc).
  StockEntry.get_gl_entries is now a 3-line shim.
  Removed private helpers from StockEntry; dropped unused process_gl_map and
  get_account_currency imports.

Stock Reconciliation
  stock_reconciliation/services/gl_composer.py → StockReconciliationGLComposer(BaseStockGLComposer)
  compose() guards cost_center and delegates to
  super().compose(inventory_account_map, doc.expense_account, doc.cost_center).
  StockReconciliation.get_gl_entries is now a 3-line shim.

Verified: 26 GL snapshots byte-identical on test-erpnext-v17;
89 SE tests and 33/34 SR tests green on test-site-ai
(1 pre-existing SR failure in test_serial_no_status_with_backdated_stock_reco,
unrelated to GL — IndexError in serial bundle setup).
2026-05-27 15:01:27 +05:30
Nabin Hait
001c70831c test: add Stock Entry and Stock Reconciliation GL snapshots
Extends the Phase-0 characterization suite with 4 scenarios:
  se_material_receipt, se_material_issue, se_material_transfer, sr_basic.

All use _Test Company with perpetual inventory (TCP1) so stock accounting
GL entries are produced. 26 snapshots total, all green on test-erpnext-v17.
2026-05-27 15:01:10 +05:30
Nabin Hait
b68daea365 refactor: introduce BaseStockGLComposer, slim StockController.get_gl_entries
Moves the StockController.get_gl_entries body into
erpnext/stock/services/base_stock_gl_composer.py → BaseStockGLComposer(BaseGLComposer).
compose(inventory_account_map, default_expense_account, default_cost_center) contains
all warehouse↔expense-account GL pair building and the internal-transfer rounding-diff
block; all helpers (get_inventory_account_dict, get_stock_ledger_details, etc.) remain
on self.doc and are called via doc.<method>.

StockController.get_gl_entries becomes a 3-line shim.  Delivery Note, Stock Entry, and
Stock Reconciliation continue to work unchanged — DN inherits the shim directly; SE and
SR override and call super(), which now delegates to the composer.

Verified: 22 GL snapshots byte-identical on test-erpnext-v17.
2026-05-27 14:47:19 +05:30
Nabin Hait
e8f9cf6e3f test: add Delivery Note GL snapshots
Extends the Phase-0 characterization suite with 2 DN scenarios (basic
delivery and return) using _Test Company with perpetual inventory so
stock accounting GL entries are produced. Uses stock_entry_utils.make_stock_entry
directly (avoids importing test_delivery_note and its conflicting test-record deps).

Run: bench --site test-erpnext-v17 run-tests --module erpnext.accounts.test_gl_characterization
2026-05-27 14:46:40 +05:30
ljain112
4a49a205b3 fix(custom_financial_template): sum account closing balances across dimensions 2026-05-27 13:57:56 +05:30
ljain112
251e7b623c fix: changes as per review 2026-05-27 13:06:07 +05:30
Nabin Hait
55368256fd docs: mark Phase 4 Journal Entry as done in refactor spec 2026-05-27 12:49:11 +05:30
Nabin Hait
8f05e0596e refactor: introduce Journal Entry GL composer
Move the Journal Entry GL assembly into a new JournalEntryGLComposer(
BaseGLComposer); compose() projects the accounts child rows into GL dicts,
mirroring the former build_gl_map, which is now a thin shim delegating to
the composer. Drop the now-unused get_advance_payment_doctypes import.
2026-05-27 12:49:05 +05:30
Nabin Hait
473f6e833a test: add Journal Entry GL characterization snapshots
Extend the Phase-0 GL safety net with three representative Journal Entry
scenarios (basic two-line, multi-currency, against a Sales Invoice with
party and reference) ahead of moving JE onto the composer.
2026-05-27 12:48:57 +05:30
Nabin Hait
d775d540c4 docs: mark Phase 4 Payment Entry as done in refactor spec 2026-05-27 12:42:59 +05:30
Nabin Hait
b381061742 refactor: introduce Payment Entry GL composer
Move the Payment Entry GL row builders (party, bank, deductions, tax)
onto a new PaymentEntryGLComposer(BaseGLComposer); compose() mirrors the
former build_gl_map, which is now a thin shim delegating to the composer.
The builders operate on self.doc and shared helpers stay on the document.
Advance-posting builders are left on the controller; they post in a
separate pass and move with the advances service in a later phase.
2026-05-27 12:42:52 +05:30
Nabin Hait
90801550eb test: add Payment Entry GL characterization snapshots
Extend the Phase-0 GL safety net with five representative Payment Entry
scenarios (receive against SI, pay against PI, with deductions, with
taxes, multi-currency) ahead of moving PE onto the composer.
2026-05-27 12:42:43 +05:30
ljain112
a85f8a64b1 fix(tds): treat NULL and empty-string tax_withholding_group as equivalent 2026-05-27 12:40:57 +05:30
Pandiyan P
05a46ffefd fix(selling): handle None values while grouping opportunities by utm … (#55300) 2026-05-27 06:52:43 +00:00
Sudharsanan11
373696d470 fix(stock): set outgoing rate as zero for inward transactions 2026-05-27 12:06:21 +05:30
Sudharsanan Ashok
3ad67021d6 fix(manufacturing): allow to edit batch size while creating a work order (#55058) 2026-05-27 05:57:17 +00:00
Sudharsanan11
4e7aa499ea fix(stock): change valuation rate column label in stock ledger entry/report 2026-05-27 11:00:47 +05:30
Nabin Hait
8677e2df40 docs: mark Phase 3 as DONE in refactor spec 2026-05-27 08:40:26 +05:30
Nabin Hait
9c78c9ab7b refactor: migrate PI item/stock/provisional GL builders onto the composer
Move make_item_gl_entries, make_stock_adjustment_entry,
get_provisional_accounts, make_provisional_gl_entry, and
update_net_purchase_amount_for_linked_assets from PurchaseInvoice onto
PurchaseInvoiceGLComposer, completing the full GL builder migration.

purchase_invoice.py no longer contains any GL row-building logic;
PurchaseInvoiceGLComposer is the single authoritative source for all
PI GL entries, mirroring the SalesInvoiceGLComposer pattern.

All 12 GL characterization snapshots pass.
2026-05-27 08:40:01 +05:30
Nabin Hait
32c4b1d98a refactor: migrate PI supplier/tax/payment GL builders onto the composer
Move make_supplier_gl_entry, add_supplier_gl_entry, make_tax_gl_entries,
make_internal_transfer_gl_entries, make_gl_entries_for_tax_withholding,
make_payment_gl_entries, make_write_off_gl_entry, and
make_gle_for_rounding_adjustment from PurchaseInvoice onto
PurchaseInvoiceGLComposer.

compose() now calls self.X for all moved builders; the make_item cluster
(make_item_gl_entries, make_provisional_gl_entry, get_provisional_accounts,
update_net_purchase_amount_for_linked_assets, make_stock_adjustment_entry)
still lives on doc pending batch-2 migration.

All 12 GL characterization snapshots pass.
2026-05-27 08:29:32 +05:30
Nabin Hait
6467f07459 refactor: introduce Purchase Invoice GL composer
Phase 3 of the accounts/controller refactor. Adds PurchaseInvoiceGLComposer;
PI's get_gl_entries body moves into compose() and the method becomes a thin
shim. Row-builder methods still live on the document (invoked via self.doc)
and migrate onto the composer next.

After comparing the SI and PI compose() flows, BaseGLComposer is kept minimal:
the two differ in step order, builders, and per-doctype regional function, so a
shared template is not warranted. No behavior change (Phase 0 snapshots and PI
GL tests stay green).
2026-05-27 08:13:10 +05:30
MochaMind
8bb611dfee fix: sync translations from crowdin (#55239) 2026-05-27 05:28:39 +05:30
Himanshu Jain
652014700c fix(employee): js error if user does not have write permission for date field (#55312) 2026-05-27 01:49:16 +05:30
Diptanil Saha
2a7867511d fix(sales_invoice): skip stock update for POS invoices linked to Delivery Note (#55311) 2026-05-26 20:13:40 +00:00
Nabin Hait
b5c96dfef0 refactor: move Sales Invoice GL row builders onto the composer
Relocates all 11 Sales Invoice-specific GL entry builders from the document
onto SalesInvoiceGLComposer, operating on self.doc. The perpetual-inventory
super().get_gl_entries() call becomes super(SalesInvoice, doc).get_gl_entries().
Shared bucket-A helpers (get_gl_dict, make_discount_gl_entries, etc.) remain on
AccountsController for now, invoked via self.doc, until all doctypes use a
composer. No behavior change: Phase 0 snapshots and the SI tests covering
perpetual inventory, POS, write-off, returns, fixed assets, internal transfer
and loyalty all stay green.
2026-05-27 01:24:56 +05:30
Nabin Hait
cf1817c1ea refactor: introduce GL composer and delegate SI get_gl_entries
Phase 2 (pilot) of the accounts/controller refactor. Adds BaseGLComposer
and SalesInvoiceGLComposer; Sales Invoice's get_gl_entries body moves into
compose() and the method becomes a thin shim. Row-builder methods still live
on the document (invoked via self.doc) and migrate onto the composer next.
No behavior change (Phase 0 GL snapshots remain byte-identical).
2026-05-27 01:12:11 +05:30
Nabin Hait
3ec6387425 fix: honor account freezing date when cancelling vouchers
make_reverse_gl_entries passed adv_adj as the company argument to
check_freezing_date, so the freeze-date check silently no-op'd on
cancellation (no company matched). Pass company explicitly so
cancellations respect the freezing date like submissions do.

Adds a regression test covering cancellation after the freeze date.
2026-05-27 01:01:43 +05:30
Nabin Hait
234c4a45b8 refactor: extract list-level GL validations into gl_validator service
Phase 1 of the accounts/controller refactor. Moves the six pure
list-level validators (validate_disabled_accounts, validate_accounting_period,
validate_cwip_accounts, check_freezing_date, validate_against_pcv,
validate_allowed_dimensions) out of general_ledger.py into the new
erpnext/accounts/services/gl_validator.py. general_ledger.py imports and
calls them at the existing sites; no behavior change (Phase 0 GL snapshots
remain byte-identical).

The debit/credit balance trio stays in general_ledger.py for now since
get_debit_credit_difference mutates entries and is interleaved with the
round-off repair.
2026-05-27 01:01:20 +05:30
Nabin Hait
064340cafb test: add Phase 0 GL characterization safety net
Golden-master snapshot harness (GLSnapshot / assert_gl_snapshot) plus 12
characterization scenarios for Sales and Purchase Invoice (basic, taxes,
multi-currency, returns, round-off, discount accounting, advance, POS).
Locks current GL Entry output so the upcoming GL pipeline refactor
(composer / validator / sink) can be verified byte-identical.

Regenerate goldens with REGEN_GL_SNAPSHOTS=1.
2026-05-27 00:49:48 +05:30
Nabin Hait
dfbd8db9d3 docs: add accounts/controller refactor spec
Phased plan to decompose accounts_controller.py and the sales_invoice.py
monolith into composed services. Documents the frozen GL-layer design
(GLComposer / gl_validator / general_ledger sink), method bucketing, and
the 8-phase rollout.
2026-05-27 00:05:35 +05:30
Sudharsanan11
58f24c83c0 fix(stock): add validation for work order seial nos and batch nos 2026-05-26 18:27:59 +05:30
rohitwaghchaure
e1ddc50872 Merge pull request #55242 from rohitwaghchaure/fixed-stock-reco-for-legacy-serial-nos
fix: stock reco for legacy serial nos
2026-05-26 15:58:16 +05:30
rohitwaghchaure
5057057f43 Merge pull request #55290 from rohitwaghchaure/fixed-tax-amount-issue-in-invoice-lcv
fix: inclusive tax amount not considered while setting LCV from purchase invoice
2026-05-26 15:44:26 +05:30
Nihantra C. Patel
cad4d497bd Merge pull request #55268 from Nihantra-Patel/immutable-ledger-reverse-posting-date
fix: use passed posting date for period closing validation in reverse GL entries
2026-05-26 15:43:06 +05:30
Rohit Waghchaure
048ddfc265 fix: inclusive tax amount not considered while setting LCV from purchase invoice 2026-05-26 15:13:05 +05:30
Nihantra Patel
9c39b01f1c test: update testcase 2026-05-26 14:19:04 +05:30
Loic Oberle
a051049710 refactor(sales_order): Replace SQL with ORM in validate_po (#55198) 2026-05-26 08:20:04 +00:00
Mihir Kandoi
f023bf8a96 fix: single variant creation error (#55286)
* fix: single variant creation error

* feat: allow creation of any number of variants in multiple item variant creation dialog
2026-05-26 13:34:44 +05:30
Loic Oberle
b8327e4031 refactor(customer): replace SQL with query builder in get_customer_ou… (#55209) 2026-05-26 08:00:23 +00:00
Loic Oberle
bbb7b6f8e0 refactor(buying): replace sql query by orm (#55153) 2026-05-26 13:14:39 +05:30
Mihir Kandoi
090c25d848 feat: allow creation of any number of variants in multiple item variant creation dialog 2026-05-26 13:09:14 +05:30
Mihir Kandoi
bda75135c3 fix: single variant creation error 2026-05-26 12:53:47 +05:30
Mihir Kandoi
a128d851c5 refactor: remove unused customer field in Item DocType (#55277) 2026-05-26 05:17:00 +00:00
ruthra kumar
cd35fbde94 Merge pull request #55256 from ruthra-kumar/handle_stuck_running_state_in_process_pcv
refactor: handle processes stuck in running state in process pcv
2026-05-26 10:27:28 +05:30
Pandiyan P
c286a73e0b fix: prevent AttributeError in batch query filters (#55257) 2026-05-26 10:23:18 +05:30
ruthra kumar
6cb7971342 refactor: atomic summarization step for process pcv 2026-05-26 09:55:38 +05:30
diptanilsaha
49d579a016 fix(payment_entry): sync paid/received amounts for cross-currency entries (#55270) 2026-05-25 23:16:33 +05:30
Nihantra Patel
f040bdf165 fix: use passed posting date in make_reverse_gl_entries 2026-05-25 21:39:54 +05:30
Rohit Waghchaure
9d5fd11bcd fix: stock reco for legacy serial nos 2026-05-25 17:22:08 +05:30
rohitwaghchaure
af26986def Merge pull request #55252 from rohitwaghchaure/fixed-job-card-buttons-class
fix: job card buttons color
2026-05-25 17:21:34 +05:30
rohitwaghchaure
7982ecfdf7 Merge pull request #55249 from aerele/fix/support-#68708
fix(stock): remove precision for valuation rate while creating sle
2026-05-25 17:21:01 +05:30
ruthra kumar
f414778486 refactor: handle processes stuck in running state in process pcv 2026-05-25 16:02:35 +05:30
Khushi Rawat
631a4a67ba Merge pull request #55126 from khushi8112/asset-scrap-flow
fix: asset scrap flow related changes
2026-05-25 15:45:03 +05:30
Rohit Waghchaure
c327a5ca93 fix: job card buttons color 2026-05-25 15:33:12 +05:30
Sudharsanan11
66ba7be239 fix(stock): remove precision for valuation rate while calculating difference amount 2026-05-25 14:43:39 +05:30
Sudharsanan11
ccb8837c6c fix(stock): remove precision for valuation rate while creating sle 2026-05-25 14:42:58 +05:30
ruthra kumar
1c3a9f7dd9 refactor: summarize in background 2026-05-25 14:11:46 +05:30
Mihir Kandoi
bafa6f9508 feat: add party groups functionality to party specific item (#54988) 2026-05-25 12:06:54 +05:30
rohitwaghchaure
b0a83f9b22 Merge pull request #55216 from rohitwaghchaure/fixed-valuation-rate-for-fg-item-new
fix: fg valuation rate in repack entry when multiple FGs
2026-05-25 11:44:02 +05:30
MochaMind
7ae6535be9 chore: update POT file (#55235) 2026-05-24 14:47:38 +02:00
Mihir Kandoi
2a01a37d5d refactor: stock ageing report (#55231) 2026-05-24 15:43:07 +05:30
Mihir Kandoi
c1a4c3d053 refactor: use frappe.db.bulk_update instead of Case queries in subcon… (#55232) 2026-05-24 09:36:45 +00:00
Mihir Kandoi
004818e0ac fix: consider batchwise valuation in stock ageing report (#54919) 2026-05-24 12:27:48 +05:30
Mihir Kandoi
268910467a fix: not able to reserve product bundle through dialog (#55194) 2026-05-24 12:26:48 +05:30
Rohit Waghchaure
a47e4c04f7 fix: fg valuation rate in repack entry when multiple FGs 2026-05-23 14:42:38 +05:30
Loic Oberle
983ae011f0 refactor(sales_order): Replace SQL with ORM in make_maintenance_schedule (#55206) 2026-05-23 06:27:27 +00:00
Loic Oberle
6f9f6d3b7d refactor(sales_order): Replace SQL with ORM in validate_proj_cust (#55202) 2026-05-23 06:26:25 +00:00
Loic Oberle
9546374ac3 refactor(sales_order): Replace SQL with ORM in validate_sales_mntc_qu… (#55201) 2026-05-23 06:17:00 +00:00
Loic Oberle
78894f7c78 refactor(sales_order): Replace SQL with ORM in validate_for_items (#55199) 2026-05-23 06:13:50 +00:00
Loic Oberle
2d2b45f270 refactor(sales_order): Replace SQL with ORM in check_modified_date (#55205) 2026-05-23 11:40:04 +05:30
Loic Oberle
3cd9943cc0 refactor(customer): replace SQL with ORM in on_trash (#55211) 2026-05-23 11:39:28 +05:30
Loic Oberle
f9d430c4aa refactor(supplier_scorecard): replace sql with orm (#55169) 2026-05-23 11:37:09 +05:30
Loic Oberle
ea2eb3dc01 refactor(supplier_scorecard_variable): replace sql with query builder (#55162) 2026-05-23 11:36:11 +05:30
Loic Oberle
f370404a75 refactor(sales_order): Replace SQL with ORM in product_bundle_has_sto… (#55200) 2026-05-23 11:35:46 +05:30
Loic Oberle
4719ba15c6 refactor(sales_order): Replace SQL with query builder in make_mainten… (#55207) 2026-05-23 11:34:54 +05:30
Loic Oberle
e27b88d789 refactor(sales_order): replace SQL with ORM in check_nextdoc_docstatus (#55204) 2026-05-23 11:34:18 +05:30
Loic Oberle
f1c2d2e21d refactor(sales_order): Replace SQL with ORM in update_enquiry_status (#55203) 2026-05-23 11:33:54 +05:30
Loic Oberle
9a46b3374f refactor(sales_order):Replace SQL with query builder in get_events (#55208) 2026-05-23 11:33:23 +05:30
Loic Oberle
df3d0859a1 refactor(sales_person_wise_transaction_summary): Replace SQL with que… (#55191) 2026-05-23 11:29:09 +05:30
Loic Oberle
de531ceeb9 refactor(sales_person_wise_transaction_summary): Replace SQL with ORM (#55190) 2026-05-23 11:28:42 +05:30
Loic Oberle
c9593d8c62 refactor(customer): Replace SQL with query builder in get_customer_name (#55210) 2026-05-23 11:28:06 +05:30
Loic Oberle
4d0ee719c0 refactor(purchase_order): Use the ORM instead of SQL (#55173) 2026-05-23 11:26:23 +05:30
MochaMind
3aaa828e32 fix: sync translations from crowdin (#55118)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2026-05-22 22:47:48 +00:00
Nishka Gosalia
264c10dee8 Merge pull request #55189 from aerele/support-#69032
fix(project): update customer and sales order as no copy
2026-05-22 17:49:58 +05:30
Loic Oberle
98c2ec528c refactor(territory_wise_sales): replace sql with query builder (#55175) 2026-05-22 11:56:10 +00:00
Loic Oberle
e11e386fff refactor(territory_wise_sales):replace sql with query builder (#55174) 2026-05-22 11:45:56 +00:00
nareshkannasln
9d8f3863f2 fix(project): update customer and sales order as no copy 2026-05-22 16:47:46 +05:30
Mihir Kandoi
b71eacd6b3 fix: invalid filter on item_group (#55186) 2026-05-22 16:44:09 +05:30
Loic Oberle
8fb962e50e refactor(supplier_scorecard_variable):replace sql with query builder (#55168) 2026-05-22 10:44:30 +00:00
Loic Oberle
1b23ef2ff4 refactor(request_for_quotation): use query builder instead of SQL (#55172) 2026-05-22 16:11:48 +05:30
Loic Oberle
f5899b5519 refactor(supplier_scorecard):replace sql with orm (#55161) 2026-05-22 16:11:04 +05:30
Loic Oberle
30ba93fb8f refactor(supplier_quotation): Replace SQL by the orm (#55155) 2026-05-22 16:10:40 +05:30
Loic Oberle
e7c4fb85f8 refactor(request_for_quotation): Use query builder instead of SQL (#55171) 2026-05-22 16:10:18 +05:30
Loic Oberle
1135429181 refactor(territory_wise_sales):replace sql with orm (#55177) 2026-05-22 10:39:41 +00:00
Loic Oberle
f6bf7d85ad refactor(supplier_qotation): Replace sql by query builder (#55154) 2026-05-22 16:09:15 +05:30
Loic Oberle
ab99c9a54e refactor(supplier_scorecard): Replace sql with orm (#55170) 2026-05-22 16:07:12 +05:30
Loic Oberle
e75de4d337 refactor(supplier_scorecard_variable): replace sql with query builder (#55167) 2026-05-22 16:06:30 +05:30
Loic Oberle
2eb2defd90 refactor(supplier_scorecard_variable): replace sql with query builder (#55163) 2026-05-22 16:06:04 +05:30
Loic Oberle
82d19677ed refactor(supplier_scorecard_variable): replace sql with query builder (#55164) 2026-05-22 16:05:33 +05:30
Loic Oberle
b84ec2d22a refactor(territory_wise_sales): replace SQL with query builder (#55176) 2026-05-22 16:04:18 +05:30
rohitwaghchaure
719cf8a48f Merge pull request #55091 from rohitwaghchaure/fixed-job-card-pending-qty
feat: pending qty in job card
2026-05-22 15:21:44 +05:30
Loic Oberle
1bc8d02cef refactor(queries): migrate item_query to Query Builder (#54834)
* refactor(queries): migrate item_query to Query Builder

Use Frappe Query Builder to ensure compatibility with PostgreSQL.
The implementation still relies on raw SQL for fcond and mcond through
LiteralValue to maintain compatibility with legacy filter builders.

* refactor(queries): migrate item_query to Query Builder

Fix the bugs found by coderabbit.
For the eol condition: PostgreSQL raises DatetimeFieldOverflow when evaluating '0000-00-00' as
a date literal, even inside NULLIF(). Added a db_type guard to skip the
zero-date condition on PostgreSQL, where it can never be stored anyway.

No generic cross-db solution found for this case; open to revisiting

* refactor(queries): Rework item_query to use get_query

Rework the item_query method to use get_query with the ignore_permissions flag at False

* refactor(controller): Fix the query builder

Fix the build query in item_query according to coderabbit

* refactor(queries): explicitly add has_variants

Explicitely add has_variants==0 to the query according to coderabbit feedback
2026-05-22 09:42:06 +00:00
rohitwaghchaure
8915095804 Merge pull request #55159 from rohitwaghchaure/fixed-slow-query
fix: slow query
2026-05-22 14:46:19 +05:30
Nishka Gosalia
ace4e45cfe fix: edit stock uom qty for purchase documents (#55135) 2026-05-22 14:23:24 +05:30
Nihantra C. Patel
9eeccecd30 perf: skip delink_original_entry during cancellation when Immutable Ledger is enabled (#55130)
* perf: get payment ledger and remove update from delink when immutable ledger is enabled

* revert: changes of get_payment_ledger_entries

* perf: skip delink_original_entry during cancellation when Immutable Ledger is enabled

* test: for immutable ledger

* test: add posting_date in create_sales_invoice

* fix: link validation err with immutable ledger on

* test: update testcase of the immutable ledger

* refactor(test): simpler test for immutable invariants

---------

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
2026-05-22 12:32:53 +05:30
Rohit Waghchaure
d44f574581 fix: slow query 2026-05-22 11:41:13 +05:30
rohitwaghchaure
ebcdcfcd84 Merge pull request #53679 from aerele/feat/SDBNB-account
feat: add Stock Delivered But Not Billed (SDBNB) accounting for DN and SI
2026-05-22 08:41:39 +05:30
kavin-114
91026fbdb3 fix: classify Stock Delivered But Not Billed as a Current Asset
This account holds a debit balance (inventory value delivered but not yet
invoiced) and clears to COGS on Sales Invoice, so it is economically a
short-term clearing asset rather than a trade payable. Move it from the
Stock Liabilities group to Stock Assets under Current Assets, with
account_category "Stock Assets" (and account_number 1420 in the numbered
chart). The account_type "Stock Delivered But Not Billed" is unchanged,
so posting logic in Sales Invoice and Delivery Note continues to key off
the correct account.
2026-05-22 06:50:23 +05:30
rohitwaghchaure
61547fff44 chore: fixed test case 2026-05-22 06:50:23 +05:30
Rohit Waghchaure
ba1f40fdd9 fix: posting date and time 2026-05-22 06:50:23 +05:30
Pugazhendhi Velu
9ff3e28f5d fix: validate expense account for items linked to sales invoice 2026-05-22 06:50:23 +05:30
kavin-114
78993c1ebe fix: update cost center tests to use dynamic expense account
Existing tests hardcoded "Cost of Goods Sold" as expected GL account,
but SDBNB overrides it on DN submission. Use dn.items[0].expense_account
to work with both SDBNB-enabled and legacy companies.
2026-05-22 06:50:23 +05:30
kavin-114
6ee7dc0b49 test: add unit test cases for Stock Delivered But Not Billed 2026-05-22 06:50:23 +05:30
kavin-114
05877140d1 feat: handle post delivery invoices gl reposting 2026-05-22 01:13:12 +05:30
Pugazhendhi Velu
3364ee9274 feat(stock): add Stock Delivered But Not Billed GL entries on Delivery Note and Sales Invoice 2026-05-22 01:13:12 +05:30
Pugazhendhi Velu
8596d98ac4 feat(accounts): add Stock Delivered But Not Billed account type and defaults 2026-05-22 01:13:12 +05:30
Pugazhendhi Velu
bb5d4d8682 feat(company): add Stock Delivered But Not Billed account configuration 2026-05-22 01:13:12 +05:30
Khushi Rawat
8ea7efc01d Merge pull request #55146 from khushi8112/payment-entry-foreign-currency-remarks
fix: correct remarks for foreign currency payment entries
2026-05-21 20:11:38 +05:30
Khushi Rawat
23b5afc5de Merge pull request #54946 from Shllokkk/letter-head-fix
feat(company): add a default_letter_head_report field in company doctype
2026-05-21 20:05:56 +05:30
rohitwaghchaure
160b92f9cd Merge pull request #54466 from rohitwaghchaure/revamp-stock-entry
refactor: stock_entry file to improve readability and maintainability
2026-05-21 19:47:04 +05:30
Rohit Waghchaure
1be92f6d05 refactor: better timer and complete button 2026-05-21 19:45:10 +05:30
Khushi Rawat
70b9f549a4 Merge pull request #55147 from khushi8112/debit-note-rate-adjustment-description
fix: correct description for Is Rate Adjustment Entry (Debit Note) checkbox
2026-05-21 18:06:51 +05:30
Rohit Waghchaure
0a215b0717 refactor: job_card.js code for better readability 2026-05-21 17:46:29 +05:30
Rohit Waghchaure
db64f451c1 feat: pending qty in job card 2026-05-21 17:46:24 +05:30
khushi8112
92c969478e fix: correct description for Is Rate Adjustment Entry (Debit Note) checkbox 2026-05-21 17:33:59 +05:30
khushi8112
c6cde700b5 fix: correct remarks for foreign currency payment entries 2026-05-21 17:25:55 +05:30
Rohit Waghchaure
068f7b9a8d refactor: split large functions into smaller functions 2026-05-21 17:12:59 +05:30
Khushi Rawat
83f100bae1 Merge pull request #55142 from khushi8112/composite-asset-net-purchase-amount-reset
fix: don't reset net_purchase_amount for Composite Asset if already set
2026-05-21 17:07:41 +05:30
khushi8112
98dae6e43a fix: don't reset net_purchase_amount for Composite Asset if already set 2026-05-21 17:04:33 +05:30
diptanilsaha
18bdd0afd3 Merge pull request #55127 from diptanilsaha/fix/tax-rule-date-filter
refactor: migrate get_tax_template to query builder with hierarchical group matching
2026-05-21 17:04:02 +05:30
diptanilsaha
8c43118725 test: add tests for supplier group hierarchy and use_for_shopping_cart filter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:43:00 +05:30
diptanilsaha
4d43c74f5f fix: default use_for_shopping_cart to 0 in set_taxes
Ensures regular transactions only match tax rules where
use_for_shopping_cart = 0, preventing webshop-specific rules
from applying to standard documents.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:43:00 +05:30
diptanilsaha
f98975f51a refactor: rewrite get_tax_template using query builder
Migrates from raw frappe.db.sql with string interpolation to frappe.qb.
Adds hierarchical supplier_group matching (mirrors customer_group behaviour).
Removes unused get_customer_group_condition helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:43:00 +05:30
diptanilsaha
cb610b79d2 feat: add get_parent_supplier_groups using query builder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:42:56 +05:30
diptanilsaha
91a2a7b0a0 refactor: migrate get_parent_customer_groups to query builder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:41:53 +05:30
rohitwaghchaure
8aaa7c0993 Merge pull request #55134 from rohitwaghchaure/fixed-removed-redundant-code
fix: removed redundant code
2026-05-21 15:24:41 +05:30
khushi8112
1fd99337b3 fix: use get_query instead of get_all for data fetching 2026-05-21 15:05:44 +05:30
Pandiyan P
1a81265c2c fix(manufacturing): remove forecast_qty and adjust_qty fields from sa… (#55129) 2026-05-21 15:01:55 +05:30
Rohit Waghchaure
14b17cd8a6 fix: removed redundant code 2026-05-21 14:56:35 +05:30
Mihir Kandoi
2f35660142 fix: consumed operation cost calculation (#54858) 2026-05-21 14:55:46 +05:30
khushi8112
21bb8fe979 fix: asset scrap flow related changes 2026-05-21 12:14:08 +05:30
Jatin3128
06477119d1 fix: corrected the pricing rule taking the wrong value (#54894) 2026-05-21 12:04:45 +05:30
Rohit Waghchaure
961cbc3625 refactor: using agentic AI 2026-05-21 09:52:55 +05:30
Raffael Meyer
341891e326 fix: status for settled credit notes in sales invoice list (#54764) 2026-05-20 21:50:41 +02:00
Rohit Waghchaure
4d14727b26 fix: linter issue 2026-05-20 23:31:09 +05:30
Mihir Kandoi
33dc1f5f09 fix: set weight in update items (#55089) 2026-05-20 16:38:37 +00:00
Rohit Waghchaure
a3a7733440 test: fixed test cases 2026-05-20 21:59:17 +05:30
Daniel Radl
d85f6a4541 chore: migrate to new docker publish workflow (#54499) 2026-05-20 16:22:09 +00:00
Raffael Meyer
8845be9419 fix: allow direct drop-ship on Purchase Orders without Sales Order (#54930) 2026-05-20 18:03:21 +02:00
Abdeali Chharchhoda
814c11200a fix: update formatter to handle blank rows in financial statements 2026-05-20 17:31:21 +05:30
Mihir Kandoi
3084e3654c fix: item price with party condition (#55100) 2026-05-20 11:48:15 +00:00
Abdeali Chharchhoda
f7c744350c fix: update add_total_row_account to control blank row addition 2026-05-20 17:15:44 +05:30
Mihir Kandoi
00057b1798 fix: valuation rate missing for standalone credit notes for moving av… (#55102) 2026-05-20 11:28:01 +00:00
Abdeali Chharchhoda
cf597361f6 fix: handle separator rows in financial statement formatter 2026-05-20 16:28:38 +05:30
Mihir Kandoi
0bbddf4994 fix: set bin details when adding item using update items (#55096) 2026-05-20 09:46:05 +00:00
soham7117
88f6f182e3 feat: removed extra page break
Signed-off-by: soham7117 <sohampawar626@gmail.com>
2026-05-20 14:57:29 +05:30
soham7117
4c8f95a1a5 feat: added cost of goods sold
Signed-off-by: soham7117 <sohampawar626@gmail.com>
2026-05-20 14:57:29 +05:30
Shllokkk
bd84434d34 fix: incorrect error message string in sales order (#55090) 2026-05-20 14:41:06 +05:30
Pandiyan P
a3950590da fix(manufacturing): fetch from_bom name in production plan (#55085) 2026-05-20 14:22:17 +05:30
diptanilsaha
6c6fa722af chore: migrate Address/Contact custom fields from JSON fixtures to install (#55084)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 08:39:24 +00:00
MochaMind
eb67afa01a fix: sync translations from crowdin (#55065) 2026-05-20 13:53:53 +05:30
diptanilsaha
12bb86d688 chore: remove frappe-semgrep-rules submodule (#55083) 2026-05-20 07:28:01 +00:00
Rohit Waghchaure
38eeb6994c test: fixed test cases 2026-05-20 12:02:44 +05:30
ruthra kumar
dd782d96bf Merge pull request #55072 from ruthra-kumar/faster_opening_balance_range_calculation
perf: faster opening balance range calculation in process period closing voucher
2026-05-20 11:48:10 +05:30
Sudharsanan Ashok
b9e08f3ce4 fix(stock): remove recalculate current qty function (#54774) 2026-05-20 11:37:26 +05:30
ruthra kumar
eba58b2837 refactor: ppcv select with for update and skip locked 2026-05-20 11:23:06 +05:30
ruthra kumar
ee33574a6d fix: faster range calculation on process period closing voucher 2026-05-20 11:23:00 +05:30
MochaMind
202ea0061c fix: sync translations from crowdin (#54951) 2026-05-20 00:50:45 +05:30
Nabin Hait
13e0a211ae fix: prevent negative amounts in common party JE on return invoices (#55034)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 00:48:29 +05:30
Nabin Hait
87a4e872cf fix: use route_options for Credit Note and Debit Note sidebar links (#55026)
fix: use route_options instead of filters for Credit Note and Debit Note sidebar links

Filters with ["=", value] format produce broken URLs like
`?is_return=%3D%2C1` instead of `?is_return=1`. Switching to
route_options with a plain JSON object generates correct URLs.
2026-05-19 23:13:30 +05:30
Nabin Hait
fa403dd23b fix: warn when accounting dimension fieldname conflicts with existing fields (#55036) 2026-05-19 23:04:47 +05:30
Nabin Hait
55bb6e0357 fix: handle None delivery_date when sorting MPS data (#55028) 2026-05-19 21:08:47 +05:30
Nabin Hait
6114293b92 chore: remove leaderboard dead code (#55030) 2026-05-19 21:07:52 +05:30
Rohit Waghchaure
e4b5e6bd1e refactor: split stock_entry.py into multiple files for better readability 2026-05-19 18:41:31 +05:30
ruthra kumar
83cba39aa7 Merge pull request #55053 from ruthra-kumar/drop_procedures_first_and_then_change
fix(patch): drop dead procedures first before other changes
2026-05-19 16:37:40 +05:30
Ravibharathi
ad7ddae32f fix: validate company region in uae vat 201 (#54899) 2026-05-19 16:30:07 +05:30
ruthra kumar
61d24ba55f fix(patch): drop dead procedures first before other changes 2026-05-19 16:12:25 +05:30
rohitwaghchaure
6878fc9ab6 Merge pull request #55046 from rohitwaghchaure/fixed-incorrect-balance
fix: stock balance showing incorrect value because of incorrect SLE
2026-05-19 13:50:55 +05:30
Rohit Waghchaure
94b95d6c2f fix: stock balance showing incorrect value because of incorrect SLE 2026-05-19 13:23:32 +05:30
Ravibharathi
133ccd8214 Merge pull request #54761 from aerele/fix-validate-due-date-with-template
fix: normalize date comparison to avoid datatype mismatch
2026-05-19 11:26:55 +05:30
Nabin Hait
f99e331742 fix: prevent duplicate task execution and timestamp error in transaction deletion (#55021) 2026-05-18 23:06:09 +05:30
Sudharsanan Ashok
21a9eedb5c fix(stock): update buying amount calculation in gross profit report (#55020) 2026-05-18 22:33:10 +05:30
ruthra kumar
eac31d2ab4 Merge pull request #55001 from ruthra-kumar/remove_ar_procedures
fix: remove sql procedure method from AR report
2026-05-18 13:44:18 +05:30
ruthra kumar
63a7142b9b fix: remove sql procedure method from AR report 2026-05-18 12:16:46 +05:30
Nishka Gosalia
ae9c632e39 fix: toast message for item price insert (#55009) 2026-05-18 06:10:40 +00:00
Soham Kulkarni
26f5f110d6 Merge pull request #55000 from sokumon/workspace-json
fix: remove parent page
2026-05-18 10:31:06 +05:30
sokumon
e13bd9eaa6 fix: remove parent page 2026-05-18 10:09:28 +05:30
MochaMind
78e3b54953 chore: update POT file (#54991) 2026-05-17 21:45:21 +02:00
Shllokkk
9ea56910a1 test: update setup for test_process_statement_of_accounts 2026-05-17 19:51:52 +05:30
Sudharsanan Ashok
2ad9231fb2 fix(stock): apply posting datetime filters while fetching available batches (#54976) 2026-05-17 06:43:13 +00:00
Shllokkk
d2b09f71c3 fix: populate missing letter_head_for in tabLetter Head and set default letterheads 2026-05-16 17:59:30 +05:30
Shllokkk
f31b3749bc feat: standard letterheads for doctype and reports 2026-05-16 17:54:02 +05:30
Dany Robert
30b9e11303 fix: update default_advance_account type 2026-05-16 12:09:59 +05:30
Dany Robert
4b1d369ac6 fix(ppr): make default_advance_account optional 2026-05-16 11:48:18 +05:30
rohitwaghchaure
7d1a86f4e5 Merge pull request #54962 from rohitwaghchaure/fixed-legacy-serial-no
fix: incoming rate for legacy serial no
2026-05-15 22:09:24 +05:30
Ejaaz Khan
55d6bc475e Merge pull request #54655 from iamejaaz/remove-sales-print
refactor: remove dead print format
2026-05-15 17:26:48 +05:30
diptanilsaha
712403aae4 Merge pull request #54963 from diptanilsaha/fix/pe_paid_amt_rec_amt
fix(payment_entry): fix paid/received amount calculation for multi-currency accounts
2026-05-15 15:42:46 +05:30
Rohit Waghchaure
2773b7c002 fix: incoming rate for legacy serial no 2026-05-15 15:21:36 +05:30
diptanilsaha
69642860ee fix(payment_entry): paid_amount and received_amount calculation depending upon account_currency 2026-05-15 14:31:37 +05:30
rohitwaghchaure
d22cd7b856 Merge pull request #54403 from aerele/fix/support-#64052
fix(stock): ignore fetching warehouse account for asset items
2026-05-15 13:15:11 +05:30
ruthra kumar
53b5de85bb Merge pull request #54941 from ruthra-kumar/flaky_is_opening_filter_in_general_ledger
fix: flag to disable opening balance calculation in general ledger
2026-05-15 12:19:04 +05:30
ruthra kumar
28a2230d02 refactor: flag to disable opening balance calculation 2026-05-15 11:41:12 +05:30
Shllokkk
63daba9715 feat(company): add a default_letter_head_report field in company doctype 2026-05-14 20:13:23 +05:30
Ahmed Reda Abukhatwa
3592c3086d fix: skip empty spacer rows in compute_growth_view_data (P&L growth view) 2026-05-14 14:40:03 +03:00
MochaMind
4380d710c7 fix: sync translations from crowdin (#54893)
* fix: Persian translations

* fix: Croatian translations

* fix: Swedish translations
2026-05-14 13:30:43 +02:00
Mihir Kandoi
78a79120ea fix: status not changing for dropshipped POs and SOs (#54934)
* fix: status not changing for dropshipped POs and SOs

* test: change test case to accomodate new flow
2026-05-14 08:26:51 +00:00
Khushi Rawat
930990434c Merge pull request #54935 from frappe/revert-54176-payment-entry-list-reconciliation-indicator
Revert "feat: show reconciled/unreconciled indicator in list view"
2026-05-14 12:52:35 +05:30
Khushi Rawat
c5e24eda69 Revert "feat: show reconciled/unreconciled indicator in list view" 2026-05-14 12:35:57 +05:30
rohitwaghchaure
06784d2a46 Merge pull request #54905 from rohitwaghchaure/fixed-support-67449
fix: posting date and time
2026-05-13 23:47:38 +05:30
Pandiyan P
f9dec73042 fix(stock): add whole number quantity validation in Stock Reconciliation (#54922) 2026-05-13 20:11:34 +05:30
rohitwaghchaure
3c993377aa chore: fix linter issue 2026-05-13 18:50:09 +05:30
Nishka Gosalia
45f05fbeaa fix(UX): Buying settings form cleanup (#54731)
* fix(UX): Buying settings form cleanup

* fix: controller approach modification

* fix: dark mode support
2026-05-13 14:53:04 +05:30
Mihir Kandoi
cf5e8ce878 Revert "fix: debit credit not equal in purchase transactions for mult… (#54906)
* Revert "fix: debit credit not equal in purchase transactions for multi currency"

This reverts commit 75bcea57f4.

* Revert "test: add test case"

This reverts commit 1d30a202c3.

* Revert "fix: include rejected qty in tax (purchase receipt)"

This reverts commit 8c9a88abbe.
2026-05-13 08:57:52 +00:00
rohitwaghchaure
c740f77a6f chore: fixed test case 2026-05-13 14:05:55 +05:30
Rohit Waghchaure
fb6c05f186 fix: posting date and time 2026-05-13 13:16:00 +05:30
Pandiyan P
bc07b2d3e5 fix: add warehouse vaildation for repack entry (#54866) 2026-05-13 11:51:49 +05:30
Loïc Oberle
d80a52ae22 refactor(supplier): Using query builder for get_rfq_total_items (#54877)
Use the query builder for get_rfq_total_items to assure compatibility with PostgreSQL.
2026-05-12 17:22:23 +00:00
Loïc Oberle
d128fb92cf refactor(supplier): Using query builder for get_total_accepted_amount (#54873)
Use the query builder for get_total_accepted_amount to assure compatibility with PostgreSQL.
2026-05-12 17:14:30 +00:00
Loïc Oberle
66914ac2fc refactor(supplier): Using query builder for get_total_rejected_items (#54872)
Use the query builder for get_total_rejected_items to assure compatibility with PostgreSQL.
2026-05-12 22:37:04 +05:30
Loïc Oberle
20d6b54590 refactor(supplier): Using query builder for get_total_received_items (#54870)
Use the query builder for get_total_received_items to assure compatibility with PostgreSQL
2026-05-12 22:36:07 +05:30
Loïc Oberle
573e37a78d refactor(supplier): Using query builder for get_total_rejected_amount (#54871)
Use the query builder for get_total_rejected_amount to assure compatibility with PostgreSQL.
2026-05-12 22:35:47 +05:30
Loïc Oberle
7a292f9ea6 refactor(supplier): Using query builder for get_total received (#54868)
Use the query builder for get_total_received to assure compatibility with PostgreSQL.
2026-05-12 22:34:30 +05:30
Loïc Oberle
876d4bdb75 refactor(supplier): Using query builder for get_sq_total_number (#54878)
Use the query builder for get_sq_total_number to assure compatibility with PostgreSQL.
2026-05-12 22:33:24 +05:30
Loïc Oberle
24530fa349 refactor(supplier): Using query builder for get_total_shipments (#54875)
Use the query builder for get_total_shipments to assure compatibility with PostgreSQL.
2026-05-12 22:32:57 +05:30
Loïc Oberle
5b7f07ddb1 refactor(supplier): Using query builder for get_total_received_amount (#54869)
Use the query builder for get_total_received_amount to assure compatibility with PostgreSQL.
2026-05-12 22:32:34 +05:30
Loïc Oberle
1a4748759d refactor(supplier): Using query builder for get_total_accepted_items (#54874)
Use the query builder for get_total_accepted_items to assure compatibility with PostgreSQL.
2026-05-12 22:31:34 +05:30
Loïc Oberle
c8f91ac4db refactor(supplier): Using query builder for get_rfq_total_number (#54876)
Use the query builder for get_rfq_total_number to assure compatibility with PostgreSQL.
2026-05-12 22:30:49 +05:30
Loïc Oberle
1e7a265037 refactor(supplier): Using query builder for get_sq_total_items (#54879)
Use the query builder for get_sq_total_items to assure compatibility with PostgreSQL.
2026-05-12 22:30:21 +05:30
Loïc Oberle
1b9eaed4d2 refactor(supplier): Using query builder for get_rfq_response_days (#54880)
Use the query builder for get_rfq_response_days to assure compatibility with PostgreSQL.
2026-05-12 22:29:31 +05:30
Soham-ambibuzz
5560f6c270 feat: Added Philippines chart of account json file (#53918)
* feat: Added philipinnes chart of account json file

Signed-off-by: Soham-ambibuzz <soham.pawar@ambibuzz.com>

* feat: made changes as per review comments and corrected indentation

* feat: made changes as per review comments

* feat: made changes as per review comments to resolve the issues

* fix: fixed changes as per review comments

Signed-off-by: soham7117 <sohampawar626@gmail.com>

* fix: fixed changes as per review comments on bank group account

Signed-off-by: soham7117 <sohampawar626@gmail.com>

---------

Signed-off-by: Soham-ambibuzz <soham.pawar@ambibuzz.com>
Signed-off-by: soham7117 <sohampawar626@gmail.com>
Co-authored-by: soham7117 <sohampawar626@gmail.com>
2026-05-12 21:48:55 +05:30
diptanilsaha
9134db9cd3 fix: added permission validation for deactivate_sales_person (#54884) 2026-05-12 16:01:08 +00:00
MochaMind
6e349569c7 fix: sync translations from crowdin (#54810)
* fix: Swedish translations

* fix: Croatian translations

* fix: Bosnian translations

* fix: French translations

* fix: Arabic translations

* fix: Czech translations

* fix: Danish translations

* fix: German translations

* fix: Hungarian translations

* fix: Italian translations

* fix: Dutch translations

* fix: Polish translations

* fix: Portuguese translations

* fix: Russian translations

* fix: Slovenian translations

* fix: Serbian (Cyrillic) translations

* fix: Swedish translations

* fix: Turkish translations

* fix: Chinese Simplified translations

* fix: Vietnamese translations

* fix: Portuguese, Brazilian translations

* fix: Indonesian translations

* fix: Persian translations

* fix: Thai translations

* fix: Croatian translations

* fix: Burmese translations

* fix: Bosnian translations

* fix: Norwegian Bokmal translations

* fix: Serbian (Latin) translations

* fix: Spanish translations

* fix: Esperanto translations

* fix: Swedish translations

* fix: Croatian translations

* fix: Bosnian translations
2026-05-12 21:10:00 +05:30
Jaypal Lakum
3532c1cc69 fix(task): update depends_on for closing date and review date #54850 (#54852) 2026-05-12 09:53:42 +00:00
Mihir Kandoi
b5527cf328 fix: raw material should not have target warehouse in manufacture entry (#54849) 2026-05-12 14:56:59 +05:30
Nishka Gosalia
631958314f Merge pull request #54835 from nishkagosalia/st-67801
fix: rename supplier wise stock analytics report
2026-05-12 12:37:36 +05:30
Nikhil Kothari
422ff15be5 fix: remove wrapper for list items in error messages (#54848) 2026-05-12 05:52:39 +00:00
Loïc Oberle
1d5ef62452 refactor(supplier): use frappe orm for criteria retrieval (#54841)
replace raw SQL with frappe.get_all in get_criteria_list to leverage
the standard Frappe API. This improves code readability and follows
framework best practices.
2026-05-11 21:27:10 +05:30
Loïc Oberle
2e958de95b refactor(supplier): use frappe orm for database queries (#54842)
replace raw SQL with frappe orm to leverage the framework's native
capabilities. this improves code maintainability and adheres to frappe
best practices.
2026-05-11 21:24:28 +05:30
HemilSangani
bdf0136fc5 fix: add company filter to Budget Against dimension options 2026-05-11 18:58:57 +05:30
Loïc Oberle
0729c9a9cd refactor(material-request): replace raw SQL with Frappe Query Builder (#54836)
* refactor(material-request): replace raw SQL with Frappe Query Builder

Replace frappe.db.sql with frappe.qb in get_linked_material_requests
to improve readability and leverage the ORM's built-in SQL injection protection.

* removes unused import
2026-05-11 12:10:04 +00:00
Mihir Kandoi
95705f18aa fix: validate variant values (#54831) 2026-05-11 12:00:57 +00:00
nishkagosalia
85206e0278 fix: rename supplier wise stock analytics report 2026-05-11 16:24:57 +05:30
ruthra kumar
0f9cfeb2ef Merge pull request #54828 from ruthra-kumar/faster_payment_reconciliation_tests
refactor(test): speed up payment reconciliation tests
2026-05-11 14:09:45 +05:30
Jatin3128
dfbe847307 fix(general-ledger): show raw GL entries when categorize_by is empty (#54816) 2026-05-11 13:41:23 +05:30
ruthra kumar
f58242dca7 refactor(test): speed up payment reconciliation tests 2026-05-11 13:21:01 +05:30
Mihir Kandoi
23e9ad3fd9 fix: check if item is dropshipped before updating quantity (#54825) 2026-05-11 07:46:27 +00:00
Nikhil Kothari
f4008adc16 fix: UI/UX issues in new banking module (#54824)
* fix: enforce user permissions on bank account get_list

* feat: auto-select last used bank account

* fix: skeleton loaders in bank balance

* fix: show empty state for no bank transactions

* chore: add Stripe and PayPal logos

* fix: alignment of header text in list-view

* fix: wrap words in transaction description

* fix: change file-dropzone color on hover
2026-05-11 07:32:11 +00:00
Mihir Kandoi
03acbc3dc9 fix: do not rely on client side to update quantities during partial d… (#54804)
fix: do not rely on client side to update quantities during partial dropship
2026-05-11 06:17:54 +00:00
ruthra kumar
3deda25d21 Merge pull request #54783 from ruthra-kumar/prevent_editing_reversal_journals
fix: disallow editing on reversal journals
2026-05-11 10:08:18 +05:30
MochaMind
8c3739eb08 chore: update POT file (#54815) 2026-05-10 13:56:37 +02:00
Nikhil Kothari
346f080538 chore: update frappe-react-sdk (#54811) 2026-05-09 18:58:15 +00:00
dependabot[bot]
09d772f92e chore(deps): bump socket.io-parser from 4.2.5 to 4.2.6 in /banking (#54807)
Bumps [socket.io-parser](https://github.com/socketio/socket.io) from 4.2.5 to 4.2.6.
- [Release notes](https://github.com/socketio/socket.io/releases)
- [Changelog](https://github.com/socketio/socket.io/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io/compare/socket.io-parser@4.2.5...socket.io-parser@4.2.6)

---
updated-dependencies:
- dependency-name: socket.io-parser
  dependency-version: 4.2.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-09 18:35:33 +00:00
dependabot[bot]
4dfe532475 chore(deps): bump axios from 1.13.5 to 1.16.0 in /banking (#54806)
Bumps [axios](https://github.com/axios/axios) from 1.13.5 to 1.16.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.13.5...v1.16.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.16.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-09 18:12:04 +00:00
Nikhil Kothari
6de5367f12 feat: new banking module (#54720)
* feat: initial SPA setup for banking

* wip: bring over new banking module

* feat: added Espresso design tokens

* feat: button styles

* fix: add all ink colors

* wip: espresso design system changes

* feat: button and badge espresso components

* fix: button styling for reconcile

* feat: Espresso progress bar

* feat: Espresso toggle switch

* feat: Espresso tabs design

* fix: vertical tab support

* fix: button sizing across modals

* feat: Espresso style table layout

* feat: Espresso tooltip

* feat: Espresso elevations and checkbox

* feat: Dialog with Espresso styles

* feat: Espresso textarea

* fix: input styles

* fix: colors on bank picker

* fix: breadcrumb styling

* fix: bank picker styling

* feat: create doctypes and fields for bank reconciliation

* feat: APIs for banking

* fix: use date format parser

* fix: font styling to match Espresso

* wip: settings modal

* feat: settings dialog component

* fix: icons and invalid requests

* feat: preferences tab

* fix: adjust icon stroke width to 1.5

* feat: rule configuration in settings

* fix: remove sheet component

* feat: alert and error banner component

* feat: dropdown in Espresso

* feat: popover and select in Espresso

* fix: cleanup more styles

* fix: match size of link fields

* feat: command styling

* fix: remove unused style tokens

* fix: styles for global date picker dropdown

* fix: styles for match and reconcile

* feat: table Espresso component

* feat: remove all other design tokens

* fix: remove unused tokens

* fix: form elements

* fix: remove unused styles and fix filters in bank transaction list

* feat: fetch bank rec doctypes for filtering

* fix: record payment modal

* feat: support for dark mode switching

* fix: move bank logos to public folder

* feat: add support for RTL

* feat: support for RTL

* chore: send layout direction in dev boot

* fix: make checkbox work in RTL

* feat: dark mode support

* fix: dark mode style

* feat: bank logos in dark mode

* feat: dark mode bank logos

* chore: use dark mode bank logos everywhere

* chore: move rule evaluation to controller

* chore: add tests for bank transaction rules

* fix: move deps to fix actions errors

* fix: move tw-animate-css to deps

* fix: remove shadcn

* fix: do not open modal if no transactions selected

* fix: add translation strings

* feat: add banner on existing bank reconciliation tool

* feat: bank statement import

* fix: translations and layout directions

* fix: validation for transaction matching rule

* fix: styles

* fix: show conflicting transactions in alert

* fix: show help text for new banking module forms

* feat: show total debits and credits

* fix: dark mode colors in automatic config

* feat: add keyboard shortcuts help

* feat: added keyboard shortcut for settings

* fix: decrease size of progress bar

* chore: bump packages

* feat: add tests for statement import

* fix: settings dialog

* fix: show banner on small screens

* fix: show banner when no bank account set
2026-05-09 23:14:58 +05:30
MochaMind
332026fe5e fix: sync translations from crowdin (#54683) 2026-05-08 22:34:27 +02:00
Raffael Meyer
992800f3dd fix: implement get_notification_email hook on Opportunity, Prospect and Customer (#54789) 2026-05-08 22:32:38 +02:00
Mihir Kandoi
db74360396 feat: partial delivery in dropshipping (#54787) 2026-05-08 15:30:53 +00:00
Pandiyan P
0b6a372a52 fix(stock): ignore reserved qty for stock levels in batch (#54790) 2026-05-08 17:51:59 +05:30
Sakthivel Murugan S
a4a389bd41 fix(crm): handle empty _assign in appointment auto assignment (#54782) 2026-05-08 17:51:08 +05:30
Sudharsanan Ashok
4e850f31d5 fix(stock): priorities pick list parent warehouse (#54788) 2026-05-08 17:50:00 +05:30
Raffael Meyer
6f9f3d0a5c feat(Lead)!: send notifications to lead owner (#53959) 2026-05-08 12:40:23 +02:00
ruthra kumar
26ca7445eb fix: disallow editing on reversal journals 2026-05-08 12:27:32 +05:30
Khushi Rawat
ddc6d2c4e0 Merge pull request #53934 from Shllokkk/financial-statements-print-formats
feat: Financial Statements print format introduction
2026-05-08 12:05:24 +05:30
ruthra kumar
385835a167 Merge pull request #51723 from nlvegan/feat/payment-controller-v2-support
feat(payments): Add PaymentController v2 gateway support
2026-05-08 10:26:45 +05:30
Loïc Oberle
548e9a26db refactor(purchase-order): use ORM syntax for min order quantity query (#54778)
* refactor(purchase-order): use ORM syntax for min order quantity query

Use frappe.get_all instead of raw SQL with manual string formatting
to fetch min_order_qty. This improves code readability and leverages
the framework's built-in database abstraction.

* chore: fix formatting

* chore: fix formatting

* chore: fix formatting by adding a space
2026-05-07 20:35:45 +05:30
Loïc Oberle
d04aa4408d fix(stock): use case instead of if in get_reserved_qty for postgres (#54763)
Fixes get_reserved_qty on stock balance to use case instead of if to support postgresql
2026-05-07 11:02:28 +00:00
Loïc Oberle
bbb6d7c004 refactor(buying): replace raw sql with orm in supplier scorecard (#54771)
Use frappe.get_all instead of frappe.db.sql to fetch standings list.
2026-05-07 10:55:06 +00:00
Pandiyan P
0fc96e8f7d fix(stock): apply filters for rejected warehouse in pick list (#54733) 2026-05-07 15:58:57 +05:30
ruthra kumar
d4bf9ee0ec Merge pull request #54461 from Jatin3128/CL_pre_submit
feat: add pre-submit credit limit warning on save
2026-05-07 10:04:30 +05:30
Shllokkk
e82b4d9ca7 fix: add filter subtitle in print formats 2026-05-06 17:45:33 +05:30
ervishnucs
01e382b106 fix: normalize date comparison to avoid datatype mismatch 2026-05-06 17:08:27 +05:30
Mihir Kandoi
d5549e2f6c feat: stock reservation for product bundle (#54750)
* feat: stock reservation for product bundle

* test: add test case
2026-05-06 16:39:04 +05:30
Shllokkk
5858b14071 fix: styling in trial_balance.html and print format 2026-05-06 16:17:03 +05:30
Shllokkk
e8777a1e34 refactor: print templates for financial statements 2026-05-06 16:17:03 +05:30
Shllokkk
fa0a9085ca fix: minor text issues in print 2026-05-06 16:17:03 +05:30
Shllokkk
ac7e5271b0 feat: print format for report trial balance 2026-05-06 16:17:03 +05:30
Shllokkk
82cac9c40f feat: introduce print formats for financial statements 2026-05-06 16:17:03 +05:30
rohitwaghchaure
75804a364b Merge pull request #54757 from rohitwaghchaure/fixed-support-67550
fix: incorrect serial nos picked during disassemble
2026-05-06 15:06:45 +05:30
Rohit Waghchaure
25f7fa548d fix: incorrect serial nos picked during disassemble 2026-05-06 14:24:43 +05:30
Mihir Kandoi
28d9c2ca68 Revert "ci: auto merge backports" (#54754)
* Revert "ci: auto merge backports"

This reverts commit dfe1a5749a.

* revert: propogate label
2026-05-06 06:04:34 +00:00
Farouk Guerdelli
8efdab7e96 Revise CONTRIBUTING.md for clarity and formatting (#54739)
Updated the contributing guidelines for clarity and consistency. Improved language and formatting for better readability.
2026-05-06 05:33:26 +00:00
Mihir Kandoi
907a809f3f fix: incorrect validation thrown for drop shipped PI (#54751) 2026-05-06 05:30:14 +00:00
MochaMind
7028034cd6 chore: update POT file (#54709) 2026-05-05 21:28:05 +05:30
rohitwaghchaure
757923b482 Merge pull request #54723 from rohitwaghchaure/fixed-support-59821
fix: decimal issue in stock ageing report
2026-05-05 16:41:56 +05:30
Nishka Gosalia
2370d04b41 Merge pull request #54732 from nishkagosalia/st-67351 2026-05-05 16:20:50 +05:30
Sakthivel Murugan S
fb7f9a81d4 fix: hide payment and payment request buttons based on permissions in invoices and orders (#53920)
Co-authored-by: ravibharathi656 <ravibharathi656@gmail.com>
2026-05-05 11:46:12 +05:30
nishkagosalia
f86568b078 fix: Remove bom stock report link from manufacturing workspace 2026-05-05 11:18:05 +05:30
foppe
b9e40a42b8 test(payments): add tests for v2 gateway detection, tx_data, and contact/address handling 2026-05-04 21:49:49 +02:00
foppe
4f8cc1359b feat(payments): add PaymentController v2 gateway support
Add support for the new PaymentController interface from frappe/payments,
enabling Payment Request to work with v2 gateways while maintaining
backward compatibility with v1.

Related: frappe/payments#192
2026-05-04 21:49:48 +02:00
Mihir Kandoi
0cd0b8213d ci: Upgrade github-script action to version 8 (#54726) 2026-05-04 16:08:56 +00:00
Mihir Kandoi
2d3190effb fix: error when creating quotation from CRM (#54722) 2026-05-04 15:41:09 +00:00
Rohit Waghchaure
542eb6aca4 fix: decimal issue 2026-05-04 20:59:38 +05:30
Jatin3128
55619be732 feat: pre-submit validation error for packed quantity mismatch 2026-05-04 16:31:06 +05:30
Mihir Kandoi
a68769565b refactor: remove old subcontracting flow (#54717) 2026-05-04 14:06:59 +05:30
mergify[bot]
19234cafbe fix: accounts and account types in German CoA "SKR 03" (backport #54711) (#54712)
Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
2026-05-03 17:49:03 +00:00
Mihir Kandoi
09623d4c0c refactor: update_child_qty_rate function (#54706) 2026-05-02 23:58:58 +05:30
Mihir Kandoi
032a282f84 ci: auto merge backports (#54701)
* ci: auto merge backports

* ci: add github action to propogate auto-merge label
2026-05-02 17:11:39 +00:00
mergify[bot]
ca093177e0 fix: set valid_from in created Item Price (backport #54696) (#54699)
* fix: set valid_from in created Item Price (#54696)

Co-authored-by: Kaajal-Chhattani <kaajal.chhattani@aurigait.com>
(cherry picked from commit 6246a9aa6e)

# Conflicts:
#	erpnext/stock/get_item_details.py

* chore: resolve conflicts

---------

Co-authored-by: Kaajalchhattani <89331214+Kaajalchhattani@users.noreply.github.com>
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-05-02 16:29:16 +00:00
Kenneth Sequeira
ea3cf57042 fix: update frappe docker badge and link (#54702)
* fix: update frappe docker badge and link

* remove pwd link
2026-05-02 21:55:29 +05:30
rohitwaghchaure
06ffe52d6e Merge pull request #54681 from rohitwaghchaure/fixed-support-66529
fix: incorrect expense account book in purchase return
2026-05-01 08:12:31 +05:30
Raffael Meyer
c120cc7ed1 fix: add missing fields in set_currency_labels (#54689) 2026-05-01 03:54:14 +02:00
Raffael Meyer
25be38e23c fix: Backfill not_applicable on Item Tax Template Details for German companies (#54682) 2026-04-30 19:21:24 +00:00
Ahmed Reda Abukhatwa
7335011814 fix(profit-loss-report): handle zero base values and prevent null% display 2026-04-30 20:54:44 +03:00
Ahmed Reda Abukhatwa
671555edbc fix(profit-and-loss-statement): margin calculation the report showing null% for empty cell 2026-04-30 20:54:28 +03:00
Ahmed Reda Abukhatwa
df6fd782b7 fix(profit-and-loss-statement-report): margin calculation the report showing null% for empty cell 2026-04-30 20:54:07 +03:00
Rohit Waghchaure
2a720e7008 fix: incorrect expense account book in purchase return 2026-04-30 20:36:20 +05:30
Raffael Meyer
f38eca9124 fix: mark item tax templates as not applicable (#54673)
* fix: mark item tax templates as not applicable

For new German charts of accounts, mark accounts for different tax rates as *Not Applicable* in **Item Tax Templates**.

* fix: wrong applicable rate 19 in template 7
2026-04-30 11:44:08 +00:00
rohitwaghchaure
ad89f88c93 Merge pull request #54664 from rohitwaghchaure/fixed-support-66924
fix: show in and out qty in the stock ledger report for stock recos
2026-04-30 14:13:42 +05:30
Trusted Computer
78f654765d fix: correct titles set to {customer_name} or {supplier_name} text strings (#54656) 2026-04-30 10:28:14 +02:00
Hemil-Sangani
231dd1856f fix(project): use user.email for invitations and skip disabled users. (#54561)
* fix(project): use user.email for invitations and skip disabled users.

* Update erpnext/projects/doctype/project/project.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix(project): remove duplicate loop causing indentation error

* fix(project): resolve pre-commit hook failure

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-04-30 07:53:32 +00:00
Rohit Waghchaure
da081254a6 fix: show in and out qty in the stock ledger report for stock recos 2026-04-30 13:16:13 +05:30
Raffael Meyer
c543d15f3c feat: copy terms attachments to transactions (#53403) 2026-04-29 21:14:58 +00:00
Khushi Rawat
ddf0e35009 Merge pull request #54658 from khushi8112/skip-rescheduling-for-fully-depreciated-asset-sale
fix: skip depreciation rescheduling when asset is fully depreciated on sale
2026-04-30 02:34:10 +05:30
khushi8112
88b82383f5 fix: skip rescheduling only for asset being disposed 2026-04-30 02:11:57 +05:30
khushi8112
c4155b6c81 fix: skip depreciation rescheduling when asset is fully depreciated on sale 2026-04-30 02:01:57 +05:30
Ejaaz Khan
c933c2bd53 refactor: remove dead print format 2026-04-29 21:35:11 +05:30
Mihir Kandoi
a04c028522 fix: correct project filter in buying doctypes (#54644) 2026-04-29 11:27:47 +00:00
diptanilsaha
5c5a5361bc fix(payment_entry): convert the date args to string type before escaping in get_outstanding_reference_documents (#54639) 2026-04-29 16:38:57 +05:30
Mihir Kandoi
060defcc2b fix: dont show serial/batch button when PR is submitted (#54642) 2026-04-29 16:36:31 +05:30
Mihir Kandoi
d0d8cff48f fix: py error on sales forecast doctype (#54641)
fix: py error on sales forecase doctype
2026-04-29 10:49:05 +00:00
Nishka Gosalia
844f3dbc0b feat(ux): Naming series dialog (#54554) 2026-04-29 14:45:10 +05:30
Khushi Rawat
43937acd8b fix(UX): Item master form cleanup (#54538)
* fix: UI improvements for item form

* fix: add descriptions and tooltips to all checkboxes

* feat: show toast notification when item price is created

* fix: do not use selling rate for opening stock entry

* fix: add descriptions and tooltips to item default fields

* fix(test): give valuation rate for opening stock entry creation

* fix: moving naming series toggle before the return

* refactor: more changes in the form UI
2026-04-29 14:44:55 +05:30
Mihir Kandoi
503b5bf140 perf: max recursion depth error in serial no (#54629) 2026-04-29 08:34:08 +00:00
rohitwaghchaure
3542087003 Merge pull request #54567 from barredterra/sn-ledger-status
fix: show correct status in Serial No Ledger
2026-04-29 12:42:54 +05:30
Pandiyan P
d68801e73a fix(selling): blanket order ordered qty recalculation on sales order status change (#54593) 2026-04-29 11:57:40 +05:30
Nishka Gosalia
addec3aa8f Merge pull request #53295 from aerele/project-not-copied-from-first-item-row 2026-04-29 11:38:07 +05:30
MochaMind
b001884f9d fix: sync translations from crowdin (#54607) 2026-04-29 01:52:16 +05:30
Ravibharathi
d1a80d40c4 fix: avoid double reduction of pe reference outstanding (#54193)
Co-authored-by: diptanilsaha <diptanil@frappe.io>
2026-04-29 01:46:55 +05:30
Ravibharathi
a8030c9713 fix: filter overdue purchase order items by company (#54099) 2026-04-29 00:58:01 +05:30
Mihir Kandoi
54f20de7e3 fix: duplicate entries being shown in batch exists in future transact… (#54604)
fix: duplicate entries being shown in batch exists in future transactions msg
2026-04-28 16:28:53 +00:00
diptanilsaha
f8893b04d5 refactor(sms_center): replaced raw SQL queries with Query Builder (#54600) 2026-04-28 15:15:46 +00:00
Lakshit Jain
1bade56e37 Merge pull request #54362 from frappe/ignore-opening-check
fix: filter opening entries after closing voucher
2026-04-28 18:43:25 +05:30
Lakshit Jain
a2b96799ff Merge pull request #54517 from vorasmit/exclude-pcv
fix: always exclude pcv entries except for closing account head
2026-04-28 18:42:42 +05:30
Smit Vora
d0f0e38e8d Merge pull request #54479 from Abdeali099/cash-flow-fixes 2026-04-28 17:30:32 +05:30
Smit Vora
590f2ffe28 test: include both accounts to test sum = 0 2026-04-28 16:45:26 +05:30
diptanilsaha
084c7f72f0 fix(get_stock_balance): validate inventory dimension fieldnames (#54587) 2026-04-28 16:41:22 +05:30
Smit Vora
84aa54c540 test: pcv is excluded from PL accounts 2026-04-28 16:30:02 +05:30
Smit Vora
5fc3ca1d4b test: opening entries after period closing 2026-04-28 16:02:32 +05:30
diptanilsaha
d62fa3c464 fix(payment_entry): escape arguments on invoice and order fetching sql queries (#54582) 2026-04-28 15:55:45 +05:30
diptanilsaha
07337ba9da chore(sidebar): moved Inactive Customers from CRM to Selling Workspace Sidbar (#54578) 2026-04-28 09:31:51 +00:00
Mihir Kandoi
2088a01c19 fix: update status of quotation in patch (#54577) 2026-04-28 09:20:41 +00:00
ravibharathi656
68cc518497 fix: copy project to new item row from parent 2026-04-28 13:10:48 +05:30
Sudharsanan Ashok
6f9089dd5b fix(manufacturing): remove conversion factor for stock qty (#54525) 2026-04-28 10:45:54 +05:30
Vinay Mishra
63edd5ddc6 fix: negative quantity check in validate_item_qty (#54559)
Fix negative quantity check in validate_item_qty

When saving a Blanket Order with a blank qty field in the items table, the following error is raised:

TypeError: '<' not supported between instances of 'NoneType' and 'int'

Root cause: The validate_item_qty method compares d.qty < 0 directly. When the qty field is left empty, its value is None, and Python cannot compare None with an integer.

Fix
Wrap d.qty with flt(), which safely converts None (and any non-numeric value) to 0.0 before the comparison.

# Before
if d.qty < 0:

# After
if flt(d.qty) < 0:
2026-04-28 05:12:49 +00:00
barredterra
2b3e047143 fix: show correct status in Serial No Ledger 2026-04-27 21:41:38 +02:00
barredterra
cb2e6e1e2e refactor: extract SN status logic 2026-04-27 21:41:12 +02:00
MochaMind
37e3493ec4 fix: sync translations from crowdin (#54520) 2026-04-27 20:53:04 +02:00
Mihir Kandoi
601581d6f8 fix: debit credit not equal in purchase transactions for multi currency (#54456) 2026-04-27 20:30:41 +05:30
Sudharsanan11
8cf4402823 test(stock): add test to create pr for asset item without checking the stock account 2026-04-27 18:02:10 +05:30
Sudharsanan11
6fe08428c1 fix(stock): ignore fetching warehouse account for asset items 2026-04-27 18:02:06 +05:30
ruthra kumar
837cdc9cc3 Merge pull request #54509 from ruthra-kumar/hide_toggleable_fields
fix: hide feature flag controlled fields on install
2026-04-27 14:43:11 +05:30
Mihir Kandoi
5281d60f2d fix: correct display depends on condition (#54548) 2026-04-27 09:07:36 +00:00
Mihir Kandoi
0aadd1e3a5 fix: make inv dimen reqd only in delivery note (#54546) 2026-04-27 08:28:55 +00:00
Pandiyan P
60a6b38c31 fix(stock): remove validation for transfer_qty field (#54542) 2026-04-27 06:56:30 +00:00
Mihir Kandoi
be2a4b7b2a refactor: quality inspection item query (#54511) 2026-04-27 10:45:25 +05:30
MochaMind
5c839f60e4 chore: update POT file (#54536) 2026-04-26 18:55:27 +02:00
rohitwaghchaure
6e77a45c05 Merge pull request #54514 from aerele/fix/incoming-rate-issue
fix(stock): set incoming rate as zero for outward sle
2026-04-26 10:06:35 +05:30
rohitwaghchaure
2a6ddc7f67 Merge pull request #54530 from aerele/fix/support-#66029
fix(stock): show item code in serial and batch selector dialog
2026-04-26 10:04:41 +05:30
Sudharsanan11
fee5bcadb2 fix(stock): add stock entry in batch master connection 2026-04-26 00:05:19 +05:30
Sudharsanan11
f572bc51e1 fix(stock): show item code in serial and batch selector dialog 2026-04-26 00:05:19 +05:30
Nishka Gosalia
fba33b7e7a refactor(UX): selling settings form (#54412)
refactor(UX): Selling settings form cleanup
2026-04-25 15:27:32 +05:30
diptanilsaha
ebca389136 fix(PCV): set correct filters of from_date and to_date on General Ledger Report on clicking Ledger button (#54522) 2026-04-25 00:03:38 +05:30
Smit Vora
c94b8c41f3 chore: comment 2026-04-24 19:32:00 +05:30
mahsem
e517eeaaa2 feat: danish_bosnian_address_template (#54093) 2026-04-24 14:54:37 +02:00
Khushi Rawat
c3931d4e29 Merge pull request #53843 from Shllokkk/ap-print-format
feat: Accounts Payable print template revamp and print format introduction
2026-04-24 17:51:45 +05:30
Khushi Rawat
0b9fdcd8cd Merge pull request #53870 from Shllokkk/arap-summary-print-formats
feat: AR and AP summary reports print template revamp and print format introduction
2026-04-24 17:42:52 +05:30
Khushi Rawat
b4e941835b Merge pull request #53822 from Shllokkk/ar-print-format
feat: Accounts Receivable print template revamp and print format introduction
2026-04-24 17:41:13 +05:30
Khushi Rawat
9132f0fc4a Merge pull request #53762 from Shllokkk/gl-print-format
feat: General ledger print template revamp and print format introduction
2026-04-24 17:39:45 +05:30
Sudharsanan11
ce37530e70 fix(stock): set incoming rate as zero for outward sle 2026-04-24 17:29:13 +05:30
ruthra kumar
889fdf2f11 fix: hide feature flag controlled fields on install 2026-04-24 17:13:36 +05:30
Smit Vora
5518e8c99f Merge pull request #54480 from ljain112/fix-change-customer 2026-04-24 13:19:32 +05:30
Smit Vora
419b9b3279 Merge pull request #54476 from ljain112/fix-tds-threshhold
fix: ensure tax withholding entries respect date range of category
2026-04-24 13:18:25 +05:30
Khushi Rawat
a9e6f8efd8 Merge pull request #53314 from aerele/budget-validation-on-cancel
fix: skip budget validation when cancelling GL entries
2026-04-24 12:14:09 +05:30
Jatin3128
26d3a25d18 feat: add pre-submit credit limit warning on save 2026-04-24 05:05:43 +05:30
Mihir Kandoi
0e20e35842 fix: preserve inventory dimensions when raw materials are reset (#54440)
* fix: preserve inventory dimensions when raw materials are reset

* test: add test case
2026-04-23 17:16:12 +00:00
Raffael Meyer
b4107b8fd5 test(Code List): check content, not filename (#54490) 2026-04-23 15:40:22 +00:00
Raffael Meyer
a165b240a7 fix(edi): hardcode "Code List" DocType in importer (#54488) 2026-04-23 13:48:18 +00:00
Abdeali Chharchhodawala
f6639db0e9 feat: enhance account category with root type (#53190) 2026-04-23 17:34:37 +05:30
Abdeali Chharchhodawala
c35221852a feat: Add XLSX styling support to custom financial report templates (#52612) 2026-04-23 17:15:41 +05:30
Abdeali Chharchhoda
3854d2cbf6 chore: minor fix 2026-04-23 17:13:01 +05:30
Sudharsanan Ashok
ab19b16fe2 fix(stock): show available qty in warehouse link field (#54474) 2026-04-23 17:08:54 +05:30
Abdeali Chharchhoda
1fd6c3ba1a fix: update account identification to avoid using name_field in financial statements 2026-04-23 17:05:33 +05:30
Abdeali Chharchhoda
4274c2aba3 fix: add filter labels and required filters for financial report validation 2026-04-23 16:29:38 +05:30
Abdeali Chharchhoda
79d6a51e1e fix: update fiscal year filter to use mandatory_depends_on instead of reqd 2026-04-23 15:54:42 +05:30
ljain112
4eb9107e22 fix: update type hint for get_item_tax_template function 2026-04-23 15:50:03 +05:30
Abdeali Chharchhoda
5a915cb45e fix: ensure fiscal year is checked before validating date filters in financial statements 2026-04-23 15:43:20 +05:30
Smit Vora
b8c3765b85 Merge pull request #54449 from vorasmit/tds-reports-refactor
refactor: tax witholding report
2026-04-23 14:57:31 +05:30
ljain112
9ead8d4e3f fix: ensure tax withholding entries respect date range of category 2026-04-23 13:35:46 +05:30
Raffael Meyer
7f8fa7cf5e ci: test correctness pattern (#54186) 2026-04-22 22:00:42 +02:00
rohitwaghchaure
fd4cedf5e4 Merge pull request #54471 from rohitwaghchaure/fixed-delivery-schedule
fix: delivery schedule in the sales order
2026-04-22 22:02:15 +05:30
Rohit Waghchaure
435db260ee fix: delivery schedule in the sales order 2026-04-22 21:36:51 +05:30
Mihir Kandoi
f5357c233d fix: py error on stock ageing report (#54467) 2026-04-22 19:45:12 +05:30
diptanilsaha
0d2da6d86c ci: fix timezone for python mariadb tests (#54464) 2026-04-22 17:46:28 +05:30
Smit Vora
0349e7a0b8 fix: always exclude pcv entries except for closing account head 2026-04-22 16:09:42 +05:30
Smit Vora
7ae91cac01 fix: summing of values could be zero even if values exist 2026-04-22 13:27:36 +05:30
Smit Vora
b925469c4d fix: add party type for dynamic link support 2026-04-22 12:06:38 +05:30
Smit Vora
f0ea20e579 refactor: make report extensible by regional apps 2026-04-22 12:04:35 +05:30
ruthra kumar
3faeb1609b Merge pull request #54447 from ruthra-kumar/test_remove_raw_sql_delete_on_setup
refactor(test): remove explicit sql delete calls
2026-04-22 11:12:59 +05:30
ruthra kumar
b16dd3f2dd refactor(test): remove explicit sql delete calls 2026-04-22 10:33:25 +05:30
MochaMind
ffae7e42d3 fix: sync translations from crowdin (#54454) 2026-04-22 00:26:57 +05:30
Smit Vora
b5550f747e test: None is better than zero, as no values exist 2026-04-21 19:33:29 +05:30
Shllokkk
f6adef45bf Merge pull request #54307 from aerele/fix/populate_project_from_pe
fix(accounts): fetch project name from payment entry to journal entry
2026-04-21 18:57:45 +05:30
Smit Vora
07b023a934 refactor: updated key for withholding_date 2026-04-21 18:45:26 +05:30
Smit Vora
53666974a3 refactor: better label for entity type 2026-04-21 18:29:50 +05:30
Smit Vora
c3e7f7f02f refactor: how data is built 2026-04-21 18:04:02 +05:30
ruthra kumar
75a068aea8 Merge pull request #54446 from ruthra-kumar/wrong_type_hint_in_pos
fix: incorrect type hint
2026-04-21 17:56:01 +05:30
Smit Vora
6dca96b423 refactor: use consistent report column names 2026-04-21 17:28:56 +05:30
Smit Vora
f6eb844d20 Merge pull request #54422 from ljain112/fix-test-tds-report 2026-04-21 17:21:40 +05:30
Smit Vora
6d727c90b6 Merge pull request #54272 from ljain112/parrenttype 2026-04-21 17:20:56 +05:30
Smit Vora
d8fc9444ea Merge pull request #54344 from ljain112/project-filter-ar-ap 2026-04-21 17:15:37 +05:30
Mihir Kandoi
e65b9fc2ae fix: sales order is not valid when creating WO from MR from PP (#54435) 2026-04-21 09:47:02 +00:00
ruthra kumar
1995fcfdd8 fix: incorrect type hint 2026-04-21 13:57:12 +05:30
MochaMind
c2590c174d fix: sync translations from crowdin (#54358) 2026-04-21 09:24:40 +05:30
diptanilsaha
11fc3e5495 refactor: Sales Partner Commission Summary and Sales Partner Transaction Summary report (#54268) 2026-04-21 03:12:22 +00:00
Khushi Rawat
0edee23e53 Merge pull request #54131 from khushi8112/journal-entry-custom-remark-toggle
feat: use single remark field with custom remark toggle
2026-04-21 00:45:46 +05:30
Ravibharathi
f9232b209c Merge pull request #54415 from aerele/fix/clear-condions-table
fix: clear conditions table when calculate_based_on is set to Fixed
2026-04-20 19:22:25 +05:30
ravibharathi656
d6bb0ae093 fix: clear shipping rule conditions for fixed shipping rule 2026-04-20 19:01:37 +05:30
sarathibalamurugan
d73920be12 fix: clear conditions table when calculate_based_on is set to Fixed 2026-04-20 19:01:37 +05:30
ljain112
6545bcbbd9 refactor: fix test cases in tax withholding details report 2026-04-20 18:15:10 +05:30
Nihantra C. Patel
bc8f63b6dd Merge pull request #54419 from Nihantra-Patel/fix-default-letterhead-report-validation
fix: set letter_head_for letterhead and remove unknown letterhead from report
2026-04-20 17:25:51 +05:30
diptanilsaha
f4e77f63dd test(BootStrapTestData): create sales_partner test data while bootstrapping (#54416) 2026-04-20 11:41:02 +00:00
Nihantra Patel
a2ec597e3d fix: set letter_head_for for letterhead 2026-04-20 16:58:35 +05:30
diptanilsaha
6c51e4cd1f fix(pos_invoice_item): fetch grant_commission from item_code (#54413) 2026-04-20 11:21:10 +00:00
rohitwaghchaure
f89448709f Merge pull request #54350 from rohitwaghchaure/feat-backflush-based-on-in-bom
feat: backflush based on in BOM
2026-04-20 16:36:36 +05:30
Rohit Waghchaure
877d99c5a5 feat: backflush based on in BOM 2026-04-20 16:02:18 +05:30
ruthra kumar
1614d33e5c Merge pull request #54406 from ruthra-kumar/remove_dead_test_code
refactor(test): move contact and address creation to bootstrap
2026-04-20 14:16:04 +05:30
ruthra kumar
336be9d820 refactor(test): set instance variables before calling utility method 2026-04-20 13:53:03 +05:30
rohitwaghchaure
742c5f1822 Merge pull request #53708 from aerele/fetch_item_tax_template
fix: fetch get_item_tax_template while update items
2026-04-20 12:17:22 +05:30
rohitwaghchaure
0a8c195ab9 Merge pull request #54378 from rohitwaghchaure/exclude-group-warehouse
fix: exclude group warehouse in the report
2026-04-20 11:38:21 +05:30
Deepesh Garg
53d7c9fd9c Merge pull request #53756 from iamkhanraheel/fix/hr-default_role_permission
fix(hrms): default permission for HR roles
2026-04-20 11:20:12 +05:30
ruthra kumar
7f021fb705 refactor(test): move create_test_contact_and_address to bootstrap 2026-04-20 11:07:20 +05:30
ruthra kumar
e2b554e151 chore(test): remove dead test code 2026-04-20 10:37:31 +05:30
MochaMind
c1a469478d chore: update POT file (#54402) 2026-04-19 14:02:58 +02:00
Ahmed AbuKhatwa
d61b5fd5f6 fix(dashboard-trends): set default fiscal year and company before val… (#54339)
* fix(dashboard-trends): set default fiscal year and company before validating filters Ensure  and  are populated with default values

* fix(dashboard-trends): ensure fiscal_year and company are properly set before validation to avoid empty filter issues

* Update erpnext/controllers/trends.py

---------

Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-04-19 08:10:44 +00:00
Mihir Kandoi
28f3429a54 fix: recalculate operating costs if workstation type is changed (#54390)
* fix: recalculate operating costs if workstation type is changed

* fix: do not overwrite op costs on every save
2026-04-19 07:43:48 +00:00
yasmine ben ismail
af98963fa8 fix(readme): correct HTML issues and improve accessibility (#54267)
- Fix invalid width attribute (80xp → 80px)
- Remove invalid nested <p> tag in centered header section
- Add missing alt attribute to hero image for accessibility
- Improve external link security by recommending rel="noopener noreferrer"
2026-04-19 07:40:00 +00:00
Jaganath-Tridots
82438d6c72 Fix : None handling in pricing rule free item quantity calculation (#54375)
* fix(pricing_rule): handle None qty in transaction_qty calculation

* Update erpnext/accounts/doctype/pricing_rule/utils.py

---------

Co-authored-by: Jagan <jagan@DESKTOP-HPDMQ06.localdomain>
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-04-19 07:39:39 +00:00
Ravibharathi
1c65cc1088 fix: validate south africa company in vat audit report (#54030)
* fix: validate south africa company in vat audit report

* fix: use qb to get invoice data

* fix: validate company region in south africa vat settings
2026-04-19 13:06:15 +05:30
Nishka Gosalia
23768ae0a5 fix: Disallow negative rates in Purchase invoice (#54254) 2026-04-19 12:55:05 +05:30
yasmine ben ismail
3d87f3c070 fix(contributing): fix typos, grammar, and inconsistent casing (#54384) 2026-04-19 07:18:12 +00:00
yasmine ben ismail
43e5dfc3ca Revise feature request template for clarity and structure (#54386)
* Revise feature request template for clarity and structure

- Updated `about` field to mention "enhancement"
- Fixed typo: "many many requests" → "many requests"
- Fixed typo: "urgent need to" → "urgent need of"
- Added "Before Submitting" checklist to reduce duplicate issues
- Improved problem statement placeholder with a role-based example
- Added Environment section for ERPNext and Frappe version info

* chore: fix case

---------

Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-04-19 07:17:22 +00:00
yasmine ben ismail
e6f17e0447 Fix typos and enhance phrasing in README (#54387)
Fixed typo: "80xp" → "80px" in logo image tag
- Fixed typo: "many many requests" → "many requests"
- Fixed capitalization: "Javascript" → "JavaScript"
- Fixed capitalization: "Learning and community" → "Learning and Community"
- Fixed capitalization: "Open-Source ERP system" → "Open-Source ERP System"
- Fixed capitalization: "Frappe user" → "Frappe user"
- Fixed broken documentation link to use consistent URL
- Added missing Oxford commas
- Added missing "the" before "create-site"
- Improved phrasing: "with peace of mind" → "reliably and securely"
- Improved phrasing: "ad-hoc activities" → "other daily operations"
- Improved phrasing: "already set up sandbox" → "pre-configured sandbox"
- Improved phrasing: "It takes care of" → "It handles"
2026-04-19 07:15:49 +00:00
Mihir Kandoi
d6b379b936 fix: use qty instead of stock qty dropship gross profit report (#54389) 2026-04-19 06:40:59 +00:00
Mihir Kandoi
40bcaa7bc3 fix: dropship logic should come above non stock logic in gross profit… (#54383)
fix: dropship logic should come above non stock logic in gross profit report
2026-04-18 16:16:26 +00:00
Rohit Waghchaure
31fe6a378c fix: exclude group warehouse in the report 2026-04-18 17:41:53 +05:30
Mihir Kandoi
3ef6c24f07 fix: zero valuation rate popup on SI (#54376) 2026-04-18 11:44:49 +00:00
Pandiyan P
b93f2350ee fix: fetch item tax template from item group when creating item (#54258) 2026-04-18 11:58:33 +05:30
Lakshit Jain
453fe376ab feat: add support for 'not applicable' tax in item tax templates (#50898)
* feat: add support for 'not applicable' tax in item tax templates

* refactor: remove unused imports

* fix: import NOT_APPLICABLE_TAX in get_item_tax_map function

* fix: add item wise tax details for not applicable taxes

* test: added test case for `not_applicable`

* fix: do not create item wise tax details for not applicable tax

* fix: ensure tax rate is set to 0 for not applicable tax rows

* refactor: changes as per review

* test: update selling settings

* test: correct settings

* fix: return both net and current tax amounts for not applicable tax
2026-04-18 11:34:36 +05:30
vorasmit
3c8a066484 fix: filter opening entries in first year in custom financial statement 2026-04-17 22:27:48 +05:30
rohitwaghchaure
b0fd152896 Merge pull request #54355 from aerele/fix/support-65791
fix(manufacturing): handle empty list in query builder
2026-04-17 21:21:29 +05:30
rohitwaghchaure
0359a3ed0b Merge pull request #54354 from rohitwaghchaure/fixed-negative-batch-report
fix: negative batch report showing same batch-warehouse multiple times
2026-04-17 21:10:47 +05:30
sarathibalamurugan
9eeb819106 test: add test for project name in exchange gain loss entry 2026-04-17 18:44:44 +05:30
sarathibalamurugan
d9b255b952 fix(accounts): fetch project name from payment entry to journal entry 2026-04-17 18:43:50 +05:30
Jatin3128
ba01d66c24 fix: changed qty validation from qty field to stock_qty (#54352) 2026-04-17 13:13:13 +00:00
Pandiyan37
9e5d94c1e6 fix(manufacturing): handle empty list in query builder 2026-04-17 18:26:34 +05:30
Rohit Waghchaure
700572980d fix: negative batch report showing same batch-warehouse multiple times 2026-04-17 18:21:57 +05:30
iamkhanraheel
2018a90ad8 fix: default company perms for HR manager 2026-04-17 17:13:51 +05:30
Nishka Gosalia
9ecbf57a84 Merge pull request #54074 from nishkagosalia/gh-53442 2026-04-17 16:09:44 +05:30
iamkhanraheel
d26cd69fe5 fix: remove unwanted perm for HR user role 2026-04-17 15:39:42 +05:30
MochaMind
be711eacde fix: sync translations from crowdin (#54334) 2026-04-17 11:49:12 +02:00
ljain112
0cad511136 test: add test with project not in payment entry 2026-04-17 15:18:57 +05:30
nishkagosalia
eb89903dec fix: Table row in dialog should not have delete row option 2026-04-17 15:16:40 +05:30
Nishka Gosalia
6ee4b46be0 Merge pull request #54345 from nishkagosalia/batch-form-cleanup 2026-04-17 15:13:57 +05:30
nishkagosalia
de747fe625 refactor(UX): Batch Form Cleanup 2026-04-17 14:31:42 +05:30
ljain112
d51dbf5254 fix: add project filter to accounts payable and receivable reports 2026-04-17 14:00:01 +05:30
rohitwaghchaure
f555183ab6 Merge pull request #54342 from rohitwaghchaure/fixed-reqd-fg_warehouse
fix: make Target Warehouse mandatory on UI for WO
2026-04-17 13:23:39 +05:30
Rohit Waghchaure
2a8267e10a fix: make Target Warehouse mandatory on UI 2026-04-17 13:17:06 +05:30
Mihir Kandoi
5f4641e55b fix: hide operations field in bom creator if phantom (#54336) 2026-04-16 15:36:14 +00:00
Mihir Kandoi
cac7a358dd feat: make fg phantom-able in bom creator (#54332) 2026-04-16 13:25:54 +00:00
ruthra kumar
ee50767e42 Merge pull request #54327 from ruthra-kumar/setup_default_for_repost_on_fresh_install
fix(test): missing repost allowed defaults
2026-04-16 16:02:18 +05:30
ruthra kumar
257865deb2 fix(test): missing repost allowed defaults 2026-04-16 15:36:15 +05:30
Mihir Kandoi
e04a2e6da2 refactor: add category field to uom (#54290) 2026-04-16 09:03:12 +00:00
Venkatesh
97efd51fb8 feat: add option to create production plan from sales order (#53662)
Co-authored-by: sudarsan2001 <frankel9675@gmail.com>
2026-04-16 13:49:28 +05:30
ruthra kumar
40012f6617 Merge pull request #54301 from ruthra-kumar/merge_repost_settings_to_accounts_settings
refactor(ux): merge repost settings to accounts settings
2026-04-16 12:08:50 +05:30
ruthra kumar
6a04c159ca refactor: delete redundent repost setting 2026-04-16 11:35:23 +05:30
ruthra kumar
940d3cfe0a refactor: limit reposting to only supported doctypes 2026-04-16 11:35:23 +05:30
ruthra kumar
ece85c770f refactor: remove redundant field from filter 2026-04-16 11:35:23 +05:30
ruthra kumar
3093409933 refactor(ux): better error message 2026-04-16 11:35:23 +05:30
ruthra kumar
b8207d5ed1 refactor(test): use new source for repost setting 2026-04-16 11:35:23 +05:30
ruthra kumar
d5c58277cb refactor: move allowed doctypes to accounts settings
- dropped 'allowed' field
2026-04-16 11:35:20 +05:30
ruthra kumar
ff2d536943 Merge pull request #54172 from Shllokkk/acc-dimension-fix
fix: move make_dimension_in_accounting_doctypes from after_insert to on_update
2026-04-16 11:05:51 +05:30
ruthra kumar
2f4bb23125 Merge pull request #52923 from aerele/fix/taxable-amount-conversion-rate
fix(taxes_and_totals): apply conversion_rate to taxable_amount in get_itemised_tax
2026-04-16 10:52:13 +05:30
Dharanidharan2813
2e577ed25b fix(taxes_and_totals): apply conversion_rate to taxable_amount in get_itemised_tax 2026-04-16 10:30:20 +05:30
MochaMind
2e1d426c78 fix: sync translations from crowdin (#54312) 2026-04-15 16:11:43 +00:00
NaviN
9e9c8a07a7 Merge pull request #54306 from aerele/fix/expand_details_in_customer_quick_entry
fix: non-collapsible in customer quick entry
2026-04-15 17:26:13 +05:30
PKSowmiya05
53e120269d fix: non-collapsible in customer quick entry 2026-04-15 17:17:51 +05:30
ruthra kumar
89ebf48544 refactor: merge reposting settings to accounts settings 2026-04-15 16:31:02 +05:30
ruthra kumar
4198dd643d refactor(company): don't force set service expense account on save (#54275) 2026-04-15 15:33:39 +05:30
Smit Vora
ab61a757e3 Merge pull request #54241 from ljain112/fix-rounded-total 2026-04-15 15:23:14 +05:30
ruthra kumar
299e141cee refactor(test): set dependant value in company master 2026-04-15 12:29:29 +05:30
Mihir Kandoi
af6974893b fix: add portal user ownership check to supplier quotation (#54298) 2026-04-15 11:21:08 +05:30
rohitwaghchaure
0969ec4186 Merge pull request #54279 from rohitwaghchaure/fixed-banner-for-serial-batch
fix: banner to enable serial / batch feature
2026-04-14 23:14:30 +05:30
Vishnu Priya Baskaran
ce2670b252 Revert "fix: sync paid and received amount" (#54238) 2026-04-14 22:16:00 +05:30
MochaMind
b083121421 fix: sync translations from crowdin (#54259) 2026-04-14 16:46:06 +02:00
iamkhanraheel
41103a0622 fix: default perm for HR manager & HR user 2026-04-14 18:30:41 +05:30
Rohit Waghchaure
08e8cc8575 fix: banner to enable serial / batch feature 2026-04-14 18:26:35 +05:30
Sudharsanan Ashok
b6b7e8e2f6 fix(stock): remove float precision to fix precision issue (#54284) 2026-04-14 16:42:17 +05:30
Mihir Kandoi
1cc2b159dd fix: handle multi uom conversion factor for manufacture entry (#54285) 2026-04-14 10:43:47 +00:00
Mihir Kandoi
5ff2ae5a83 fix: fetch correct expense account for operations in stock entry (#54278) 2026-04-14 09:55:07 +00:00
Mihir Kandoi
ea0d53e2f3 fix: add drop ship logic in gross profit report (#54220) 2026-04-14 09:29:01 +00:00
ruthra kumar
927f40b296 refactor(company): don't force set service expense account on save 2026-04-14 14:46:46 +05:30
Mihir Kandoi
f37bf62824 fix: wrong operation time calculation (#53796) 2026-04-14 14:42:02 +05:30
ljain112
3aeb7d6b01 fix(purchase_register): filter tax rows by parenttype in invoice tax map query 2026-04-14 12:31:10 +05:30
Raffael Meyer
8a72d7fafe fix(edi): restrict Code List imports to files and trusted backend URLs (#54137) 2026-04-13 21:44:24 +05:30
Sudharsanan Ashok
2f025272d7 fix(stock): update bin to zero when no previous sle exists (#54236) 2026-04-13 21:04:14 +05:30
rohitwaghchaure
488747eb5d Merge pull request #54257 from rohitwaghchaure/fixed-github-65007
fix: not able to submit the PO
2026-04-13 19:43:34 +05:30
Rohit Waghchaure
1e43c37452 fix: not able to submit the PO 2026-04-13 17:10:37 +05:30
ljain112
e2ac476587 chore: spelling mistake 2026-04-13 16:51:20 +05:30
Khushi Rawat
6c5788dfba Merge pull request #54190 from khushi8112/company-address-permission-check
fix: add permission validation when prompting company details for incomplete letterhead data
2026-04-13 15:24:04 +05:30
Nishka Gosalia
aa9d35b28a Merge pull request #54249 from nishkagosalia/gh-53595 2026-04-13 15:21:30 +05:30
khushi8112
84e5272f5d fix: append row level user remarks in gl map 2026-04-13 15:15:52 +05:30
khushi8112
697f521e14 feat: use single remark field with custom remark toggle 2026-04-13 15:15:45 +05:30
Khushi Rawat
c805324a99 Merge pull request #54244 from khushi8112/journal-entry-get-against-jv-sql-injection
fix: replace raw SQL with qb in get_against_jv to prevent SQL injection
2026-04-13 15:12:49 +05:30
nishkagosalia
3e2b40ad4a refactor(UX): Stock ledger serial and batch number fields 2026-04-13 14:47:22 +05:30
khushi8112
c133f7156d fix: replace raw SQL with qb in get_against_jv to prevent SQL injection 2026-04-13 14:47:21 +05:30
Sudarshan
a9bb3e2315 fix: make operation mandatory when any sub operation row is added (#54245) 2026-04-13 07:38:22 +00:00
Khushi Rawat
577a7591c7 Merge pull request #54176 from khushi8112/payment-entry-list-reconciliation-indicator
feat: show reconciled/unreconciled indicator in list view
2026-04-13 12:13:23 +05:30
ljain112
f8d278b733 fix: reset base_rounded_total when rounded_total resets 2026-04-13 11:48:08 +05:30
ruthra kumar
451e4fbb21 Merge pull request #54237 from ruthra-kumar/bold_group_accounts
refactor: boldface for group accounts in financial statements
2026-04-13 11:40:23 +05:30
ruthra kumar
545e9e069a refactor: boldface for group accounts in financial statements 2026-04-13 11:16:49 +05:30
MochaMind
3617a9b674 fix: sync translations from crowdin (#54234) 2026-04-12 19:11:36 +02:00
MochaMind
39d93f35e0 chore: update POT file (#54228) 2026-04-12 10:12:49 +00:00
Shllokkk
44e0b36093 fix: minor changes in print templates 2026-04-12 13:14:24 +05:30
Shllokkk
915fcc0166 fix: minor changes in print template 2026-04-12 13:07:41 +05:30
Shllokkk
e3019c827c fix: minor changes in print template 2026-04-12 13:00:51 +05:30
MochaMind
a76336e3d9 fix: sync translations from crowdin (#54181) 2026-04-11 21:07:20 +02:00
Shllokkk
e8d08df044 fix: changes to gl print template 2026-04-11 23:06:01 +05:30
mgicking-bmi
3e5d18c5c4 Fix(selling): enable selling_settings creation through fixtures (#54177) 2026-04-11 05:12:00 +00:00
Mihir Kandoi
2f5fa3b207 fix: batch/serial should use parent's posting datetime for naming (#54206) 2026-04-10 18:59:16 +00:00
Sambhav Saxena
1dcfd9174f Fix(bom): refetch the rate of item when 'source_from_supplier' is updated (#54187) 2026-04-10 18:12:13 +00:00
rohitwaghchaure
1e64f392bb Merge pull request #54182 from nishkagosalia/st-64901-2
fix: account change in warehouse
2026-04-10 19:41:14 +05:30
nishkagosalia
777d9161cc fix: account change in warehouse 2026-04-10 18:54:43 +05:30
Praveenkumar Dhanasekar
887d2a8379 fix: update return value in workstation list view indicator (#54198) 2026-04-10 16:49:05 +05:30
Mihir Kandoi
9cdfe74de6 fix: remove unneccessary function for serial no status updation (#54191) 2026-04-10 10:36:42 +00:00
Trusted Computer
bd9427623f refactor: bring back titles on sales transactions and make them optional and visible on purchase transactions (#52633)
* fix: correct wrong PO titles

* refactor: restore title fields to sales transaction doctypes

* refactor: change title fields to optional fields with no default in purchase transactional doctypes

* chore: re-save doctype definitions

- updates modified timestamps
- regenerates type hints

---------

Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
2026-04-10 13:09:32 +05:30
khushi8112
256a258b38 fix: add permission validation when prompting company details for incomplete letterhead data 2026-04-10 12:53:45 +05:30
iamkhanraheel
f02b3b6166 fix: default perm for HR manager & HR user 2026-04-09 19:15:45 +05:30
Mihir Kandoi
9bc5a30ea4 Revert "fix: update_nsm only in warehouse creation" (#54178) 2026-04-09 13:04:38 +00:00
khushi8112
a48a29410e fix: refresh after unreconcile 2026-04-09 18:05:39 +05:30
khushi8112
7eded60892 feat: show reconciled/unreconciled indicator in list view 2026-04-09 17:40:03 +05:30
Shllokkk
ee067e6015 fix: move make_dimension_in_accounting_doctypes from after_insert to on_update 2026-04-09 16:27:54 +05:30
Nishka Gosalia
b0e3fa3979 fix: update_nsm only in warehouse creation (#54165) 2026-04-09 10:27:22 +00:00
Khushi Rawat
514c86cf4b Merge pull request #54142 from khushi8112/blank-remarks-in-invoices
fix: Set remarks blank instead of No remarks in Sales/Purchase Invoices
2026-04-09 14:54:23 +05:30
khushi8112
56416d18d3 fix(test): Remove usage of No remark as remark in tests 2026-04-09 14:23:52 +05:30
rohitwaghchaure
90a1d32098 Merge pull request #54161 from rohitwaghchaure/fixed-posting-time-riv
fix: set default posting time in RIV
2026-04-09 13:55:44 +05:30
Rohit Waghchaure
a7ece65536 fix: set default posting time in RIV 2026-04-09 13:31:34 +05:30
Aarol D'Souza
f5dda90f26 Merge pull request #54129 from AarDG10/refactor-util-use
refactor: update reset password method name
2026-04-09 11:52:15 +05:30
mergify[bot]
f09001a25e Merge branch 'develop' into refactor-util-use 2026-04-09 05:58:56 +00:00
rohitwaghchaure
d7254bba47 Merge pull request #54132 from rohitwaghchaure/fixed-reposting-file-not-updating
fix: last SLE not updated in the file
2026-04-09 08:22:11 +05:30
Mihir Kandoi
71a17cfda9 fix: inventory dimension patch (#54147) 2026-04-09 02:26:35 +00:00
Mihir Kandoi
7f0751539b fix: inventory dimension patch (#54141) 2026-04-09 01:45:48 +00:00
Nishka Gosalia
7ef48a966a feat: Allowing operation level quality inspection check in BOM (#53859)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-04-09 01:41:45 +00:00
khushi8112
2515bf3aff fix: Set remarks blank instead of No remarks in Sales/Purchase Invoices 2026-04-09 01:54:35 +05:30
diptanilsaha
d15cd08e72 refactor(lost_opportunity_report): replaced raw_sql with query builder (#54136) 2026-04-08 23:38:43 +05:30
Rohit Waghchaure
38ed425ee2 fix: last SLE not updated in the file 2026-04-08 20:43:23 +05:30
NaviN
ef454822d7 fix(sales invoice): toggle Get Items From button based on is_return and POS view (#52594) 2026-04-08 20:42:58 +05:30
Mihir Kandoi
6e44b8913e fix: inventory dimensions should not be mandatory unnecesarily (#54064) 2026-04-08 19:09:56 +05:30
Sudharsanan Ashok
9d16d06504 fix(manufacturing): check remaining qty to calculate operating cost (#53983) 2026-04-08 17:20:49 +05:30
Nishka Gosalia
31319cb6ee fix: quality inspection item code fetch perm issue (#54121)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-04-08 17:20:09 +05:30
AarDG10
c4d74483e1 refactor: update reset password method name 2026-04-08 17:19:43 +05:30
Sudharsanan Ashok
086122f650 fix(stock): ignore delivery note on delivery trip on_cancel trigger (#54120) 2026-04-08 16:36:02 +05:30
rohitwaghchaure
f9e2696745 Merge pull request #54102 from rohitwaghchaure/fixed-precision-issue
fix: hardcoded precision causing decimal issues
2026-04-08 12:19:21 +05:30
Khushi Rawat
f183885829 Merge pull request #54103 from aerele/asset-movement-field-state-after-save
fix: preserve asset movement field properties after save
2026-04-08 11:57:19 +05:30
MochaMind
eb04706fee fix: sync translations from crowdin (#54105) 2026-04-07 23:12:50 +05:30
Abdeali Chharchhodawala
76a7781283 refactor: financial report template enhancements (#52687) 2026-04-07 22:18:31 +05:30
Ahmed AbuKhatwa
89560d4691 fix(promotional_scheme): toggle enable state between Buying and Selli… (#54110)
Co-authored-by: AhmedAbukhatwa <Ahmedabukhatwa1@gmail.com>
2026-04-07 21:52:24 +05:30
Rohit Waghchaure
90fd6f2e40 fix: hardcoded precision causing decimal issues 2026-04-07 19:48:18 +05:30
Vishnu Priya Baskaran
edba5f3a06 fix: sync paid and received amount (#53039) 2026-04-07 18:33:31 +05:30
mergify[bot]
6da5dff26c fix: skip validate_stock_accounts in Journal Entry when perpetual inventory is disabled (backport #53554) (backport #53558) (#54104)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Saeed Kola <mohammedsaeedk@gmail.com>
Co-authored-by: diptanilsaha <diptanil@frappe.io>
2026-04-07 12:28:41 +00:00
ravibharathi656
4a004a2a82 fix: preserve asset movement field properties after save 2026-04-07 16:54:44 +05:30
Smit Vora
187542bfa5 Merge pull request #53964 from vorasmit/disassembly-by-se 2026-04-07 14:17:16 +05:30
Smit Vora
98dfd64f63 fix: remove unnecessary param, and use value from self 2026-04-07 13:17:22 +05:30
Shllokkk
4228885f1e fix: minor bug fixes for ar print template 2026-04-07 13:01:18 +05:30
Shllokkk
e6a32a9d02 feat: introduce print format for Accounts Receivable report 2026-04-07 13:01:18 +05:30
Shllokkk
ffc59ebc9c fix: improve design and refactor ar print template 2026-04-07 13:01:18 +05:30
Khushi Rawat
b4be235bbf Merge pull request #53394 from aerele/fix-asset-filter
fix: remove null from link_filters
2026-04-07 12:29:44 +05:30
Sakthivel Murugan S
00c94afa78 fix: task gantt popup text not visible in light theme (#53882) 2026-04-07 12:08:52 +05:30
Mihir Kandoi
17853931d6 fix: divide sub-assembly cost by qty to get per-unit rate in BOM Creator (#54090)
Co-authored-by: Ravindu Gajanayaka <ravindu2012@users.noreply.github.com>
2026-04-07 05:33:05 +00:00
Smit Vora
f13d37fbf9 test: enhance tests as per review comments 2026-04-07 10:54:34 +05:30
Smit Vora
b892139342 test: maintain sufficient stock for scrap item 2026-04-07 10:27:41 +05:30
Smit Vora
ab1fc22431 fix: set bom details on disassembly; abs batch qty 2026-04-07 10:00:30 +05:30
Smit Vora
93ad48bc1b fix: process loss with bom path disassembly 2026-04-07 09:59:54 +05:30
Amine
13cc07237e docs: fix typo, grammar and numbering in README.md (#54008) 2026-04-07 09:41:16 +05:30
mahsem
4282b9c68a fix: dif_inward_from_outward_workspace_sidebar (#54083) 2026-04-07 09:26:23 +05:30
Lakshit Jain
6d11a08cdd fix: add tax_id handling in Tax Withholding Entry (#53598)
* fix: add tax_id handling in Tax Withholding Entry

* fix: update get_tax_id_for_party to handle absence of tax_id in payment and journal entries

* fix: refactor tax_id handling in Tax Withholding Entry and Details

* test: correct function address
2026-04-06 22:27:32 +05:30
Nishka Gosalia
66780543bd fix: transactions where update stock is 0 should not create SLEs (#54035) 2026-04-06 20:25:51 +05:30
Smit Vora
ea392b2009 fix: validate work order consistency in stock entry 2026-04-06 20:08:38 +05:30
MochaMind
80272de0df fix: sync translations from crowdin (#53955) 2026-04-06 13:07:08 +00:00
Smit Vora
54342539c3 Merge pull request #53973 from vorasmit/persist-toggle 2026-04-06 17:26:19 +05:30
rohitwaghchaure
eebc0d2ad3 Merge pull request #54050 from rohitwaghchaure/fixed-github-51874
fix: GL entries for different exchange rate in the purchase invoice
2026-04-06 17:21:50 +05:30
Amine
fa814c0b71 fix: fix formatting and missing bullet point in TRADEMARK_POLICY.md (#54054) 2026-04-06 17:13:04 +05:30
Amine
83235b90d7 fix: fix incorrect issue link numbers in sponsors.md (#54055) 2026-04-06 17:12:26 +05:30
Mihir Kandoi
9b60d8e711 fix: remove title field from purchase receipt (#54051) 2026-04-06 17:09:00 +05:30
Rohit Waghchaure
a953709640 fix: GL entries for different exchange rate in the purchase invoice 2026-04-06 17:00:02 +05:30
Khushi Rawat
adea316dd2 Merge pull request #54052 from khushi8112/add-print-hide-to-fields
fix: print hide unnecessary fields
2026-04-06 16:13:26 +05:30
Deepesh Garg
77578e41e5 Merge pull request #54033 from krishna-254/fix-user-permission-error-on-status-change
fix: resolve user permission error on status change by updating user …
2026-04-06 15:49:47 +05:30
mahsem
1e90b9a148 feat: croatian_address_template (#53888) 2026-04-06 15:41:23 +05:30
Krishna Shirsath
c6695b613c fix: resolve user permission error on status change by updating user enabled status directly 2026-04-06 15:27:39 +05:30
khushi8112
8f83616b60 fix: print hide unnecessary fields 2026-04-06 14:35:15 +05:30
Sagar Vora
99da4f5147 Merge pull request #54042 from sagarvora/fix/discount-amount-validation-on-save
fix: skip discount amount validation when not saving
2026-04-06 13:00:22 +05:30
Sagar Vora
135cb5fd67 test: add test for discount amount on partial purchase receipt
Co-authored-by: ravibharathi656 <131471282+ravibharathi656@users.noreply.github.com>
2026-04-06 12:38:46 +05:30
Sagar Vora
0975583388 fix: skip discount amount validation when not saving 2026-04-06 12:33:49 +05:30
Gajendra Nishad
b9ef061911 fix: show current stock qty in Stock Entry PDF (#53761) 2026-04-06 10:50:13 +05:30
Amine
7a2759b2f0 fix: fix typos, grammar and numbering in CONTRIBUTING.md (#54027) 2026-04-06 04:25:24 +00:00
rohitwaghchaure
ccd017c737 Merge pull request #54004 from rohitwaghchaure/fixed-do-not-repost-gl
fix: do not repost GL if no change in valuation
2026-04-06 09:07:29 +05:30
Rohit Waghchaure
bb53cce228 fix: do not repost GL if no change in valuation 2026-04-05 22:54:51 +05:30
Vishnu Priya Baskaran
9417f55b7d fix: update min date based on transaction_date (#53803) 2026-04-05 20:59:13 +05:30
MochaMind
eca3ec114c chore: update POT file (#54018) 2026-04-05 15:59:23 +02:00
rohitwaghchaure
92dc95570d Merge pull request #54005 from rohitwaghchaure/fixed-github-53991
fix: screen freezes if consumed qty set in SCR
2026-04-05 13:19:49 +05:30
Pandiyan P
74b11710cc fix(manufacturing): handle null cur_dialog in BOM work order dialog (#54011) 2026-04-05 12:47:18 +05:30
ervishnucs
ad22256b2d fix: resolve item tax template from item group in update items 2026-04-05 11:16:37 +05:30
Rohit Waghchaure
dd7be2b370 fix: screen freezes if consumed qty set in SCR 2026-04-04 13:25:43 +05:30
rohitwaghchaure
f322dc9d69 Merge pull request #53994 from aerele/fix/update-sabe-stock-queue
fix(stock): update stock queue in SABE for return entries
2026-04-04 12:51:34 +05:30
kavin-114
e537896df8 test(stock): add unit test to update stock queue for return 2026-04-03 17:37:19 +05:30
kavin-114
0af8077bcc fix(stock): update stock queue in SABE for return entries 2026-04-03 17:37:05 +05:30
vorasmit
a71e8bb116 fix: use get_value 2026-04-03 16:19:43 +05:30
Mihir Kandoi
efd716e53d fix: remove reference in serial/batch when document is cancelled (#53979) 2026-04-02 07:51:20 +00:00
vorasmit
71fd18bdf9 fix: avg stock entries for disassembly from WO 2026-04-01 23:56:44 +05:30
vorasmit
3cf1ce8360 fix: manufacture entry with group_by support 2026-04-01 23:42:36 +05:30
Smit Vora
a6d41151ff test: disassembly for scrap / secondary item 2026-04-01 16:55:15 +05:30
Smit Vora
2be8313819 fix: handle disassembly for secondary / scrap items 2026-04-01 16:55:15 +05:30
Smit Vora
1693698fed test: disassembly of items with batch and serial numbers 2026-04-01 16:55:15 +05:30
Smit Vora
d32977e3a9 test: additional items in stock entry considered with disassembly 2026-04-01 16:55:15 +05:30
Smit Vora
6988e2cbbc test: disassemble with source stock entry reference 2026-04-01 16:55:15 +05:30
Smit Vora
342a14d340 test: disassembly from wo 2026-04-01 16:55:15 +05:30
Smit Vora
13b019ab8e fix: set serial and batch from source stock entry - on disassemble 2026-04-01 16:55:15 +05:30
Smit Vora
d3d6b5c660 fix: correct warehouse preference for disassemble 2026-04-01 16:55:15 +05:30
Smit Vora
2e4e8bcaa7 fix: auto-set source_stock_entry 2026-04-01 16:55:15 +05:30
Smit Vora
1ed0124ad7 fix: add support to fetch items based on manufacture stock entry; fix how it's done from work order 2026-04-01 16:55:15 +05:30
Smit Vora
6394dead72 fix: validate qty that can be disassembled from source stock entry. 2026-04-01 16:55:15 +05:30
Smit Vora
dba82720b6 fix: support creating disassembly (without link of WO) 2026-04-01 16:55:15 +05:30
Smit Vora
b64f86148c fix: custom button to disassemble manufactured stock entry with work order 2026-04-01 16:55:15 +05:30
Smit Vora
b47dfacb3e fix: set_query for source stock entry 2026-04-01 16:55:15 +05:30
Smit Vora
68e97808c5 fix: disassembly prompt with source stock entry field 2026-04-01 16:55:14 +05:30
Smit Vora
d4baa9a74a fix: create source_stock_entry to refer to original manufacturing entry 2026-04-01 16:55:13 +05:30
rohitwaghchaure
7846548a1b Merge pull request #53963 from rohitwaghchaure/fixed-github-53743
fix: hide fields related to track Semi-Finished Goods if feature has disabled
2026-04-01 16:37:13 +05:30
Shllokkk
86ee9959a2 fix: minor bugs in print templates 2026-04-01 12:32:15 +05:30
Rohit Waghchaure
399faf0ced fix: hide fields related to track Semi-Finished Goods if feature has disabled 2026-04-01 12:05:41 +05:30
Smit Vora
da778edf48 fix(ux): refresh grid to correctly persist the state of fields 2026-04-01 08:43:56 +05:30
Shllokkk
fbe5d128a8 feat: sticky column in various reports (#53960)
Co-authored-by: diptanilsaha <diptanil@frappe.io>
Co-authored-by: mihir-kandoi <kandoimihir@gmail.com>
2026-03-31 23:38:19 +05:30
Mihir Kandoi
d76ddf7271 fix: include rejected qty in tax (purchase receipt) (#53624) 2026-03-31 15:29:56 +00:00
Lakshit Jain
1e85d72127 Merge pull request #53961 from ljain112/fix-taxe-rounding
fix: ensure accurate rounding for item-wise tax and taxable amounts
2026-03-31 19:49:39 +05:30
Mihir Kandoi
ef18b5cd93 Revert "chore: initiate release twice in a week" (#53944) 2026-03-31 19:01:12 +05:30
Nishka Gosalia
7ff3dc0ac4 Merge pull request #53965 from nishkagosalia/gh-53962 2026-03-31 18:07:43 +05:30
nishkagosalia
e9e510a76e fix: Party Field only visibile when party type selected 2026-03-31 17:52:41 +05:30
ljain112
b73b161cbe test: improve test case 2026-03-31 17:46:46 +05:30
ljain112
9b37f2d95c fix: ensure accurate rounding for item-wise tax and taxable amounts 2026-03-31 17:23:01 +05:30
Khushi Rawat
f5bf95ca65 Merge pull request #53811 from khushi8112/customer-group-is-group-validation
fix: prevent selection of group type customer group in customer master
2026-03-31 16:46:25 +05:30
rohitwaghchaure
4013092271 Merge pull request #53953 from rohitwaghchaure/fixed-github-53597
fix: rejected serial no field showing even if serial / batch feature disabled
2026-03-31 16:11:12 +05:30
Rohit Waghchaure
c2f419ac3d fix: rejected serial no field showing even if serial / batch feature not enabled 2026-03-31 16:09:00 +05:30
Ejaaz Khan
eaa4f7bb55 Merge pull request #53949 from iamejaaz/sticky-erpnext-reports
feat: sticky columns in reports
2026-03-31 16:04:31 +05:30
khushi8112
75fa2b2277 fix(test): do not use is_group enabled customer group in test 2026-03-31 15:42:08 +05:30
Ejaaz Khan
df753676c6 fix: semgrep translation issue 2026-03-31 15:34:46 +05:30
Ejaaz Khan
03e4df7a1a feat: sticky columns in reports
Co-authored-by: diptanilsaha <diptanil@frappe.io>
2026-03-31 15:12:58 +05:30
Mihir Kandoi
f1529a05b2 fix: do not show inv dimension unnecessarily in stock entry (#53946) 2026-03-31 09:42:21 +00:00
ruthra kumar
f452ad3ce2 Merge pull request #53795 from ruthra-kumar/use_erpnext_testsuite_across_repo
refactor(test): enforce ERPNextTestSuite across repo
2026-03-31 15:01:58 +05:30
khushi8112
6068dc959f fix: prevent selection of group type customer group in customer master 2026-03-31 14:40:59 +05:30
Khushi Rawat
dce5e46599 Merge pull request #53939 from khushi8112/ux-improvement-for-opening-invoice-tool
fix: dynamic labels on invoice type change
2026-03-31 12:06:45 +05:30
Nishka Gosalia
0696bd2082 chore: remove inter warehouse transfer settings (#53860) 2026-03-31 11:13:26 +05:30
khushi8112
820bd15e1e fix: dynamic labels on invoice type change 2026-03-31 01:53:28 +05:30
MochaMind
e7614e2290 fix: sync translations from crowdin (#53864) 2026-03-30 18:11:38 +00:00
Ankush Menat
f97877a60a fix(UX): Store weekly off at the end of holiday list (#53833)
Perhaps these two should be stored separately too?
2026-03-30 21:28:40 +05:30
Smit Vora
28ac0effff Merge pull request #53925 from ljain112/fix-item-tax-rounding 2026-03-30 20:46:21 +05:30
ljain112
fc8437c499 test: update item-wise tax detail test for high conversion rates 2026-03-30 20:04:53 +05:30
Smit Vora
a9edd3f132 Merge pull request #53406 from ljain112/fix-item-valaution-deduct 2026-03-30 19:53:55 +05:30
Smit Vora
a18196f584 fix(taxes): improve tax calculation accuracy and update test assertions 2026-03-30 19:37:59 +05:30
diptanilsaha
7d7a1efadb fix(bank_account): added validation to fetch bank account details using get_bank_account_details (#53926) 2026-03-30 18:51:27 +05:30
ljain112
3449ab063a fix(tests): update item code and quantity in tax detail test case 2026-03-30 18:37:07 +05:30
Jatin3128
d827ab3d2e Merge pull request #53922 from Jatin3128/toggle-ps
feat(Payment Request): Added a toggle for using the payment schedule
2026-03-30 18:28:30 +05:30
Jatin3128
8ec15b537e feat(Payment Request): Added a toggle for using the payment schedule 2026-03-30 18:05:42 +05:30
ljain112
7f87a5e5c6 fix(taxes): increase rounding threshold for tax breakup calculations 2026-03-30 17:58:47 +05:30
diptanilsaha
c41730dfee fix(opening_invoice_creation_tool): sanitize summary content for dashboard (#53917) 2026-03-30 17:52:27 +05:30
diptanilsaha
fa5238ba12 fix(item_dashboard): escaping warehouse, item_code, stock_uom and item_name on get_data (#53904) 2026-03-30 09:30:51 +00:00
rohitwaghchaure
b9f26a1f31 Merge pull request #53906 from rohitwaghchaure/fixed-support-63613
fix: purchase invoice missing item
2026-03-30 14:44:37 +05:30
diptanilsaha
eda64cbd4d fix(warehouse_capacity_dashboard): removed escape from template (#53907) 2026-03-30 09:01:34 +00:00
Rohit Waghchaure
af994c1a22 fix: purchase invoice missing item 2026-03-30 14:07:31 +05:30
rohitwaghchaure
91aaabdd31 Merge pull request #53902 from rohitwaghchaure/fixed-code-cleanup-reposting
fix: item-wh reposting, code cleanup
2026-03-30 14:01:07 +05:30
Rohit Waghchaure
e0ca34ae39 fix: item-wh reposting, code cleanup 2026-03-30 13:39:24 +05:30
diptanilsaha
ddeb9775ed fix(warehouse_capacity_dashboard): escaping warehouse, item_code and company on get_data (#53894) 2026-03-30 07:46:33 +00:00
Sudharsanan Ashok
ad25c6d163 fix(stock): add warehouse filter to pick work order raw materials (#53748) 2026-03-30 13:15:48 +05:30
rohitwaghchaure
71a1dda958 Merge pull request #53799 from aerele/fix/lcv-company-validation
fix(stock): update company validation for expense account in lcv
2026-03-30 13:03:36 +05:30
Sudharsanan11
875a2e4947 fix(test): enable perpetual inventory 2026-03-30 12:16:48 +05:30
Sudharsanan Ashok
d28474a450 fix(stock): ignore qty validation for pick list (#53871) 2026-03-30 06:37:26 +00:00
Sudharsanan Ashok
f3a794384a fix(manufacturing): update the qty precision (#53874) 2026-03-29 21:51:36 +05:30
ervishnucs
97e7916b66 fix: resolve item tax template from item group in update items 2026-03-29 21:35:26 +05:30
MochaMind
893eb8c77a chore: update POT file (#53876) 2026-03-29 14:56:50 +02:00
rohitwaghchaure
0e0a7f3563 Merge pull request #53878 from rohitwaghchaure/fixed-maintain-reposting-state
fix: maintain state during reposting
2026-03-29 16:12:48 +05:30
Rohit Waghchaure
f8738a791b fix: maintain state during reposting 2026-03-29 15:53:46 +05:30
Kaushal Shriwas
6badf00313 fix: change shipment parcel dimension fields from Int to Float (#53867) 2026-03-29 06:48:51 +00:00
Shllokkk
5bbcb73808 fix: revamp print formats for accounts receivable summary and accounts payable summary reports 2026-03-29 02:02:59 +05:30
diptanilsaha
998469d5c7 refactor: setup wizard stages and demo data creation (#53866) 2026-03-29 00:43:58 +05:30
rohitwaghchaure
5c95f3347b Merge pull request #53853 from rohitwaghchaure/fixed-reposting-dependent-sles
fix: corrected logic to retry reposting if timeout occurs after dependant SLE processing
2026-03-27 21:25:44 +05:30
Rohit Waghchaure
90b9ab0bc8 fix: corrected logic to retry reposting if timeout occurs after dependent SLE processing 2026-03-27 21:04:35 +05:30
Mihir Kandoi
935eea6463 fix: invalid dynamic link filter for address doctype (#53849) 2026-03-27 12:23:58 +00:00
Shllokkk
2bf9d41797 feat: add print format for accounts payable report 2026-03-27 16:03:20 +05:30
Mihir Kandoi
6008fa710d fix: validate if quantity greater than 0 in item dashboard (#53846) 2026-03-27 10:32:35 +00:00
ruthra kumar
47bb728f65 fix: sync translations from crowdin (#53841)
* fix: Italian translations

* fix: Swedish translations
2026-03-27 15:56:27 +05:30
MochaMind
aef6c959ea fix: Swedish translations 2026-03-27 14:12:13 +05:30
MochaMind
bddc7a3e4a fix: Italian translations 2026-03-27 14:11:56 +05:30
rohitwaghchaure
54c6948174 Merge pull request #53839 from rohitwaghchaure/fixed-job-card-timer-issue
fix: timer not showing in job card
2026-03-27 13:50:14 +05:30
ruthra kumar
e45af4345f Merge pull request #53837 from ruthra-kumar/semgrep_to_prevent_test_regression
ci: semgrep to prevent test regression
2026-03-27 13:41:47 +05:30
Rohit Waghchaure
58dbb3d638 fix: timer not showing in job card 2026-03-27 13:06:34 +05:30
ruthra kumar
be4496e4ab ci: semgrep to prevent test regression 2026-03-27 12:49:28 +05:30
Shllokkk
c051536182 refactor: revamp print template for accounts payable report 2026-03-27 12:32:17 +05:30
ruthra kumar
2aecf0103a refactor(test): remove AccountsTestMixin from Sales Order 2026-03-27 12:12:48 +05:30
rohitwaghchaure
e6cac26640 Merge pull request #53812 from rohitwaghchaure/fixed-pick-correct-dependent-sle
fix: pick correct dependant sle during reposting
2026-03-27 12:12:48 +05:30
ruthra kumar
d2ee967383 refactor(test): remove AccountsTestMixin from reactivity 2026-03-27 11:56:52 +05:30
ruthra kumar
0b6546ea06 refactor(test): remove AccountsTestMixin from distributed discount 2026-03-27 11:56:30 +05:30
Rohit Waghchaure
8e8ee56e64 fix: pick correct dependant sle during reposting 2026-03-27 11:50:34 +05:30
ruthra kumar
13505ddcfb test: fixed test case (backport #53826) (#53834)
test: fixed test case

(cherry picked from commit 10f58112ae)

Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
2026-03-27 11:47:12 +05:30
Nishka Gosalia
5d4ac95e7a Merge pull request #53704 from nishkagosalia/gh-53512-fixes 2026-03-27 11:38:52 +05:30
ruthra kumar
2b37d7514d refactor(test): move logic from AccountsTestMixin to ERPNextTestSuite 2026-03-27 11:20:11 +05:30
Rohit Waghchaure
8368feb9df test: fixed test case
(cherry picked from commit 10f58112ae)
2026-03-27 05:49:25 +00:00
nishkagosalia
3a78af7f42 fix: test case 2026-03-27 11:11:19 +05:30
nishkagosalia
3bedc6cf7e chore: Dropping bom stock report and bom stock calculated report 2026-03-27 11:11:18 +05:30
nishkagosalia
c1874cb7d5 fix: change in functionality 2026-03-27 11:11:18 +05:30
nishkagosalia
5d088350dc feat: Bom stock analysis report 2026-03-27 11:11:18 +05:30
ruthra kumar
f3148e052c refactor(test): erpnext testsuite should be primary superclass 2026-03-27 11:00:25 +05:30
Shllokkk
d987688058 fix: support translated search in get_party_type and refactor raw sql to qb 2026-03-27 10:49:34 +05:30
ruthra kumar
c283c1c472 Merge pull request #53074 from Jatin3128/subscription-section-hide
feat: add setting to hide Subscription references across doctypes
2026-03-27 10:37:59 +05:30
ruthra kumar
6566acbe23 Merge pull request #53429 from Shllokkk/deferred-rev-fix
feat(report): add service start/end date and amount with roll-ups in deferred revenue/expense report
2026-03-27 10:30:12 +05:30
ruthra kumar
d6755c3d14 Merge pull request #53343 from Shllokkk/email-campaign-fix
fix(email_campaign): prevent unsubscribing entire campaign when email group member unsubscribes
2026-03-27 10:26:49 +05:30
Shllokkk
0d4f56bf84 refactor: table body data rendering cleanup 2026-03-26 21:56:51 +05:30
Pandiyan P
5b1fa81451 fix(accounts): set supplier name as title field in Purchase Invoice (#53710)
fix(accounts): update title field in purchase order and purchase invoice
2026-03-26 19:00:10 +05:30
Mihir Kandoi
8164d195fc fix: flaky currency exchange test (#53813) 2026-03-26 12:23:55 +00:00
iamkhanraheel
5ec66169a7 fix: default permission for HR manager role 2026-03-26 17:23:54 +05:30
Shllokkk
9660debe28 fix: improve filter details render logic to avoid showing duplicate information 2026-03-26 16:18:51 +05:30
rohitwaghchaure
f382b30b4e Merge pull request #53216 from aerele/fix/legacy-recon-in-ageing
fix(stock): handle legacy single sle recon entries
2026-03-26 15:37:21 +05:30
rohitwaghchaure
15996952f6 Merge pull request #52152 from rohitwaghchaure/refactor-reposting-feature
Refactor reposting feature
2026-03-26 15:12:20 +05:30
Rohit Waghchaure
daa2420996 refactor: storing of current status of reposting 2026-03-26 14:49:39 +05:30
Krishna Pramod Shirsath
f37b6fde72 Merge pull request #53245 from krishna-254/feat/employee-milestone-indicators
feat: employee milestone indicators
2026-03-26 13:40:20 +05:30
Mihir Kandoi
afa66e4785 fix: keep from and to time blank until added explicitly (#53798) 2026-03-26 13:05:54 +05:30
Sudharsanan11
913168e8b6 fix(stock): update company validation for expense account in lcv 2026-03-26 12:56:59 +05:30
kavin-114
7e6bbcc3fb fix(stock): handle legacy single sle recon entries 2026-03-26 12:46:06 +05:30
Krishna Shirsath
9715637c80 Merge remote-tracking branch 'origin/develop' into feat/employee-milestone-indicators 2026-03-26 10:05:23 +05:30
Mihir Kandoi
3f74733942 fix: purchase invoice for internal transfers should not require PO (#53791) 2026-03-25 16:18:51 +00:00
diptanilsaha
e136bfbb61 fix(contract_template): restrict create, write and delete access only to System Manager (#53787) 2026-03-25 14:43:45 +00:00
MochaMind
00b780362b fix: sync translations from crowdin (#53475) 2026-03-25 11:47:01 +01:00
diptanilsaha
1d202fe739 Merge pull request #53779 from diptanilsaha/template_fixes 2026-03-25 14:56:36 +05:30
diptanilsaha
bc6561cdd0 fix(templates): using correct syntax of include in projects.html 2026-03-25 14:55:05 +05:30
diptanilsaha
d9760bbf4f fix(templates): escape attachment file_url and file_name in order.html and projects.html 2026-03-25 14:46:50 +05:30
Sudharsanan Ashok
a821c6669f fix(manufacturing): update condition for base hour rate calculation (#53753) 2026-03-25 11:37:38 +05:30
Pandiyan P
d43d308e2f fix(manufacturing): apply work order status filter in job card (#53766) 2026-03-25 11:20:04 +05:30
Mihir Kandoi
90cd957d6e fix: do not check for sub assembly reference for rm of fg (#53758) 2026-03-24 17:09:49 +00:00
iamkhanraheel
7b0bfe76cc fix: default permission for HR User role 2026-03-24 19:57:42 +05:30
ruthra kumar
14a46bf920 Merge pull request #53657 from ruthra-kumar/move_commits_inside_test_guard_clause
refactor(test): move remaining commits inside test guard
2026-03-24 17:43:17 +05:30
ruthra kumar
bc2b8da597 refactor(test): process statement of acc remove commit 2026-03-24 17:21:31 +05:30
ruthra kumar
fd2b76a4d2 refactor(test): move location creation to bootstrap in asset movement 2026-03-24 17:21:31 +05:30
ruthra kumar
8fd65d7afa refactor(test): make stock entry deterministic 2026-03-24 17:21:31 +05:30
ruthra kumar
2c53cf3902 refactor(test): make asset capitalization deterministic 2026-03-24 17:21:31 +05:30
ruthra kumar
d3cf8cb851 refactor(test): make ledger merge deterministic 2026-03-24 17:21:31 +05:30
ruthra kumar
77f41e120d refactor(test): SLA move company creation to bootstrap 2026-03-24 17:21:31 +05:30
ruthra kumar
426b7db3c8 refactor(test): move webform custom dt creation to boostrap 2026-03-24 17:21:31 +05:30
ruthra kumar
934740205a refactor(test): move custom doctype data setup to bootstrap 2026-03-24 17:21:31 +05:30
ruthra kumar
4454af8efd refactor(test): move tax category custom field creation to bootstrap 2026-03-24 17:21:31 +05:30
ruthra kumar
11fb00c21d refactor(test): move trial company creation to bootstrap 2026-03-24 17:21:31 +05:30
ruthra kumar
31ce09204f refactor(test): move purchase invoice dimension setup to bootstrap 2026-03-24 17:21:31 +05:30
Nishka Gosalia
6c354895d6 Merge pull request #53738 from nishkagosalia/item-form-cleanup 2026-03-24 16:28:10 +05:30
nishkagosalia
be55082751 refactor: item master ux improvements 2026-03-24 15:55:45 +05:30
ervishnucs
a518a735f3 fix: remove null from link_filters 2026-03-24 15:43:20 +05:30
Khushi Rawat
ec003342a0 Merge pull request #53588 from khushi8112/default-print-format-for-quotation
feat: default print format for Quotation
2026-03-24 15:36:34 +05:30
Shllokkk
3ba36212b0 refactor: clean and standardize print template for general ledger report 2026-03-24 15:32:13 +05:30
khushi8112
da41057cd6 fix: add quotation print format in the list 2026-03-24 13:03:24 +05:30
khushi8112
b9083411cc fix: remove unused print format 2026-03-24 12:17:42 +05:30
khushi8112
c99cec1071 fix: add closing div tab 2026-03-24 12:17:42 +05:30
khushi8112
4307cd5b1c feat: default print format for Quotation 2026-03-24 12:17:36 +05:30
ruthra kumar
9ed072ac83 refactor(test): move company setup to bootstrap 2026-03-24 11:57:45 +05:30
ruthra kumar
342ce65401 refactor(test): move dimension setup to test data bootstrap
and remove create_dimension() and disable_dimension()
2026-03-24 11:57:43 +05:30
ruthra kumar
ed76d6699a refactor(test): move commits inside test guard clause 2026-03-24 11:57:02 +05:30
ruthra kumar
cd5b0ea5fd Merge pull request #52802 from nabinhait/workspace-cleanup-1
fix: Removed quick access link from selling workspace
2026-03-24 11:30:53 +05:30
ruthra kumar
ae8068e833 Merge pull request #53302 from Shllokkk/xxs-xxe-fix
fix: sanitize genericode import inputs and secure XML parser
2026-03-24 11:27:15 +05:30
Nabin Hait
d7c48d645a fix: Removed quick access link from selling workspace 2026-03-24 11:11:56 +05:30
ruthra kumar
107fecd4b0 Merge pull request #53730 from khushi8112/asset-location-overwritten-by-accounting-dimension
fix: skip overwriting existing asset fields with accounting dimensions
2026-03-24 11:04:59 +05:30
khushi8112
2859a143f2 fix: skip overwriting existing asset fields with accounting dimensions 2026-03-24 02:19:44 +05:30
Khushi Rawat
bd9b0185f4 Merge pull request #53680 from khushi8112/better-opening-invoice-creation-tool
fix(UX): improve party selection UX with party name field
2026-03-24 01:35:54 +05:30
Khushi Rawat
0faa261729 Merge pull request #53646 from khushi8112/default-print-format-for-rfq
feat: default print format for Request for Quotation
2026-03-24 01:34:00 +05:30
Mihir Kandoi
91da450a31 chore: remove unused imports (#53722) 2026-03-23 16:39:55 +00:00
Pandiyan P
8ebc2e38ec fix(manufacturing): close work order status when stock reservation is… (#53714)
* fix(manufacturing): close work order status when stock reservation is enabled

* chore: better syntax

---------

Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-03-23 16:05:00 +00:00
diptanilsaha
96c79dfe8b chore(test_item_group): removed unused function _print_tree (#53716) 2026-03-23 15:50:01 +00:00
diptanilsaha
958bb6c619 chore: skip semgrep check for db.commit in BootStrapTestData (#53715) 2026-03-23 15:39:14 +00:00
Rohit Waghchaure
20787ef5da refactor: reposting for better peformance 2026-03-23 20:36:02 +05:30
Jatin3128
226aafa8cf feat: add setting to hide Subscription references across doctypes 2026-03-23 19:49:01 +05:30
ruthra kumar
30380851d8 Merge pull request #52285 from Jatin3128/payment_entry_ref
fix(Payment Entry): split orders as per the schedules in the reference table
2026-03-23 19:36:36 +05:30
Rucha Mahabal
248ea16d96 feat(employee): Create User button and form. (#52726)
* feat(employee): Create User button and form.

* feat(employee): Add automatic user creation feature and related validations. Create User on Import.

* refactor(employee): create user function -removed useless function calls

* refactor(employee): reorganize joining and employee exit tabs at the end.

* feat(employee): Add birthdays and work anniversaries indicator in form ,list view enhancements and new empty state.

* fix: add missing type hints to whitelisted function arguments

* fix(employee): add 'set_only_once' property to 'Create User Automatically' field

* refactor(employee): remove anniversary indicator logic from employee form

* fix: move Joining section before Exit, relabel Employee Exit -> Exit

* fix: reset employee listview empty state, add import btn instead

* fix: employee user creation

- consider prefered email as default in employee creation

- remove unused user parameter from `create_user` API

- remove unnecessary validations on user ID, already checked by user doctype hooks

- set company email only if empty

* fix: only validate auto user creation before insert

* fix: uncollapse User Details section in new form

* fix: hide Create User Automatically checkbox if user is already selected

* fix: set create user perm to 1 by default + persist option while saving employee

* fix: avoid setting unnecessary fields

* fix: fallback to Personal Email for user creation just like client-side

* fix: reset User ID and make it read-only if 'Create User Automatically' is set

* test: Create User Automatically

* test(fix): set company in employee

---------

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
2026-03-23 17:47:02 +05:30
rohitwaghchaure
3f3ddf968e Merge pull request #53705 from rohitwaghchaure/fixed-support-63246
fix: batch validation for subcontracting receipt
2026-03-23 17:01:47 +05:30
Rucha Mahabal
a14f834589 test(fix): set company in employee 2026-03-23 16:52:11 +05:30
ervishnucs
03c9d16ca6 fix: fetch get_item_tax_template while update items 2026-03-23 16:45:20 +05:30
Rohit Waghchaure
b8d201658a fix: batch validation for subcontracting receipt 2026-03-23 16:29:47 +05:30
Rucha Mahabal
cc93b14154 Merge branch 'develop' into feat/employee-creation-and-lifecycle 2026-03-23 16:11:10 +05:30
Rucha Mahabal
d4ecede3c3 test: Create User Automatically 2026-03-23 16:09:58 +05:30
Asief Tejani
99d55ab8d8 docs(README): sync erpnext docker with frappe_docker repo (#53447)
Co-authored-by: diptanilsaha <diptanil@frappe.io>
2026-03-23 16:00:03 +05:30
diptanilsaha
8ea0cc90df fix: check for submit permissions instead of write permissions when updating status (#53697) 2026-03-23 15:43:33 +05:30
Rucha Mahabal
2be6bb694f fix: reset User ID and make it read-only if 'Create User Automatically' is set 2026-03-23 15:42:13 +05:30
Rucha Mahabal
31af13a5e6 fix: fallback to Personal Email for user creation just like client-side 2026-03-23 15:31:51 +05:30
Sudharsanan Ashok
41f986ff83 fix(manufacturing): update non-stock item dict (#53689) 2026-03-23 15:16:37 +05:30
khushi8112
469bb0ba4e fix: party name not updating correctly 2026-03-23 09:44:41 +00:00
khushi8112
8fd9b88cd9 fix(UX): improve party selection UX with party name field 2026-03-23 09:44:41 +00:00
Rucha Mahabal
97bb100010 fix: avoid setting unnecessary fields 2026-03-23 15:06:15 +05:30
khushi8112
6b9fb77772 fix: set default print format for when downlod pdf 2026-03-23 15:04:14 +05:30
khushi8112
2af0d9cf6c feat: default print format for Request for Quotation 2026-03-23 15:04:14 +05:30
Nishka Gosalia
75ce885684 Merge pull request #53695 from nishkagosalia/fix-type-hint-stock 2026-03-23 15:01:43 +05:30
Krishna Shirsath
3e56b8d71d fix(employee): removed milestone lable and remove unnecessary margins 2026-03-23 14:47:54 +05:30
nishkagosalia
2f72ae9afd fix: type hint in stock module 2026-03-23 14:37:46 +05:30
Nishka Gosalia
ca877ba223 Merge pull request #53649 from nishkagosalia/st-63180 2026-03-23 14:27:13 +05:30
diptanilsaha
a908bc7e92 fix(trends): added validation for period_based_on filter (#53690) 2026-03-23 14:23:42 +05:30
Rucha Mahabal
091899d0df fix: set create user perm to 1 by default + persist option while saving employee 2026-03-23 14:23:01 +05:30
Rucha Mahabal
ec3302d1c1 fix: hide Create User Automatically checkbox if user is already selected 2026-03-23 14:06:56 +05:30
Rucha Mahabal
1466df91bd fix: uncollapse User Details section in new form 2026-03-23 14:06:24 +05:30
Rucha Mahabal
ee1aa10328 fix: only validate auto user creation before insert 2026-03-23 13:37:07 +05:30
nishkagosalia
dcd0509089 chore: Adding new argument in status updater to skip qty validation 2026-03-23 13:18:26 +05:30
Rucha Mahabal
613d36a139 fix: employee user creation
- consider prefered email as default in employee creation

- remove unused user parameter from `create_user` API

- remove unnecessary validations on user ID, already checked by user doctype hooks

- set company email only if empty
2026-03-23 12:52:23 +05:30
Mihir Kandoi
7a61d6fcd5 fix: shipping rule applied twice on non stock items (#53655) 2026-03-23 06:49:39 +00:00
Mihir Kandoi
5154102468 fix: PO should not be required for internal transfers (#53681) 2026-03-23 06:32:26 +00:00
Rucha Mahabal
d99d16423a fix: reset employee listview empty state, add import btn instead 2026-03-23 11:59:05 +05:30
Rucha Mahabal
000b5b72d5 fix: move Joining section before Exit, relabel Employee Exit -> Exit 2026-03-23 11:27:00 +05:30
MochaMind
f483d9ff13 chore: update POT file (#53677) 2026-03-22 14:47:24 +01:00
rohitwaghchaure
c1c3757943 Merge pull request #53673 from rohitwaghchaure/fixed-stock-queue-not-updated
fix: stock queue for SABB
2026-03-22 13:00:28 +05:30
Rohit Waghchaure
3fcf308ed8 fix: stock queue for SABB 2026-03-22 12:06:43 +05:30
rohitwaghchaure
145a42eb30 Merge pull request #53638 from rohitwaghchaure/fixed-deadlock-issue-for-sle
fix: deadlock issue for SLE
2026-03-21 14:03:40 +05:30
Mihir Kandoi
fa35fbdb8e fix: do not overwrite expense account in stock entry (#53658) 2026-03-20 08:02:32 +00:00
diptanilsaha
8e17c722fb fix: validate permission before updating status (#53651) 2026-03-19 14:49:29 +00:00
Nishka Gosalia
ffd3e90806 Merge pull request #53645 from nishkagosalia/gh-53526 2026-03-19 18:29:00 +05:30
nishkagosalia
7f70e62c30 fix: Adding validation for operation time in BOM 2026-03-19 17:31:31 +05:30
ruthra kumar
44247f63d5 Merge pull request #53594 from ruthra-kumar/fix_failing_patch
fix: patch failure due to dependency
2026-03-19 17:30:35 +05:30
ruthra kumar
bb3cee8ef5 fix: patch failure due to dependency 2026-03-19 16:13:20 +05:30
Mihir Kandoi
fc25d83a9e fix: co by product patch for v14 migration (#53644) 2026-03-19 10:31:46 +00:00
Rohit Waghchaure
f48b03c6ec fix: deadlock issue for SLE 2026-03-19 14:31:17 +05:30
Sudharsanan Ashok
442fe9a833 fix(stock): fix email error message (#53606) 2026-03-19 07:11:41 +00:00
diptanilsaha
086fea7cf0 fix(payment_schedule): using show_alert instead of msgprint for non-selection of payment schedule (#53623) 2026-03-19 12:29:28 +05:30
Sakthivel Murugan S
256d267a3b fix: set customer details on customer creation at login (#53509) 2026-03-19 12:04:31 +05:30
Pandiyan P
0fdc1bc497 fix(stock): handle NoneType error (#53593) 2026-03-19 11:56:58 +05:30
Mihir Kandoi
71293bcf73 refactor: remove test file import in stock ageing report (#53619) 2026-03-19 11:52:57 +05:30
Mihir Kandoi
f1e36b09f9 fix: consider returned qty in subcontracting report (#53616) 2026-03-19 05:24:58 +00:00
Mihir Kandoi
743970a8c6 fix: python error in manufacture entry if transfer against is job card (#53615) 2026-03-19 04:57:37 +00:00
Sowmya
03d8a7a6af fix: ignore cost center (#53063) 2026-03-19 09:54:17 +05:30
Vishnu Priya Baskaran
31b44534df fix: check posting_date in args (#53303) 2026-03-19 09:52:37 +05:30
ruthra kumar
df7e6b7a79 Merge pull request #47910 from ruthra-kumar/ci_lightmode_runner
refactor(test): repo wide test suite refactor to achieve deterministic behaviour
2026-03-18 21:42:16 +05:30
ruthra kumar
eb143ba742 refactor(test): cleanup; remove redundant attribute 2026-03-18 20:59:39 +05:30
ruthra kumar
22c05d4b8f refactor(test): make pick list deterministic 2026-03-18 20:59:39 +05:30
ruthra kumar
7e8f9f10f3 refactor(test): make item wise sales register deterministic 2026-03-18 20:59:39 +05:30
ruthra kumar
5263386bb2 refactor(test): replace integration test case with ERPNextTestSuite 2026-03-18 20:59:39 +05:30
ruthra kumar
72d08902fd refactor(test): make purchase order deterministic 2026-03-18 20:59:39 +05:30
ruthra kumar
23d35c6cca refactor(test): make sales invoice deterministic 2026-03-18 20:59:39 +05:30
ruthra kumar
da8fcde4a8 refactor(test): make location determinisitic 2026-03-18 20:59:38 +05:30
ruthra kumar
6eea0a2299 refactor(test): make bank clearance deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
9e63c14cef refactor(test): make sales invoice deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
21b25ce96c refactor(test): hardcoded names over dynamic 2026-03-18 20:59:38 +05:30
ruthra kumar
7cad642a11 refactor(test): use JSON for company master 2026-03-18 20:59:38 +05:30
ruthra kumar
5237e58f29 refactor(test): remove explicit call to master data setup 2026-03-18 20:59:38 +05:30
ruthra kumar
e67165d6ce refactor(test): hardcoded names over dynamic ones
Much faster bootstrap without those get_doc calls
2026-03-18 20:59:38 +05:30
ruthra kumar
5a4a77f5d2 refactor: move test bootstrap to module 2026-03-18 20:59:38 +05:30
ruthra kumar
96b82624cd refactor(test): speed up setup 2026-03-18 20:59:38 +05:30
ruthra kumar
fc8fadf455 refactor(test): make stock entry deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
518800cd2f refactor(test): remove redundant before_tests 2026-03-18 20:59:38 +05:30
ruthra kumar
0f2f53cbd0 refactor(test): make process deferred accounting deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
19e03ccdde refactor(test): make bom deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
7fea5a5ca2 refactor(test): make customer deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
cb693e05bf refactor(test): tax rule; removed setUpClass, tearDownClass 2026-03-18 20:59:38 +05:30
ruthra kumar
aa998219b1 refactor(test): common make function 2026-03-18 20:59:38 +05:30
ruthra kumar
4d65cb907f refactor(test): make bom stock calculated deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
c2dea5245d refactor(test): make pos profile deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
07374b5dbc refactor(test): make pos opening entry deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
25279321ac refactor(test): make pos invoice merge log deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
0474d0c4e8 refactor(test): make pos closing deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
ec9b2f0567 refactor(test): make stock test_utils deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
6c27efeeea refactor(test): make currency exchange deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
ffca80daa5 refactor(test): make sales partner target variance deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
2c0466d637 refactor(test): make sales order analysis deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
a91ed14aec refactor(test): make uae vat audit deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
96f9fc3484 refactor(test): make uae vat 201 deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
e01e3c0a62 refactor(test): make job card deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
4777b060ba refactor(test): make opportunity summary by sales stage deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
ed099bcd85 refactor(test): make queries deterministic 2026-03-18 20:59:38 +05:30
ruthra kumar
d81fd25325 refactor(test): make item wise details deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
2eec0f704c refactor(test): make accounts controller deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
b4245e9353 refactor(test): make subcontracting controller deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
323a3dd573 refactor(test): make test mapper deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
56a5ddae8f refactor(test): make item wise inventory account deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
a3d8bb8d21 refactor(test): make distributed discount deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
18fe191929 refactor(test): make requested items order and receive deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
f4d355a0e4 refactor(test): make accounts/test/test_utils.py deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
0ef004ce48 refactor(test): make gross profit deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
47cae808c5 refactor(test): make sales payment summary deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
1689d6a9fc refactor(test): make consolidated trial balance report deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
12ae84401a refactor(test): remove redundant tearDown, tearDownClass and rollback 2026-03-18 20:59:37 +05:30
ruthra kumar
8090caa026 refactor(test): make inventory dimension deterministic
fixed flaky test 'test_inventory_dimension'

use '3' precision for test_opening_balnace
2026-03-18 20:59:37 +05:30
ruthra kumar
ff87eedd96 refactor(test): make item group deterministic
'Item Group C' follows 'Item Group B'. So `lft` will increase while
`rgt` stays the same.
2026-03-18 20:59:37 +05:30
ruthra kumar
57f94b3ac2 refactor(test): make packed item deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
3b65364828 chore: typo 2026-03-18 20:59:37 +05:30
ruthra kumar
b5db1e9e1f refactor(test): remove redundant create_asset_category 2026-03-18 20:59:37 +05:30
ruthra kumar
79c23fc6c6 refactor(test): make sales invoice deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
31718d2066 refactor(test): make item group deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
cd499d4955 refactor(test): make timesheet deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
4484863baa refactor(test): make task deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
ddcd8a03ee refactor(test): make project deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
ce50e23536 refactor(test): make maintenance schedule deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
3c904cbc5f refactor(test): make leads deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
06ddc80292 refactor(test): make purchase order deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
7da61621cc refactor(test): make asset repair deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
075fe3f668 refactor(test): make asset deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
b2242d3cce refactor(test): make loyalty point entry deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
c55628a55d refactor(test): make dunning deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
3a5869e525 refactor(test): make budget deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
bb51e3147c refactor(test): make auto match party deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
5415e2ca82 refactor(test): make bank clearance deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
e6885af96b refactor(test): remove explicit commit and dead code 2026-03-18 20:59:37 +05:30
ruthra kumar
6d86bfe2e3 refactor(test): rollback on tearDown 2026-03-18 20:59:37 +05:30
ruthra kumar
70059d1ec0 refactor(test): make irs supplier test deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
d2da518e02 refactor(test): make party specific item deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
d119e3a8e8 refactor(test): make subcontracting receipt deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
577be4f9ad refactor(test): make purchase receipt deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
8dd9ab6475 refactor(test): make stock reconciliation deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
ee8e96dbcf refactor(test): make subcontracting order deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
faaad3ae8e refactor(test): make purchase receipt deterministic 2026-03-18 20:59:37 +05:30
ruthra kumar
c5f2ef454f refactor(test): make material request deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
7224dcce26 refactor(test): make stock ledger entry deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
f758ee4adc refactor(test): make item deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
26d7900590 refactor(test): make work order deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
2d1db2e403 refactor(test): make purchase receipt deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
4111d4ee1d refactor: fix logical bug and make stock settings test deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
d8be59b1ba refactor(test): make stock entry deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
c38696157c refactor(test): make serial no deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
dab31bc36d refactor(test): make serial and batch bundle deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
d790a1d3a6 refactor(test): make pick list deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
298960bfc6 refactor(test): make packed item deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
b8437f7f22 refactor(test): make material request deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
db49e6d830 refactor(test): make LCV deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
7853b779bd refactor(test): make item price deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
23cdd82de1 refactor(test): make delivery trip deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
5c85074f54 refactor(test): make delivery note deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
8d20da91d1 refactor(test): make transaction deletion record deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
0b046647e7 refactor(test): make item group deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
9231dbbb2f refactor(test): make employee deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
0dbd10893e refactor(test): make department deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
f2a85fd134 refactor(test): make currency exchange deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
7a8ece76ea refactor(test): make test deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
8b720ffd4f refactor(test): make project deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
6e3ea35dda refactor(test): make sales order deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
a4f8920d97 refactor(test): make quotation deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
7b8e15c5b8 refactor(test): make production plan deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
464c09ed10 refactor(test): make job card tests deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
bfb8837c54 refactor(test): make bom tests deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
7b26a4c2eb refactor(test): make bom update tool tests deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
8c5276c5e1 refactor(test): make plaid settings deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
2516cdafcb refactor(test): make financial reports deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
fcee9ad778 refactor(test): make sales invoice deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
5b0c41a3f7 refactor(test): make pos invoice deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
f5e69f2602 refactor(test): better setup for loyalty point and POS Invoice 2026-03-18 20:59:36 +05:30
ruthra kumar
d69d2c374f refactor(test): pos invoice tests are almost deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
524118e108 refactor(test): make timesheet and activity type deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
b64231ce2e refactor(test): make maintenance schedule deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
1a6358ec70 refactor(test): make prospect deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
0b2dbcf30c refactor(test): make opportunity deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
3b5667c007 refactor(test): remove empty IntegrationTestCase 2026-03-18 20:59:36 +05:30
ruthra kumar
e490d5044b refactor(test): make tax withholding tests deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
87f0247f2b refactor(test): ensure new bankers rounding method is set 2026-03-18 20:59:36 +05:30
ruthra kumar
91875fdf8d refactor(test): set precision in class setup 2026-03-18 20:59:36 +05:30
ruthra kumar
3dc3b2b64e refactor(test): make sales invoice tests deterministic
- allow_negative_stock is required for test_taxes_merging_from_delivery_note
2026-03-18 20:59:36 +05:30
ruthra kumar
eb70060798 refactor(test): make purchase invoice tests deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
2edbbb6052 refactor: avoid name clash 2026-03-18 20:59:36 +05:30
ruthra kumar
c2e9a91a94 refactor(test): handle setup of Workstation Operation Component 2026-03-18 20:59:36 +05:30
ruthra kumar
81ef8655c2 refactor(tests): make asset maintenance tests deterministic 2026-03-18 20:59:36 +05:30
ruthra kumar
def64ae864 refactor(test): incorrect fieldname for abbrevation 2026-03-18 20:59:36 +05:30
ruthra kumar
379f12daee refactor(test): make asset repair tests deterministic 2026-03-18 20:59:35 +05:30
ruthra kumar
cee55a1518 refactor(test): make supplier quotation deterministic 2026-03-18 20:59:35 +05:30
ruthra kumar
1560619fe0 refactor(test): install supplier scorecard presets 2026-03-18 20:59:35 +05:30
ruthra kumar
5b20935235 chore: remove default templated test case 2026-03-18 20:59:35 +05:30
ruthra kumar
4eb23df627 refactor(test): set_user utility method 2026-03-18 20:59:35 +05:30
ruthra kumar
253fbc2a70 refactor: replace all IntegrationTestCase -> ERPNextTestSuite 2026-03-18 20:59:35 +05:30
ruthra kumar
ea2763432d refactor: utility to return default supplier scorecards 2026-03-18 20:59:35 +05:30
ruthra kumar
03a64b67d9 refactor(test): flaky test in lead 2026-03-18 20:59:35 +05:30
ruthra kumar
2309bea1a0 refactor(test): flaky tax rule testsuite
- Make Sales Stage preset
2026-03-18 20:59:35 +05:30
ruthra kumar
3c14621ae0 refactor(test): load shipping rule records 2026-03-18 20:59:35 +05:30
ruthra kumar
27474eceee refactor(test): fix flaky shareholder test 2026-03-18 20:59:35 +05:30
ruthra kumar
36a9893558 refactor(test): fix flaky process deferred accounting tests 2026-03-18 20:59:35 +05:30
ruthra kumar
d37f2ada65 refactor(test): flaky pricing rule tests 2026-03-18 20:59:35 +05:30
ruthra kumar
c0647cf93b refactor(test): flaky stock entry; load records json 2026-03-18 20:59:35 +05:30
ruthra kumar
95d6bbe7ad refactor(test): flaky pos invoice merge log test 2026-03-18 20:59:35 +05:30
ruthra kumar
aeae6d4a10 refactor(test): flaky post invoice test 2026-03-18 20:59:35 +05:30
ruthra kumar
0914fd695d refactor(test): flaky pos invoice test; load stock entry json 2026-03-18 20:59:35 +05:30
ruthra kumar
a5a6a3bc9c refactor(test): flaky PE test; load currency exchange record 2026-03-18 20:59:35 +05:30
ruthra kumar
56542c805a refactor: load journal entry test records and make holiday list 2026-03-18 20:59:35 +05:30
ruthra kumar
6041574209 refactor: utility to load JSON records 2026-03-18 20:59:35 +05:30
ruthra kumar
0b14d1fe34 refactor(test): update system settings in super() 2026-03-18 20:59:35 +05:30
ruthra kumar
6572dc286a refactor(test): flaky test setup in pos closing entry 2026-03-18 20:59:35 +05:30
ruthra kumar
223737cbe2 refactor(test): fix flaky test setup for opening invoice creation 2026-03-18 20:59:35 +05:30
ruthra kumar
b00df01817 refactor(test): flaky test setup in Exchange Rate Revaluation 2026-03-18 20:59:35 +05:30
ruthra kumar
ce8ce10ef1 refactor(test): flaky test data setup for coupon code 2026-03-18 20:59:35 +05:30
ruthra kumar
97b922f9f1 refactor(test): make price list - more test records 2026-03-18 20:59:35 +05:30
ruthra kumar
92f0175e91 refactor(test): flaky test data in bank reconciliation tool 2026-03-18 20:59:35 +05:30
ruthra kumar
66c7815369 refactor(test): call super() method first 2026-03-18 20:59:35 +05:30
ruthra kumar
f6b6c93c10 refactor(test): make customer 2026-03-18 20:59:35 +05:30
ruthra kumar
8393c1b4f6 refactor(test): make price list and update selling settings 2026-03-18 20:59:35 +05:30
ruthra kumar
20b835a53b refactor(test): make item attribute 2026-03-18 20:59:35 +05:30
ruthra kumar
1fb26b5989 refactor(test): make test accounts 2026-03-18 20:59:35 +05:30
ruthra kumar
59144e03bc refactor(test): make item tax template 2026-03-18 20:59:35 +05:30
ruthra kumar
0feedd183b refactor(test): make uom 2026-03-18 20:59:35 +05:30
ruthra kumar
402c7df643 refactor(test): make item group 2026-03-18 20:59:35 +05:30
ruthra kumar
526fc1778f refactor(test): make item 2026-03-18 20:59:35 +05:30
ruthra kumar
aa76fc5d7c refactor(test): make warehouse 2026-03-18 20:59:35 +05:30
ruthra kumar
a769c71642 chore: typo in setup method 2026-03-18 20:59:35 +05:30
ruthra kumar
3ea1283613 refactor(test): make persistent location 2026-03-18 20:59:35 +05:30
ruthra kumar
6fc0a53bae refactor(test): setup fiscal years without any gap 2026-03-18 20:59:35 +05:30
ruthra kumar
c6b661526d refactor(test): make cost center 2026-03-18 20:59:35 +05:30
ruthra kumar
0c8145e924 refactor: suppress welcome mail 2026-03-18 20:59:35 +05:30
ruthra kumar
033e826242 refactor(test): even more master data setup 2026-03-18 20:59:35 +05:30
ruthra kumar
783d51e8cc refactor(test): make all presets in setupclass 2026-03-18 20:59:35 +05:30
ruthra kumar
aff6452075 refactor: temporary standing decorator for change_settings 2026-03-18 20:59:35 +05:30
ruthra kumar
33f4791698 refactor: replace IntegrationTestCase with ERPNextTestCase repo-wide
- import ERPNextTestSuite
 - use it on test class
2026-03-18 20:59:35 +05:30
ruthra kumar
4027b82714 refactor(test): bare bones presets for company 2026-03-18 20:59:34 +05:30
ruthra kumar
5c112daa1e refactor(test): make persistent company records
'test_coa_based_on_country_template' made deterministic
2026-03-18 20:59:34 +05:30
ruthra kumar
a00814d849 refactor(test): IntegraionTestCase -> python's built-in TestCase 2026-03-18 20:59:34 +05:30
ruthra kumar
3cee89d827 chore: drop dead hook 2026-03-18 20:59:34 +05:30
ruthra kumar
2447042060 chore: remove global dependencies 2026-03-18 20:59:34 +05:30
ruthra kumar
319e220efe chore: remove IGNORE_TEST_RECORD_DEPENDENCIES 2026-03-18 20:59:34 +05:30
ruthra kumar
8eef42d075 chore: remove EXTRA_TEST_RECORD_DEPENDENCIES 2026-03-18 20:59:34 +05:30
ruthra kumar
002b4fb048 chore: delete all test_records.json 2026-03-18 20:59:34 +05:30
ruthra kumar
4167609e41 ci: run parallel test in lightmode
- modify individual test CI. let it be dormat for now.

Acked-by: ruthra kumar <ruthra@erpnext.com>
2026-03-18 20:59:34 +05:30
Mihir Kandoi
6cb6a52ded fix: incorrect sle calculation when doc has project (#53599) 2026-03-18 13:19:30 +00:00
rohitwaghchaure
0d8f6b05e3 Merge pull request #53246 from aerele/stock-entry-cost-center
feat: add cost center field to the stock entry accounting dimension tab
2026-03-18 11:49:01 +05:30
Lakshit Jain
072ec9b7ae fix: initialize all tax columns to resolve Key error in item_wise_sales_register and item_wise_purchase_register reports (#53323) 2026-03-17 23:37:06 +05:30
Mihir Kandoi
aba1f34de0 Modify CODEOWNERS to include additional owners (#53575) 2026-03-17 17:07:48 +00:00
Sudharsanan Ashok
31d14df37b fix(stock): add company filter while fetching batches (#53369) 2026-03-17 16:39:21 +00:00
Mihir Kandoi
b433852f8a chore: make supplier data expanded by default in PI (#53565) 2026-03-17 22:08:17 +05:30
Sudharsanan Ashok
fe5f16cb18 fix(stock): fix the property setter (#53422) 2026-03-17 22:02:41 +05:30
mergify[bot]
fe85dc10cc fix(italy): fix e-invoice ScontoMaggiorazione structure and included_in_print_rate support (backport #53334) (#53568)
Co-authored-by: Arturo <tamburro92@users.noreply.github.com>
2026-03-17 22:01:15 +05:30
Khushi Rawat
445aef7d17 Merge pull request #53446 from Kesavan-code/Fix-53445
fix: fetch accounting dimensions from child row in asset creation
2026-03-17 21:37:34 +05:30
Mihir Kandoi
f319857939 chore: add documentation link in valuation method field (#53564) 2026-03-17 15:32:29 +00:00
Sudharsanan Ashok
517310182e fix(manufacturing): update working hours validation (#53559) 2026-03-17 20:47:46 +05:30
diptanilsaha
3ff2871f24 fix(sales_invoice): reset payment methods on pos_profile change (#53514) 2026-03-17 19:29:30 +05:30
Soham Kulkarni
72835f9a58 Merge pull request #53322 from sokumon/add-clear-demo-data 2026-03-17 17:05:51 +05:30
ruthra kumar
dd4b83906d Merge pull request #53535 from aerele/remove-payables-receivables-workspace-v16
fix: remove payables and receivables workspace
2026-03-17 17:03:02 +05:30
ruthra kumar
41fbb916a0 fix: incorrect user perms in queries (#53548)
* chore: remove incorrect import

* fix: use qb to prevent incorrect sql due to user permissions
2026-03-17 16:32:05 +05:30
ruthra kumar
04b967bd6d fix: use qb to prevent incorrect sql due to user permissions 2026-03-17 16:06:54 +05:30
sokumon
ed3444de5a fix: use same label 2026-03-17 15:48:24 +05:30
Mihir Kandoi
ef09cffa58 chore: initiate release twice in a week (#53543) 2026-03-17 10:17:02 +00:00
Nishka Gosalia
49581e7408 fix: Creating new item price incase of changes in expired item price (#53534)
Co-authored-by: Nishka Gosalia <nishkagosalia@Nishkas-MacBook-Air.local>
2026-03-17 15:32:17 +05:30
ruthra kumar
fc2edfbded chore: remove incorrect import 2026-03-17 15:23:05 +05:30
rohitwaghchaure
13765e7557 Merge pull request #53500 from rohitwaghchaure/fixed-valuation-for-non-batchwise-valuation-batches
fix: valuation rate for no Use Batch wise Valuation batches
2026-03-17 14:12:15 +05:30
Rohit Waghchaure
4befa15198 fix: valuation rate for no Use Batch wise Valuation batches 2026-03-17 13:17:00 +05:30
ravibharathi656
26a9646407 fix: remove payables and receivables workspace 2026-03-17 12:36:57 +05:30
Jatin3128
a9e52833fe fix(Payment Entry): split orders as per the schedules in the refrence table 2026-03-17 11:28:48 +05:30
Abdus Samad
65ed936ff3 fix: add item_name to quick entry fields in Item doctype (#53530) 2026-03-17 10:56:30 +05:30
Nikhil Kothari
ef32622166 fix(banking): include paid purchase invoices in reports and bank clearance (#52675)
* fix(banking): include paid purchase invoices in reports and bank clearance

* fix: condition for amounts not reflected in system

* fix: set Sales Invoice to be the payment document in bank rec

* fix: add additional filter for `is_paid`

* fix: added is_paid

* fix: added invoice number in bank clearance tool

* chore: make requested changes

* fix: exclude opening JEs

* fix: bring back banking icon in desktop
2026-03-17 10:17:32 +05:30
Jeraldin P J
e2667ab098 fix: enable logs to track changes in doctype. (#53491)
Co-authored-by: jeraldin2003 <jeraldin2003>
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-03-16 18:21:26 +00:00
Sanjesh-Raju
0a38389bc3 fix: correct overlap detection in JobCard.has_overlap (#53473)
Co-authored-by: Sanjesh <rsanjesh64@gmail.com>
Co-authored-by: Tridots Tech <info@tridotstech.com>
2026-03-16 18:18:30 +00:00
Nishka Gosalia
953f089c06 feat: Adding requested qty in packed item (#53486)
* feat: Adding requested qty in packed item

* fix: correct import path

---------

Co-authored-by: Nishka Gosalia <nishkagosalia@Nishkas-MacBook-Air.local>
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2026-03-16 18:09:39 +00:00
rohitwaghchaure
87785a2886 Merge pull request #53513 from rohitwaghchaure/fixed-do-not-set-rate-for-si
fix: do not set valuation rate for invoice without update stock
2026-03-16 23:32:52 +05:30
Abdus Samad
4cd150ba7a fix: change "Date" label to "Posting Date" in Sales Invoice and Purchase Invoice (#53503) 2026-03-16 17:57:44 +00:00
Rohit Waghchaure
bec9e48435 fix: do not set valuation rate for invoice without update stock 2026-03-16 23:08:55 +05:30
Shllokkk
0ef7594536 Merge pull request #53223 from Shllokkk/dashboard-chart-fix
Bank balance chart fix for payments dashboard
2026-03-16 20:01:39 +05:30
diptanilsaha
09dd2f851d fix(support-settings): disable the auto-close tickets feature if close_issue_after_days is set to 0 (#53499) 2026-03-16 11:47:01 +00:00
rohitwaghchaure
b5d24f5971 Merge pull request #53495 from rohitwaghchaure/fixed-support-62674
fix: stock adjustment entry
2026-03-16 15:17:12 +05:30
Rohit Waghchaure
af3067ee23 fix: stock adjustment entry 2026-03-16 14:51:09 +05:30
diptanilsaha
5f2c24a199 fix(p&l_statement): disable accumulated value filter by default (#53488) 2026-03-16 07:18:06 +00:00
Mihir Kandoi
fd7d5bdae1 fix: use bom source warehouse in WO created from PP (#53478) 2026-03-16 10:46:28 +05:30
Mihir Kandoi
ebb4a3d053 fix: use bom source warehouse in WO created from PP 2026-03-16 10:29:31 +05:30
Jeraldin P J
c09ea94133 fix: remove supplier selection dialog when creating Purchase Order from Material Request (#53391)
Co-authored-by: jeraldin2003 <jeraldin2003>
Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>
2026-03-16 09:45:30 +05:30
Raffael Meyer
9e8c70e6b4 chore: add docs to project URLs (#53467) 2026-03-15 13:36:00 +00:00
MochaMind
008b296014 chore: update POT file (#53464) 2026-03-15 14:31:26 +01:00
sokumon
413b119ec6 fix: add icon in clear demo data 2026-03-15 17:49:32 +05:30
diptanilsaha
7a8d1931ed fix(serial_and_batch_bundle_selector): handle CSV attachment properly (#53460) 2026-03-15 12:58:58 +05:30
Mihir Kandoi
5ba6446451 fix: sales order indicator should be based on available qty rather th… (#53456) 2026-03-15 09:43:11 +05:30
Mihir Kandoi
708e4fa2be fix: sales order indicator should be based on available qty rather than delivered qty 2026-03-15 09:41:32 +05:30
[Kesavan-001]
e0fb31f81e Fix:Cost center mapping issue 2026-03-14 13:26:46 +05:30
[Kesavan-001]
a084feba96 Fix:Cost center mapping issue 2026-03-14 12:50:47 +05:30
[Kesavan-001]
10fe8580d5 Fix:Cost center mapping issue 2026-03-14 12:39:48 +05:30
David
b5a21855f6 feat(stock): implement fallback logic for Delivery Trip address mapping (#53260) 2026-03-14 05:41:19 +00:00
diptanilsaha
c99598e22e Merge pull request #53309 from frappe/l10n_develop 2026-03-14 02:39:06 +05:30
Sagar Vora
be85ecba1b Merge pull request #53430 from sagarvora/auto-cancel-exempt
fix: exempt ledger entries and closing balance from auto-cancellation
2026-03-13 18:06:21 +00:00
Sagar Vora
c069a1787d fix: hide cancel button from ledger / closing balance doctypes 2026-03-13 23:20:42 +05:30
MochaMind
67a80127e3 fix: Portuguese, Brazilian translations 2026-03-13 23:07:09 +05:30
Sagar Vora
56efe5e82c fix: exempt ledger entries and account closing balance from auto-cancellation 2026-03-13 23:03:13 +05:30
Shllokkk
8e5692d8a3 feat(report): add service start/end date and amount with roll-ups in deferred revenue/expense report 2026-03-13 21:31:37 +05:30
ruthra kumar
b1c1bca2b8 Merge pull request #53423 from ruthra-kumar/remove_fw_added_total_rows_from_trends_reports
refactor: disable total row in trends report
2026-03-13 18:02:05 +05:30
ruthra kumar
4dbc72b301 refactor: disable total row in trends report 2026-03-13 17:37:04 +05:30
ruthra kumar
b9a47d85db Merge pull request #53415 from ruthra-kumar/broken_cost_center_filter_in_get_outstanding_documents
fix: broke cost center filter in get outstanding reference docs
2026-03-13 15:24:28 +05:30
ruthra kumar
7dfe36fdce fix: broke cost center filter in get outstanding reference docs 2026-03-13 14:55:56 +05:30
Khushi Rawat
e85eb90ec7 Merge pull request #53416 from khushi8112/subsidiary-companies-value-in-purchase-analytics
feat: show subsidiary companies value in purchase analytics
2026-03-13 14:42:06 +05:30
khushi8112
9f755ad65a feat: show subsidiary companies value in purchase analytics 2026-03-13 14:37:11 +05:30
Mihir Kandoi
bd87a7e612 Revert "fix(regional): rename duplicate Customer fields in Italy setup" (#53409) 2026-03-13 07:27:32 +00:00
ljain112
e68f149d3a fix: correct item valuation when "Deduct" is used in Purchase Invoice and Receipt. 2026-03-13 11:53:08 +05:30
Smit Vora
20fc9c7b18 Merge pull request #53396 from vorasmit/same-phantom-different-fg 2026-03-13 09:44:42 +05:30
Khushi Rawat
f08293efec Merge pull request #53390 from khushi8112/asset-purchase-amount-currency
refactor: show company currency in purchase amount label
2026-03-13 00:47:37 +05:30
khushi8112
6219a9e6f0 fix: update label on company change 2026-03-13 00:27:43 +05:30
khushi8112
b4c82c0f1a refactor: show company currency in purchase amount label 2026-03-13 00:27:43 +05:30
MochaMind
7362f2e5fb fix: Portuguese, Brazilian translations 2026-03-12 23:05:16 +05:30
MochaMind
62715787c1 fix: Swedish translations 2026-03-12 23:05:07 +05:30
Smit Vora
b1e1c65774 chore: phantom qty unused in sub_assembly_items 2026-03-12 21:16:03 +05:30
Smit Vora
1975ae4486 test: ensure phantom BOM explosion across all items 2026-03-12 20:31:56 +05:30
Solede
c6efc403cd fix(regional): rename duplicate Customer fields in Italy setup (#50921)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 20:25:35 +05:30
Smit Vora
e57de4311c fix: correctly group RMs of same phantom from different FG 2026-03-12 20:21:18 +05:30
Mihir Kandoi
999a72a16a fix: get_item_tax_info type hints (#53392) 2026-03-12 14:07:49 +00:00
Sagar Vora
d8a56e9943 Merge pull request #53395 from shubhdoshi21/flag-fix
fix: update invalid syntax for flags
2026-03-12 12:39:22 +00:00
Shubh Doshi
c6e6859090 fix: update invalid syntax for flags 2026-03-12 17:52:10 +05:30
Shubh Doshi
ad8c05426e fix: make ledger entries submittable and cleanup invalid test submissions (#52921)
* fix: enable submittability for ledger entries and cleanup invalid test submissions

* fix: reverted child table submittability

* fix: added ignore_links flag for back gl entry

* fix: add ignore_links for reconcile,cancelled PLE,cancelled SLE

* fix: update test_recreate_stock_ledgers to use db.delete instead of doc.delete

* chore: temporary test against frappe PR 37009

* fix: make Advance Payment Ledger Entry submittable

* refactor: add extra line for create_shipping_rule

* chore: revert temporary test against frappe PR 37009

* fix: use parent doc save with ignore_validate_update_after_submit for child table updates

* chore: temporary test against frappe PR 37009

* chore: revert temporary test against frappe PR 37009

* fix: use skip_docstatus_validation
2026-03-12 16:27:51 +05:30
Khushi Rawat
0e888cc86b Merge pull request #53379 from khushi8112/correct-filter-for-asset-in-purchase-receipt
fix: use correct filter to get the composite assets
2026-03-12 15:10:34 +05:30
khushi8112
f5a3227349 fix: use correct filter to get the composite assets 2026-03-12 14:51:25 +05:30
Mihir Kandoi
7f644785ce fix: do not modify rate in the child item merely for comparison (#53301) 2026-03-12 14:30:00 +05:30
Mihir Kandoi
3bb18d0baf fix: precision issue in production plan (#53370) 2026-03-12 14:26:29 +05:30
Krishna Shirsath
831b1d3a79 feat(employee): Refactor milestone indicator functions to accept 'today' parameter 2026-03-12 14:19:15 +05:30
Khushi Rawat
bef4c010c6 Merge pull request #53371 from khushi8112/asset-repair-show-general-ledger
fix: move show_general_ledger to Asset Repair form events
2026-03-12 14:05:20 +05:30
khushi8112
ac124bdc7e fix: move show_general_ledger to Asset Repair form events 2026-03-12 13:18:00 +05:30
Mihir Kandoi
9c0c39381f fix: add validation in bom creator function (#53364) 2026-03-12 06:48:54 +00:00
Mihir Kandoi
b1ff4daaf5 fix: NoneType error when template description is to be copied to variant (#53358) 2026-03-12 06:33:28 +00:00
Mihir Kandoi
cb05f8a67a refactor: supplier quotation comparision report button should start f… (#53361) 2026-03-12 06:15:47 +00:00
Mihir Kandoi
8d5566e783 refactor: add type hints required flag to hooks.py (#53356) 2026-03-12 11:42:46 +05:30
Mihir Kandoi
417066d188 refactor: add type hints required flag to hooks.py 2026-03-12 11:08:24 +05:30
Ejaaz Khan
e4d79c6246 fix: remove redundant pos print format (#53348) 2026-03-12 05:11:53 +00:00
David
a3a57e20f1 Feat/shipment default contact (#53029) 2026-03-12 10:40:39 +05:30
NaviN
a8dcf70459 fix(delivery note): avoid maintaining si_detail on return delivery note (#52456) 2026-03-12 10:36:18 +05:30
Pandiyan P
a30599570c fix: handle NoneType error while creating a item (#53313) 2026-03-12 10:31:41 +05:30
V Shankar
e107d3ca84 fix: re-calculate taxes and totals after resetting bundle item rate (#53342) 2026-03-12 10:29:59 +05:30
Pandiyan P
77cf0afa1a fix: update child item schedule_date and prevent past dates (#53298) 2026-03-12 09:57:38 +05:30
Shllokkk
56f597f5ad fix(email_campaign): prevent unsubscribing entire campaign when email group member unsubscribes 2026-03-12 00:54:40 +05:30
MochaMind
793db90a14 fix: Portuguese, Brazilian translations 2026-03-11 23:09:41 +05:30
Krishna Shirsath
e4a0d2ab0b feat(employee): Enhance milestone indicators for birthdays and work anniversaries 2026-03-11 22:38:42 +05:30
Deepesh Garg
9a4c7766e3 Merge pull request #53327 from Nihantra-Patel/fix-journal-entry-ignore-linked-doctypes
fix: Append existing ignored doctypes in Journal Entry on_cancel instead of overwriting
2026-03-11 16:10:37 +05:30
Mihir Kandoi
f1ac0376fb feat: co product by product support (#52979) 2026-03-11 14:46:36 +05:30
ruthra kumar
65c33e6b39 Merge pull request #53326 from ruthra-kumar/allow_cost_center_on_payment_entry_deductions
refactor: make cost center editable in payment entry deduction
2026-03-11 14:45:41 +05:30
Nihantra Patel
39e10c4ab0 fix: Append existing ignored doctypes in Journal Entry on_cancel instead of overwriting 2026-03-11 14:40:41 +05:30
ruthra kumar
38bdc99172 Merge pull request #53294 from ruthra-kumar/stop_v14_weekly_release
ci: drop v14 from weekly release
2026-03-11 14:38:38 +05:30
ruthra kumar
078b22d985 refactor: make cost center editable in payment entry deduction 2026-03-11 14:26:16 +05:30
Nishka Gosalia
0205341cb5 Merge pull request #53312 from creative-paramu/production_plan_item_description_update 2026-03-11 14:18:36 +05:30
nareshkannasln
fa34ebea94 fix: skip BudgetValidation when cancelling GL entries 2026-03-11 11:59:14 +05:30
Parameshwari Palanisamy
39e68a9ce7 Update production_plan.py 2026-03-11 11:41:24 +05:30
creative-paramu
19533551f4 fix: update item description in Production Plan Assembly Items table 2026-03-11 11:14:33 +05:30
MochaMind
f3b270c927 fix: Serbian (Cyrillic) translations 2026-03-10 23:06:36 +05:30
MochaMind
330216ff0d fix: Serbian (Latin) translations 2026-03-10 23:06:26 +05:30
MochaMind
86bad84504 fix: Swedish translations 2026-03-10 23:06:18 +05:30
MochaMind
24e0c4034d fix: Spanish translations 2026-03-10 23:06:09 +05:30
Shllokkk
17eb983c40 fix: sanitize genericode import inputs and secure XML parser 2026-03-10 21:15:33 +05:30
ruthra kumar
ac8f3d7f96 fix: set default list view columns and filters for sales, purchase and accounts module (#53256) 2026-03-10 17:52:17 +05:30
Abdeali Chharchhodawala
0d42faac2e Merge pull request #52636 from Abdeali099/Abdeali/india-coa
refactor: enhance chart of accounts for India with account categories
2026-03-10 17:21:37 +05:30
ruthra kumar
7cf7a967da Merge pull request #53071 from aerele/fix-gross-profit-qty-precision
fix(gross-profit): apply precision-based rounding to grouped totals
2026-03-10 16:37:41 +05:30
ruthra kumar
ee187065c6 ci: drop v14 from weekly release 2026-03-10 16:29:02 +05:30
rohitwaghchaure
ac8a0b7b3d Merge pull request #53283 from rohitwaghchaure/fixed-patch-not-exists
fix: removed non existent patch
2026-03-10 14:25:50 +05:30
Mihir Kandoi
567d6c5102 Merge pull request #53282 from mihir-kandoi/fix-qi-submission 2026-03-10 14:15:32 +05:30
rohitwaghchaure
20cdf744fd Merge pull request #53281 from rohitwaghchaure/fixed-better-validation-message-pi-with-update-stock
fix: better validation message for Purchase Invoice with Update Stock
2026-03-10 14:03:18 +05:30
Mihir Kandoi
9f62ec5192 fix: allow user to make QI after submission not working 2026-03-10 13:55:49 +05:30
Rohit Waghchaure
c4b3080eae fix: removed non existent patch 2026-03-10 13:55:36 +05:30
Rohit Waghchaure
cfb06cf247 fix: better validation message for Purchase Invoice with Update Stock 2026-03-10 13:36:11 +05:30
Mihir Kandoi
53238ba94f Merge pull request #53203 from aerele/employee-user-status 2026-03-10 13:09:08 +05:30
Mihir Kandoi
1da71fee2b Merge pull request #53235 from aerele/fix/sales-order-delivery-date 2026-03-10 12:52:53 +05:30
Priyal Rawal
a6e78c2eea fix: add permission checks in whitelisted functions (#53103) 2026-03-10 07:04:15 +00:00
ruthra kumar
f2f47d6d88 Merge pull request #53238 from vorasmit/regional-rounding
fix: use return value of `get_round_off_applicable_accounts`
2026-03-10 12:28:16 +05:30
rohitwaghchaure
8d470b92db Merge pull request #53272 from rohitwaghchaure/fixed-patch-falling
fix: patch failing
2026-03-10 12:01:42 +05:30
Rohit Waghchaure
6024c4a077 fix: patch failing 2026-03-10 11:44:20 +05:30
MochaMind
b0ec75d539 fix: sync translations from crowdin (#53262) 2026-03-09 20:49:12 +01:00
ruthra kumar
cd7845124c fix: allow payment_request to be created in draft (#53160) 2026-03-09 20:21:33 +05:30
Shllokkk
2e844a58fb perf: optimize account balance data fetching for Chart Of Accounts 2026-03-09 20:09:03 +05:30
rohitwaghchaure
5ca8641488 Merge pull request #53254 from rohitwaghchaure/fixed-github-53253
fix: bom UX issues
2026-03-09 18:17:33 +05:30
Nabin Hait
9cf529215f fix: set default list view columns and filters for sales, purchase and accounts module 2026-03-09 17:20:52 +05:30
Rohit Waghchaure
32447b8204 fix: bom UX issues 2026-03-09 16:25:08 +05:30
Krishna Shirsath
be819eb876 fix(employee): correct work anniversary message pluralization 2026-03-09 16:06:55 +05:30
Nishka Gosalia
af817b8134 Merge pull request #53249 from nishkagosalia/purchase-order-button-fix 2026-03-09 15:05:42 +05:30
Nishka Gosalia
829dbbe12b fix :buttons not visible on purchase and sales order 2026-03-09 15:02:31 +05:30
Khushi Rawat
9c27d66add Merge pull request #53242 from khushi8112/asset-report-query-builder
refactor: replace raw SQL with query builder in asset depreciation and balances report
2026-03-09 14:57:29 +05:30
sudarshan-g
47772f4e77 feat: add cost center field to the stock entry accounting dimension tab 2026-03-09 13:32:59 +05:30
rohitwaghchaure
563184920a Merge pull request #53239 from rohitwaghchaure/fixed-validation-for-docstatus
fix: validation for cancellation
2026-03-09 13:18:56 +05:30
Pandiyan37
77367b5517 fix(selling): update delivery date in line items 2026-03-09 13:10:01 +05:30
Krishna Pramod Shirsath
2b8a4a9b5f Merge branch 'frappe:develop' into feat/employee-milestone-indicators 2026-03-09 13:06:20 +05:30
Krishna Shirsath
7e8a830f42 feat(employee): Add birthdays and work anniversaries indicator in form 2026-03-09 13:01:52 +05:30
khushi8112
f496995415 refactor: more functions in same file 2026-03-09 12:56:24 +05:30
Krishna Shirsath
1f19175fef refactor(employee): remove anniversary indicator logic from employee form 2026-03-09 12:50:56 +05:30
khushi8112
314c882f3b refactor: replace raw SQL with query builder in asset depreciation and balannces report 2026-03-09 12:39:49 +05:30
Mihir Kandoi
adbe856c4e Merge pull request #53234 from aerele/fix/support-#61532 2026-03-09 12:33:46 +05:30
Rohit Waghchaure
8de272a8a1 fix: validation for cancellation 2026-03-09 12:05:46 +05:30
Krishna Pramod Shirsath
f8f61f0b81 Merge branch 'develop' into feat/employee-creation-and-lifecycle 2026-03-09 11:47:19 +05:30
Krishna Shirsath
053242d5bd fix(employee): add 'set_only_once' property to 'Create User Automatically' field 2026-03-09 11:12:12 +05:30
Smit Vora
56a073955a test: regional account correctly added to round off accounts 2026-03-09 06:19:42 +05:30
Smit Vora
5c6056e76b fix: use return value of get_round_off_applicable_accounts 2026-03-09 05:19:22 +05:30
diptanilsaha
bf38dea95f Merge pull request #53233 from frappe/pot_develop_2026-03-08 2026-03-08 22:56:51 +05:30
Sudharsanan11
ae9ff767fa feat(manufacturing): show disassembled qty in progress bar 2026-03-08 19:14:41 +05:30
Sudharsanan11
8027f5aafd fix(manufacturing): show returned qty in progress bar 2026-03-08 19:14:41 +05:30
frappe-pr-bot
cad6956935 chore: update POT file 2026-03-08 09:42:56 +00:00
ruthra kumar
d038ad2350 Merge pull request #53227 from ruthra-kumar/add_party_filter_on_comparison_report
refactor: party type and party filter for comparison report
2026-03-07 18:18:58 +05:30
ruthra kumar
b6f9c0844e refactor: party type and party filter for comparison report 2026-03-07 18:02:56 +05:30
diptanilsaha
f67cfc48e0 Merge pull request #53224 from diptanilsaha/missed_ta 2026-03-07 15:23:50 +05:30
diptanilsaha
56345f4354 refactor(book_appointment): type annotations for whitelisted methods 2026-03-07 15:00:34 +05:30
diptanilsaha
b51c59d20d refactor(templates): type annotations for whitelisted methods 2026-03-07 15:00:34 +05:30
diptanilsaha
decd9343ee refactor(call_log): type annotations for whitelisted methods 2026-03-07 15:00:34 +05:30
diptanilsaha
950bf682c3 refactor(support): type annotations for whitelisted methods 2026-03-07 15:00:34 +05:30
diptanilsaha
1f4d20413e refactor(serial_no): added missing type annotation on auto_fetch_serial_number 2026-03-07 15:00:34 +05:30
diptanilsaha
11a6db32ae refactor(leaderboard): type annotations for whitelisted methods 2026-03-07 15:00:34 +05:30
diptanilsaha
805fc807a9 refactor(work_order): added type annotations on cancel_stock_reservation_entries 2026-03-07 15:00:34 +05:30
diptanilsaha
b4fb74c84d refactor(asset): added type annotations on get_depreciation_rate 2026-03-07 15:00:28 +05:30
diptanilsaha
ac351bce4b Merge pull request #53222 from frappe/l10n_develop 2026-03-07 14:55:12 +05:30
diptanilsaha
208112e7a9 refactor(payment_request): type annotations for whitelisted methods 2026-03-07 11:44:16 +05:30
diptanilsaha
616bae1f84 refactor: type annotations for whitelisted methods 2026-03-07 11:42:16 +05:30
diptanilsaha
573eb25d5b Merge pull request #53022 from diptanilsaha/crm_ta 2026-03-07 11:41:26 +05:30
diptanilsaha
8267482ee9 refactor(crm): type annotations for whitelisted methods 2026-03-07 03:00:54 +05:30
diptanilsaha
a1c378c16f Merge pull request #53032 from diptanilsaha/setup_ta 2026-03-07 02:29:29 +05:30
diptanilsaha
e6bebbfe81 test: added the currency key and fixed company 2026-03-07 02:05:54 +05:30
MochaMind
9358a122cd fix: Russian translations 2026-03-06 23:08:42 +05:30
rohitwaghchaure
3bd023d640 Merge pull request #53218 from rohitwaghchaure/fixed-item-creation-in-test-cases
fix: HRMS test cases failing due to validation in item
2026-03-06 17:54:36 +05:30
Rohit Waghchaure
6702506f58 fix: HRMS test cases failing due to validation in item 2026-03-06 17:35:12 +05:30
diptanilsaha
913ce9454e fix(consolidated_financial_statement): convert report to presentation_currency if valid filter is set 2026-03-06 16:04:28 +05:30
diptanilsaha
24f5fb7b44 fix(sales_order): set valid target.currency in make_purchase_order 2026-03-06 16:04:28 +05:30
diptanilsaha
6aaca38ce3 refactor(setup): type annotataions for whitelisted methods 2026-03-06 16:04:28 +05:30
diptanilsaha
fbdb3a1f48 Merge pull request #53031 from diptanilsaha/regional_ta 2026-03-06 15:54:05 +05:30
Shubh Doshi
d2e039ad4e fix: add type hints to whitelisted functions (#53210) 2026-03-06 08:27:01 +00:00
rohitwaghchaure
d6abbce4ec Merge pull request #53200 from rohitwaghchaure/fixed-stock-balance-report
fix: stock balance report qty
2026-03-06 12:43:55 +05:30
Poovitha Palanivelu
194d060f13 fix: update user status depends on employee status 2026-03-06 12:27:24 +05:30
rohitwaghchaure
f316229f9e Merge pull request #52549 from rohitwaghchaure/feat-option-to-enable-disable-serial-batch
feat: option to enable serial / batch feature
2026-03-06 12:17:11 +05:30
Rohit Waghchaure
a15e5fdc4e fix: stock balance report qty 2026-03-06 12:16:07 +05:30
Rohit Waghchaure
82c3da5b1e feat: option to enable serial / batch features 2026-03-06 11:47:53 +05:30
Soham Kulkarni
76d8e8fec9 Merge pull request #53177 from sokumon/add-clear-demo-data 2026-03-05 23:43:21 +05:30
Akhil Narang
702adda000 fix(help): escape query (#53192)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-03-05 13:06:09 +00:00
rohitwaghchaure
2bc3c146a6 Merge pull request #52956 from rohitwaghchaure/organization-desktop-icon
feat: organization desktop icon
2026-03-05 14:05:32 +05:30
rohitwaghchaure
ba05608ce6 Merge pull request #52745 from rohitwaghchaure/fixed-balance-qty-inv-dimension
fix: balance qty for inv dimension
2026-03-05 13:49:36 +05:30
Rohit Waghchaure
4e9a2a327f feat: organization desktop icon 2026-03-05 13:43:35 +05:30
rohitwaghchaure
06e0effbf7 Merge pull request #53170 from jacob-salvi/new-org-icon
chore: New org icon
2026-03-05 13:39:16 +05:30
Rohit Waghchaure
a3eafe5b18 fix: balance qty for inv dimension 2026-03-05 13:22:45 +05:30
Mihir Kandoi
50d6971d20 Merge pull request #53161 from mihir-kandoi/type-hint-issues 2026-03-05 12:06:26 +05:30
Nishka Gosalia
7e368c16b7 Merge pull request #52924 from nishkagosalia/projects-form-cleanup 2026-03-05 11:57:43 +05:30
Jatin3128
edac82f6e3 Merge pull request #52138 from aerele/payment-date-mismatch
feat(selling-settings): add checkbox to fetch payment terms
2026-03-05 11:48:43 +05:30
Nishka Gosalia
3c9f520e68 refactor: project module form cleanup 2026-03-05 11:40:22 +05:30
sokumon
6603005822 fix: add clear demo data in sidebar 2026-03-05 11:32:56 +05:30
Nishka Gosalia
15eb5d9827 Merge pull request #52415 from aerele/project-template-task-subject 2026-03-05 11:31:21 +05:30
ravibharathi656
7801dd5353 fix(task): allow is_template field in quick entry 2026-03-05 10:56:48 +05:30
ravibharathi656
c1431105f4 fix(project template): clear subject when task is empty 2026-03-05 10:56:48 +05:30
jacob-salvi
6f93210b9b chore: new organisation icon 2026-03-05 10:14:45 +05:30
SowmyaArunachalam
8aae46a25e test: test payment terms with backdated entries 2026-03-04 21:47:43 +05:30
SowmyaArunachalam
99ed1c34f3 fix: fetch payment terms from quotation 2026-03-04 21:47:41 +05:30
Mihir Kandoi
f07a6eb199 Merge pull request #53166 from mihir-kandoi/wo-producted-qty 2026-03-04 20:33:57 +05:30
Mihir Kandoi
5fead1d17a fix: WO produced qty should be calculated using finished item child table transfer qty 2026-03-04 20:17:37 +05:30
SowmyaArunachalam
8b9e02fd44 fix: set default to 1 2026-03-04 19:00:16 +05:30
SowmyaArunachalam
f23dc07914 fix: handle payment terms template when disabled 2026-03-04 19:00:15 +05:30
SowmyaArunachalam
5611e9168e test: enable automatically_fetch_payment_terms_from_quotation 2026-03-04 19:00:15 +05:30
SowmyaArunachalam
b1149fe950 fix: consider payment term only when enabled 2026-03-04 19:00:15 +05:30
SowmyaArunachalam
70b401e610 feat(selling-settings): add checkbox to recalculate payment date 2026-03-04 19:00:15 +05:30
Mihir Kandoi
58c198a58b Merge pull request #53157 from mihir-kandoi/gh53101 2026-03-04 16:51:09 +05:30
Khushi Rawat
f2decc852c Merge pull request #53154 from khushi8112/inter-company-asset-transfer-issue
fix: skip asset sale processing for internal transfer invoices
2026-03-04 16:36:03 +05:30
Mihir Kandoi
ee19c32c3a fix: disallow all actions on job card if work order is closed 2026-03-04 16:34:32 +05:30
Mihir Kandoi
74b658fabf fix: some type hints 2026-03-04 16:31:28 +05:30
ervishnucs
24825a16e0 fix: allow payment_request to be created in draft 2026-03-04 16:25:30 +05:30
Mihir Kandoi
083b571641 Merge pull request #53156 from nishkagosalia/st-61597 2026-03-04 16:12:24 +05:30
Nishka Gosalia
e37d4a6f7c fix: updating costing based on employee change in timesheet 2026-03-04 15:24:54 +05:30
khushi8112
9cb3dad079 fix: skip asset sale processing for internal transfer invoices 2026-03-04 14:20:14 +05:30
Mihir Kandoi
700c14d5b3 Merge pull request #53147 from nishkagosalia/gh-52102 2026-03-04 12:19:35 +05:30
Mihir Kandoi
c0148c7266 Merge pull request #53148 from mihir-kandoi/fg_completed_qty 2026-03-04 12:09:18 +05:30
Mihir Kandoi
2d83069b82 fix: do not update fg_completed_qty when changing qty of fg line item 2026-03-04 12:06:28 +05:30
Nishka Gosalia
2ec02e477f feat: allowing rate modification in update item in quotation 2026-03-04 10:54:51 +05:30
ruthra kumar
42ae954c16 Merge pull request #53005 from frappe/l10n_develop
fix: sync translations from crowdin
2026-03-04 10:45:47 +05:30
Mihir Kandoi
e3a55d31d3 Merge pull request #52784 from aerele/fix/support-#60042 2026-03-03 21:16:15 +05:30
Mihir Kandoi
767925a481 Merge pull request #53132 from aerele/fix/selling-price-validation 2026-03-03 21:09:30 +05:30
Mihir Kandoi
e970578c47 Merge pull request #53070 from aerele/rfq-email-template 2026-03-03 21:05:53 +05:30
kavin-114
723993fdf6 test: add unit test for FG Item selling price validation 2026-03-03 20:44:08 +05:30
kavin-114
4335318482 fix(selling): handle selling price validation for FG item
System checks valuation rate in incoming_rate field, since SO has it in valuation_rate field of item row,
need to handle the field name dynamically based upon the doctype name in Selling Controller.
2026-03-03 20:44:00 +05:30
Mihir Kandoi
17c715fde0 Merge pull request #53084 from aerele/fix/support-#61033 2026-03-03 20:40:31 +05:30
Mihir Kandoi
c76be620a8 Merge pull request #53037 from aerele/fix/qi-naming-rule-issue 2026-03-03 20:38:54 +05:30
Mihir Kandoi
2ce276df5b Merge pull request #53099 from aerele/fix/procurement-report-requestor-invalid 2026-03-03 20:38:10 +05:30
rohitwaghchaure
e1bad10e6c Merge pull request #53123 from rohitwaghchaure/fixed-status-of-serial-no
fix: serial no status for Disassemble entry
2026-03-03 18:53:35 +05:30
Shariq Ansari
93f2a8ad6b Merge pull request #53119 from shariquerik/erpnext-crm-fix 2026-03-03 03:42:52 -08:00
Rohit Waghchaure
81acefa8ad fix: serial no status for Disassemble entry 2026-03-03 17:11:53 +05:30
shariquerik
800810d23d fix: ensure contacts are processed only if present in create_prospect_against_crm_deal 2026-03-03 16:56:00 +05:30
diptanilsaha
a1124449c2 Merge pull request #53110 from diptanilsaha/pr_tt 2026-03-03 15:00:09 +05:30
diptanilsaha
6342e78305 refactor: renamed args to pricing_ctx in set_transaction_type for clarity 2026-03-03 14:42:11 +05:30
Vishnu Priya Baskaran
d2e04750b5 fix: avoid circular dependency (#53109) 2026-03-03 14:32:08 +05:30
diptanilsaha
7ec0354a79 fix(pricing_rule): strict validation of transaction_type 2026-03-03 14:08:49 +05:30
Ravibharathi
9a5b476d9c Merge pull request #51940 from aerele/accounts-receivable-payment-terms-template-filter 2026-03-03 11:27:31 +05:30
diptanilsaha
7ee08c9964 Merge pull request #53104 from frappe/ch-sec 2026-03-03 10:38:15 +05:30
diptanilsaha
b666d9d5c1 chore: update SECURITY.md 2026-03-03 10:36:54 +05:30
kavin-114
bdf4e51da3 fix: populate mr owner and set po owner as fallback 2026-03-02 23:40:40 +05:30
kavin-114
397de1274f fix: pass company in test case using make_quality_inspections 2026-03-02 22:50:21 +05:30
kavin-114
4c39cf2d65 test: add unit test to handle company condition in naming rule 2026-03-02 22:50:11 +05:30
rohitwaghchaure
260fc6a7ce Merge pull request #53093 from rohitwaghchaure/fixed-opening-qty-in-stock-balance
fix: opening qty in stock balance
2026-03-02 20:48:51 +05:30
Mihir Kandoi
c031e345db Merge pull request #52838 from Shllokkk/so-mr-po 2026-03-02 20:41:20 +05:30
Rohit Waghchaure
d7fdab99cb fix: opening qty in stock balance 2026-03-02 17:44:13 +05:30
Shllokkk
35d814c7b3 Merge branch 'develop' into so-mr-po 2026-03-02 16:43:13 +05:30
Shllokkk
91c6475f1c fix: update select query field in patch and code refactor 2026-03-02 16:25:02 +05:30
rohitwaghchaure
735631899f Merge pull request #53087 from aerele/perf/index-reference-purchase-receipt-column
perf: add index on reference_purchase_receipt column
2026-03-02 14:37:08 +05:30
rohitwaghchaure
868a7eb5ca Merge pull request #53082 from rohitwaghchaure/fixed-validate-warehouse-of-sabb
fix: validate warehouse of SABB for draft entry
2026-03-02 14:21:56 +05:30
kavin-114
8c94396ad9 perf: add index on reference_purchase_receipt column 2026-03-02 14:05:40 +05:30
rohitwaghchaure
47b08eaa41 Merge pull request #53072 from aerele/fix/support-#61417
fix(accounts): set posting time to get incoming rate
2026-03-02 13:45:49 +05:30
Rohit Waghchaure
9b8f685c82 fix: validate warehouse of SABB for draft entry 2026-03-02 13:41:20 +05:30
Sudharsanan11
c5b3673a30 fix(accounts): set posting time to get incoming rate 2026-03-02 13:21:25 +05:30
Sudharsanan11
9538a9870c fix(accounts): add transaction time field 2026-03-02 13:21:21 +05:30
Sudharsanan11
6b1aac4aee fix(manufacturing): ignore sales order validation for subassembly item 2026-03-02 12:26:55 +05:30
Diptanil Saha
066442c236 Merge pull request #53079 from diptanilsaha/bvr-validate-dimension 2026-03-02 12:00:37 +05:30
Navin-S-R
52dd7665e7 fix(gross-profit): apply precision-based rounding to grouped totals 2026-03-02 11:15:49 +05:30
diptanilsaha
79d0708ea7 fix(budget-variance-report): validate 'budget_against' filter 2026-03-02 11:04:35 +05:30
Nishka Gosalia
7b3d85c74e Merge pull request #53047 from trustedcomputer/fix-timesheet-table-read-only 2026-03-02 10:54:44 +05:30
rohitwaghchaure
733528a9f5 Merge pull request #53050 from rohitwaghchaure/fixed-incorrect-voucher-detail-no
fix: voucher detail no in SABB
2026-03-02 09:52:48 +05:30
Pugazhendhi Velu
49d363b174 fix: handle html email template separately in RFQ to avoid jinja context error 2026-03-01 18:21:09 +00:00
Rohit Waghchaure
c37a56ec89 fix: voucher detail no in SABB 2026-03-01 21:54:00 +05:30
Mihir Kandoi
1592229b24 Merge pull request #53067 from mihir-kandoi/correct-precision 2026-03-01 21:21:10 +05:30
Mihir Kandoi
36726b0f7b fix: use the correct precision value in stock reco 2026-03-01 20:48:33 +05:30
Mihir Kandoi
3fad5fb9b9 Merge pull request #53062 from Sanjesh2254/fix/sle-voucher-type-comparison 2026-03-01 20:46:01 +05:30
Sanjesh
cffb59ae73 fix: correct sle voucher_type comparison in get_ref_doctype 2026-03-01 16:31:53 +05:30
Mihir Kandoi
9563af9ae1 Merge pull request #53057 from mihir-kandoi/gh53003 2026-03-01 15:47:12 +05:30
Mihir Kandoi
e68d9af498 Merge pull request #53052 from mihir-kandoi/gh53035 2026-03-01 15:20:55 +05:30
Mihir Kandoi
04127019f9 fix: allow allowed roles to bypass over billing validation 2026-03-01 15:16:38 +05:30
Mihir Kandoi
81fd3c86f4 Merge pull request #53051 from mihir-kandoi/gh53049 2026-03-01 15:09:29 +05:30
Mihir Kandoi
30c3ff2efe fix: use stock qty instead of qty when creating stock entry from MR 2026-03-01 15:04:17 +05:30
Mihir Kandoi
5f12b0db3f fix: use conversion factor when creating stock entry from pick list 2026-03-01 14:53:27 +05:30
trustedcomputer
b9d95711a2 fix: remove read-only property from Sales Invoice Timesheet Table 2026-02-28 18:10:07 -08:00
MochaMind
86ade52dc6 fix: Spanish translations 2026-02-28 22:26:03 +05:30
kavin-114
74def423ed fix(stock): pass company to avoid document naming rule issue in QI
When a Document Naming Rule is configured in QI with a condition based on the company,
the system was not passing the company value properly. As a result, the naming rule
condition was skipped and the document name was generated using the default series.

This fix ensures that the company is passed correctly so that the configured
Document Naming Rule is evaluated and applied as expected.
2026-02-28 13:10:30 +05:30
rohitwaghchaure
061d2e45a9 Merge pull request #52988 from rohitwaghchaure/fixed-same-reposting-picked-by-multiple-jobs
fix: same reposting entry picked by multiple rq jobs
2026-02-28 07:35:44 +05:30
diptanilsaha
df6780bf1a refactor(regional): type annotataions for whitelisted methods 2026-02-28 02:52:03 +05:30
Khushi Rawat
6fc0ea02a1 Merge pull request #53004 from khushi8112/tax-rule-validation-query-builder
refactor: use query builder for Tax Rule validation query
2026-02-27 23:54:03 +05:30
MochaMind
81281d88c7 fix: Serbian (Cyrillic) translations 2026-02-27 22:21:42 +05:30
MochaMind
3dcdde83c7 fix: Serbian (Latin) translations 2026-02-27 22:21:36 +05:30
MochaMind
27381ae77b fix: Swedish translations 2026-02-27 22:21:32 +05:30
MochaMind
63fe68bf28 fix: Spanish translations 2026-02-27 22:21:25 +05:30
Diptanil Saha
6fbdcc3dd1 Merge pull request #53028 from diptanilsaha/qm_ta 2026-02-27 17:06:37 +05:30
ruthra kumar
8397b1ee4b Merge pull request #53027 from ruthra-kumar/remove_frappe_flags_from_dimension_filter
refactor: remove frappe.flags from accounting dimensions filter
2026-02-27 16:54:56 +05:30
Diptanil Saha
a5e4256491 Merge pull request #53026 from diptanilsaha/project_ta 2026-02-27 16:50:36 +05:30
diptanilsaha
eb2f986b11 refactor(quality_management): type annotations for whitelisted methods 2026-02-27 16:48:58 +05:30
Diptanil Saha
5bae06ae96 Merge pull request #53024 from diptanilsaha/maintenance_ta 2026-02-27 16:41:39 +05:30
Diptanil Saha
2712bc8661 Merge pull request #53023 from diptanilsaha/ref_erp_int 2026-02-27 16:40:49 +05:30
ruthra kumar
290f979fd3 refactor: remove frappe.flags from accounting dimensions filter 2026-02-27 16:37:27 +05:30
diptanilsaha
a22ea1de86 refactor(project): type annotations for whitelisted methods 2026-02-27 16:34:04 +05:30
diptanilsaha
13859dfb3c refactor(erpnext_integrations): type annotations for whitelisted methods 2026-02-27 16:19:40 +05:30
diptanilsaha
3078c4a451 fix: get_serial_nos_from_schedule return value 2026-02-27 16:11:45 +05:30
diptanilsaha
73f72bda42 refactor(maintenance): type annotations for whitelisted methods 2026-02-27 16:00:20 +05:30
rohitwaghchaure
aec400c12d Merge pull request #53013 from rohitwaghchaure/revert-stock-reco-issue
fix: old stock reco entries causing issue in the stock balance report
2026-02-27 14:56:07 +05:30
Rohit Waghchaure
0874cbc268 fix: old stock reco entries causing issue in the stock balance report 2026-02-27 14:09:15 +05:30
Mihir Kandoi
048608556c Merge pull request #53012 from thomasantony12/patch-2 2026-02-27 13:53:07 +05:30
Krishna Pramod Shirsath
66976c13e4 Merge branch 'develop' into feat/employee-creation-and-lifecycle 2026-02-27 13:10:24 +05:30
Diptanil Saha
397d806f0f Merge pull request #53014 from diptanilsaha/tb_ctb 2026-02-27 12:55:13 +05:30
Krishna Shirsath
124ec4d3c2 fix: add missing type hints to whitelisted function arguments 2026-02-27 12:53:44 +05:30
diptanilsaha
61e01aff67 fix(consolidated-trial=balance): total calculation with show_group_accounts and show_net_values filters 2026-02-27 12:26:20 +05:30
diptanilsaha
560c2511cc feat(consolidated-trial-balance): introduced show_net_values filter 2026-02-27 12:24:47 +05:30
diptanilsaha
f582fdbf71 fix(trial-balance): totals with filter show_group_accounts enabled 2026-02-27 12:21:56 +05:30
ruthra kumar
ffa6280431 Merge pull request #53011 from ruthra-kumar/remove_frappe_flags_from_acc_dimension
refactor: use cache decorator in accounting dimensions
2026-02-27 11:48:06 +05:30
ruthra kumar
565542879e refactor: remove frappe.flags and make use of cache decorator 2026-02-27 11:30:52 +05:30
Thomas antony
b33f06701c feat: UOM query filter for opportunity items
Add UOM query filter based on item code in opportunity form.
2026-02-27 11:11:28 +05:30
MochaMind
1811bb7643 fix: Serbian (Latin) translations 2026-02-26 22:23:42 +05:30
MochaMind
94ea72948e fix: Persian translations 2026-02-26 22:23:37 +05:30
MochaMind
cfda569af1 fix: Swedish translations 2026-02-26 22:23:29 +05:30
MochaMind
4b72ac7d22 fix: Spanish translations 2026-02-26 22:23:21 +05:30
khushi8112
235e3adbcb refactor: use query builder for Tax Rule validation query 2026-02-26 17:18:40 +05:30
Diptanil Saha
c57e452efd Merge pull request #52997 from diptanilsaha/pe-correct-precisions 2026-02-26 14:53:50 +05:30
Rohit Waghchaure
4dfbacfd92 fix: same reposting entry picked by multiple rq jobs 2026-02-26 14:34:39 +05:30
diptanilsaha
d82a0a9455 fix(payment_entry): fix precision for total_allocated_amount and base_total_allocated_amount
Co-authored-by: Ahuahuachi <Ahuahuachi@users.noreply.github.com>
2026-02-26 14:33:50 +05:30
ruthra kumar
c2ed02d4e4 Merge pull request #52630 from mendozal/fix-compute-tax-net-amount-in-js
fix(account): compute tax net_amount in JS controller
2026-02-26 13:47:27 +05:30
Luis Mendoza
b10b205394 fix(accounts): round and convert net_amount to company currency in JS tax controller 2026-02-26 08:09:53 +00:00
Luis Mendoza
485166b668 style: prettier formatting 2026-02-26 08:09:53 +00:00
Luis Mendoza
153ad99f85 fix(accounts): compute tax net_amount in JS controller 2026-02-26 08:09:53 +00:00
ruthra kumar
2d07b346de Merge pull request #52970 from ljain112/fix-missing-type-hint
fix: update type hint for party parameter to allow None in get_party_details and set_taxes functions
2026-02-26 13:32:43 +05:30
ruthra kumar
56732df641 Merge pull request #52188 from aerele/payment-entry-float-precision
fix(payment entry): round unallocated amount
2026-02-26 13:07:33 +05:30
Shllokkk
8c46e06e04 fix: correct get linked payments type hint in bank reconcilliation tool (#52982)
fix: correct type hint for bank reconcilliation tool
2026-02-26 12:41:40 +05:30
ravibharathi656
b0d6751777 fix(payment entry): round unallocated amount 2026-02-26 12:25:44 +05:30
rohitwaghchaure
5d46e1a7b1 Merge pull request #52983 from rohitwaghchaure/fixed-asset-broken-link
fix: broken link of docs in asset onboarding
2026-02-26 11:05:43 +05:30
Rohit Waghchaure
1cdf439e38 fix: broekn link of docs in asset onboarding 2026-02-26 10:47:56 +05:30
Mihir Kandoi
4c374e182d Merge pull request #52952 from nishkagosalia/gh-52947 2026-02-25 20:59:15 +05:30
Diptanil Saha
4c7175fad1 Merge pull request #52973 from ljain112/fix-fiscal-year
fix: ensure cache is cleared on fiscal year update and trash
2026-02-25 20:05:23 +05:30
ljain112
39b0e3522a fix: ensure cache is cleared on fiscal year update and trash 2026-02-25 19:27:52 +05:30
ljain112
f220960d91 fix: update type hint for party parameter to allow None in get_party_details and set_taxes functions 2026-02-25 18:01:24 +05:30
rohitwaghchaure
7ef187b1eb Merge pull request #52967 from rohitwaghchaure/patch-for-existing-records
fix: patch to complete onboarding stpes for existing records
2026-02-25 17:59:17 +05:30
Rohit Waghchaure
d90ec49241 fix: patch to complete onboarding stpes for existing records 2026-02-25 17:23:57 +05:30
rohitwaghchaure
2517369270 Merge pull request #52957 from rohitwaghchaure/fixed-parallel-reposting
fix: reposting creation slow for GL entries
2026-02-25 16:03:26 +05:30
Rohit Waghchaure
d9ac198bad fix: reposting creation slow for GL entries 2026-02-25 14:23:38 +05:30
ruthra kumar
cf09f725ca Merge pull request #52910 from Shllokkk/accounts-type-hints
refactor(accounts): add type hints for whitelisted functions
2026-02-25 13:25:31 +05:30
Krishna Shirsath
4f43f655cf feat(employee): Add birthdays and work anniversaries indicator in form ,list view enhancements and new empty state. 2026-02-25 13:21:06 +05:30
Nishka Gosalia
a37ffe6e2a Merge pull request #52948 from nishkagosalia/fix-type-hints 2026-02-25 13:12:13 +05:30
Nishka Gosalia
dd0bcf4dbd fix: type hint in stock 2026-02-25 12:54:10 +05:30
Nishka Gosalia
1d4c835843 fix: customer field made mandatory for sales invoice 2026-02-25 12:43:20 +05:30
Shllokkk
61661a159d fix: correct type hints 2026-02-25 12:30:52 +05:30
Mihir Kandoi
1e297a0e5f Merge pull request #52945 from mihir-kandoi/fix-item-link-formatter 2026-02-25 10:25:38 +05:30
Mihir Kandoi
9ef7f05712 fix: item code shows undefined 2026-02-25 10:19:10 +05:30
Mihir Kandoi
10257bbb6e Merge pull request #52942 from mihir-kandoi/gh52359 2026-02-25 10:12:45 +05:30
Mihir Kandoi
bd9e5e97d7 chore: clearer description for internal transfer at arms length 2026-02-25 09:57:13 +05:30
ruthra kumar
bf8b730259 Merge pull request #52940 from frappe/l10n_develop
fix: sync translations from crowdin
2026-02-25 08:49:47 +05:30
MochaMind
cecea63627 fix: Persian translations 2026-02-24 22:28:22 +05:30
MochaMind
d6888a32ae fix: Portuguese, Brazilian translations 2026-02-24 22:28:15 +05:30
MochaMind
1a6a16be5b fix: Swedish translations 2026-02-24 22:28:02 +05:30
MochaMind
dced32088c fix: Spanish translations 2026-02-24 22:27:22 +05:30
Khushi Rawat
bb7fdd59dc Merge pull request #52889 from khushi8112/default-print-format-and-letterhead
feat: default letterhead and print format
2026-02-24 21:21:36 +05:30
Mihir Kandoi
c2a1dbeb67 Merge pull request #52724 from ljain112/fix-subcontracting-ctrl 2026-02-24 20:37:09 +05:30
khushi8112
8a2cb96c2a fix: test cases related to default letterhead change 2026-02-24 19:56:25 +05:30
ruthra kumar
7aa3dbcd86 Merge pull request #51777 from Jatin3128/payment-request-schedules-feat
feat: making payment requests based on payment schedule
2026-02-24 18:38:16 +05:30
khushi8112
570f574758 test: debugging the issue 2026-02-24 18:24:16 +05:30
khushi8112
fbf5529ddd fix: add missing property_type 2026-02-24 18:24:16 +05:30
khushi8112
0ea22f9796 feat: default letterhead and print format 2026-02-24 18:24:16 +05:30
Harsh Patadia
bdcb2c1512 refactor: separate construction of chart related data from get_columns() (#52824)
* fix: avoid hardcoded column slicing for Profit & Loss chart data

* refactor: improve parameter naming and reduce code repetion by using same function get_period_columns()

* refactor: improved parameter naming in get_data() and get_chart_data()
2026-02-24 12:36:47 +00:00
Nishka Gosalia
ddb497acb5 Merge pull request #52834 from nishkagosalia/stock-type-hints 2026-02-24 17:34:04 +05:30
rohitwaghchaure
539d1a4e42 Merge pull request #52930 from rohitwaghchaure/fixed-removed-form-tour-
fix: remove form tour for sales and purchase order
2026-02-24 17:23:33 +05:30
Nishka Gosalia
13995a64b8 refactor(stock): adding type hint for stock module 2026-02-24 17:10:57 +05:30
Rohit Waghchaure
ed7315d78e fix: remove form tour for sales and purchase order 2026-02-24 17:00:02 +05:30
Diptanil Saha
9541cb226d Merge pull request #52029 from ljain112/fix-inclusive-discount 2026-02-24 16:58:12 +05:30
Khushi Rawat
dd910bb4cc Merge pull request #52927 from khushi8112/fix-taxes-and-totals-type-hint
fix: type hint for get_round_off_applicable_accounts
2026-02-24 15:57:47 +05:30
khushi8112
2f3ac06eff fix: type hint for get_round_off_applicable_accounts 2026-02-24 15:36:41 +05:30
Jatin3128
e476dff842 feat(payment request): create payment request as per payment schedules 2026-02-24 07:04:16 +00:00
Jatin3128
60108590b0 feat(payment_request): add option to calculate request amount using payment schedule 2026-02-24 07:04:16 +00:00
Shllokkk
f7ff61be5d refactor(accounts): add type hints for whitelisted functions 2026-02-24 12:30:44 +05:30
rohitwaghchaure
a15e2ecf78 Merge pull request #52839 from rohitwaghchaure/feat-user-onboarding
feat: module onboarding
2026-02-24 12:25:06 +05:30
ruthra kumar
4ba43a538e fix: unhide book_advance_payments_in_separate_party_account check fie… (#52363)
fix: unhide book_advance_payments_in_separate_party_account check field in Payment Entry doctype
2026-02-24 11:51:39 +05:30
Sowmya
d638f3e033 fix(sales-order): update quotation status while cancelling sales order (#52822)
* fix(sales-order): update quotation status while cancelling sales order

* test: validate quotation status

* chore: remove submit
2026-02-24 11:47:48 +05:30
Rohit Waghchaure
792a1a7ab7 feat: module onboarding 2026-02-24 11:45:31 +05:30
rohitwaghchaure
ced0c94e8e fix: sales and purchase modules forms clean-up (#52875) 2026-02-23 23:35:08 +05:30
Rohit Waghchaure
0e356dc2e3 fix: sales and purchase modules forms clean-up 2026-02-23 23:05:05 +05:30
ruthra kumar
99a5886f3a Merge pull request #52896 from aerele/skip-empty-dimensions-exc-gain-loss
fix: skip empty dimension values in exchange gain loss
2026-02-23 21:06:00 +05:30
Mihir Kandoi
e5e164c536 Merge pull request #52905 from frappe/mergify/bp/develop/pr-52544 2026-02-23 20:59:03 +05:30
Mihir Kandoi
bde15cb64b Merge pull request #52417 from Shllokkk/quality-procedure-fix 2026-02-23 20:52:40 +05:30
Imesha Sudasingha
ae3453c84b Merge pull request #52544 from one-highflyer/fix/improve-reserved-serial-no-error-message
fix(stock): improve error message when serial no is reserved via SRE

(cherry picked from commit 71248ff40b)
2026-02-23 15:12:56 +00:00
Mihir Kandoi
a0c8ac524b Merge pull request #52764 from aerele/populate_doctypes_to_be_ignored_table 2026-02-23 20:20:29 +05:30
Diptanil Saha
30e0285ae7 Merge pull request #52891 from diptanilsaha/notifs 2026-02-23 19:37:52 +05:30
Mihir Kandoi
2f635a1021 Merge pull request #52892 from mihir-kandoi/gh52864 2026-02-23 19:06:17 +05:30
Mihir Kandoi
9a253c4f54 Merge pull request #52878 from mihir-kandoi/gh52832 2026-02-23 18:48:45 +05:30
ruthra kumar
68144c5be2 Merge pull request #52812 from aerele/fix-clerance-details
fix: bank account mismatch error on reverse transaction reconciliation
2026-02-23 18:05:55 +05:30
ravibharathi656
7df9d951c6 fix: skip empty dimension values in exchange gain loss 2026-02-23 18:01:10 +05:30
Mihir Kandoi
db00860662 fix: link field displays incorrect value when empty 2026-02-23 17:50:24 +05:30
Mihir Kandoi
a85a0aef52 fix: standalone sales invoice return should not fallback to item master for valuation rate 2026-02-23 17:48:46 +05:30
diptanilsaha
3e87059939 fix: fiscal year notification subject 2026-02-23 17:43:36 +05:30
diptanilsaha
96aa37eff5 fix: material request on receive notification condition 2026-02-23 17:43:08 +05:30
Diptanil Saha
a8b538cc67 Merge pull request #50301 from Abdeali099/fixing-emp-contacts 2026-02-23 17:39:46 +05:30
l0gesh29
60d2f2d304 fix: populate doctypes to be ignored table in validate 2026-02-23 17:20:54 +05:30
Sudharsanan Ashok
8b2a971019 fix(manufacturing): remove delete query of job card & batch and serial no (#52840)
* fix(manufacturing): remove delete query of batch and serial no

* fix(manufacturing): remove delete query of job card

* fix: remove delete function call for work order
2026-02-23 16:58:13 +05:30
Khushi Rawat
9478ccca27 Merge pull request #52861 from khushi8112/print-format-sales-order-purchase-invoice
feat: standard print format for Sales Order and Purchase Invoice
2026-02-23 16:26:48 +05:30
Khushi Rawat
9198bc1b8f Merge pull request #52884 from khushi8112/update-modified-timestamp-in-json
fix: update modified timestamp in json
2026-02-23 16:07:03 +05:30
khushi8112
7b3c10769b fix: update modified timestamp in json 2026-02-23 15:42:57 +05:30
Mihir Kandoi
a2afabab79 Merge pull request #52880 from aerele/fix-support/60562 2026-02-23 15:33:33 +05:30
Khushi Rawat
5e5487faae Merge pull request #52879 from mahsem/typo_recon
fix: typo
2026-02-23 15:23:52 +05:30
mahsem
2b72aab671 fix: typo 2026-02-23 10:34:30 +01:00
Pandiyan37
b7f45e6963 fix(work_order): update returned qty 2026-02-23 15:04:21 +05:30
khushi8112
cbea4493c1 refactor: add translation and fix typo 2026-02-23 14:17:08 +05:30
khushi8112
371efce88a feat: standard print format for Sales Order and Purchase Invoice 2026-02-23 14:17:08 +05:30
Khushi Rawat
f133b96cb4 Merge pull request #52823 from khushi8112/type-hints-for-controllers
refactor: add type hints to controller functions
2026-02-23 14:13:19 +05:30
Mihir Kandoi
853090729a Merge pull request #52871 from mihir-kandoi/gh52856 2026-02-23 13:22:38 +05:30
khushi8112
3677609838 refactor: correct type hint for rm_items 2026-02-23 13:08:26 +05:30
Mihir Kandoi
8e14249335 fix: use stock qty instead of qty when updating transferred qty in WO 2026-02-23 13:02:04 +05:30
khushi8112
e088a596c7 fix: remove unnecessary guest access from get_period_date_ranges 2026-02-23 12:49:46 +05:30
khushi8112
021aa63e24 fix: incorrect type hint 2026-02-23 12:49:46 +05:30
khushi8112
7100d61f3c refactor: add type hints to controller functions 2026-02-23 12:49:46 +05:30
ruthra kumar
3584d2bf23 Merge pull request #52852 from frappe/l10n_develop
fix: sync translations from crowdin
2026-02-23 11:01:57 +05:30
Mihir Kandoi
60e96633c4 Merge pull request #52803 from aerele/fix/support-#60342 2026-02-23 07:30:39 +05:30
Sudharsanan11
cfbdfcf515 test(manufacturing): add test to validate the planned qty 2026-02-23 02:32:40 +05:30
Sudharsanan11
d58171987c test(stock): add test to validate company for receipts and expense accounts 2026-02-23 02:16:21 +05:30
Sudharsanan11
d54d0c25a2 fix: set company based expense account 2026-02-23 02:16:21 +05:30
Sudharsanan11
15dfc08a31 fix(stock): validate company for receipt documents and expense accounts 2026-02-23 02:16:16 +05:30
MochaMind
e2682d2690 fix: Esperanto translations 2026-02-22 22:08:55 +05:30
MochaMind
ad511755ec fix: French translations 2026-02-22 22:08:52 +05:30
MochaMind
d790c60a93 fix: Serbian (Latin) translations 2026-02-22 22:08:49 +05:30
MochaMind
f53ea90113 fix: Norwegian Bokmal translations 2026-02-22 22:08:45 +05:30
MochaMind
a4652e0d5f fix: Bosnian translations 2026-02-22 22:08:42 +05:30
MochaMind
da16cc1727 fix: Burmese translations 2026-02-22 22:08:39 +05:30
MochaMind
a8fe1e24b3 fix: Croatian translations 2026-02-22 22:08:36 +05:30
MochaMind
a24efc6e34 fix: Thai translations 2026-02-22 22:08:33 +05:30
MochaMind
61f6daf55e fix: Persian translations 2026-02-22 22:08:30 +05:30
MochaMind
ddc3842eb7 fix: Indonesian translations 2026-02-22 22:08:26 +05:30
MochaMind
ad7a52e2cb fix: Portuguese, Brazilian translations 2026-02-22 22:08:23 +05:30
MochaMind
589f1246cb fix: Vietnamese translations 2026-02-22 22:08:20 +05:30
MochaMind
cbb3bf6f6a fix: Chinese Simplified translations 2026-02-22 22:08:17 +05:30
MochaMind
3ce05fc0dc fix: Turkish translations 2026-02-22 22:08:13 +05:30
MochaMind
7388b051ed fix: Swedish translations 2026-02-22 22:08:10 +05:30
MochaMind
e4c4f1a0c2 fix: Serbian (Cyrillic) translations 2026-02-22 22:08:06 +05:30
MochaMind
d4f2ea3358 fix: Slovenian translations 2026-02-22 22:08:03 +05:30
MochaMind
d490b2a3c6 fix: Russian translations 2026-02-22 22:08:00 +05:30
MochaMind
8915df90ae fix: Portuguese translations 2026-02-22 22:07:57 +05:30
MochaMind
0ac09df5d9 fix: Polish translations 2026-02-22 22:07:53 +05:30
MochaMind
0f0f8bd64b fix: Dutch translations 2026-02-22 22:07:50 +05:30
MochaMind
3eb0d5fd73 fix: Italian translations 2026-02-22 22:07:46 +05:30
MochaMind
6f77a11522 fix: Hungarian translations 2026-02-22 22:07:43 +05:30
MochaMind
3f2603a34d fix: German translations 2026-02-22 22:07:40 +05:30
MochaMind
48fc867b7b fix: Danish translations 2026-02-22 22:07:37 +05:30
MochaMind
4674b5a207 fix: Czech translations 2026-02-22 22:07:34 +05:30
MochaMind
c2b8b8469d fix: Arabic translations 2026-02-22 22:07:31 +05:30
MochaMind
50daec2972 fix: Spanish translations 2026-02-22 22:07:28 +05:30
MochaMind
63defa40cb chore: update POT file (#52857) 2026-02-22 13:33:52 +01:00
MochaMind
f7830fddeb fix: Vietnamese translations 2026-02-21 21:47:16 +05:30
MochaMind
f65d50b7e4 fix: Swedish translations 2026-02-21 21:47:09 +05:30
MochaMind
dcd47223fa fix: Dutch translations 2026-02-21 21:46:52 +05:30
Diptanil Saha
d6531189f9 Merge pull request #52842 from diptanilsaha/ref-fy
refactor: `Fiscal Year` cleanup
2026-02-21 12:39:14 +05:30
Mihir Kandoi
b49adbd74c Merge pull request #52845 from mihir-kandoi/remove-supplier-invoice-date-validdation 2026-02-21 12:24:48 +05:30
diptanilsaha
4c76786ce4 fix(fiscal_year): Fiscal Year auto-generation and notification 2026-02-21 12:17:09 +05:30
Mihir Kandoi
7cff0ba626 fix: remove supplier invoice date/posting date validation 2026-02-21 12:08:37 +05:30
diptanilsaha
94fb7e11b4 fix(fiscal_year_company): made company field mandatory 2026-02-21 02:02:03 +05:30
diptanilsaha
74ac28fc70 refactor: Fiscal Year DocType cleanup 2026-02-21 01:58:45 +05:30
Shllokkk
d0323dea65 fix: add missing logic to update requested qty on cancel of a material request 2026-02-20 20:29:43 +05:30
Shllokkk
519e115eb2 Merge branch 'develop' into so-mr-po 2026-02-20 20:11:44 +05:30
Shllokkk
1a4d7ad937 fix: correct ordered_qty and requested_qty for Sales Order Item through a patch 2026-02-20 20:09:18 +05:30
Shllokkk
c2f19036f3 fix: correct fields being updated on material request and purchase order creation from sales order 2026-02-20 19:58:23 +05:30
Mihir Kandoi
969f01fca3 Merge pull request #52835 from mihir-kandoi/inconsistent-label-name 2026-02-20 16:58:15 +05:30
Mihir Kandoi
d6e1ca0f10 fix: inconsistent label name between parent and child 2026-02-20 16:40:32 +05:30
Mihir Kandoi
32d09acba9 Merge pull request #52825 from mihir-kandoi/gh52746 2026-02-20 14:23:40 +05:30
Mihir Kandoi
59492cf08e Merge pull request #52821 from mihir-kandoi/gh52770 2026-02-20 14:23:16 +05:30
ruthra kumar
9902473321 Merge pull request #52783 from frappe/l10n_develop
fix: sync translations from crowdin
2026-02-20 14:22:57 +05:30
Mihir Kandoi
ba96d37c11 fix: update items fetches wrong item code 2026-02-20 14:21:26 +05:30
Mihir Kandoi
1352dc79bb fix: sensible insufficient stock message in pick list 2026-02-20 10:29:07 +05:30
Mihir Kandoi
548cdb55d7 Merge pull request #52814 from Shllokkk/selling-type-hints
refactor(selling): add type hints to whitelisted function parameters
2026-02-19 23:07:49 +05:30
Mihir Kandoi
b2afda0462 Merge pull request #52781 from Shllokkk/buying-type-hints
refactor(buying): add type hints for whitelisted function parameters
2026-02-19 23:05:49 +05:30
Mihir Kandoi
866bca70f9 Merge pull request #52811 from nishkagosalia/gh-52373
fix: permission issue for quotation item during update item
2026-02-19 22:57:49 +05:30
Shllokkk
d3911cd7d8 fix: add missing type hints due to failing test case 2026-02-19 22:08:18 +05:30
Raffael Meyer
387fb1b202 feat: add Bank Transaction as Reference Type to Journal Entry Account (#52760)
* feat: add Bank Transaction as Reference Type to Journal Entry Account

* fix: take care of existing property setters

* fix: cancelling Bank Transactions should still be possible

* fix: handle blank options in patch

* fix: hide Reference Due Date for Bank Transaction
2026-02-19 16:20:12 +00:00
MochaMind
0ef15e6364 fix: Serbian (Latin) translations 2026-02-19 21:32:58 +05:30
MochaMind
6e95eebfa4 fix: Thai translations 2026-02-19 21:32:39 +05:30
MochaMind
a4175553fc fix: Swedish translations 2026-02-19 21:32:04 +05:30
MochaMind
b8d7bb2c08 fix: Serbian (Cyrillic) translations 2026-02-19 21:31:59 +05:30
Shllokkk
2504f0fc0c refactor(selling): add type hints to whitelisted function parameters 2026-02-19 20:39:05 +05:30
Mihir Kandoi
732c98b72f fix: typo 2026-02-19 20:28:33 +05:30
Mihir Kandoi
6342e9a3e2 fix: ignore permissions instead of saving parent 2026-02-19 20:27:54 +05:30
ervishnucs
8fe0bf4ba3 fix: check gl account of an associated bank account in bank transaction 2026-02-19 18:39:54 +05:30
Nishka Gosalia
58b8af0fa8 fix: permission issue for quotation item during update item 2026-02-19 17:16:06 +05:30
Krishna Shirsath
870254b710 refactor(employee): reorganize joining and employee exit tabs at the end. 2026-02-19 17:14:50 +05:30
Krishna Shirsath
6513185cb7 refactor(employee): create user function -removed useless function calls 2026-02-19 17:00:35 +05:30
Krishna Shirsath
57f3048d27 feat(employee): Add automatic user creation feature and related validations. Create User on Import. 2026-02-19 15:51:53 +05:30
diptanilsaha
fa5eae08a0 fix(test_purchase_order): validation to create pi from po with terms
Fixed the test to check for error while creating Purchase Invoice from unsubmitted Purchase Order
2026-02-19 14:44:15 +05:30
Mihir Kandoi
4561e3a389 Merge pull request #52804 from marcramser/patch-6
fix(Purchase Receipt): copy project from first row when adding items
2026-02-19 14:01:39 +05:30
Marc Ramser
21423676c9 fix(Purchase Receipt): copy project from first row when adding items
Adds `items_add` method to copy expense_account, cost_center and project from first row to newly added items, matching Purchase Invoice behavior.
2026-02-19 09:25:38 +01:00
Shllokkk
531112e364 refactor(buying): correct broken test case test_make_purchase_invoice_with_terms 2026-02-19 13:22:33 +05:30
Sudharsanan11
4d40c84a31 fix(manufacturing): update status for work order before calculating planned qty 2026-02-19 12:59:11 +05:30
Mihir Kandoi
fc54565d95 Merge pull request #52792 from mihir-kandoi/gh52782
fix: unable to submit subcontracting order if created from material r…
2026-02-19 11:09:17 +05:30
Mihir Kandoi
37323480dd fix: unable to submit subcontracting order if created from material request 2026-02-19 10:50:26 +05:30
Mihir Kandoi
29bc300282 Merge pull request #52794 from mihir-kandoi/sre-read-only
fix: reservation based on field should be read only in SRE
2026-02-19 10:39:36 +05:30
Mihir Kandoi
21452b4c6e fix: reservation based on field should be read only in SRE 2026-02-19 10:18:26 +05:30
Mihir Kandoi
c98e1454fc Merge pull request #52490 from thomasantony12/patch-1
fix: Add handling for Sales Invoice Item quantity field
2026-02-19 09:42:12 +05:30
Mihir Kandoi
1fc2eddf6f fix: add purchase invoice as well 2026-02-19 04:45:20 +05:30
Mihir Kandoi
024c268fe0 Merge pull request #52712 from mihir-kandoi/gh52710
fix: addresses portal
2026-02-19 04:39:35 +05:30
Shllokkk
85c8296548 fix: add missing type hints 2026-02-18 22:37:25 +05:30
MochaMind
b15716f65a fix: Persian translations 2026-02-18 20:27:11 +05:30
MochaMind
a6f5130db1 fix: Portuguese, Brazilian translations 2026-02-18 20:27:07 +05:30
MochaMind
37b9402214 fix: Swedish translations 2026-02-18 20:27:00 +05:30
ruthra kumar
390294a92b Merge pull request #52780 from ruthra-kumar/journal_entry_form_cleanup
refactor: Journal Entry form cleanup
2026-02-18 18:00:46 +05:30
Shllokkk
a6bb44b421 refactor(buying): add type hints for whitelisted function parameters 2026-02-18 17:50:19 +05:30
Khushi Rawat
d3ebcd85b4 Merge pull request #52776 from khushi8112/type-hint-for-projects-module
refactor(projects): add type hints to functions
2026-02-18 17:33:31 +05:30
ruthra kumar
73d5aa35a1 refactor: Journal Entry form cleanup 2026-02-18 17:26:19 +05:30
khushi8112
39d3f4580e refactor(projects): add type hints to functions 2026-02-18 17:13:39 +05:30
mergify[bot]
40391252d5 Merge branch 'develop' into fixing-emp-contacts 2026-02-18 10:47:34 +00:00
Mihir Kandoi
1f62cecdfd Merge pull request #52628 from aerele/fix/support-#59774
fix(manufacturing): set pick list purpose while creating it from work order
2026-02-18 15:14:50 +05:30
Mihir Kandoi
e5f138d004 Merge pull request #52771 from mihir-kandoi/type-hints-manufacturing 2026-02-18 14:16:57 +05:30
Sudharsanan11
23ccc2a8c5 fix(manufacturing): set pick list purpose while creating it from work order 2026-02-18 14:05:42 +05:30
Mihir Kandoi
fad53f6fe4 refactor(manufacturing): add args type hints to functions 2026-02-18 13:58:44 +05:30
Khushi Rawat
7f9066c05a Merge pull request #52734 from khushi8112/type-hint-for-asset-module
refactor(assets): add type annotations in asset module
2026-02-18 12:59:44 +05:30
khushi8112
eb17284711 fix: args must be wrapped under a ctx 2026-02-18 12:35:29 +05:30
MochaMind
e159fc2779 fix: sync translations from crowdin (#52748)
* fix: Portuguese, Brazilian translations

* fix: Persian translations
2026-02-18 12:30:22 +05:30
ruthra kumar
747595082d Merge pull request #52763 from ruthra-kumar/fix_payment_request_bug
fix: better permissions on make payment request
2026-02-18 12:28:06 +05:30
khushi8112
beffc016da refactor: Optimize asset depreciation schedule retrieval with type hints 2026-02-18 12:22:55 +05:30
Mihir Kandoi
f9ec45eda7 Merge pull request #52762 from mihir-kandoi/type-hints-subcontracting
refactor(subcontracting): add arg type hints to functions
2026-02-18 12:17:24 +05:30
Mihir Kandoi
1bc0b40a2e refactor(subcontracting): add arg type hints to functions 2026-02-18 12:01:24 +05:30
ruthra kumar
f36962fc58 fix: better permissions on make payment request 2026-02-18 11:54:53 +05:30
khushi8112
36dcf8b2a5 fix: type hint in make depreciation entry function 2026-02-18 11:33:12 +05:30
Mihir Kandoi
e317ab1479 fix: addresses portal 2026-02-18 11:15:32 +05:30
Diptanil Saha
ea04f55d12 Merge pull request #52759 from diptanilsaha/utils_ta
refactor(utilities): type annotations for whitelisted methods
2026-02-18 01:56:33 +05:30
diptanilsaha
cac6b65dee refactor(utilities): type annotations for whitelisted methods 2026-02-18 01:39:50 +05:30
Diptanil Saha
c6a292f6a9 fix: user permission on reports (#52709) 2026-02-17 21:56:25 +05:30
Mihir Kandoi
e6825476e7 Merge pull request #52750 from mihir-kandoi/st60110
fix: setup fails to set abbr to departments
2026-02-17 21:24:32 +05:30
Mihir Kandoi
54144f72a5 Merge pull request #52743 from Mutantpenguin/patch-3
bug: fix comparison regarding `None` values
2026-02-17 21:21:25 +05:30
Mihir Kandoi
debe868950 fix: setup fails to set abbr to departments 2026-02-17 21:07:30 +05:30
khushi8112
773cc80ed4 fix: incorrect type hint 2026-02-17 17:51:27 +05:30
Markus Lobedann
3fd5a0f100 fix: bug with comparison regarding None values and empty string
In their default state, the fields can be `None`. When a user enters something and deletes it afterwards, the fields contain an empty string.

This fixes the comparison.
2026-02-17 12:46:30 +01:00
rohitwaghchaure
83f5c03494 Merge pull request #52729 from rohitwaghchaure/feat-negative-batch-report
feat: Negative Batch report
2026-02-17 16:33:28 +05:30
Mihir Kandoi
eb0fa4d26d Merge pull request #52677 from mihir-kandoi/standalone-credit-debit-note
fix: standalone credit/debit notes should not fetch any serial or bat…
2026-02-17 16:09:47 +05:30
Mihir Kandoi
4f4bd98943 Merge pull request #52733 from mihir-kandoi/allow-sequence-id-edit
fix: allow sequence ID edit in BOM if routing is not set
2026-02-17 16:05:33 +05:30
Rohit Waghchaure
34edbed00b feat: Negative Batch report 2026-02-17 16:05:13 +05:30
khushi8112
84773a3a32 refactor(assets): add type annotations in asset module 2026-02-17 15:56:24 +05:30
Mihir Kandoi
08529964b4 fix: allow sequence id edit in BOM if routing is not set 2026-02-17 15:39:52 +05:30
ruthra kumar
2c011bb9ad Merge pull request #52679 from AarDG10/fix-acc-timeline
fix: log changes made to accounts settings
2026-02-17 13:55:24 +05:30
ruthra kumar
ee9ce0dee8 Merge pull request #52648 from Abdeali099/Abdeali/fix-typo
fix: correct typos in marketing campaign custom fields function
2026-02-17 13:41:40 +05:30
Krishna Shirsath
3b521b74ea feat(employee): Create User button and form. 2026-02-17 13:32:09 +05:30
ljain112
1d3d09f48c refactor: use postprocess in mapped_doc to update items in subcontracting controller 2026-02-17 13:16:41 +05:30
ruthra kumar
e8ef6f1afb Merge pull request #52654 from Jarif-Junaeed/develop
fix: resolve POS crash and correct is_return typo in TransactionBase
2026-02-17 13:10:29 +05:30
Mihir Kandoi
a374d0b3e7 Merge pull request #52720 from Shllokkk/pricing-rule-fix
fix: wrong display_depends_on condition for item group and brand chil…
2026-02-17 12:59:22 +05:30
Shllokkk
de2843d9f1 fix: wrong display_depends_on condition for item group and brand child tables 2026-02-17 12:28:15 +05:30
Vishnu Priya Baskaran
ae0be7f6ce Merge pull request #52649 from aerele/fix-sales-funnel-layout
fix: ensure layout has Bootstrap row and column
2026-02-17 12:25:15 +05:30
Mihir Kandoi
7860673855 Merge pull request #52716 from mihir-kandoi/gh52551
fix: do not allow plant floor company and warehouse to be updated
2026-02-17 12:11:53 +05:30
Mihir Kandoi
fd72132743 fix: do not allow plant floor company and warehouse to be updated 2026-02-17 11:54:12 +05:30
Mihir Kandoi
1eb9f5b803 Merge pull request #52713 from mihir-kandoi/st60127
fix: production plan status
2026-02-17 11:23:17 +05:30
Mihir Kandoi
b3e6b304e4 fix: production plan status 2026-02-17 10:43:47 +05:30
Diptanil Saha
c8c54a42e2 Merge pull request #52706 from diptanilsaha/wsb-pp
fix(selling-workspace-sidebar): changed order of pos profile
2026-02-17 00:40:33 +05:30
diptanilsaha
72f4fd08ee fix(selling-workspace-sidebar): changed order of pos profile 2026-02-17 00:23:01 +05:30
rohitwaghchaure
4defb104db Merge pull request #52620 from Shllokkk/production-plan-fix
fix: prevent rows from being added to sub_assembly_items and mr_items
2026-02-17 00:11:31 +05:30
Mihir Kandoi
48cafc8e57 Merge pull request #52626 from aerele/fix/support-#59888
fix(manufacturing): add sales order fields in subassembly child table
2026-02-16 23:41:16 +05:30
rohitwaghchaure
8adf8aed41 Merge pull request #52699 from rohitwaghchaure/fixed-negative-stock-validation-sle
fix: consider sle for negative stock validation
2026-02-16 23:25:52 +05:30
Sudharsanan11
341dc4be7a test(manufacturing): add test to validate the sales order references for sub assembly items 2026-02-16 23:21:35 +05:30
Sudharsanan11
0f2ed28ab7 fix(manufacturing): set sales order references in subassembly child table 2026-02-16 23:21:35 +05:30
Sudharsanan11
c2282eaf08 fix(manufacturing): add sales order fields in subassembly child table 2026-02-16 23:21:35 +05:30
Rohit Waghchaure
38f35acffe fix: consider sle for negative stock validation 2026-02-16 23:02:15 +05:30
Shllokkk
25f979a825 fix: prevent rows from being added to sub_assembly_items and mr_items 2026-02-16 22:33:36 +05:30
rohitwaghchaure
afa14e6cd4 Merge pull request #52678 from mihir-kandoi/sales-purchase-invoice-update-stock-cleanup
chore: do not show stock details if update stock is disabled
2026-02-16 22:31:25 +05:30
Diptanil Saha
802507d321 Merge pull request #52692 from frappe/l10n_develop
fix: sync translations from crowdin
2026-02-16 21:16:11 +05:30
rohitwaghchaure
12ff8e6279 Merge pull request #52691 from rohitwaghchaure/fixed-cancel-sabb-for-lcv
fix: cancel SABB if SLE cancelled from LCV
2026-02-16 21:11:38 +05:30
Soham Kulkarni
219cf6bc57 fix(pos_invoice): add correct depends on condition (#52689)
* fix(pos_invoice): add correct depends on condition

* fix: show field in sales order

* refactor: eval condition
2026-02-16 15:36:30 +00:00
MochaMind
a7ec72b25c fix: Esperanto translations 2026-02-16 20:22:05 +05:30
MochaMind
4bd3d4d36c fix: Serbian (Latin) translations 2026-02-16 20:22:01 +05:30
MochaMind
d425270c88 fix: Norwegian Bokmal translations 2026-02-16 20:21:57 +05:30
MochaMind
f8c8c1cc2d fix: Bosnian translations 2026-02-16 20:21:53 +05:30
MochaMind
cc02c411b6 fix: Burmese translations 2026-02-16 20:21:49 +05:30
MochaMind
65dd7d4851 fix: Croatian translations 2026-02-16 20:21:45 +05:30
MochaMind
47b80cbc2b fix: Thai translations 2026-02-16 20:21:39 +05:30
MochaMind
20d2317f61 fix: Persian translations 2026-02-16 20:21:35 +05:30
MochaMind
d2a4b8bfd8 fix: Indonesian translations 2026-02-16 20:21:30 +05:30
MochaMind
2b26d859c3 fix: Portuguese, Brazilian translations 2026-02-16 20:21:26 +05:30
MochaMind
3516cda350 fix: Vietnamese translations 2026-02-16 20:21:22 +05:30
MochaMind
4d51d0d351 fix: Chinese Simplified translations 2026-02-16 20:21:19 +05:30
MochaMind
303b7a117c fix: Turkish translations 2026-02-16 20:21:15 +05:30
MochaMind
83006a3ed1 fix: Swedish translations 2026-02-16 20:21:11 +05:30
MochaMind
b3e9fa2142 fix: Serbian (Cyrillic) translations 2026-02-16 20:21:07 +05:30
MochaMind
45d7a398b6 fix: Slovenian translations 2026-02-16 20:21:01 +05:30
MochaMind
ffb88c30b9 fix: Russian translations 2026-02-16 20:20:58 +05:30
MochaMind
40fd9a8008 fix: Portuguese translations 2026-02-16 20:20:53 +05:30
MochaMind
eb357a2805 fix: Polish translations 2026-02-16 20:20:48 +05:30
MochaMind
fd2cadd431 fix: Dutch translations 2026-02-16 20:20:44 +05:30
MochaMind
e66bbe4eec fix: Italian translations 2026-02-16 20:20:40 +05:30
Rohit Waghchaure
f23a49a25e fix: cancel SABB if SLE cancelled from LCV 2026-02-16 20:20:39 +05:30
MochaMind
1c749c01cd fix: Hungarian translations 2026-02-16 20:20:37 +05:30
MochaMind
f95ff68c10 fix: German translations 2026-02-16 20:20:30 +05:30
MochaMind
5815a92273 fix: Danish translations 2026-02-16 20:20:26 +05:30
MochaMind
bb8d84e65e fix: Czech translations 2026-02-16 20:20:23 +05:30
MochaMind
c28020a1bd fix: Arabic translations 2026-02-16 20:20:19 +05:30
MochaMind
95b0ec70cb fix: Spanish translations 2026-02-16 20:20:15 +05:30
MochaMind
1c0f2e1fba fix: French translations 2026-02-16 20:20:11 +05:30
Khushi Rawat
83338675f9 Merge pull request #52331 from aerele/fix-validate-asset-category-accounts
fix(asset): validate depreciation when category has active depreciable assets
2026-02-16 17:45:18 +05:30
Khushi Rawat
a6f808702f Merge pull request #52688 from khushi8112/toggle-reference-doc
fix: toggle reference doc on asset_type change
2026-02-16 17:38:39 +05:30
khushi8112
8e71060931 fix: toggle reference doc on asset_type change 2026-02-16 17:28:51 +05:30
rohitwaghchaure
659112842e Merge pull request #52681 from rohitwaghchaure/fixed-better-validation-message-for-batch
fix: better validation for negative batch
2026-02-16 15:15:54 +05:30
Rohit Waghchaure
a8636e4f59 fix: better validation for negative batch 2026-02-16 13:06:11 +05:30
AarDG10
45febbabd7 fix: log changes made to accounts settings 2026-02-15 23:18:49 +05:30
Mihir Kandoi
cdc62e7327 chore: do not show serial batch selector if not needed 2026-02-15 21:09:04 +05:30
Mihir Kandoi
4499e974a0 chore: do not show stock details if update stock is disabled 2026-02-15 20:54:44 +05:30
Mihir Kandoi
2017edca88 fix: standalone credit/debit notes should not fetch any serial or batch by default 2026-02-15 20:29:57 +05:30
MochaMind
894771029c chore: update POT file (#52673) 2026-02-15 14:00:17 +01:00
Mihir Kandoi
bdf909e94e Merge pull request #52670 from mihir-kandoi/st59534
fix: total weight does not update when updating items
2026-02-15 14:14:11 +05:30
Mihir Kandoi
63323a2611 fix: total weight does not update when updating items 2026-02-15 13:58:32 +05:30
Mihir Kandoi
36393e447e Merge pull request #52658 from aerele/fix-filter-for-update-items
fix: allow non-stock items while updating items
2026-02-15 12:57:39 +05:30
Diptanil Saha
fe01206a73 Merge pull request #52666 from frappe/l10n_develop
fix: sync translations from crowdin
2026-02-15 11:29:26 +05:30
MochaMind
e766bb0cd7 fix: Burmese translations 2026-02-14 19:11:32 +05:30
MochaMind
53e3222935 fix: Persian translations 2026-02-14 19:11:29 +05:30
Jarif Junaeed
47353fbceb fix: resolve POS crash and correct is_return typo in TransactionBase 2026-02-14 14:08:57 +06:00
ruthra kumar
a23c2f2166 Merge pull request #52643 from aerele/quotation-lost-reason-detail
fix: consider table multiselect in delete transaction
2026-02-13 14:07:07 +05:30
ervishnucs
07db5941aa fix: allow non-stock items while updating items 2026-02-13 11:58:54 +05:30
ruthra kumar
dd9e1814b0 Merge pull request #52651 from frappe/l10n_develop
fix: sync translations from crowdin
2026-02-13 10:14:33 +05:30
MochaMind
0e262de96f fix: Spanish translations 2026-02-12 19:09:18 +05:30
Abdeali Chharchhoda
6b7fed7f59 fix: correct typos in marketing campaign custom fields function 2026-02-12 15:41:14 +05:30
ruthra kumar
7ba2ed6f3f Merge pull request #52644 from ruthra-kumar/use_query_builder_for_profitability_analysis
refactor: use query builder for profitability analysis
2026-02-12 14:24:04 +05:30
ruthra kumar
5e34325604 refactor: use query builder for profitability analysis 2026-02-12 14:08:27 +05:30
SowmyaArunachalam
9bb60405e7 fix: removed lost reason detail 2026-02-12 13:26:47 +05:30
SowmyaArunachalam
be3d2422a7 fix: consider table multiselect in delete transaction 2026-02-12 13:22:17 +05:30
Navin-S-R
bd9d9c3cc7 fix: validate depreciation accounts exist for all companies with depreciable assets 2026-02-12 13:08:19 +05:30
ruthra kumar
1218c0f518 Merge pull request #52640 from ruthra-kumar/use_query_builder_for_sales_person_commision
refactor: use query builder for sales person commission summary
2026-02-12 12:36:43 +05:30
ruthra kumar
7105e3fb69 refactor: use query builder for sales person commission summary 2026-02-12 12:19:51 +05:30
ruthra kumar
ae985c00e9 Merge pull request #52571 from belee-asp/fix/report-letterhead-hardcode
fix(stock): remove hardcoded letter_head from report
2026-02-12 11:48:58 +05:30
ruthra kumar
803c09a4ae Merge pull request #52619 from aerele/feat-show-formatted-currency-on-preview
feat: show formatted currency symbol on ledger preview
2026-02-12 11:28:21 +05:30
Navin-S-R
1b288682e8 chore: resolve conflicts 2026-02-12 11:13:46 +05:30
Navin-S-R
7d14833856 fix: handle duplicate acctount row for the same company 2026-02-12 11:13:46 +05:30
Navin-S-R
2c6054d51a fix(asset category): validate depreciation accounts when category has active depreciable assets 2026-02-12 11:13:46 +05:30
Navin-S-R
464e1929db fix(asset): validate depreciation accounts for depreciable asset upon creation 2026-02-12 11:13:46 +05:30
ruthra kumar
33d0e9559a Merge pull request #52507 from ruthra-kumar/toggle_for_utm_parameters
refactor: toggle for UTM parameters
2026-02-12 10:55:45 +05:30
ruthra kumar
20af546b26 refactor: better description on toggle 2026-02-12 10:38:50 +05:30
Diptanil Saha
7e99a1f4b0 Merge pull request #52625 from frappe/l10n_develop 2026-02-11 19:15:44 +05:30
MochaMind
2adde497c8 fix: Serbian (Latin) translations 2026-02-11 18:59:56 +05:30
MochaMind
97d6a35edc fix: Serbian (Cyrillic) translations 2026-02-11 18:59:32 +05:30
Navin-S-R
5c8cb1e7ec feat: show formatted currency symbol on ledger preview 2026-02-11 17:29:20 +05:30
ruthra kumar
d1217dfedd Merge pull request #52593 from ljain112/tds-report-columns
refactor: update labels for tax withholding reports columns to improve clarity
2026-02-10 18:12:09 +05:30
ruthra kumar
4ddb3c7a6c Merge pull request #52602 from frappe/l10n_develop2
fix: sync translations from crowdin
2026-02-10 18:11:22 +05:30
ruthra kumar
3ed7627ec3 Merge pull request #52017 from aerele/fix-gross-profit-return-period
fix(gross-profit): handle returns outside the given sale period
2026-02-10 18:10:30 +05:30
MochaMind
1b5d5c5be8 fix: Swedish translations 2026-02-10 17:54:26 +05:30
MochaMind
4946a13d45 fix: Italian translations 2026-02-10 17:54:05 +05:30
ruthra kumar
578783af8e refactor: utm analytics section delivery note 2026-02-10 14:36:55 +05:30
ruthra kumar
223d560b32 refactor: utm section in opportunity 2026-02-10 14:36:55 +05:30
ruthra kumar
71e8941285 refactor: utm analytics section in lead 2026-02-10 14:36:52 +05:30
ruthra kumar
7de0ca164d refactor: utm analytics section in pos profile 2026-02-10 14:24:59 +05:30
ruthra kumar
0bafa347a5 refactor: utm section pos invoice 2026-02-10 14:23:28 +05:30
ljain112
2cfdcc1af4 refactor: update labels for tax withholding reports columns to improve clarity 2026-02-10 12:54:46 +05:30
ruthra kumar
678d261f40 refactor: utm section in sales invoice 2026-02-10 11:59:17 +05:30
ruthra kumar
c00bf7df6a refactor: utm section in sales order 2026-02-10 11:56:32 +05:30
Navin-S-R
047b278791 fix(gross-profit): handle item group filters 2026-02-10 11:47:35 +05:30
ruthra kumar
aaf5f923b0 refactor: hide UTM parameters 2026-02-10 11:40:12 +05:30
Navin-S-R
fdfa7bc963 test: fix test assertions to use index-based totals 2026-02-10 11:29:58 +05:30
Navin-S-R
3ab978ab46 test: validate sales person wise gross profit 2026-02-10 11:29:58 +05:30
Navin-S-R
4da3d43013 test: validate return invoice profit and profit percentage 2026-02-10 11:29:58 +05:30
Navin-S-R
51709f032f fix: handle gross profit and percentage for return invoices 2026-02-10 11:29:58 +05:30
Navin-S-R
67d8223f73 fix(gross-profit): handle returns outside sale period 2026-02-10 11:29:57 +05:30
El-Shafei H.
da07f84e44 fix: Added a missing option to the currency field (#52528) 2026-02-10 02:14:06 +05:30
V Shankar
23a73c9cdb fix(map_current_doc): prevent mutation of query args in get_query (#52202) 2026-02-10 00:16:59 +05:30
Mihir Kandoi
7b197cbe1c Merge pull request #52527 from aerele/fix/support-59242
fix(stock): correct warehouse mapping for material issue
2026-02-09 21:05:56 +05:30
Roxxane
99cd29d88f fix(stock): remove hardcoded letter_head from report
The 'Incorrect Serial and Batch Bundle' report had a hardcoded
letter_head value of 'Test', preventing users from deleting a
Letter Head named 'Test' due to link check.

Standard reports should not reference specific Letter Head names.

Fixes #52569
2026-02-09 22:25:11 +08:00
Akhil Narang
0cf4c2ded5 Merge pull request #52559 from akhilnarang/drop-db-query-usage
refactor: drop usages of db_query
2026-02-09 18:52:04 +05:30
Diptanil Saha
271a982cb4 Merge pull request #52562 from frappe/l10n_develop2
fix: sync translations from crowdin
2026-02-09 17:49:10 +05:30
Pandiyan37
f22b9e297b fix(stock): inward stock for pick list test record 2026-02-09 17:45:50 +05:30
MochaMind
61d0863239 fix: Esperanto translations 2026-02-09 17:30:45 +05:30
MochaMind
803cc7c653 fix: Serbian (Latin) translations 2026-02-09 17:30:37 +05:30
MochaMind
b4341df44c fix: Norwegian Bokmal translations 2026-02-09 17:30:31 +05:30
MochaMind
4a77a8b840 fix: Bosnian translations 2026-02-09 17:30:27 +05:30
MochaMind
680117e97e fix: Burmese translations 2026-02-09 17:30:22 +05:30
MochaMind
4bab80faaa fix: Croatian translations 2026-02-09 17:30:11 +05:30
MochaMind
74a1707e3f fix: Thai translations 2026-02-09 17:30:01 +05:30
MochaMind
f145331ae5 fix: Persian translations 2026-02-09 17:29:57 +05:30
MochaMind
be5df6b2b7 fix: Indonesian translations 2026-02-09 17:29:53 +05:30
MochaMind
14a5ff2b54 fix: Portuguese, Brazilian translations 2026-02-09 17:29:48 +05:30
MochaMind
f585ddea71 fix: Vietnamese translations 2026-02-09 17:29:44 +05:30
MochaMind
958ba61f66 fix: Chinese Simplified translations 2026-02-09 17:29:40 +05:30
MochaMind
f7b18159a6 fix: Turkish translations 2026-02-09 17:29:37 +05:30
MochaMind
ae759481e1 fix: Swedish translations 2026-02-09 17:29:33 +05:30
MochaMind
c2bafcf83b fix: Serbian (Cyrillic) translations 2026-02-09 17:29:28 +05:30
MochaMind
04b5e1b3a0 fix: Slovenian translations 2026-02-09 17:29:24 +05:30
MochaMind
3207a9e642 fix: Russian translations 2026-02-09 17:29:19 +05:30
MochaMind
67e8286a57 fix: Portuguese translations 2026-02-09 17:29:14 +05:30
MochaMind
7c0c41f3de fix: Polish translations 2026-02-09 17:29:09 +05:30
MochaMind
c5da02dbd0 fix: Dutch translations 2026-02-09 17:29:05 +05:30
MochaMind
ee1ae88ecd fix: Italian translations 2026-02-09 17:29:01 +05:30
MochaMind
e7b8c257a3 fix: Hungarian translations 2026-02-09 17:28:57 +05:30
MochaMind
93078bcf0c fix: German translations 2026-02-09 17:28:54 +05:30
MochaMind
566072a17f fix: Danish translations 2026-02-09 17:28:50 +05:30
MochaMind
31191096ad fix: Czech translations 2026-02-09 17:28:46 +05:30
MochaMind
0975222e3a fix: Arabic translations 2026-02-09 17:28:42 +05:30
MochaMind
576279fa92 fix: Spanish translations 2026-02-09 17:28:38 +05:30
MochaMind
21eec60924 fix: French translations 2026-02-09 17:28:34 +05:30
Poojashree T R
e98b68c38f fix: validate asset movement transaction date (#52340)
* fix: validate asset transaction date

* fix: validate asset transaction date

* fix: add translation in validate_transaction_date

* test: test_movement_transaction_date

* fix: to ensure test reliability
2026-02-09 17:20:42 +05:30
Poojashree T R
155f6afb48 fix: set asset status as fully depreciated (#52309)
* fix: set asset status as fully depreciated

* test: test_is_fully_depreciated_asset_status

* fix: remove unused condition
2026-02-09 17:01:40 +05:30
Akhil Narang
1e45195ef9 refactor: drop usages of db_query
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-02-09 16:53:02 +05:30
rohitwaghchaure
3a2e4ff5e5 Merge pull request #52550 from rohitwaghchaure/feat-allow-negative-stock-for-batch
feat: allow negative stock for the batch item
2026-02-09 16:19:29 +05:30
Mihir Kandoi
b2a0d6559f Merge pull request #52501 from aerele/quotation-ordered-status-regression
fix(quotation): ignore zero ordered_qty
2026-02-09 16:08:22 +05:30
Pratik Badhe
22123dd955 fix: email campaign timeout issue (#51994)
* fix: email campaign timeout issue

* refactor: email campaign backend logic

* refactor: use sendmail instead of manually batching
2026-02-09 16:07:46 +05:30
Rohit Waghchaure
376ab0e346 feat: allow negative stock for the batch item 2026-02-09 15:04:19 +05:30
Pandiyan37
da0322e994 test(stock): add test to check from warehouse for issue type 2026-02-09 13:06:27 +05:30
rohitwaghchaure
479b44c610 Merge pull request #52516 from aerele/fix/support-#59057
fix(stock): ignore pos reserved batches for stock levels
2026-02-09 11:57:43 +05:30
Pandiyan37
a34e8c99cd fix(stock): set source warehouse for issue type 2026-02-09 10:58:50 +05:30
Mihir Kandoi
b8e1758dcf Merge pull request #52538 from mihir-kandoi/revert-gh52220
revert: "fix: allow sales invoice to be renamed"
2026-02-09 10:29:47 +05:30
Mihir Kandoi
2660907ac8 revert: "fix: allow sales invoice to be renamed"
This reverts commit 95fdbe55f9.
2026-02-09 10:13:23 +05:30
rohitwaghchaure
9f8c08fd18 Merge pull request #52534 from rohitwaghchaure/form-cleanup-supplier-form
refactor: supplier form cleanup
2026-02-09 09:36:32 +05:30
Sudharsanan11
47ac67f7a2 test(stock): add test to ignore pos reserved batches for stock levels 2026-02-08 23:28:06 +05:30
Jannat Patel
0cf9915698 fix: sync translations from crowdin (#52449)
* fix: French translations

* fix: Spanish translations

* fix: Arabic translations

* fix: Czech translations

* fix: Danish translations

* fix: German translations

* fix: Hungarian translations

* fix: Italian translations

* fix: Dutch translations

* fix: Polish translations

* fix: Portuguese translations

* fix: Russian translations

* fix: Slovenian translations

* fix: Serbian (Cyrillic) translations

* fix: Swedish translations

* fix: Turkish translations

* fix: Chinese Simplified translations

* fix: Vietnamese translations

* fix: Portuguese, Brazilian translations

* fix: Indonesian translations

* fix: Persian translations

* fix: Thai translations

* fix: Croatian translations

* fix: Burmese translations

* fix: Bosnian translations

* fix: Norwegian Bokmal translations

* fix: Serbian (Latin) translations

* fix: Esperanto translations

* fix: Serbian (Cyrillic) translations

* fix: Swedish translations

* fix: Croatian translations

* fix: Bosnian translations

* fix: Serbian (Latin) translations

* fix: Persian translations

* fix: Italian translations
2026-02-08 17:50:31 +01:00
MochaMind
dd1027f165 chore: update POT file (#52531) 2026-02-08 17:49:49 +01:00
Rohit Waghchaure
bd521d9089 refactor: supplier form cleanup 2026-02-08 20:37:57 +05:30
rohitwaghchaure
ebce5d2635 Merge pull request #52508 from rohitwaghchaure/form-cleanup-stock-manufacturing
refactor: form cleanup for stock and manufacturing doctypes
2026-02-08 20:21:46 +05:30
Sudharsanan11
277ba9cb79 fix(stock): ignore pos reserved batches for stock levels 2026-02-08 10:05:07 +05:30
Mihir Kandoi
86389b46e2 Merge pull request #52497 from aerele/fix/support-#59190
fix: add is_group filter for supplier_group and warehouse fields
2026-02-07 21:40:41 +05:30
Rohit Waghchaure
bf20ecca60 refactor: form cleanup for stock and manufacturing doctypes 2026-02-06 19:27:35 +05:30
ruthra kumar
8c960620cc Merge pull request #52504 from ruthra-kumar/ux_refactor_sales_order
refactor: form cleanup for sales order
2026-02-06 17:27:07 +05:30
Khushi Rawat
7be1c885cd Merge pull request #52393 from khushi8112/form-cleanup-assets
refactor: assets module form cleanup
2026-02-06 17:23:06 +05:30
ruthra kumar
3957df6511 Merge pull request #52495 from ruthra-kumar/ux_refactor_for_quotation
refactor: form cleanup for quotation
2026-02-06 17:13:19 +05:30
Sudharsanan11
a9829f5f7b fix(stock): add is group filter for warehouse fields 2026-02-06 17:05:24 +05:30
ruthra kumar
9db3fa1b65 refactor: form cleanup for quotation
1. use standard names for dimension section
2026-02-06 16:48:11 +05:30
ruthra kumar
93d1716eb5 refactor: form cleanup for sales order 2026-02-06 16:24:53 +05:30
khushi8112
4f59d580c4 chore: linters check 2026-02-06 16:22:44 +05:30
khushi8112
d1b81b96a5 fix: implement coderabbit suggested changes 2026-02-06 16:19:40 +05:30
khushi8112
9f7bfc0e36 refactor: asset repair UI changes 2026-02-06 16:19:40 +05:30
khushi8112
eb7932ed73 refactor: asset capitalization form cleanup 2026-02-06 16:19:40 +05:30
khushi8112
e8e8d233ab fix: test cases fixes related to new select box change 2026-02-06 16:19:40 +05:30
khushi8112
f2f509234b fix: test case 2026-02-06 16:19:40 +05:30
khushi8112
e90a3b5a56 fix(UI): improve asset action buttons group 2026-02-06 16:19:40 +05:30
khushi8112
c36fa5bdb6 fix: patch to migrate checkbox data into select 2026-02-06 16:19:40 +05:30
khushi8112
f7b9221324 refactor: use selectbox instead of checkboxes for asset type 2026-02-06 16:19:40 +05:30
khushi8112
4e7794bfc3 fix(UI): reposition fields for better UX 2026-02-06 16:19:40 +05:30
Mihir Kandoi
71ad323cb6 Merge pull request #52499 from nishkagosalia/fix-test-case 2026-02-06 15:58:48 +05:30
ravibharathi656
32ea37035e fix(quotation): ignore zero ordered_qty 2026-02-06 15:50:01 +05:30
Nishka Gosalia
81dceceb4f fix: test case 2026-02-06 15:42:15 +05:30
rohitwaghchaure
d02a85df50 Merge pull request #52494 from rohitwaghchaure/fixed-remove-lable-currency
fix: remove currency label for rounding adjustment
2026-02-06 13:30:24 +05:30
Rohit Waghchaure
000af2bc96 fix: remove currency label for rounding adjustment 2026-02-06 13:29:23 +05:30
Sudharsanan11
cfdc554a19 fix(buying): add supplier group link filters in field level 2026-02-06 13:12:04 +05:30
Khushi Rawat
6e744bcaa7 Merge pull request #52491 from khushi8112/asset-field-toggle-issue
fix: apply composite asset logic only in draft
2026-02-06 13:04:31 +05:30
khushi8112
ee501e884a fix: apply composite asset logic only in draft 2026-02-06 12:58:42 +05:30
Thomas antony
edfcaee99b fix: Add handling for Sales Invoice Item quantity field
Add handling for Sales Invoice Item quantity field
2026-02-06 12:48:15 +05:30
Mihir Kandoi
31ec3af164 Merge pull request #52219 from nishkagosalia/st-56775
fix: enabling skip delivery option for order type maintenance
2026-02-06 12:09:28 +05:30
Mihir Kandoi
70053fea8e Merge pull request #52000 from nishkagosalia/gh-51010
fix: Added validation for quality inspection in job card
2026-02-06 12:07:41 +05:30
Mihir Kandoi
ac9232d888 Merge pull request #52475 from mihir-kandoi/gh52358-2
fix: do not show update stock flag unneccessarily
2026-02-06 11:57:11 +05:30
Nishka Gosalia
1a22e3cb61 fix: enabling skip delivery option for order type maintenance 2026-02-06 11:53:09 +05:30
Diptanil Saha
57d14f695f refactor: global defaults (#52481)
* fix(global_defaults): set disable rounded total on POS Profiles

* fix: removed re-setting fields on toggle functions

* fix: removed property setter for print_hide
2026-02-06 10:18:07 +05:30
rohitwaghchaure
1415472674 Merge pull request #52476 from rohitwaghchaure/fixed-stock-reservation-for-fg
fix: stock reservation created against job card
2026-02-06 04:34:59 +05:30
Rohit Waghchaure
dca2cfd009 fix: stock reservation created against job card 2026-02-05 22:06:54 +05:30
Mihir Kandoi
5fb5b7b30e fix: do not show update stock flag unneccessarily 2026-02-05 20:45:46 +05:30
rohitwaghchaure
a632d5f313 Merge pull request #52469 from rohitwaghchaure/form-cleanup-master-doctypes
refactor: form cleanup for master doctypes related to stock module
2026-02-05 19:46:18 +05:30
rohitwaghchaure
4136ac26c4 Merge pull request #52467 from rohitwaghchaure/fixed-github-52466
fix: operation status and bom validation
2026-02-05 19:45:39 +05:30
Diptanil Saha
a67b548f44 fix(pos_profile): allow_partial_payment field description (#52470)
fix(pos_profile): allow_partial_payment field description
2026-02-05 13:07:40 +00:00
Nikhil Kothari
ef44528ba5 feat(accounts): expand Journal Entry Template to support dimensions and party (#51621)
* feat(accounts): expand Journal Entry Template to support dimensions and party

* fix: do not update standard row values
2026-02-05 18:24:26 +05:30
Rohit Waghchaure
6c49d5dc7d refactor: form cleanup for master doctypes related to stock module 2026-02-05 18:17:37 +05:30
Rohit Waghchaure
95baf953a8 fix: operation status and bom validation 2026-02-05 18:14:35 +05:30
rohitwaghchaure
c86e316670 Merge pull request #52459 from rohitwaghchaure/fixed-stock-reco-balance-value
fix: stock balance report issue
2026-02-05 14:49:22 +05:30
Rohit Waghchaure
7e584dd84a fix: stock balance report issue 2026-02-05 14:32:48 +05:30
Jatin3128
cb4e6ad825 Merge pull request #52438 from Jatin3128/fix-chart-label
fix(balance sheet): removed the extra labels from the chart
2026-02-05 13:23:55 +05:30
Deepesh Garg
4584893542 Merge pull request #52453 from deepeshgarg007/erpnext_form_cleanups_v1
fix: Currency fields label (Sales Invoice)
2026-02-05 13:10:53 +05:30
Mihir Kandoi
6b0fe32180 Merge pull request #52452 from mihir-kandoi/gh52451
fix: process loss error incorrectly thrown even when semi FG BOM does…
2026-02-05 12:57:22 +05:30
Deepesh Garg
e08fe10f31 fix: Currency fields label 2026-02-05 12:54:48 +05:30
Mihir Kandoi
99ddc36c26 fix: process loss error incorrectly thrown even when semi FG BOM does not have any process loss 2026-02-05 12:42:12 +05:30
Smit Vora
26854d8d42 Merge pull request #52360 from vorasmit/fix-calc-balance
fix: correctly calculate running balances for financial report
2026-02-05 12:23:09 +05:30
Diptanil Saha
1c5e36017c feat(pos): allow warehouse change configuration (#52437) 2026-02-05 12:00:42 +05:30
Mihir Kandoi
611f7d07c2 Merge pull request #52445 from mihir-kandoi/gh52444
fix: item code is tuple with operation id
2026-02-05 11:57:55 +05:30
Mihir Kandoi
481deee4b2 fix: item code is tuple with operation id 2026-02-05 11:42:52 +05:30
Deepesh Garg
116ea657cd Merge pull request #52399 from deepeshgarg007/erpnext_form_cleanups
refactor: Better organizing of the fields in various doctypes
2026-02-05 11:27:39 +05:30
Mihir Kandoi
e9befff0cb Merge pull request #52416 from aerele/fix/inventory-dimension-attribute
fix(stock): update target field attribute
2026-02-05 10:23:31 +05:30
Deepesh Garg
1770d92ea6 Merge branch 'develop' into erpnext_form_cleanups 2026-02-05 09:50:22 +05:30
Jatin3128
a64b5f2c5d fix(balance sheet): removed the extra labels from the chart 2026-02-05 05:02:46 +05:30
Diptanil Saha
812d7de7f7 fix: pos profile form cleanup (#52436) 2026-02-05 04:21:14 +05:30
Pandiyan37
21d0ee8db1 test(stock): testcase for different inventory dimension 2026-02-04 22:33:39 +05:30
Pandiyan37
14818b8311 Merge branch 'develop' of https://github.com/frappe/erpnext into fix/inventory-dimension-attribute 2026-02-04 22:09:09 +05:30
Mihir Kandoi
c9dbd58e7f Merge pull request #52427 from archielister/develop 2026-02-04 20:02:33 +05:30
rohitwaghchaure
e63ff83f24 Merge pull request #52422 from rohitwaghchaure/fixed-not-able-to-complete-jc
fix: not able to complete job card
2026-02-04 18:42:56 +05:30
rohitwaghchaure
d3e269a3d3 Merge pull request #52392 from rohitwaghchaure/form-cleanup-buying
refactor: Cleanup buying module related doctypes
2026-02-04 18:13:00 +05:30
ruthra kumar
b33a805702 Merge pull request #51990 from ruthra-kumar/security_fixes
refactor: use https over http while saving website link
2026-02-04 18:01:55 +05:30
Deepesh Garg
efc4c900f3 chore: linting issues 2026-02-04 17:55:06 +05:30
archielister
e4df0a393a fix for obtaining bom_no 2026-02-04 12:20:43 +00:00
ruthra kumar
a3bd73b9db Merge pull request #52419 from ruthra-kumar/plug_payment_request_vulnerability
fix: enfore permission on make_payment_request
2026-02-04 17:44:27 +05:30
ruthra kumar
8db29b0a81 refactor: patch partner_website for old data 2026-02-04 17:43:31 +05:30
ruthra kumar
8cf31548f2 refactor: scrub http and use https in sales partner 2026-02-04 17:43:29 +05:30
Deepesh Garg
3a91f6793f refactor: Add advance settings 2026-02-04 17:35:27 +05:30
Shllokkk
ced2f33a63 fix: correct link filter for processes child table procedure field 2026-02-04 17:22:19 +05:30
Deepesh Garg
954173d629 refactor: Add advance settings 2026-02-04 17:16:40 +05:30
Rohit Waghchaure
f3ea1863ae refactor: Cleanup buying module forms 2026-02-04 17:07:25 +05:30
Rohit Waghchaure
175fe9279c fix: not able to complete job card 2026-02-04 17:04:13 +05:30
Mihir Kandoi
3b45485351 Merge pull request #51773 from aerele/fix/production-analytics-report 2026-02-04 16:57:23 +05:30
ruthra kumar
b755ca12ca fix: enfore permission on make_payment_request 2026-02-04 16:54:51 +05:30
Deepesh Garg
0687e683f8 refactor: Add advance settings 2026-02-04 16:50:58 +05:30
Pandiyan37
7e08154217 fix(stock): update target field attribute 2026-02-04 15:19:56 +05:30
Deepesh Garg
a734f90920 fix: Add totals and base total section 2026-02-04 12:41:19 +05:30
Sudharsanan11
27091e5168 fix(manufacturing): fix chart period keys 2026-02-04 12:18:03 +05:30
Mihir Kandoi
3f8af9b3c9 Merge pull request #52383 from mihir-kandoi/fix-rate-comparison-3 2026-02-04 12:17:53 +05:30
Mihir Kandoi
e8d1e9d946 fix: return None instead of 0 if valuation rate is falsy 2026-02-04 12:02:14 +05:30
Deepesh Garg
6d64a6a1d1 Merge branch 'develop' of https://github.com/frappe/erpnext into erpnext_form_cleanups 2026-02-04 11:57:05 +05:30
Deepesh Garg
2f2e16fc33 refactor: Better organizing of the fields in various doctypes 2026-02-04 11:18:09 +05:30
Sudharsanan11
16f09141da fix(manufacturing): handle None value for actual_end_date 2026-02-04 11:14:47 +05:30
Diptanil Saha
036f64013d fix: remove customer_pos_id reference (#52396) 2026-02-04 10:47:56 +05:30
Jatin3128
51cfd6119f Merge pull request #51745 from elshafei-developer/fix-translate-report-Gross-Profit
fix(gross profit report): translate column Sales Invoice
2026-02-04 04:43:23 +05:30
ruthra kumar
b719a6c767 fix: group item wise tax details by tax row (#51898) 2026-02-03 21:08:01 +05:30
NaviN
6fde0a6261 fix: merge taxes in purchase receipt when get items from multiple purchase invoices (#51422)
* fix: merge taxes in purchase receipt when get items from multiple purchase invoices

* fix: make merge tax configurable

* chore: follow standard merge taxes method

* chore: follow standard merge taxes method
2026-02-03 21:03:14 +05:30
Mihir Kandoi
671726a3e4 Merge pull request #52259 from aerele/fix/support-#58787 2026-02-03 20:24:43 +05:30
Mihir Kandoi
f1b4fe12a2 fix: rate comparison in stock reco 2026-02-03 20:21:51 +05:30
Mihir Kandoi
4c4d8859f6 Merge pull request #52374 from aerele/fix/fetch-batch-valuation-rate-in-stock-recon 2026-02-03 20:17:12 +05:30
rohitwaghchaure
a3ba0a18c4 Merge pull request #52278 from aerele/feat/add-company-field-bin
feat(stock): add company field to Bin with migration patch
2026-02-03 20:10:44 +05:30
ruthra kumar
2e51e7fb78 Merge pull request #51651 from aerele/ppr-skip-ref-detail
fix: correct exchange gain loss in ppr
2026-02-03 20:05:19 +05:30
ruthra kumar
6387aebed8 Merge pull request #51558 from ili-ad/fix/postgres-customer-autoname
fix(postgres): avoid UNSIGNED cast in customer autoname
2026-02-03 19:48:49 +05:30
ruthra kumar
b478f0da89 Merge pull request #52314 from aerele/fix/journal-entry-exchange-rate-type
fix(journal-entry): normalize exchange rate to float
2026-02-03 19:47:00 +05:30
rohitwaghchaure
6d41e35242 Merge pull request #52375 from frappe/mergify/bp/develop/pr-52369
fix: zero valuation rate if returning from different warehouse (backport #52369)
2026-02-03 19:29:08 +05:30
Rohit Waghchaure
eb2119e292 fix: zero valuation rate if returning from different warehouse
(cherry picked from commit 28929df0e8)
2026-02-03 13:41:15 +00:00
kavin-114
c5df570262 fix(stock): fetch batch wise valuation rate in get_items 2026-02-03 18:36:18 +05:30
Smit Vora
12f8bb2937 test: further tests for query builder 2026-02-03 18:11:34 +05:30
ruthra kumar
7fd6278c18 Merge pull request #52320 from mendozal/fix-sales-tax-template-sidebar-link
fix: correct Sales Tax Template sidebar link to proper DocType
2026-02-03 17:35:14 +05:30
ruthra kumar
c90f77af44 Merge pull request #52279 from aerele/profit-loss-chart-xaxis
fix(profit and loss statement): exclude non period columns
2026-02-03 17:29:18 +05:30
rohitwaghchaure
c29bcbfed8 Merge pull request #52160 from aerele/support-57403
fix(stock): remove is_return condition on pos batch qty calculation
2026-02-03 16:41:09 +05:30
Smit Vora
a29710dc07 test: correct error message 2026-02-03 16:32:26 +05:30
Smit Vora
f45a5a63a7 test: revert original pcv setting 2026-02-03 16:30:05 +05:30
ruthra kumar
82aa32f74e Merge pull request #51997 from aerele/feat/add-partially-billed-status
Add partially billed status indicator
2026-02-03 16:28:24 +05:30
Shllokkk
5793322c30 fix: unhide book_advance_payments_in_separate_party_account check field in Payment Entry doctype 2026-02-03 16:26:35 +05:30
Smit Vora
61d8308e81 test: add tests for query builder 2026-02-03 16:18:27 +05:30
Smit Vora
b41c1858a3 fix: Period Closing Voucher doesn't exist for GL Entry 2026-02-03 16:03:14 +05:30
rohitwaghchaure
4a7d606099 Merge pull request #52338 from rohitwaghchaure/fixed-negative-stock-error-for-purchase-return
fix: negative stock for purchase return
2026-02-03 15:54:39 +05:30
Sudharsanan11
de8f8ef9f4 fix(stock): include subcontracting order qty while calculating the bin qty 2026-02-03 15:37:15 +05:30
Shllokkk
93a4b9d49f Merge pull request #52346 from Shllokkk/ux-fixes
fix: move company field to first position in sales invoice, purchase …
2026-02-03 15:34:33 +05:30
ruthra kumar
9160aeb30e Merge pull request #52339 from sokumon/rename-icons
chore: rename icons
2026-02-03 15:30:20 +05:30
Smit Vora
ee2f8d8ebc fix: correctly calculate running balances for financial report 2026-02-03 15:21:38 +05:30
sokumon
2d312bcfe8 chore: rename icons 2026-02-03 15:21:17 +05:30
ruthra kumar
3ee11307f1 Merge pull request #52345 from ruthra-kumar/ignore_svg
ci: skip svg
2026-02-03 15:19:40 +05:30
Shllokkk
8e9365eb3b fix: move company field to first position in sales invoice, purchase invoice, sales order, purchase order and journal entry 2026-02-03 15:04:39 +05:30
Rohit Waghchaure
77893933a2 fix: negative stock for purchase return 2026-02-03 15:02:59 +05:30
ruthra kumar
e565d2283e ci: skip svg 2026-02-03 14:59:52 +05:30
ruthra kumar
ff2f015d67 Merge pull request #52280 from aerele/fix/support-#57038
fix(stock): ignore packing slip while cancelling the sales invoice
2026-02-03 13:53:51 +05:30
Dharanidharan2813
be0040ddc7 fix(journal-entry): normalize exchange rate to float 2026-02-03 12:51:53 +05:30
kavin-114
12ec997027 test: add unit test case for pos reserved with return qty 2026-02-03 12:43:09 +05:30
Dharanidharan2813
7767000ccf feat(delivery-note): add status indicator when document is partially billed 2026-02-03 12:29:55 +05:30
Praveenkumar26-S
d54259c99c feat(stock): add company field to Bin with migration patch 2026-02-03 11:41:20 +05:30
Nishka Gosalia
46b4cf3add fix: Added validation for quality inspection in job card 2026-02-03 11:38:36 +05:30
ruthra kumar
42f2abf5ae Merge pull request #51655 from aerele/project-gross-margin-credit-note
fix: include credit notes in project gross margin calculation
2026-02-03 11:37:09 +05:30
Mihir Kandoi
dbbeca6308 Merge pull request #52184 from aerele/fix/support-#58126 2026-02-03 09:09:21 +05:30
Luis Mendoza
06a7c85c93 fix: correct Sales Tax Template sidebar link to proper DocType 2026-02-02 20:53:47 +00:00
Dharanidharan S
7a1c4a5ded fix: avoid duplicate taxes and charges rows in payment entry (#52178) 2026-02-03 00:56:02 +05:30
Apriliansyah Idris
6cc802147b fix: duplicate account number (Indonesia COA) (#52080) 2026-02-03 00:22:43 +05:30
Sudharsanan11
4d9412181c test(subcontracting): add test for consumed_qty calculation with similar finished goods 2026-02-02 22:52:30 +05:30
Sudharsanan11
0d372a62a1 fix(subcontracting): include item bom in supplied items grouping key 2026-02-02 22:51:33 +05:30
rohitwaghchaure
62a98a0504 Merge pull request #52303 from rohitwaghchaure/fixed-batch-selector-v16
fix: batch selector not working if Use Legacy (Client side) Reactivity disabled
2026-02-02 22:01:25 +05:30
Mihir Kandoi
135a433018 Merge pull request #52246 from mihir-kandoi/st58765 2026-02-02 15:14:22 +00:00
Mihir Kandoi
af6a1eb189 Merge pull request #52304 from mihir-kandoi/customer-contact-quotation 2026-02-02 20:15:59 +05:30
Mihir Kandoi
a8068b89ed Merge pull request #52281 from aerele/fix/stock-bal-report-opening 2026-02-02 20:06:53 +05:30
Mihir Kandoi
75b2c2c83d fix: populate contact fields when creating quotation from customer 2026-02-02 19:59:53 +05:30
Rohit Waghchaure
d1cba1073f fix: batch selector not working if Use Legacy (Client side) Reactivity disabled 2026-02-02 19:54:27 +05:30
Mihir Kandoi
c176af4fe3 Merge pull request #52286 from mihir-kandoi/reset-incoming-rate 2026-02-02 19:47:04 +05:30
Mihir Kandoi
2d6b43fd54 fix: reset incoming rate in selling controller if there are changes in item 2026-02-02 14:08:27 +05:30
ruthra kumar
20ce96e358 Merge pull request #52200 from Tom-1508/fix-journal-print-date
fix(accounts): correct date in Journal Auditing Voucher print format
2026-02-02 12:51:02 +05:30
Tamal Majumdar
43e2495df8 fix: journal auditing voucher print date to use posting_date 2026-02-02 12:42:38 +05:30
ruthra kumar
0e4c37bb6d Merge pull request #51692 from aerele/fix/payment-reconciliation-spelling
fix: correct spelling of Payment Reconciliation in Accounting
2026-02-02 12:39:33 +05:30
kavin-114
f3eb6c7078 fix(stock): add stock recon opening stock condition 2026-02-02 12:36:09 +05:30
nivithamerlin
35e53d28df fix: correct spelling of Payment Reconciliation in Accounting 2026-02-02 12:24:36 +05:30
ravibharathi656
6180e5eb53 fix(profit and loss statement): exclude non period columns 2026-02-02 12:05:45 +05:30
Sudharsanan11
c58887b44a fix(stock): ignore packing slip while cancelling the sales invoice 2026-02-02 11:59:42 +05:30
Mihir Kandoi
c7fd855092 Merge pull request #52274 from mihir-kandoi/over-order-quotation-test 2026-02-02 10:07:20 +05:30
Mihir Kandoi
53e58f6678 test: over ordering of quotation items 2026-02-02 09:51:09 +05:30
MochaMind
5ea7a91fe1 chore: update POT file (#52265) 2026-02-01 15:07:23 +01:00
Mihir Kandoi
200cefa0a5 Merge pull request #52253 from mihir-kandoi/st58854 2026-01-31 20:03:17 +05:30
Mihir Kandoi
f5d74b4572 Merge pull request #52252 from mihir-kandoi/item-report-view-blank 2026-01-31 19:50:51 +05:30
Mihir Kandoi
d9998a977c fix: make item name editable in RFQ 2026-01-31 19:47:51 +05:30
Mihir Kandoi
b24ae5e9a2 fix: better fix for aac39b2671 2026-01-31 19:42:27 +05:30
rohitwaghchaure
54d96bb761 Merge pull request #52232 from rohitwaghchaure/fixed-validate-repack-stock-entry
fix: validation when more than one FG items in repack stock entry
2026-01-31 12:46:02 +05:30
Rohit Waghchaure
6423ce2fa7 fix: validation when more than one FG items in repack stock entry 2026-01-31 12:30:18 +05:30
Mihir Kandoi
6066fef1c9 Merge pull request #52231 from UmakanthKaspa/fix/report-view-item-code 2026-01-30 22:15:40 +05:30
UmakanthKaspa
b20f57321f fix: item code not showing in report view 2026-01-30 14:13:34 +00:00
Mihir Kandoi
33b6fd408f Merge pull request #52222 from mihir-kandoi/st56549 2026-01-30 19:30:05 +05:30
Mihir Kandoi
36f1e3572c fix: test cases 2026-01-30 19:16:39 +05:30
Mihir Kandoi
4cc306d2d8 fix: validate over ordering of quotation 2026-01-30 18:36:24 +05:30
Mihir Kandoi
3e9a3c1185 Merge pull request #52226 from mihir-kandoi/failing-tests 2026-01-30 17:47:44 +05:30
Mihir Kandoi
d3f44a425c fix: failing test cases 2026-01-30 17:30:50 +05:30
Mihir Kandoi
058be326f0 Merge pull request #51433 from mihir-kandoi/naming-rule-based-on-posting-date 2026-01-30 17:10:50 +05:30
Mihir Kandoi
46b742cd4c Merge pull request #52223 from mihir-kandoi/gh52220 2026-01-30 17:02:10 +05:30
Mihir Kandoi
95fdbe55f9 fix: allow sales invoice to be renamed 2026-01-30 16:46:41 +05:30
Mihir Kandoi
fc8647d1da Merge pull request #52209 from mihir-kandoi/fix-precision-pr 2026-01-30 12:05:16 +05:30
Mihir Kandoi
f82f1da706 Merge pull request #52213 from mihir-kandoi/st58513 2026-01-30 11:58:53 +05:30
Mihir Kandoi
6e17ccf499 fix: hide close button on WO if WO is completed 2026-01-30 11:56:38 +05:30
Mihir Kandoi
40bfd08866 Merge pull request #52210 from mihir-kandoi/gh52189 2026-01-30 11:46:49 +05:30
Mihir Kandoi
89f6f0f46f fix(barcode): failing request when item has both batch and serial 2026-01-30 11:37:21 +05:30
Mihir Kandoi
838d245215 fix: add precision to rejected batch no qty calculation 2026-01-30 10:19:35 +05:30
Dany Robert
b565dd3da8 fix: missing depr_series causing error on jv creation (#52085) 2026-01-29 23:10:04 +05:30
Mihir Kandoi
e1b6ec340c Merge pull request #52201 from mihir-kandoi/gh52199 2026-01-29 21:42:29 +05:30
Mihir Kandoi
c38f884095 fix: hide item_wise_tax_details table from print 2026-01-29 21:25:39 +05:30
rohitwaghchaure
464560a949 Merge pull request #52190 from rohitwaghchaure/fixed-lead-time-calculation-for-fg
fix: lead time calculation for FG item
2026-01-29 17:58:44 +05:30
rohitwaghchaure
f7f2e73f79 Add Landed Cost Voucher Amount in Internal Purchase Receipt (#52158)
* fix(stock): set incoming_rate with lcv rate for internal purchase

* test: add unit test to check internal purchase with lcv
2026-01-29 17:32:13 +05:30
Rohit Waghchaure
646688c291 fix: lead time calculation for FG item 2026-01-29 17:30:22 +05:30
kavin-114
dd4fd89ef8 test: add unit test to check internal purchase with lcv 2026-01-29 16:48:39 +05:30
kavin-114
f0dccc3cd7 fix(stock): set incoming_rate with lcv rate for internal purchase 2026-01-29 16:48:32 +05:30
Mihir Kandoi
91b1df49a4 Merge pull request #52181 from mihir-kandoi/st58663 2026-01-29 15:30:29 +05:30
Mihir Kandoi
7f6f39f5e7 fix: js error if user does not have write permission for date field 2026-01-29 15:28:55 +05:30
Jacob Salvi
cdcf3fa593 refactor: new accounting icons (#52173)
* chore: new icons share-management

* chore: new accounting icons

* chore: trigger CI

---------

Co-authored-by: Soham Kulkarni <77533095+sokumon@users.noreply.github.com>
Co-authored-by: ruthra kumar <ruthra@erpnext.com>
2026-01-29 14:42:47 +05:30
jacob-salvi
728c678cf9 chore: new accounting icons 2026-01-29 11:47:57 +05:30
Diptanil Saha
e11ba21b42 fix(demo): removed toolbar eventlistener (#52171) 2026-01-29 05:57:12 +00:00
Mihir Kandoi
1a4ecba742 Merge pull request #52166 from mihir-kandoi/gh52113 2026-01-29 10:49:53 +05:30
Mihir Kandoi
4e19c7e8bd fix: production plan not considering planning datetime when creating WO 2026-01-29 10:16:06 +05:30
Aarol D'Souza
578b06e027 Merge pull request #52092 from AarDG10/fix-email-render-rfq
fix(RFQ): render email templates for preview and sending
2026-01-29 09:06:51 +05:30
kavin-114
2c19c1fd06 fix(stock): remove is_return condition on pos batch qty calculation 2026-01-29 02:17:20 +05:30
Soham Kulkarni
3d65db2ac3 feat: clear demo data from desktop screen (#52128) 2026-01-28 17:13:22 +05:30
rohitwaghchaure
fabc26bb69 Merge pull request #52007 from aerele/fix/set-zero-rate-for-expired-batch
Fix: Set Zero Rate for Standalone Credit Note with Expired Batch
2026-01-28 16:12:37 +05:30
mahsem
27226b1d82 chore: delete swedish 2024 chart of accounts template (#52032) 2026-01-28 15:09:48 +05:30
Mihir Kandoi
0dc804f9b4 Merge pull request #51961 from aerele/sales-order-project-dimensions 2026-01-27 21:53:39 +05:30
Mihir Kandoi
3192f3f011 Merge pull request #52084 from harrishragavan/fix/shipment-field-validation 2026-01-27 21:26:42 +05:30
harrishragavan
3c6eb9a531 fix(shipment): user contact validation to use full name 2026-01-27 20:52:26 +05:30
Soham Kulkarni
8dae178728 Merge pull request #52119 from sokumon/blue-icons 2026-01-27 20:43:51 +05:30
sokumon
6f9cd8c261 chore: change color of icons in accounting folders 2026-01-27 20:15:00 +05:30
ruthra kumar
d6189b8101 Merge pull request #51894 from ruthra-kumar/refactor_accounting_workspace
refactor: accounting workspace
2026-01-27 18:45:10 +05:30
Nikhil Kothari
48f4a44fb5 feat(accounts): retain filters when switching between financial statements (#51668) 2026-01-27 18:38:37 +05:30
ruthra kumar
f0332c4dc7 refactor: reuse icon for invoicing 2026-01-27 18:30:03 +05:30
NaviN
ec41f1b0f5 fix(asset capitalization): update total_asset_cost on asset capitalisation submission (#52077)
fix(asset capitalization): update total_asset_cost on asset capitalization submission
2026-01-27 18:04:04 +05:30
madelyngamble2
7e9647f3f0 fix: unable to split asset from capitalization (#52020)
* fix: Allow split asset from capitalized composite asset (fixes #52016)

* test: Add test case for splitting asset created via capitalization (fixes #52016)

* docs: Add docstring to before_submit method

* fix: Remove unused variable and fix UTF-8 encoding in asset files

* fix: Remove UTF-8 BOM from asset.py to fix linting

* fix: Fix test_split_asset_created_via_capitalization test parameters

* fix: Remove unused import create_item

* chore: remove unnecessary comments

Removed validation comments for composite asset capitalization in before_submit method.

---------

Co-authored-by: Khushi Rawat <142375893+khushi8112@users.noreply.github.com>
2026-01-27 17:46:58 +05:30
ruthra kumar
fb9656b975 refactor: rename Accounts to Accounting 2026-01-27 17:23:40 +05:30
Mihir Kandoi
1b6fe8498d Merge pull request #52106 from mihir-kandoi/gh34977 2026-01-27 16:27:14 +05:30
Mihir Kandoi
5eeebbde7f test: fix tests 2026-01-27 16:10:44 +05:30
ruthra kumar
f7abf9c1da refactor: link payments dashboard to sidebar 2026-01-27 15:52:57 +05:30
ruthra kumar
99406ccc15 refactor: payments dashboard 2026-01-27 15:52:57 +05:30
ruthra kumar
1295d7aa30 refactor: shed duplicates from invoicing sidebar 2026-01-27 15:52:57 +05:30
ruthra kumar
5a680d5037 refactor: reorder accounts setup sidebar 2026-01-27 15:52:57 +05:30
ruthra kumar
7528d42187 refactor: introduce setup icon and reorder 2026-01-27 15:52:57 +05:30
ruthra kumar
cbdc945287 refactor: payments sidebar and icon 2026-01-27 15:52:57 +05:30
ruthra kumar
faf0dcb102 chore: rename accounting to invoicing 2026-01-27 15:52:57 +05:30
ruthra kumar
5e02b4009e chore: remove accounting icon 2026-01-27 15:52:57 +05:30
ruthra kumar
8125f9035c refactor: invoicing icon 2026-01-27 15:52:57 +05:30
Vishnu Priya Baskaran
efa3973b77 fix: check the payment ledger entry has the dimension (#51823)
* fix: check the payment ledger entry has the dimension

* fix: add project in payment ledger entry
2026-01-27 15:45:33 +05:30
Mihir Kandoi
71371b0ba5 fix: show everything else besides other party specific item 2026-01-27 15:43:58 +05:30
SowmyaArunachalam
543b6e51c0 fix: handle parent level project change 2026-01-27 15:37:14 +05:30
kavin-114
3460a7efb5 test(credit-note): add unit test for zero valuation rate on expired batch 2026-01-27 15:13:46 +05:30
kavin-114
e78c750b4e fix(credit-note): set incoming rate as zero for expired batch 2026-01-27 15:13:34 +05:30
Dharanidharan S
d82c92a237 fix(accounts): correct base grand total and rounded total mismatch (#51739) 2026-01-27 14:08:16 +05:30
Mihir Kandoi
826cf66af8 Merge pull request #52088 from mihir-kandoi/gh51577 2026-01-27 12:19:58 +05:30
Mihir Kandoi
b49c679a50 fix: show message if image is removed from item description 2026-01-27 12:04:49 +05:30
NaviN
5f05714e9d fix(payment entry): update currency symbol (#51956) 2026-01-27 12:01:11 +05:30
AarDG10
37cdae2f34 ci: minor text correction 2026-01-27 11:59:18 +05:30
SowmyaArunachalam
3b27f49d79 chore: use frappe.model.set_value 2026-01-27 11:36:51 +05:30
AarDG10
525b3960e1 fix(RFQ): render email templates for preview and sending 2026-01-27 11:35:50 +05:30
kavin-114
04cdf88715 feat(credit-note): add checkbox to set valuation rate as zero for expired batch 2026-01-27 11:04:36 +05:30
V Shankar
f8f626975f fix(journal-entry): prevent submit failure due to double background queuing (#52083) 2026-01-27 11:00:38 +05:30
rohitwaghchaure
31c536e33f Merge pull request #52062 from rohitwaghchaure/fixed-github-52028
fix: not able to complete the job card
2026-01-26 23:14:20 +05:30
Mihir Kandoi
c1fef8269a Merge pull request #52064 from Shankarv19bcr/customer-auto-name-fix 2026-01-26 15:16:21 +05:30
Shankarv19bcr
e5ba0e6401 fix: strip whitespace in customer_name 2026-01-26 14:37:55 +05:30
Rohit Waghchaure
696ea68f86 fix: not able to complete the job card 2026-01-26 11:35:48 +05:30
MochaMind
71d00f5290 chore: update POT file (#52057) 2026-01-25 20:37:19 +01:00
Henning Wendtland
0fb37ad792 feat(Transaction Deletion Record): Editable "DocTypes To Delete" List with CSV import/export (#50592)
* feat: add editable DocTypes To Delete list with import/export

Add user control over transaction deletion with reviewable and reusable deletion templates.

- New "DocTypes To Delete" table allows users to review and customize what will be deleted before submission
- Import/Export CSV templates for reusability across environments
- Company field rule: only filter by company if field is specifically named "company", otherwise delete all records
- Child tables (istable=1) automatically excluded from selection
- "Remove Zero Counts" helper button to clean up list
- Backward compatible with existing deletion records

* refactor: improve Transaction Deletion Record code quality

- Remove unnecessary chatty comments from AI-generated code
- Add concise docstrings to all new methods
- Remove redundant @frappe.whitelist() decorators from internal methods
- Improve CSV import validation (header check, child table filtering)
- Add better error feedback with consolidated skip messages
- Reorder form fields: To Delete list now appears before Excluded list
- Add conditional visibility for Summary table (legacy records only)
- Improve architectural clarity: single API entry point per feature

Technical improvements:
- export_to_delete_template_method and import_to_delete_template_method
  are now internal helpers without whitelist decorators
- CSV import now validates format and provides detailed skip reasons
- Summary table only shows for submitted records without To Delete list
- Maintains backward compatibility for existing deletion records

* fix: field order

* test: fix broken tests and add new ones

* fix: adapt create_transaction_deletion_request

* test: fix assertRaises trigger

* fix: conditionally execute Transaction Deletion pre-tasks based on selected DocTypes

* refactor: replace boolean task flags with status fields

* fix: remove UI comment

* fix: don't allow virtual doctype selection and improve protected Doctype List

* fix: replace outdated frappe.db.sql by frappe.qb

* feat: add support for multiple company fields

* fix: autofill comapny field, add docstrings, filter for company_field

* fix: add edge case handling for update_naming_series and add tests for prefix extraction

* fix: use redis for running deletion validation, check per doctype instead of company
2026-01-25 14:20:28 +05:30
rohitwaghchaure
88069779b2 Merge pull request #52050 from mahsem/swedish_address_template
fix: swedish_address_template
2026-01-25 10:51:39 +05:30
rohitwaghchaure
c5a4164a6b Merge pull request #52043 from rohitwaghchaure/fixed-uom-not-fetching-in-bom
fix: UOM of item not fetching in BOM
2026-01-25 10:44:28 +05:30
mahsem
334e8ada30 fix: swedish_address_template 2026-01-24 23:41:30 +01:00
Rohit Waghchaure
ba8eadda52 fix: UOM of item not fetching in BOM 2026-01-24 14:15:56 +05:30
Smit Vora
297a2ea259 Merge pull request #51691 from Abdeali099/do-not-warn-filter-missing 2026-01-24 12:37:45 +05:30
Smit Vora
e129e1438e Merge pull request #51670 from Abdeali099/fix-bank-quik-entry-erroe 2026-01-24 12:36:46 +05:30
HALFWARE
e810cd8440 fix: update country_wise_tax.json for Algerian Taxes (#51878)
* Algeria chart of accounts

Algeria chart of accounts

* Update Algeria Chart Of Account

* Algeria chart of account

* Algeria Chart of Account

Algeria Chart of Account

* Modify Algeria tax entries in country_wise_tax.json

Updated tax rates and account names for Algeria.

* Rename account for Algeria tax from VAT to TVA

Rename account for Algeria tax from VAT to TVA
2026-01-24 12:02:39 +05:30
El-Shafei H.
50b3396064 fix: Ensure paid_amount is always numeric before calling allocate_amount_to_references (#50935)
fix: ensure paid_amount is not null in allocate_party_amount_against_ref_docs
2026-01-24 11:47:38 +05:30
Abdeali Chharchhoda
9322095786 refactor: use console.error for error logging in Plaid integration 2026-01-24 11:34:34 +05:30
Abdeali Chharchhoda
8a1b8259bd fix: handle undefined bank_transaction_mapping in quick entry 2026-01-24 11:33:42 +05:30
Abdeali Chharchhoda
d905f78984 refactor: not warn when filter field is missing in FS reports 2026-01-24 11:21:17 +05:30
rohitwaghchaure
7250ee4429 Merge pull request #52024 from rohitwaghchaure/fixed-support-56966
fix: Bin reserved qty for production for extra material transfer
2026-01-23 21:13:20 +05:30
ljain112
2068299766 fix: prevent precision errors in discount distribution with inclusive tax 2026-01-23 20:30:07 +05:30
Rohit Waghchaure
f5378b6573 fix: Bin reserved qty for production for extra material transfer 2026-01-23 19:35:47 +05:30
Diptanil Saha
c4e35f1284 Merge pull request #51976 from diptanilsaha/gh_51348 2026-01-23 16:30:27 +05:30
Mihir Kandoi
6a9c0e22de Merge pull request #51999 from aerele/support/fix-58134 2026-01-23 14:03:26 +05:30
rohitwaghchaure
809b29fe90 Merge pull request #52006 from rohitwaghchaure/fixed-negative-stock-for-purchase-return
fix: negative stock for purchase return
2026-01-23 11:33:25 +05:30
Rohit Waghchaure
d68a04ad16 fix: negative stock for purchae return 2026-01-23 01:19:52 +05:30
rohitwaghchaure
6954811c55 Merge pull request #52003 from rohitwaghchaure/fixed-hide-stock-entry-button
fix: do not show stock entry button if timer is running
2026-01-22 23:56:54 +05:30
rohitwaghchaure
8cdc21c264 Merge pull request #51989 from aerele/fix/autofill-warehouse
fix: autofill warehouse for packed items
2026-01-22 22:57:16 +05:30
Rohit Waghchaure
466668c6b8 fix: do not show stock entry button if timer is running 2026-01-22 22:56:34 +05:30
MochaMind
e7e22c809e fix: sync translations from crowdin (#51913)
* fix: Arabic translations

* fix: Arabic translations

* fix: Arabic translations

* fix: Arabic translations
2026-01-22 13:52:18 +00:00
Bharathidhasan06
2606ca6fa9 fix(stock): use purchase UOM in Supplier Quotation items 2026-01-22 18:07:36 +05:30
diptanilsaha
54acaa2aec fix(payment_reconciliation): retain journal entry accounts child table order 2026-01-22 14:06:56 +05:30
Khushi Rawat
a030ea6fde Merge pull request #51756 from aerele/asset-repair
fix: disable asset repair when status is fully depreciated
2026-01-22 13:59:39 +05:30
Sudharsanan11
3f8a0a4833 fix: autofill warehouse for packed items 2026-01-22 12:54:51 +05:30
Mihir Kandoi
e5d25a7f04 Merge pull request #51908 from ljain112/fix-inward-subcontracting 2026-01-22 10:34:44 +05:30
Mihir Kandoi
40e86b6670 Merge pull request #51929 from ljain112/fix-subcontracting-inward-rm-rate 2026-01-22 10:31:53 +05:30
Mihir Kandoi
d0c9924c37 Merge pull request #51966 from aerele/customer-group-filters 2026-01-22 10:26:22 +05:30
Mihir Kandoi
ede4faa152 Merge pull request #51967 from aerele/project-update-naming-series 2026-01-22 10:22:31 +05:30
Mihir Kandoi
05cf1dcab8 Merge pull request #51968 from mihir-kandoi/gh51965 2026-01-21 22:50:22 +05:30
Mihir Kandoi
43a6dd5657 Merge pull request #51964 from mihir-kandoi/dont-show-dn-btn-if-not-reqd 2026-01-21 22:39:08 +05:30
Mihir Kandoi
343ee9695b fix: rejected qty in PR doesn't consider conversion factor 2026-01-21 22:33:24 +05:30
ravibharathi656
49e64f4e1c fix(project): add missing counter to project update naming series 2026-01-21 19:55:33 +05:30
SowmyaArunachalam
1e3db9f916 fix(customer): add customer group filters 2026-01-21 17:37:37 +05:30
Mihir Kandoi
70ec977cb2 fix: create DN btn should not be shown if it cannot be created 2026-01-21 17:13:35 +05:30
Mihir Kandoi
d6bbe43fa0 Merge pull request #51958 from mihir-kandoi/force-serial-batch-stock-reco 2026-01-21 16:23:18 +05:30
SowmyaArunachalam
9e51701e2a fix(sales order): set project at item level from parent 2026-01-21 16:11:04 +05:30
Mihir Kandoi
035b3cb61e fix: tests 2026-01-21 15:58:46 +05:30
Mihir Kandoi
97c36d1edc Merge pull request #51947 from mihir-kandoi/st57849 2026-01-21 15:46:38 +05:30
Mihir Kandoi
7170a1bd78 fix: force user to enter batch or serial for serial/batch items 2026-01-21 15:30:55 +05:30
Diptanil Saha
936f13eb20 ci: generate pot files for version-16-hotfix (#51954) 2026-01-21 14:37:21 +05:30
Mihir Kandoi
ed51db3217 Merge pull request #51948 from mihir-kandoi/st57735 2026-01-21 13:05:43 +05:30
Mihir Kandoi
5bacb67d36 fix: warehouse permissions in MR incorrectly ignored 2026-01-21 12:50:50 +05:30
Mihir Kandoi
c919b1de38 fix: job cards should not be deleted on close of WO 2026-01-21 11:46:00 +05:30
Mihir Kandoi
46ab5e8e46 Merge pull request #51934 from mihir-kandoi/st57619 2026-01-20 20:46:38 +05:30
Mihir Kandoi
3960c01798 fix: validation message in stock reco row idx 2026-01-20 20:30:10 +05:30
rohitwaghchaure
3c5071cefc Merge pull request #51930 from frappe/revert-51920-fixed-do-reposting-for-lcv
Revert "perf: prevent duplicate reposting for the same item"
2026-01-20 19:48:35 +05:30
rohitwaghchaure
6e4b90055f Revert "perf: prevent duplicate reposting for the same item" 2026-01-20 19:30:42 +05:30
ljain112
37ee560eae fix: calculate weighted average rate for customer provided items in subcontracting inward order 2026-01-20 18:48:59 +05:30
Mihir Kandoi
4b3000b071 Merge pull request #51909 from mihir-kandoi/gh51906 2026-01-20 17:44:23 +05:30
rohitwaghchaure
ad6cb177e3 Merge pull request #51920 from rohitwaghchaure/fixed-do-reposting-for-lcv
perf: prevent duplicate reposting for the same item
2026-01-20 17:38:15 +05:30
ljain112
d256365f4a fix: throw if item order field is not set in subcontracting controller 2026-01-20 17:33:01 +05:30
Diptanil Saha
05fea7f66f Merge pull request #51887 from diptanilsaha/bank_ac 2026-01-20 17:21:51 +05:30
Rohit Waghchaure
7535931571 perf: prevent duplicate reposting for the same item 2026-01-20 17:13:16 +05:30
Mihir Kandoi
27915c9ce2 Merge pull request #51914 from mihir-kandoi/st57262 2026-01-20 16:44:43 +05:30
ruthra kumar
93b131f48a Merge pull request #51671 from nikkothari22/advance-taxes-dimensions
fix(accounts): add missing accounting dimensions in advance taxes and charges
2026-01-20 16:36:16 +05:30
Nikhil Kothari
10d5463a40 Merge branch 'develop' into advance-taxes-dimensions 2026-01-20 16:19:08 +05:30
Mihir Kandoi
017cc9d9f9 fix: continuous raw material consumption with bom validation 2026-01-20 16:18:06 +05:30
Mihir Kandoi
b691de0147 fix: allow creation of DN in SI for items not having DN reference 2026-01-20 15:08:37 +05:30
rohitwaghchaure
beabbb1fa2 Merge pull request #51900 from rohitwaghchaure/fixed-github-49961
fix: validation to check at-least one raw material for manufacture entry
2026-01-20 13:54:48 +05:30
rohitwaghchaure
65c3020d1b Merge pull request #51899 from rohitwaghchaure/fixed-github-51401
feat: option to import serial / batches using csv for outward entry
2026-01-20 13:37:35 +05:30
Rohit Waghchaure
f003b3c378 fix: validation to check at-least one raw material for manufacture entry 2026-01-20 13:36:46 +05:30
Rohit Waghchaure
a268316322 feat: option to import serial / batches using csv for outward entry 2026-01-20 13:10:40 +05:30
ravibharathi656
57bd1facf5 fix: group item wise tax details by tax row 2026-01-20 12:31:30 +05:30
ravibharathi656
a378fee8e0 fix: include credit notes in project gross margin calculation 2026-01-20 08:47:58 +05:30
diptanilsaha
7532ab01d6 fix(bank_account): validation for is_company_account 2026-01-20 00:46:46 +05:30
Abdeali Chharchhoda
63d71ff90a Merge branch 'develop' into fixing-emp-contacts 2026-01-19 17:55:55 +05:30
Mihir Kandoi
e2c3d0fa94 test: add test case 2026-01-16 14:52:49 +05:30
Mihir Kandoi
b8d4522ea1 chore: make feature opt in 2026-01-16 14:00:42 +05:30
Mihir Kandoi
22fd1a1cfd feat: document naming rule will now use posting date of the document 2026-01-16 14:00:42 +05:30
SowmyaArunachalam
66fe1aa85d fix: disable asset repair when status is fully depreciated 2026-01-14 21:22:10 +05:30
jacob-salvi
a1192e34d7 chore: new icons share-management 2026-01-12 15:14:59 +05:30
elshafei-developer
3e39d13172 fix(gross profit report): translate column Sales Invoice 2026-01-12 06:56:13 +00:00
Nikhil Kothari
22e9cb4cf4 fix(accounts): add missing accounting dimensions in advance taxes and charges 2026-01-12 00:42:52 +05:30
Abdeali Chharchhoda
7c7ba0154a refactor: remove redundant onload function for bank mapping table 2026-01-12 00:23:02 +05:30
ravibharathi656
02e96039ac fix: correct exchange gain loss in ppr 2026-01-10 17:25:42 +05:30
Matt Howard
323636b396 fix(postgres): avoid UNSIGNED cast in customer autoname 2026-01-06 15:13:30 -05:00
Abdeali Chharchhoda
58cdb9503b refactor: method to get employee contact without permission check 2025-12-19 11:39:02 +05:30
Abdeali Chharchhoda
ec1eb6d222 refactor: use common method to get employee contacts 2025-12-18 18:48:09 +05:30
Abdeali Chharchhoda
7b89c12470 fix: get employee email with priority if preferred is not set 2025-12-18 18:41:31 +05:30
Abdeali Chharchhoda
b8e06b9636 refactor: add validation for missing employee parameter 2025-11-02 19:32:34 +05:30
Abdeali Chharchhoda
2ea6508fa5 refactor: fetch employee contact details in realtime 2025-11-01 20:18:52 +05:30
Abdeali Chharchhoda
a41297d841 feat: retrieve employee contact details 2025-11-01 19:18:23 +05:30
Abdeali Chharchhoda
4ad1474e32 feat: retrieve employee basic contact information 2025-11-01 17:55:09 +05:30
Abdeali Chharchhoda
87c59f471c chore: Removing unused import 2025-11-01 17:32:52 +05:30
1745 changed files with 532136 additions and 248926 deletions

View File

@@ -1,36 +1,70 @@
### Introduction (first timers)
### Introduction (For First-Time Contributors)
Thank you for your interest in raising an Issue with ERPNext. An Issue could mean a bug report or a request for a missing feature. By raising a bug report, you are contributing to the development of ERPNext and this is the first step of participating in the community. Bug reports are very helpful for developers as they quickly fix the issue before other users start facing it.
Thank you for your interest in raising an issue with ERPNext. An issue can be either a bug report or a feature request.
Feature requests are also a great way to take the product forward. New ideas can come in any user scenario and the issue list also acts a roadmap of future features.
By reporting bugs, you contribute directly to improving ERPNext. Bug reports help developers identify and fix issues quickly before they affect more users.
When you are raising an Issue, you should keep a few things in mind. Remember that the developer does not have access to your machine so you must give all the information you can while raising an Issue. If you are suggesting a feature, you should be very clear about what you want.
Feature requests are also valuable. They help shape the future of the product by introducing new ideas and improvements based on real-world use cases.
The Issue list is not the right place to ask a question or start a general discussion. If you want to do that , then the right place is the forum [https://discuss.frappe.io](https://discuss.frappe.io/c/erpnext/6).
When raising an issue, keep in mind that developers do not have access to your environment. Therefore, provide as much relevant information as possible.
If you are suggesting a feature, clearly describe what you expect and how it should behave.
> ⚠️ The issue tracker is not the right place for general questions or discussions.
> Please use the forum instead: https://discuss.frappe.io/c/erpnext/6
---
### Reply and Closing Policy
If your issue is not clear or does not meet the guidelines, then it will be closed. If it is closed, please supply the information asked and re-open it.
If your issue is unclear or does not meet the guidelines, it may be closed.
If that happens, please provide the requested information and reopen the issue.
---
### General Issue Guidelines
1. **Search existing Issues:** Before raising a Issue, search if it has been raised before. Maybe add a 👍 or give additional help by creating a mockup if it is not already created.
1. **Report each issue separately:** Don't club multiple, unreleated issues in one note.
1. **Brief:** Please don't include long explanations. Use screenshots and bullet points instead of descriptive paragraphs.
1. **Search existing issues:**
Before creating a new issue, check if it already exists. You can support existing issues with a 👍 or contribute additional details or mockups.
2. **Report issues separately:**
Do not combine multiple unrelated issues into a single report.
3. **Be concise:**
Avoid long explanations. Use bullet points and screenshots where possible.
---
### Bug Report Guidelines
1. **Steps to Reproduce:** The bug report must have a list of steps needed to reproduce a bug. If we cannot reproduce it, then we cannot solve it.
1. **Version Number:** Please add the version number in your report. Often a bug is fixed in the latest version
1. **Clear Title:** Add a clear subject to your bug report like "Unable to submit Purchase Order without Basic Rate" instead of just "Cannot Submit"
1. **Screenshots:** Screenshots are a great way of communicating issues. Try adding annotations or using LiceCAP to take a screencast in `gif`.
1. **Steps to reproduce:**
Clearly list the steps required to reproduce the issue. If the issue cannot be reproduced, it cannot be fixed.
2. **Version number:**
Include the ERPNext version. The issue may already be fixed in a newer release.
3. **Clear title:**
Use a descriptive title (e.g., "Unable to submit Purchase Order without Basic Rate" instead of "Cannot submit").
4. **Screenshots:**
Add screenshots or screen recordings (e.g., `.gif`) to illustrate the issue.
---
### Feature Request Guidelines
1. **Clarity:** Clearly specify how do you want the feature to behave. Don't just say "I would like multiple PDF formats", say that "Ability to add multiple print formats for customers with different languages".
1. **Solution:** Try and identify how the feature should look like.
1. **Mockups:** Mockups are a great way to explain your requirement.
1. **Clarity:**
Clearly describe the expected behavior. Avoid vague statements.
### What if my Issue is closed
2. **Proposed solution:**
Suggest how the feature should work.
Don't worry, take the feedback, supply the correct information and re-open it!
3. **Mockups:**
Provide mockups or examples whenever possible.
---
### What if my issue is closed?
Don't worry. Review the feedback, provide the required information, and reopen the issue.

View File

@@ -60,7 +60,7 @@ body:
description: Share exact version number of Frappe and ERPNext you are using.
placeholder: |
Frappe version -
ERPNext Verion -
ERPNext version -
validations:
required: true

View File

@@ -1,6 +1,6 @@
---
name: Feature request
about: Suggest an idea to improve ERPNext
about: Suggest an idea or enhancement for ERPNext
title: ''
labels: feature-request
assignees: ''
@@ -17,17 +17,21 @@ Welcome to ERPNext issue tracker! Before creating an issue, please heed the foll
3. When making a feature request, make sure to be as verbose as possible. The better you convey your message, the greater the drive to make it happen.
Please keep in mind that we get many many requests and we can't possibly work on all of them, we prioritize development based on the goals of the product and organization. Feature requests are still welcome as it helps us in research when we do decide to work on the requested feature.
Please keep in mind that we get many requests and we can't possibly work on all of them, we prioritize development based on the goals of the product and organization. Feature requests are still welcome as it helps us in research when we do decide to work on the requested feature.
If you're in urgent need to a feature, please try the following channels to get paid developments done quickly:
If you're in urgent need of a feature, please try the following channels to get paid developments done quickly:
1. Certified ERPNext partners: https://erpnext.com/partners
2. Developer community on ERPNext forums: https://discuss.frappe.io/c/framework/5
3. Telegram group for ERPNext/Frappe development work: https://t.me/erpnext_opps
-->
## Before Submitting
- [ ] I searched existing issues and confirmed this is not a duplicate
- [ ] This is a feature request, not a bug or support question
- [ ] For support: https://discuss.frappe.io/c/erpnext/6
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
A clear and concise description of what the problem is. Ex. As a [role], I have to [painful task] because [missing feature].
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
@@ -35,5 +39,17 @@ A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Impact**
<!-- Check one: -->
- [ ] Blocks critical workflow — no viable workaround
- [ ] Significant friction — workaround exists but is painful
- [ ] Nice to have — minor improvement
**Additional context**
Add any other context or screenshots about the feature request here.
**Environment**
- ERPNext Version: <!-- Find this in Help > About, e.g. v15.12.0 -->
- Frappe Version: <!-- Find this in Help > About, e.g. v15.10.0 -->
- Deployment: <!-- Frappe Cloud / Self-hosted / ERPNext Cloud -->

52
.github/helper/merge_po_files.py vendored Normal file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python3
"""Overlay develop's .po translations onto hotfix's .po files.
Called by sync_hotfix_translations.sh before `bench update-po-files`.
Merge rules:
a. msgid absent from develop → keep hotfix's existing msgstr
b. language not yet in hotfix → copy file as-is (bench will filter to main.pot)
c. msgid present in both → use develop's msgstr
"""
from datetime import datetime, timezone
from pathlib import Path
from babel.messages.pofile import read_po, write_po
DEVELOP = Path("/tmp/develop-po/erpnext/locale/")
LOCALE = Path("./apps/erpnext/erpnext/locale/")
added = updated = 0
for src in sorted(DEVELOP.glob("*.po")):
dst = LOCALE / src.name
with src.open("rb") as f:
dev = read_po(f)
if not dst.exists():
dev.revision_date = datetime.now(timezone.utc)
with dst.open("wb") as f:
write_po(f, dev)
added += 1
print(f" [new] {src.name}")
continue
with dst.open("rb") as f:
hf = read_po(f)
changes = 0
for msg in hf:
if msg.id and msg.id in dev and dev[msg.id].string and dev[msg.id].string != msg.string:
msg.string = dev[msg.id].string
changes += 1
if changes:
hf.revision_date = datetime.now(timezone.utc)
with dst.open("wb") as f:
write_po(f, hf)
updated += 1
print(f" [updated] {src.name} ({changes} msgstr(s) from develop)")
else:
print(f" [no-op] {src.name}")
print(f"\n{added} new language(s), {updated} updated.")

View File

@@ -0,0 +1,121 @@
#!/bin/bash
# Syncs Crowdin translations from develop to a hotfix branch.
# Merge logic: see merge_po_files.py.
# Env: GH_TOKEN, PR_REVIEWER, GITHUB_WORKSPACE, APP_NAME, GITHUB_REPOSITORY
# (all set by Actions).
set -e
HOTFIX_BRANCH="${HOTFIX_BRANCH:?HOTFIX_BRANCH env var is required}"
APP_NAME="${APP_NAME:?APP_NAME env var is required}"
cd ~ || exit
echo "=== Setting up bench ==="
pip install frappe-bench
bench -v init frappe-bench --skip-assets --skip-redis-config-generation --python "$(which python)"
cd ./frappe-bench || exit
bench get-app --skip-assets "${APP_NAME}" "${GITHUB_WORKSPACE}"
echo "=== Setting up sync_translations_${HOTFIX_BRANCH} branch ==="
cd "./apps/${APP_NAME}" || exit
git config user.email "developers@erpnext.com"
git config user.name "frappe-pr-bot"
git remote set-url upstream "https://github.com/${GITHUB_REPOSITORY}.git"
git config remote.upstream.fetch "+refs/heads/*:refs/remotes/upstream/*"
gh auth setup-git
git fetch upstream "${HOTFIX_BRANCH}"
if git ls-remote --exit-code --heads upstream "sync_translations_${HOTFIX_BRANCH}" >/dev/null 2>&1; then
git fetch upstream "sync_translations_${HOTFIX_BRANCH}"
git checkout -b "sync_translations_${HOTFIX_BRANCH}" "upstream/sync_translations_${HOTFIX_BRANCH}"
git merge -X theirs "upstream/${HOTFIX_BRANCH}" --no-edit
else
git checkout -b "sync_translations_${HOTFIX_BRANCH}" "upstream/${HOTFIX_BRANCH}"
fi
cd ../.. || exit
echo "=== Fetching develop's .po files ==="
mkdir -p /tmp/develop-po
git -C "${GITHUB_WORKSPACE}" fetch origin develop
git -C "${GITHUB_WORKSPACE}" archive origin/develop "${APP_NAME}/locale/" \
| tar -xf - -C /tmp/develop-po/
po_count=$(find "/tmp/develop-po/${APP_NAME}/locale" -name "*.po" | wc -l)
if [ "${po_count}" -eq 0 ]; then
echo "ERROR: No .po files found in develop's archive. Aborting." >&2
exit 1
fi
echo "Extracted ${po_count} .po file(s) from develop."
echo "=== Merging and reconciling ==="
env/bin/python "${GITHUB_WORKSPACE}/.github/helper/merge_po_files.py"
bench update-po-files --app "${APP_NAME}"
cd "./apps/${APP_NAME}" || exit
if git diff --quiet "${APP_NAME}/locale/" && [ -z "$(git ls-files --others --exclude-standard "${APP_NAME}/locale/")" ]; then
echo "Translations are already up to date. No PR needed."
exit 0
fi
echo "Changed files:"
git diff --name-only "${APP_NAME}/locale/"
git ls-files --others --exclude-standard "${APP_NAME}/locale/"
echo "=== Committing ==="
while IFS= read -r file; do
git add "${file}"
lang=$(basename "${file}" .po)
git commit -m "chore: add ${lang} translation to ${HOTFIX_BRANCH}"
done < <(git ls-files --others --exclude-standard "${APP_NAME}/locale/" | grep '\.po$' | sort)
while IFS= read -r file; do
git add "${file}"
if ! git diff --staged --quiet -- "${file}"; then
lang=$(basename "${file}" .po)
git commit -m "chore: sync ${lang} translation to ${HOTFIX_BRANCH}"
else
git restore --staged -- "${file}"
fi
done < <(git diff --name-only "${APP_NAME}/locale/" | grep '\.po$' | sort)
if git ls-remote --exit-code --heads upstream "sync_translations_${HOTFIX_BRANCH}" >/dev/null 2>&1; then
git fetch upstream "sync_translations_${HOTFIX_BRANCH}"
git merge -X ours "upstream/sync_translations_${HOTFIX_BRANCH}" --no-edit
fi
git push -u upstream sync_translations_${HOTFIX_BRANCH}
echo "=== Opening PR (if not already open) ==="
existing_pr=$(gh pr list \
--base "${HOTFIX_BRANCH}" \
--head "sync_translations_${HOTFIX_BRANCH}" \
--state open \
--json number \
--jq 'length' \
-R "${GITHUB_REPOSITORY}")
if [ "${existing_pr}" -gt 0 ]; then
echo "PR already open — branch updated in place. No new PR needed."
exit 0
fi
gh pr create \
--base "${HOTFIX_BRANCH}" \
--head "sync_translations_${HOTFIX_BRANCH}" \
--title "chore: sync translations to ${HOTFIX_BRANCH}" \
--body "Automated sync of Crowdin translations from \`develop\` to \`${HOTFIX_BRANCH}\`.
A 3-way merge is performed per language, then \`bench update-po-files\` reconciles each \`.po\` against hotfix's \`main.pot\`:
| Case | Condition | Result |
|------|-----------|--------|
| **a** | \`msgid\` in hotfix's \`main.pot\`, **not** in develop's \`.po\` | Hotfix's existing \`msgstr\` is **preserved** (string removed from develop but still needed in hotfix) |
| **b** | \`msgid\` **not** in hotfix's \`main.pot\` | **Dropped** from hotfix's \`.po\` |
| **c** | \`msgid\` in both hotfix's \`main.pot\` and develop's \`.po\` | Develop's \`msgstr\` is used (Crowdin translation wins) |
Generated by the \`sync-hotfix-translations\` workflow." \
--label "translation" \
--label "skip-release-notes" \
--reviewer "${PR_REVIEWER}" \
-R "${GITHUB_REPOSITORY}"

View File

@@ -0,0 +1,70 @@
name: Build and Upload Assets
on:
push:
branches:
- develop
- 'version-*'
concurrency:
group: build-assets-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build-assets:
name: Build JS/CSS and upload to release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: frappe/frappe
path: apps/frappe
ref: ${{ github.ref_name }}
- uses: actions/checkout@v4
with:
path: apps/erpnext
- name: Create bench structure
run: |
mkdir -p sites
printf "frappe\nerpnext\n" > sites/apps.txt
- uses: actions/setup-node@v4
with:
node-version: 24
cache: yarn
cache-dependency-path: apps/frappe/yarn.lock
- name: Install frappe JS dependencies
working-directory: apps/frappe
run: yarn install --frozen-lockfile
- name: Install erpnext JS dependencies
working-directory: apps/erpnext
run: yarn install --frozen-lockfile --ignore-scripts
- name: Link node_modules into public/
working-directory: apps/frappe
run: ln -s "$PWD/node_modules" frappe/public/node_modules
- name: Build assets (production)
working-directory: apps/frappe
run: yarn run production
- name: Package assets
working-directory: apps/erpnext
run: tar czf erpnext-assets.tar.gz -C ../../sites/assets/erpnext dist
- name: Upload to rolling release
working-directory: apps/erpnext
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="assets-${GITHUB_REF_NAME//\//-}"
gh release create "$TAG" --prerelease --title "Assets: $GITHUB_REF_NAME" --notes "" 2>/dev/null || true
gh release upload "$TAG" erpnext-assets.tar.gz --clobber

View File

@@ -15,4 +15,4 @@ jobs:
- name: curl
run: |
apk add curl bash
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.CI_PAT }}" https://api.github.com/repos/frappe/frappe_docker/actions/workflows/build_stable.yml/dispatches -d '{"ref":"main"}'
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.CI_PAT }}" https://api.github.com/repos/frappe/frappe_docker/actions/workflows/core-build-stable.yml/dispatches -d '{"ref":"main"}'

View File

@@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: ["develop"]
branch: ["develop", "version-16-hotfix"]
permissions:
contents: write

View File

@@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["14", "15", "16"]
version: ["15", "16"]
steps:
- uses: octokit/request-action@v2.x

View File

@@ -43,3 +43,6 @@ jobs:
- name: Run Semgrep rules
run: semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness
- name: Semgrep for Test Correctness
run: semgrep ci --include=**/test_*.py --config ./semgrep/test-correctness.yml

View File

@@ -0,0 +1,25 @@
name: Review translation PRs
description: "Posts review comments with relevant translation changes that are hard to inspect in the diff view."
on:
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- "**/*.po"
- "**/*.pot"
concurrency:
group: po-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
review-po-pr:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
issues: write
pull-requests: write
steps:
- uses: alyf-de/po-review-action@v1.0.0

View File

@@ -0,0 +1,52 @@
# Runner — maintain this file on each hotfix branch, not on develop.
#
# Fires when main.pot changes on this branch (i.e. after a POT update PR
# merges), or when dispatched by the orchestrator on develop (weekly schedule).
#
# Uses github.ref_name so the file is identical across all hotfix branches
# with no branch-specific edits required.
name: Run hotfix translation sync
on:
workflow_dispatch:
# One run at a time per branch. cancel-in-progress: false to avoid leaving
# an orphaned remote branch from a mid-flight git push + gh pr create.
concurrency:
group: sync-hotfix-translations-${{ github.ref_name }}
cancel-in-progress: false
jobs:
sync-translations:
name: Sync translations from develop into ${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
contents: write
env:
HOTFIX_BRANCH: ${{ github.ref_name }}
APP_NAME: ${{ github.event.repository.name }}
steps:
- name: Checkout ${{ env.HOTFIX_BRANCH }}
uses: actions/checkout@v6
with:
ref: ${{ env.HOTFIX_BRANCH }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
- name: Run sync script
run: |
bash "${GITHUB_WORKSPACE}/.github/helper/sync_hotfix_translations.sh"
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
PR_REVIEWER: diptanilsaha

View File

@@ -4,8 +4,8 @@ on:
workflow_dispatch:
concurrency:
group: server-individual-tests-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }}
cancel-in-progress: false
group: server-individual-tests-lightmode-develop
cancel-in-progress: true
permissions:
contents: read
@@ -21,7 +21,7 @@ jobs:
- id: set-matrix
run: |
# Use grep and find to get the list of test files
matrix=$(find . -path '*/doctype/*/test_*.py' | xargs grep -l 'def test_' | awk '{
matrix=$(find . -path '*/test_*.py' | xargs grep -l 'def test_' | sort | awk '{
# Remove ./ prefix, file extension, and replace / with .
gsub(/^\.\//, "", $0)
gsub(/\.py$/, "", $0)
@@ -58,6 +58,7 @@ jobs:
strategy:
fail-fast: false
matrix: ${{fromJson(needs.discover.outputs.matrix)}}
max-parallel: 14
name: Test
@@ -130,4 +131,13 @@ jobs:
FRAPPE_BRANCH: ${{ github.event.inputs.branch }}
- name: Run Tests
run: 'cd ~/frappe-bench/ && bench --site test_site run-tests --app erpnext --module ${{ matrix.test }}'
run: |
site_name=$(echo "${{matrix.test}}" | sed -e 's/.*\.\(test_.*$\)/\1/')
echo "$site_name"
mkdir ~/frappe-bench/sites/$site_name
cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config_mariadb.json" ~/frappe-bench/sites/$site_name/site_config.json
cd ~/frappe-bench/
bench --site $site_name reinstall --yes
bench --site $site_name set-config allow_tests true
bench --site $site_name run-tests --module ${{ matrix.test }} --lightmode

View File

@@ -7,6 +7,7 @@ on:
paths:
- "**.js"
- "**.css"
- "**.svg"
- "**.md"
- "**.html"
- 'crowdin.yml'

View File

@@ -41,6 +41,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
TZ: 'Asia/Kolkata'
NODE_ENV: "production"
WITH_COVERAGE: ${{ github.event_name != 'pull_request' }}
@@ -56,6 +57,7 @@ jobs:
mysql:
image: mariadb:10.6
env:
TZ: 'Asia/Kolkata'
MARIADB_ROOT_PASSWORD: 'root'
ports:
- 3306:3306
@@ -129,7 +131,7 @@ jobs:
FRAPPE_BRANCH: ${{ github.event.client_payload.sha || github.event.inputs.branch }}
- name: Run Tests
run: 'cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }} --with-coverage'
run: 'cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --lightmode --app erpnext --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }} --with-coverage'
env:
TYPE: server

View File

@@ -0,0 +1,40 @@
# Orchestrator — lives on develop only.
#
# Triggers on the weekly schedule and dispatches the runner workflow on each
# hotfix branch listed in the matrix. To add or remove a branch, edit the
# matrix below.
#
# POT-change triggers are handled by the runner on each hotfix branch
# (run-hotfix-translation-sync.yml), since GitHub only evaluates a workflow
# from the branch that receives the push.
name: Sync translations to hotfix branches
on:
schedule:
# 10:00 UTC Monday
- cron: "0 10 * * 1"
workflow_dispatch:
# The runner dispatch uses RELEASE_TOKEN (a PAT), not the default GITHUB_TOKEN,
# so no GITHUB_TOKEN permissions are required.
permissions: {}
jobs:
trigger-runners:
name: Trigger sync → ${{ matrix.hotfix_branch }}
runs-on: ubuntu-latest
strategy:
matrix:
hotfix_branch:
- version-16-hotfix
fail-fast: false
steps:
- name: Dispatch runner on ${{ matrix.hotfix_branch }}
run: |
gh workflow run run-hotfix-translation-sync.yml \
--repo "${{ github.repository }}" \
--ref "${{ matrix.hotfix_branch }}"
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}

4
.gitignore vendored
View File

@@ -19,3 +19,7 @@ node_modules/
.backportrc.json
# Aider AI Chat
.aider*
# Banking SPA
erpnext/public/banking
erpnext/www/banking.html

View File

@@ -7,17 +7,17 @@ erpnext/accounts/ @ruthra-kumar
erpnext/assets/ @khushi8112
erpnext/regional @ruthra-kumar
erpnext/selling @ruthra-kumar
erpnext/support/ @ruthra-kumar
erpnext/buying/ @rohitwaghchaure @mihir-kandoi
erpnext/maintenance/ @rohitwaghchaure
erpnext/maintenance/ @rohitwaghchaure @mihir-kandoi
erpnext/manufacturing/ @rohitwaghchaure @mihir-kandoi
erpnext/quality_management/ @rohitwaghchaure
erpnext/quality_management/ @rohitwaghchaure @mihir-kandoi
erpnext/stock/ @rohitwaghchaure @mihir-kandoi
erpnext/subcontracting @mihir-kandoi
erpnext/subcontracting/ @mihir-kandoi
erpnext/projects/ @nishkagosalia
erpnext/controllers/ @ruthra-kumar @rohitwaghchaure @mihir-kandoi
erpnext/patches/ @ruthra-kumar
erpnext/patches/ @ruthra-kumar @rohitwaghchaure @mihir-kandoi
.github/ @ruthra-kumar
.github/ @ruthra-kumar @mihir-kandoi
pyproject.toml @ruthra-kumar

View File

@@ -1,20 +1,21 @@
<div align="center">
<a href="https://frappe.io/erpnext">
<img src="./erpnext/public/images/v16/erpnext.svg" alt="ERPNext Logo" height="80px" width="80xp"/>
<img src="./erpnext/public/images/v16/erpnext.svg" alt="ERPNext Logo" height="80px" width="80px"/>
</a>
<h2>ERPNext</h2>
<p align="center">
<div align="center">
<p>Powerful, Intuitive and Open-Source ERP</p>
</p>
</div>
[![Learn on Frappe School](https://img.shields.io/badge/Frappe%20School-Learn%20ERPNext-blue?style=flat-square)](https://frappe.school)<br><br>
[![CI](https://github.com/frappe/erpnext/actions/workflows/server-tests-mariadb.yml/badge.svg?event=schedule)](https://github.com/frappe/erpnext/actions/workflows/server-tests-mariadb.yml)
[![docker pulls](https://img.shields.io/docker/pulls/frappe/erpnext-worker.svg)](https://hub.docker.com/r/frappe/erpnext-worker)
[![docker pulls](https://img.shields.io/docker/pulls/frappe/erpnext.svg)](https://hub.docker.com/r/frappe/erpnext)
</div>
<div align="center">
<img src="./erpnext/public/images/v16/hero_image.png"/>
<img src="./erpnext/public/images/v16/hero_image.png" alt="ERPNext Hero Image"/>
</div>
<div align="center">
@@ -27,19 +28,19 @@
## ERPNext
100% Open-Source ERP system to help you run your business.
100% Open-Source ERP System to help you run your business.
### Motivation
Running a business is a complex task - handling invoices, tracking stock, managing personnel and even more ad-hoc activities. In a market where software is sold separately to manage each of these tasks, ERPNext does all of the above and more, for free.
Running a business is a complex task - handling invoices, tracking stock, managing personnel, and other daily operations. In a market where software is sold separately to manage each of these tasks, ERPNext does all of the above and more, for free.
### Key Features
- **Accounting**: All the tools you need to manage cash flow in one place, right from recording transactions to summarizing and analyzing financial reports.
- **Order Management**: Track inventory levels, replenish stock, and manage sales orders, customers, suppliers, shipments, deliverables, and order fulfillment.
- **Manufacturing**: Simplifies the production cycle, helps track material consumption, exhibits capacity planning, handles subcontracting, and more!
- **Asset Management**: From purchase to perishment, IT infrastructure to equipment. Cover every branch of your organization, all in one centralized system.
- **Projects**: Delivery both internal and external Projects on time, budget and Profitability. Track tasks, timesheets, and issues by project.
- **Asset Management**: From purchase to disposal, IT infrastructure to equipment. Covers every branch of your organization, all in one centralized system.
- **Projects**: Deliver both internal and external projects on time, budget and profitability. Track tasks, timesheets, and issues by project.
<details open>
@@ -52,7 +53,7 @@ Running a business is a complex task - handling invoices, tracking stock, managi
### Under the Hood
- [**Frappe Framework**](https://github.com/frappe/frappe): A full-stack web application framework written in Python and Javascript. The framework provides a robust foundation for building web applications, including a database abstraction layer, user authentication, and a REST API.
- [**Frappe Framework**](https://github.com/frappe/frappe): A full-stack web application framework written in Python and JavaScript. The framework provides a robust foundation for building web applications, including a database abstraction layer, user authentication, and a REST API.
- [**Frappe UI**](https://github.com/frappe/frappe-ui): A Vue-based UI library, to provide a modern user interface. The Frappe UI library provides a variety of components that can be used to build single-page applications on top of the Frappe Framework.
@@ -60,12 +61,12 @@ Running a business is a complex task - handling invoices, tracking stock, managi
### Managed Hosting
You can try [Frappe Cloud](https://frappecloud.com), a simple, user-friendly and sophisticated [open-source](https://github.com/frappe/press) platform to host Frappe applications with peace of mind.
You can try [Frappe Cloud](https://frappecloud.com), a simple, user-friendly, and sophisticated [open-source](https://github.com/frappe/press) platform to host Frappe applications reliably and securely.
It takes care of installation, setup, upgrades, monitoring, maintenance and support of your Frappe deployments. It is a fully featured developer platform with an ability to manage and control multiple Frappe deployments.
It handles installation, setup, upgrades, monitoring, maintenance, and support of your Frappe deployments. It is a fully featured developer platform with an ability to manage and control multiple Frappe deployments.
<div>
<a href="https://erpnext-demo.frappe.cloud/app/home" target="_blank">
<a href="https://erpnext-demo.frappe.cloud/app/home" target="_blank" rel="noopener noreferrer">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://frappe.io/files/try-on-fc-white.png">
<img src="https://frappe.io/files/try-on-fc-black.png" alt="Try on Frappe Cloud" height="28" />
@@ -74,25 +75,40 @@ It takes care of installation, setup, upgrades, monitoring, maintenance and supp
</div>
### Self-Hosted
#### Docker
Prerequisites: docker, docker-compose, git. Refer [Docker Documentation](https://docs.docker.com) for more details on Docker setup.
See [Frappe Docker Documentation](https://github.com/frappe/frappe_docker) for full documentation & FAQ on Docker setup
Run following commands:
#### Prerequisites
```
- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose v2](https://docs.docker.com/compose/)
- [git](https://docs.github.com/en/get-started/getting-started-with-git/set-up-git)
> For Docker basics and best practices refer to Docker's [documentation](https://docs.docker.com)
### Try on your environment
> **⚠️ Disposable demo only**
>
> **This setup is intended for quick evaluation. Expect to throw the environment away.** You will not be able to install custom apps to this setup. For production deployments, custom configurations, and detailed explanations, see the full documentation.
First clone the repo:
```sh
git clone https://github.com/frappe/frappe_docker
cd frappe_docker
docker compose -f pwd.yml up -d
```
After a couple of minutes, site should be accessible on your localhost port: 8080. Use below default login credentials to access the site.
- Username: Administrator
- Password: admin
Then run:
See [Frappe Docker](https://github.com/frappe/frappe_docker?tab=readme-ov-file#to-run-on-arm64-architecture-follow-this-instructions) for ARM based docker setup.
```sh
docker compose -f pwd.yml up -d
```
Wait for a couple of minutes for ERPNext site to be created or check the `create-site` container logs before opening browser on port `8080`. (username: `Administrator`, password: `admin`)
See [Frappe Docker](https://github.com/frappe/frappe_docker/blob/main/docs/01-getting-started/03-arm64.md) for ARM based docker setup
## Development Setup
@@ -100,7 +116,7 @@ See [Frappe Docker](https://github.com/frappe/frappe_docker?tab=readme-ov-file#t
The Easy Way: our install script for bench will install all dependencies (e.g. MariaDB). See https://github.com/frappe/bench for more details.
New passwords will be created for the ERPNext "Administrator" user, the MariaDB root user, and the frappe user (the script displays the passwords and saves them to ~/frappe_passwords.txt).
New passwords will be created for the ERPNext "Administrator" user, the MariaDB root user, and the Frappe user (the script displays the passwords and saves them to ~/frappe_passwords.txt).
### Local
@@ -129,20 +145,20 @@ To setup the repository locally follow the steps mentioned below:
4. Open the URL `http://erpnext.localhost:8000/app` in your browser, you should see the app running
## Learning and community
## Learning and Community
1. [Frappe School](https://school.frappe.io) - Learn Frappe Framework and ERPNext from the various courses by the maintainers or from the community.
2. [Official documentation](https://docs.erpnext.com/) - Extensive documentation for ERPNext.
3. [Discussion Forum](https://discuss.frappe.io/c/erpnext/6) - Engage with community of ERPNext users and service providers.
3. [Discussion Forum](https://discuss.frappe.io/c/erpnext/6) - Engage with the community of ERPNext users and service providers.
4. [Telegram Group](https://erpnext_public.t.me) - Get instant help from huge community of users.
## Contributing
1. [Issue Guidelines](https://github.com/frappe/erpnext/wiki/Issue-Guidelines)
1. [Report Security Vulnerabilities](https://erpnext.com/security)
1. [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Contribution-Guidelines)
2. [Translations](https://crowdin.com/project/frappe)
2. [Report Security Vulnerabilities](https://erpnext.com/security)
3. [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Contribution-Guidelines)
4. [Translations](https://crowdin.com/project/frappe)
## Logo and Trademark Policy

View File

@@ -1,7 +1,7 @@
# Security Policy
The ERPNext team and community take security issues seriously. To report a security issue, fill out the form at [https://erpnext.com/security/report](https://erpnext.com/security/report).
The ERPNext team and community take security issues seriously. To report a security issue, please go through the information mentioned [here](https://frappe.io/security).
You can help us make ERPNext and all it's users more secure by following the [Reporting guidelines](https://erpnext.com/security).
You can help us make ERPNext and all its users more secure by following the [Reporting guidelines](https://frappe.io/security).
We appreciate your efforts to responsibly disclose your findings. We'll endeavor to respond quickly, and will keep you updated throughout the process.
We appreciate your efforts to responsibly disclose your findings. We'll endeavor to respond quickly, and will keep you updated throughout the process.

View File

@@ -18,8 +18,9 @@ We will grant permission to use the ERPNext name and logo for projects that meet
- The primary purpose of your project is to promote the spread and improvement of the ERPNext software.
- Your project is non-commercial in nature (it can make money to cover its costs or contribute to non-profit entities, but it cannot be run as a for-profit project or business).
Your project neither promotes nor is associated with entities that currently fail to comply with the GPL license under which ERPNext is distributed.
- If your project meets these criteria, you will be permitted to use the ERPNext name and logo to promote your project in any way you see fit with one exception: Please do not use ERPNext as part of a domain name.
- Your project neither promotes nor is associated with entities that currently fail to comply with the GPL license under which ERPNext is distributed.
If your project meets these criteria, you will be permitted to use the ERPNext name and logo to promote your project in any way you see fit with one exception: Please do not use ERPNext as part of a domain name.
Use of the ERPNext name and logo is additionally allowed in the following situations:

View File

@@ -1,3 +1,5 @@
**/setup/setup_wizard/data/uom_data.json,erpnext.gettext.extractors.uom_data.extract
**/setup/doctype/incoterm/incoterms.csv,erpnext.gettext.extractors.incoterms.extract
**/setup/setup_wizard/data/*.txt,erpnext.gettext.extractors.lines_from_txt_file.extract
**.tsx,frappe.gettext.extractors.html_template.extract
**.ts,frappe.gettext.extractors.html_template.extract
1 **/setup/setup_wizard/data/uom_data.json erpnext.gettext.extractors.uom_data.extract
2 **/setup/doctype/incoterm/incoterms.csv erpnext.gettext.extractors.incoterms.extract
3 **/setup/setup_wizard/data/*.txt erpnext.gettext.extractors.lines_from_txt_file.extract
4 **.tsx frappe.gettext.extractors.html_template.extract
5 **.ts frappe.gettext.extractors.html_template.extract

1
banking/.env.production Normal file
View File

@@ -0,0 +1 @@
VITE_BASE_NAME="banking"

24
banking/.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

73
banking/README.md Normal file
View File

@@ -0,0 +1,73 @@
# React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```

26
banking/eslint.config.js Normal file
View File

@@ -0,0 +1,26 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import { defineConfig, globalIgnores } from "eslint/config";
export default defineConfig([
globalIgnores(["dist"]),
{
files: ["**/*.{ts,tsx}"],
extends: [js.configs.recommended, tseslint.configs.recommended, reactRefresh.configs.vite],
plugins: {
"react-hooks": reactHooks,
},
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react-refresh/only-export-components": "off",
},
},
]);

50
banking/index.html Normal file
View File

@@ -0,0 +1,50 @@
<!doctype html>
<html lang="{{ lang }}" dir="{{layout_direction}}">
<head>
<meta charset="UTF-8" />
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#0089FF">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#0089FF">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-status-bar-style" content="#0089FF">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" href="{{ favicon or ' /assets/erpnext/images/erpnext-favicon.svg' }}" type="image/x-icon">
<link rel="icon" href="{{ favicon or ' /assets/erpnext/images/erpnext-favicon.svg' }}" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Banking | {{ app_name }}</title>
</head>
<body>
<div id="root"></div>
<script>window.csrf_token = '{{ frappe.session.csrf_token }}';
if (!window.frappe) window.frappe = {};
frappe.boot = JSON.parse({{ boot }});
frappe.boot.layout_direction = "{{ layout_direction }}";
frappe._translations_loaded = fetch(
`/api/method/frappe.translate.get_boot_translations?v=${frappe.boot.translations_version}&lang=${frappe.boot.lang}`,
{
credentials: "same-origin",
headers: {
"X-Frappe-CSRF-Token": frappe.csrf_token,
"Accept": "application/json"
}
}
).then(r => r.json()).then(data => {
frappe._messages = data.message || {};
}).catch(() => { });
</script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

65
banking/package.json Normal file
View File

@@ -0,0 +1,65 @@
{
"name": "banking",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --base=/assets/erpnext/banking/ && yarn copy-html-entry",
"lint": "eslint .",
"preview": "vite preview",
"copy-html-entry": "cp ../erpnext/public/banking/index.html ../erpnext/www/banking.html"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@tailwindcss/vite": "^4.3.0",
"@tanstack/react-table": "^8.21.3",
"@tanstack/react-virtual": "^3.13.24",
"@vitejs/plugin-react": "^6.0.1",
"chrono-node": "^2.9.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"date-fns": "^4.1.0",
"dayjs": "^1.11.20",
"frappe-react-sdk": "^1.15.0",
"fuse.js": "^7.3.0",
"jotai": "^2.20.0",
"jotai-family": "^1.0.1",
"lodash.isplainobject": "^4.0.6",
"lucide-react": "^1.14.0",
"radix-ui": "^1.4.3",
"react": "^19.2.6",
"react-currency-input-field": "^4.0.5",
"react-day-picker": "9.14.0",
"react-dom": "^19.2.6",
"react-dropzone": "^15.0.0",
"react-hook-form": "^7.75.0",
"react-hotkeys-hook": "^5.3.2",
"react-markdown": "^10.1.0",
"react-router": "^7.15.0",
"react-router-dom": "^7.15.0",
"rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.1",
"sonner": "^2.0.7",
"tailwind-merge": "^3.5.0",
"tailwindcss": "^4.3.0",
"tw-animate-css": "^1.4.0",
"usehooks-ts": "^3.1.1",
"vite": "^8.0.11"
},
"devDependencies": {
"@eslint/js": "^9.39.1",
"@types/node": "^25.3.0",
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
"eslint": "^9.39.1",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.4.24",
"globals": "^16.5.0",
"typescript": "~5.9.3",
"typescript-eslint": "^8.48.0"
}
}

17
banking/proxyOptions.ts Normal file
View File

@@ -0,0 +1,17 @@
import { readFileSync } from 'node:fs';
const common_site_config = JSON.parse(
readFileSync(new URL('../../../sites/common_site_config.json', import.meta.url), 'utf8')
) as { webserver_port: string | number };
const { webserver_port } = common_site_config;
export default {
'^/(app|api|assets|files|private)': {
target: `http://127.0.0.1:${webserver_port}`,
ws: true,
router: function (req) {
const site_name = req.headers?.host?.split(':')[0];
return `http://${site_name ?? 'localhost'}:${webserver_port}`;
}
}
};

65
banking/src/App.tsx Normal file
View File

@@ -0,0 +1,65 @@
import { lazy, useEffect } from 'react'
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'
import { FrappeProvider } from 'frappe-react-sdk'
import { Toaster } from '@/components/ui/sonner'
import BankReconciliation from '@/pages/BankReconciliation'
import BankStatementImporterContainer from '@/pages/BankStatementImporterContainer'
import { TooltipProvider } from './components/ui/tooltip'
import { LucideProvider } from 'lucide-react'
import { ThemeProvider } from './components/ui/theme-provider'
const BankStatementImporter = lazy(() => import('@/pages/BankStatementImporter'))
const ViewBankStatementImportLog = lazy(() => import('@/pages/ViewBankStatementImportLog'))
function App() {
useEffect(() => {
// Check if user is logged in by checking the Cookie "user_id"
// In Frappe, unauthenticated users are "Guest"
const userId = document.cookie?.split('; ').find(row => row.startsWith('user_id='))?.split('=')[1]?.trim()
const isLoggedIn = userId !== 'Guest'
if (!isLoggedIn) {
if (import.meta.env.DEV) {
return
}
// Redirect to Frappe login page
window.location.href = '/login?redirect-to=/banking'
return
}
}, [])
return (
<LucideProvider
strokeWidth={1.5}
>
<TooltipProvider>
<FrappeProvider
swrConfig={{
errorRetryCount: 2
}}
socketPort={import.meta.env.VITE_SOCKET_PORT}
siteName={window.frappe?.boot?.sitename ?? import.meta.env.VITE_SITE_NAME}>
<ThemeProvider
defaultTheme={window.frappe?.boot?.desk_theme ?? "Automatic"}
>
{window.frappe?.boot?.user?.name && window.frappe?.boot?.user?.name !== 'Guest' &&
<BrowserRouter basename={import.meta.env.VITE_BASE_NAME ? `/${import.meta.env.VITE_BASE_NAME}` : ''}>
<Routes>
<Route index element={<BankReconciliation />} />
<Route path="/statement-importer" element={<BankStatementImporterContainer />}>
<Route index element={<BankStatementImporter />} />
<Route path=":id" element={<ViewBankStatementImportLog />} />
</Route>
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</BrowserRouter>
}
<Toaster richColors />
</ThemeProvider>
</FrappeProvider>
</TooltipProvider>
</LucideProvider>
)
}
export default App

View File

@@ -0,0 +1,228 @@
import { Button } from "@/components/ui/button"
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
import { useCurrentCompany } from "@/hooks/useCurrentCompany"
import _ from "@/lib/translate"
import { cn } from "@/lib/utils"
import { useFrappeGetDocList } from "frappe-react-sdk"
import Fuse from "fuse.js"
import { ChevronDownIcon } from "lucide-react"
import { useLayoutEffect, useMemo, useRef, useState } from "react"
import { FormControl } from "../ui/form"
export interface AccountsDropdownProps {
root_type?: ('Asset' | 'Liability' | 'Equity' | 'Income' | 'Expense')[],
report_type?: 'Balance Sheet' | 'Profit and Loss',
account_type?: string[],
value?: string,
onChange?: (value: string) => void,
readOnly?: boolean,
disabled?: boolean,
company?: string,
filterFunction?: (account: Account) => boolean,
// If true, the component will be wrapped in a FormControl component
useInForm?: boolean,
buttonClassName?: string,
size?: 'sm' | 'md' | 'lg',
}
/**
* Component to select an account - supports fuzzy search
* @param root_type - The root type of the account
* @param report_type - The report type of the account
* @param account_type - The type of the account
* @param value - The value of the account field
* @param onChange - The function to call when the value changes
* @returns
*/
const AccountsDropdown = ({ root_type, report_type, account_type, value, onChange, readOnly, disabled, company, filterFunction, useInForm, buttonClassName, size = 'md' }: AccountsDropdownProps) => {
const { data } = useGetAccounts(root_type, report_type, account_type, company, filterFunction)
const groupedAccounts = useMemo(() => {
if (!data) return []
const grouped: Record<string, Account[]> = data.reduce((acc, account) => {
const parentAccount = account.parent_account
if (!parentAccount) return acc
if (!acc[parentAccount]) {
acc[parentAccount] = []
}
acc[parentAccount].push(account)
return acc
}, {} as Record<string, Account[]>)
return Object.entries(grouped).map(([parentAccount, accounts]) => ({
// Remove the last abbreviation from the parent account name like "Assets - TCC" should be "Assets", and "Assets - USD - TCC" should be "Assets - USD"
parentAccount: parentAccount.split(" - ").slice(0, -1).join(" - "),
accounts
}))
}, [data])
const searchIndex = useMemo(() => {
if (!data) {
return null
}
return new Fuse(data, {
keys: ['name'],
threshold: 0.5,
includeScore: true
})
}, [data])
const [search, setSearch] = useState("")
const recommendedAccounts = useMemo(() => {
if (!searchIndex || !search) {
return []
}
return searchIndex.search(search).map((result) => result.item)
}, [searchIndex, search])
const [open, setOpen] = useState(false)
const onOpenChange = (open: boolean) => {
if (readOnly) return
setOpen(open)
// setSearch("")
}
const onSelect = (value: string) => {
onChange?.(value)
setOpen(false)
setSearch(value)
}
const buttonRef = useRef<HTMLButtonElement>(null)
const [width, setWidth] = useState(320)
useLayoutEffect(() => {
if (buttonRef.current) {
setWidth(buttonRef.current.getBoundingClientRect().width)
}
}, [])
return (
<Popover open={open} onOpenChange={onOpenChange} modal={true}>
<PopoverTrigger asChild>
{useInForm ? <FormControl>
<Button
variant="subtle"
type='button'
size={size}
role="combobox"
ref={buttonRef}
tabIndex={0}
disabled={disabled || readOnly}
aria-readonly={readOnly}
aria-expanded={open}
className={cn("w-full justify-between font-normal",
readOnly ? "bg-surface-gray-1 pointer-events-none" : ""
, buttonClassName)}>
{value || _('Select Account')}
<ChevronDownIcon className="ms-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</FormControl>
: <Button
variant="subtle"
size={size}
type='button'
role="combobox"
ref={buttonRef}
disabled={disabled}
aria-expanded={open}
className={cn("w-full justify-between font-normal",
readOnly ? "bg-surface-gray-1" : ""
)}>
{value || _('Select Account')}
<ChevronDownIcon className="ms-2 h-4 w-4 shrink-0 opacity-50" />
</Button>}
</PopoverTrigger>
<PopoverContent className="p-0" style={{ minWidth: width }} align="start">
<Command shouldFilter={false} className="w-full">
<CommandInput placeholder={_("Search account...")} onValueChange={setSearch} value={search} />
<CommandList>
<CommandEmpty>{_("No accounts found.")}</CommandEmpty>
{recommendedAccounts.length > 0 && (
<CommandGroup heading={_("Search Results")}>
{recommendedAccounts.map((account) => (
<CommandItem key={account.name} onSelect={() => onSelect(account.name)}>{account.name}</CommandItem>
))}
</CommandGroup>
)}
{!search && groupedAccounts.map((group) => (
<CommandGroup key={group.parentAccount} heading={group.parentAccount}>
{group.accounts.map((account) => (
<CommandItem key={account.name} onSelect={() => onSelect(account.name)}>{account.name}</CommandItem>
))}
</CommandGroup>
))}
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}
interface Account {
name: string
root_type: 'Asset' | 'Liability' | 'Equity' | 'Income' | 'Expense'
report_type: 'Balance Sheet' | 'Profit and Loss'
account_type: string
account_currency: string
parent_account: string
}
export const useGetAccounts = (root_type?: ('Asset' | 'Liability' | 'Equity' | 'Income' | 'Expense')[], report_type?: 'Balance Sheet' | 'Profit and Loss', account_type?: string[], company?: string,
filterFunction?: (account: Account) => boolean) => {
const currentCompany = useCurrentCompany()
const { data, isLoading, error, mutate } = useFrappeGetDocList<Account>("Account", {
fields: ["name", "root_type", "report_type", "account_type", "account_currency", "parent_account"],
filters: [["is_group", "=", 0], ["disabled", "=", 0], ["company", "=", company ?? currentCompany]],
limit: 1000,
orderBy: {
"field": "root_type",
// @ts-expect-error - we can pass in additional fields to orderBy
"order": "asc, account_number asc"
}
}, `accounts-${company ?? currentCompany}`, {
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
})
const filteredData = useMemo(() => {
return data?.filter((account) => {
if (root_type && !root_type.includes(account.root_type)) return false
if (report_type && account.report_type !== report_type) return false
if (account_type && !account_type.includes(account.account_type)) return false
if (filterFunction) return filterFunction(account)
return true
}) ?? []
}, [data, root_type, report_type, account_type, filterFunction])
return { data: filteredData, isLoading, error, mutate }
}
export default AccountsDropdown

View File

@@ -0,0 +1,26 @@
import { cn } from '@/lib/utils'
import { SelectedBank } from '../features/BankReconciliation/bankRecAtoms'
import { useTheme } from '../ui/theme-provider'
import { Landmark } from 'lucide-react'
import { H4 } from '../ui/typography'
const BankLogo = ({ bank, className, imageClassName, iconSize = '18px', iconClassName }: { bank?: SelectedBank | null, className?: string, imageClassName?: string, iconSize?: string, iconClassName?: string }) => {
const { themeValue } = useTheme()
return (
<div className={cn('h-6 flex items-center gap-1', className)}> {bank?.logo ? <img
src={`/assets/erpnext/images/bank-logos/${themeValue === 'Dark' ? (bank.logoDark ?? bank.logo) : bank.logo}`}
alt={bank.bank || bank.name || ''}
className={cn("h-6 max-w-22 me-auto object-contain", imageClassName, {
'dark:invert dark:brightness-0': bank.darkModeInvert
}, bank.logoClassName)}
/> : <>
<Landmark size={iconSize} className={iconClassName} />
<H4 className={cn("text-xs -mb-0.5", {
})}>{bank?.bank ?? ''}</H4>
</>
}</div>
)
}
export default BankLogo

View File

@@ -0,0 +1,17 @@
import { CheckCircle } from 'lucide-react'
import { Progress } from '../ui/progress'
import _ from '@/lib/translate'
const FileUploadBanner = ({
uploadProgress,
}: { uploadProgress: number }) => {
return <div className="flex items-center justify-center flex-col gap-4">
<div className="flex flex-col items-center gap-4">
<CheckCircle size={48} className="text-ink-green-3" />
<span className="text-ink-gray-8 text-p-base">{_("The document has been created and reconciled. Uploading attachments...")}</span>
<Progress value={Math.round(uploadProgress * 100)} size="lg" />
</div>
</div>
}
export default FileUploadBanner

View File

@@ -0,0 +1,301 @@
import { useDocType } from "@/hooks/useDocType";
import { getSystemDefault, slug } from "@/lib/frappe";
import { Filter, useFrappeGetCall } from "frappe-react-sdk"
import { useLayoutEffect, useMemo, useRef, useState } from "react";
import { canCreateDocument } from "@/lib/permissions";
import { useDebounceValue } from "usehooks-ts";
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
import { FormControl } from "../ui/form";
import { ChevronDownIcon, ExternalLink } from "lucide-react";
import { Button } from "../ui/button";
import { cn } from "@/lib/utils";
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../ui/command";
import _ from "@/lib/translate";
import ErrorBanner from "../ui/error-banner";
import MarkdownRenderer from "../ui/markdown";
export interface ResultItem {
value: string,
description: string,
label?: string
}
export interface LinkFieldComboboxProps {
/** DocType to be fetched */
doctype: string;
/** Filters to be applied. Default: none */
filters?: Filter[]
/** Number of records to paginate with. Default: Comes from System Settings or 10 */
limit?: number;
/**
* API to call to fetch records.
*
* Default: `frappe.desk.search.search_link`
*
* If you want to use a custom API, you can pass the path to the API here.
*
* The API should return a list of documents in the following format:
* [{value: string, description: string, label?: string}] - where the value is the ID of the document.
*
* If the API sends a label, it will be used as the label in the dropdown.
*/
searchAPIPath?: string;
/**
* Field you want to search against in the doctype.
*
* Default: `name`
*
* If you want to search against a different field, you can pass the fieldname here.
*
* If you want to search against multiple fields, you can try using the `searchAPIPath` prop to call a custom API,
* or use a custom query in the `customQuery` prop.
*/
searchfield?: string;
/**
* Custom query to be used to fetch records.
*
* If you want to use a custom query, you can pass the query here.
*
* The query should be in the following format:
* {
* query: string,
* filters: {
* fieldname: string,
* operator: string,
* value: string
* }
* }
*/
customQuery?: {
/** Path to function for the query.
*
* Refer: Item/Supplier query
*/
query: string,
/** Filters are usually an object instead of an array in a custom query */
filters?: Record<string, string | number | boolean>,
},
/**
* Used for certain queries where a reference doctype is needed.
*
* For example when searching a supplier in a "Purchase Invoice", the reference_doctype is "Purchase Invoice"
*/
reference_doctype?: string,
/** Placeholder for the dropdown. Default: `doctype` */
placeholder?: string;
/**
* Should the field be read-only.
*/
readOnly?: boolean;
/** Should the field be disabled. Default: false */
disabled?: boolean;
/**
* Function to filter the options based on the input value/other criteria.
*
* For example, you might want to limit the companies shown in the dropdown since they have been already added (like in Cost Codes)
*/
filterFn?: (option: ResultItem, inputValue: string) => boolean,
value?: string,
onChange: (value: string) => void,
/** If true, the component will be wrapped in a FormControl component */
useInForm?: boolean,
/** Button Class name */
buttonClassName?: string,
size?: 'sm' | 'md' | 'lg',
}
const LinkFieldCombobox = ({
doctype,
reference_doctype,
filters = [],
value,
onChange,
readOnly,
disabled,
filterFn,
placeholder = `Select ${doctype}`,
customQuery,
searchfield,
searchAPIPath = "frappe.desk.search.search_link",
limit,
useInForm,
buttonClassName,
size = 'md'
}: LinkFieldComboboxProps) => {
const pageLimit = useMemo(() => limit || getSystemDefault('link_field_results_limit') || 20, [limit])
/** Load the Doctype meta so that we can determine the search fields + the name of the title field */
const { data: meta } = useDocType(doctype)
const userCanCreate = useMemo(() => canCreateDocument(doctype), [doctype])
const [open, setOpen] = useState(false)
const [searchInput, setSearchInput] = useDebounceValue('', 400)
const { data: linkTitleData } = useFrappeGetCall('frappe.client.get_value', {
doctype,
filters: JSON.stringify({
name: value
}),
fieldname: meta?.title_field
}, (meta?.show_title_field_in_link ?? false) && (meta?.title_field) && value ? `link_title::${doctype}::${value}` : null, {
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
})
const linkTitle = meta?.title_field && meta?.show_title_field_in_link ? (linkTitleData?.message?.[meta?.title_field] ?? value) : value
const buttonRef = useRef<HTMLButtonElement>(null)
const [width, setWidth] = useState(320)
useLayoutEffect(() => {
if (buttonRef.current) {
setWidth(buttonRef.current.getBoundingClientRect().width)
}
}, [])
const { data, error, isLoading } = useFrappeGetCall<{ message: ResultItem[] }>(searchAPIPath, {
doctype,
txt: searchInput,
page_length: pageLimit,
query: customQuery?.query,
searchfield,
filters: JSON.stringify(customQuery?.filters || filters || []),
reference_doctype,
}, () => {
if (!open) {
return null
} else {
let key = `${searchAPIPath}_${doctype}_${searchInput}`
if (pageLimit) {
key += `_${pageLimit}`
}
if (customQuery?.filters) {
key += `_${JSON.stringify(customQuery.filters)}`
} else if (filters) {
key += `_${JSON.stringify(filters)}`
}
if (customQuery && customQuery.query) {
key += `_${customQuery.query}`
}
if (reference_doctype) {
key += `_${reference_doctype}`
}
if (searchfield && searchfield !== 'name') {
key += `_${searchfield}`
}
return key
}
}, {
revalidateOnFocus: false,
revalidateIfStale: false,
shouldRetryOnError: false,
revalidateOnReconnect: false,
})
const onOpenChange = (open: boolean) => {
if (readOnly) return
setOpen(open)
setSearchInput("")
}
const onSelect = (value: string) => {
onChange?.(value)
setOpen(false)
}
const items = filterFn ? data?.message?.slice(0, 50).filter((item) => filterFn(item, searchInput)) : data?.message
const buttonProps = {
variant: "subtle",
type: 'button',
size: size,
role: "combobox",
"data-state": open ? "open" : "closed",
ref: buttonRef,
tabIndex: 0,
disabled: disabled || readOnly,
"aria-expanded": open,
"aria-readonly": readOnly,
className: cn("w-full justify-between font-normal group border border-transparent outline-none",
"data-[state=open]:bg-surface-white data-[state=open]:border-outline-gray-4 data-[state=open]:shadow-sm",
readOnly ? "bg-surface-gray-1" : "",
// Placeholder and value styling
linkTitle ? "text-ink-gray-7" : "text-ink-gray-4",
buttonClassName)
} as const
return (
<Popover open={open} onOpenChange={onOpenChange} modal={true}>
<PopoverTrigger asChild>
{useInForm ? <FormControl>
<Button {...buttonProps}>
{linkTitle || placeholder}
<div className="flex items-center gap-1">
{value && <a href={`/desk/${slug(doctype)}/${value}`} target="_blank" className="group-hover:block hidden">
<ExternalLink className="size-4 shrink-0 opacity-50" />
</a>}
<ChevronDownIcon className="ms-2 size-4 shrink-0" />
</div>
</Button>
</FormControl>
: <Button {...buttonProps}>
{linkTitle || placeholder}
<div className="flex items-center gap-1">
{value && <a href={`/desk/${slug(doctype)}/${value}`} target="_blank" className="group-hover:block hidden">
<ExternalLink className="size-4 shrink-0 opacity-50" />
</a>}
<ChevronDownIcon className="ms-2 size-4 shrink-0" />
</div>
</Button>}
</PopoverTrigger>
<PopoverContent className="p-0" style={{ minWidth: width }} align="start">
{error && <ErrorBanner error={error} />}
<Command shouldFilter={false} className="w-full">
<CommandInput placeholder={placeholder} onValueChange={setSearchInput} />
<CommandList>
<CommandEmpty>{isLoading ? _("Loading...") : _("No results found.")}</CommandEmpty>
<CommandGroup>
{items?.map((result) => (
<CommandItem key={result.value} onSelect={() => onSelect(result.value)} className="flex flex-col items-start gap-0.5">
<span className="font-medium">
{result.label || result.value}
</span>
{result.description && <span className="text-xs text-ink-gray-5">
<MarkdownRenderer content={result.description} />
</span>}
</CommandItem>
))}
{userCanCreate && <CommandItem asChild>
<a href={`/desk/${slug(doctype)}/new-${slug(doctype)}-1`}
target="_blank"
className="hover:underline underline-offset-4 cursor-pointer flex justify-between items-center">
{_("Create New {0}", [doctype])}
<ExternalLink />
</a>
</CommandItem>}
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}
export default LinkFieldCombobox

View File

@@ -0,0 +1,82 @@
import { Select, SelectValue, SelectTrigger, SelectContent, SelectItem } from '@/components/ui/select'
import _ from '@/lib/translate'
import { useFrappeGetDocList } from 'frappe-react-sdk'
import { ComponentProps, useMemo } from 'react'
import { FormControl } from '../ui/form'
export type PartyTypeDropdownProps = {
value?: string,
onChange?: (value: string) => void,
readOnly?: boolean,
disabled?: boolean,
/** Set this to order the parties so that suggested types are shown first */
type?: 'Receivable' | 'Payable'
/** Set this to true if you want to hide other options by type. e.g. - if type is Receivable, Payable options like "Supplier" will be hidden */
hideOptionsByType?: boolean,
valueProps?: ComponentProps<typeof SelectValue>,
triggerProps?: ComponentProps<typeof SelectTrigger>,
// If true, the component will be wrapped in a FormControl component
useInForm?: boolean
}
const PartyTypeDropdown = ({ value, onChange, readOnly, disabled, type, hideOptionsByType, valueProps, triggerProps, useInForm }: PartyTypeDropdownProps) => {
const { data } = useFrappeGetDocList("Party Type", {
fields: ['name', 'account_type'],
orderBy: {
field: 'creation',
order: 'asc'
}
}, `party_types`, {
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
})
const filteredData = useMemo(() => {
let options = data ?? [
{ name: "Customer", account_type: "Receivable" },
{ name: "Supplier", account_type: "Payable" },
{ name: "Employee", account_type: "Payable" },
{ name: "Shareholder", account_type: "Payable" },
]
if (hideOptionsByType && type) {
options = options.filter((option) => option.account_type === type)
}
// Order by type if type is set
if (type) {
options = options.sort((a) => a.account_type === type ? -1 : 1)
}
return options
}, [data, type, hideOptionsByType])
const onSelect = (value: string) => {
if (!readOnly) {
onChange?.(value)
}
}
return (
<Select onValueChange={onSelect} value={value} disabled={disabled}>
{useInForm ? <FormControl>
<SelectTrigger tabIndex={0} aria-readonly={readOnly} disabled={disabled || readOnly} {...triggerProps}>
<SelectValue placeholder={_("Type")} aria-readonly={readOnly} {...valueProps} />
</SelectTrigger>
</FormControl> : <SelectTrigger tabIndex={0} {...triggerProps}>
<SelectValue placeholder={_("Type")} aria-readonly={readOnly} {...valueProps} />
</SelectTrigger>
}
<SelectContent>
{filteredData.map((option) => (
<SelectItem key={option.name} value={option.name}>{option.name}</SelectItem>
))}
</SelectContent>
</Select>
)
}
export default PartyTypeDropdown

View File

@@ -0,0 +1,42 @@
import { Button } from '@/components/ui/button'
import { Dialog, DialogTrigger } from '@/components/ui/dialog'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import _ from '@/lib/translate'
import { HistoryIcon } from 'lucide-react'
import { useState } from 'react'
import { useHotkeys } from 'react-hotkeys-hook'
import ActionLogDialog from './ActionLogDialog'
const ActionLog = () => {
const [isOpen, setIsOpen] = useState(false)
useHotkeys('meta+z', () => {
setIsOpen(true)
}, {
enabled: true,
enableOnFormTags: false,
preventDefault: true
})
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<Tooltip>
<TooltipTrigger asChild>
<DialogTrigger asChild>
<Button variant={'outline'} isIconButton size='md'>
<HistoryIcon />
</Button>
</DialogTrigger>
</TooltipTrigger>
<TooltipContent>
{_("Reconciliation History")}
</TooltipContent>
</Tooltip>
{isOpen && (
<ActionLogDialog onClose={() => setIsOpen(false)} />
)}
</Dialog>
)
}
export default ActionLog

View File

@@ -0,0 +1,34 @@
import { Button } from '@/components/ui/button'
import { DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import _ from '@/lib/translate'
import { Loader2Icon } from 'lucide-react'
import { lazy, Suspense } from 'react'
const ActionLogDialogBody = lazy(() => import('./ActionLogDialogBody'))
const ActionLogDialogFallback = () => (
<div className="flex flex-1 items-center justify-center min-h-[40vh]">
<Loader2Icon className="size-6 animate-spin text-muted-foreground" />
</div>
)
const ActionLogDialog = ({ onClose }: { onClose: () => void }) => {
return (
<DialogContent className='min-w-[90vw]'>
<DialogHeader>
<DialogTitle>{_("Reconciliation History")}</DialogTitle>
<DialogDescription>{_("View all reconciliation actions taken in this session.")}</DialogDescription>
</DialogHeader>
<Suspense fallback={<ActionLogDialogFallback />}>
<ActionLogDialogBody />
</Suspense>
<DialogFooter>
<DialogClose asChild>
<Button variant={'outline'} size='md' onClick={onClose}>{_("Close")}</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
)
}
export default ActionLogDialog

View File

@@ -0,0 +1,431 @@
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import _ from '@/lib/translate'
import { useAtomValue, useSetAtom } from 'jotai'
import { ArrowDownRight, ArrowRightLeftIcon, ArrowUpRight, CalendarIcon, CircleXIcon, GitCompareIcon, HistoryIcon, LandmarkIcon, Loader2Icon, ReceiptIcon, ReceiptTextIcon, UserIcon, WalletIcon } from 'lucide-react'
import { useMemo, useState } from 'react'
import { ActionLogItem, ActionLog as ActionLogType, bankRecActionLog, bankRecDateAtom, bankRecMatchFilters, SelectedBank, selectedBankAccountAtom } from '../BankReconciliation/bankRecAtoms'
import { useGetBankAccounts } from '../BankReconciliation/utils'
import { getCompanyCurrency } from '@/lib/company'
import { formatCurrency } from '@/lib/numbers'
import dayjs from 'dayjs'
import { cn } from '@/lib/utils'
import { formatDate } from '@/lib/date'
import { Separator } from '@/components/ui/separator'
import { slug } from '@/lib/frappe'
import { PaymentEntry } from '@/types/Accounts/PaymentEntry'
import { JournalEntry } from '@/types/Accounts/JournalEntry'
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'
import { Table, TableCell, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/table'
import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog'
import { useFrappePostCall, useSWRConfig } from 'frappe-react-sdk'
import { toast } from 'sonner'
import { getErrorMessage } from '@/lib/frappe'
import ErrorBanner from '@/components/ui/error-banner'
import SelectedTransactionDetails from '../BankReconciliation/SelectedTransactionDetails'
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty'
import BankLogo from '@/components/common/BankLogo'
const ActionLogDialogBody = () => {
const actionLog = useAtomValue(bankRecActionLog)
return <div className='flex flex-col gap-2'>
{actionLog.map((action) => (
<div key={action.timestamp} className='flex flex-col gap-1'>
<ActionGroupHeader action={action} />
<div>
<div className='ms-2 border-s border-s-outline-gray-2 py-1'>
<div className='ms-5'>
{action.items.map((item, index) => (
<Row
item={item}
key={item.bankTransaction.name}
index={index}
action={action}
isLast={index === action.items.length - 1} />
))}
</div>
</div>
</div>
</div>
))}
{actionLog.length === 0 && <Empty>
<EmptyMedia>
<HistoryIcon />
</EmptyMedia>
<EmptyHeader>
<EmptyTitle>{_("No reconciliation actions found")}</EmptyTitle>
<EmptyDescription>{_("You have not performed any reconciliations in this session yet.")}</EmptyDescription>
</EmptyHeader>
</Empty>}
</div>
}
const ActionGroupHeader = ({ action }: { action: ActionLogType }) => {
const label = useMemo(() => {
switch (action.type) {
case 'match':
return _("Matched")
case 'payment':
if (action.isBulk) {
return _("Bulk Payment")
}
return _("Payment")
case 'transfer':
if (action.isBulk) {
return _("Bulk Transfer")
}
return _("Transfer")
case 'bank_entry':
if (action.isBulk) {
return _("Bulk Bank Entry")
}
return _("Bank Entry")
default:
return _("Action")
}
}, [action])
return <div className='flex items-center gap-2 text-ink-gray-5'>
{action.type === 'match' && <GitCompareIcon className='w-4 h-4' />}
{action.type === 'payment' && <ReceiptIcon className='w-4 h-4' />}
{action.type === 'transfer' && <ArrowRightLeftIcon className='w-4 h-4' />}
{action.type === 'bank_entry' && <LandmarkIcon className='w-4 h-4' />}
<span className='flex items-center gap-2 text-sm'>
{label} - {dayjs(action.timestamp).fromNow()}
</span>
</div>
}
const Row = ({ item, index, isLast, action }: { item: ActionLogItem, index: number, isLast: boolean, action: ActionLogType }) => {
const isWithdrawal = item.bankTransaction.withdrawal && item.bankTransaction.withdrawal > 0
const { banks } = useGetBankAccounts()
const bank = useMemo(() => {
if (item.bankTransaction.bank_account) {
return banks?.find((bank) => bank.name === item.bankTransaction.bank_account)
}
return null
}, [item.bankTransaction.bank_account, banks])
const amount = item.bankTransaction.withdrawal ? item.bankTransaction.withdrawal : item.bankTransaction.deposit
const currency = item.bankTransaction.currency || getCompanyCurrency(item.bankTransaction.company ?? '')
return <div className='flex items-center gap-2 group'>
<div className={cn('p-3.5 group-hover:bg-surface-gray-1 border-s border-e border-t w-full', isLast ? 'rounded-b border-b' : '', index === 0 ? 'rounded-t' : '')}>
<div className='flex justify-between items-center'>
<div className='flex flex-col gap-2'>
<p className='text-p-base'>{item.bankTransaction.description}</p>
<div className='flex items-center gap-3'>
<div className='flex gap-2 items-center'>
<BankLogo bank={bank} className='h-4 mb-0' iconSize='16px' />
<span className='text-sm text-ink-gray-5'>{item.bankTransaction.bank_account}</span>
</div>
<Separator orientation='vertical' />
<div className='flex items-center gap-2 text-ink-gray-5 text-sm' title={_("Transaction Date")}>
<CalendarIcon className='w-4 h-4' />
<span className='text-sm'>{formatDate(item.bankTransaction.date, 'Do MMM YYYY')}</span>
</div>
<Separator orientation='vertical' />
<div>
<div className='flex items-center gap-1' title={isWithdrawal ? _("Spent") : _("Received")}>
{isWithdrawal ? <ArrowUpRight className="w-5 h-5 text-ink-red-3" /> : <ArrowDownRight className="w-5 h-5 text-ink-green-3" />}
<span className='text-sm text-ink-gray-5'>{formatCurrency(amount, currency)}</span>
</div>
</div>
</div>
</div>
<div className='flex justify-end items-center gap-2'>
<div className='text-end flex flex-col gap-2'>
<a
href={`/desk/${slug(item.voucher.reference_doctype)}/${item.voucher.reference_name}`}
target='_blank'
className='underline underline-offset-4 text-base'>
{["Payment Entry", "Journal Entry"].includes(item.voucher.reference_doctype) ? "" : _("{} :", [item.voucher.reference_doctype])} {item.voucher.reference_name}
</a>
{item.voucher.reference_doctype === "Payment Entry" && item.voucher.doc && <PaymentEntryDetails item={item} />}
{item.voucher.reference_doctype === "Journal Entry" && <JournalEntryDetails item={item} bank={bank} />}
</div>
</div>
</div>
</div>
<div className='w-10 h-10 flex items-center justify-center'>
<CancelActionLogItem item={item} type={action.type} timestamp={action.timestamp} bank={bank} />
</div>
</div>
}
const JournalEntryDetails = ({ item, bank }: { item: ActionLogItem, bank?: SelectedBank | null }) => {
return <div className='flex items-center gap-2 text-ink-gray-5 justify-end'>
<WalletIcon className='w-4 h-4' />
<JournalEntryAccountsTable item={item} bank={bank} />
</div>
}
const JournalEntryAccountsTable = ({ item, bank }: { item: ActionLogItem, bank?: SelectedBank | null }) => {
const accounts = useMemo(() => {
const allAccounts = (item.voucher.doc as JournalEntry).accounts
return allAccounts.filter((acc) => bank ? acc.account !== bank.account : true)
}, [item, bank])
return <>
{accounts.length === 1 ? <span className='text-sm'>{accounts[0].account}</span> :
<HoverCard>
<HoverCardTrigger>
<span className='text-sm cursor-pointer hover:underline underline-offset-4'>{_("Split across {} accounts", [accounts.length.toString()])}</span>
</HoverCardTrigger>
<HoverCardContent className='w-full p-2' align='end'>
<Table>
<TableHeader>
<TableRow>
<TableHead>{_("Account")}</TableHead>
<TableHead className='text-end'>{_("Debit")}</TableHead>
<TableHead className='text-end'>{_("Credit")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{accounts.map((account) => (
<TableRow key={account.account}>
<TableCell>{account.account}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(account.debit ?? 0, account.account_currency ?? '')}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(account.credit ?? 0, account.account_currency ?? '')}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</HoverCardContent>
</HoverCard>
}</>
}
const PaymentEntryDetails = ({ item, className }: { item: ActionLogItem, className?: string }) => {
if ((item.voucher.doc as PaymentEntry).payment_type === "Internal Transfer") {
return <TransferDetails item={item} className={className} />
}
const invoices = (item.voucher.doc as PaymentEntry).references ?? []
const currency = item.bankTransaction.withdrawal && item.bankTransaction.withdrawal > 0 ? (item.voucher.doc as PaymentEntry)?.paid_to_account_currency : (item.voucher.doc as PaymentEntry)?.paid_from_account_currency
return <div className='flex items-center gap-3'>
<div className={cn('flex items-center gap-2 text-ink-gray-5 text-sm', className)}>
<UserIcon className='w-4 h-4' />
<span className='text-sm'>{(item.voucher.doc as PaymentEntry).party_name}</span>
</div>
<Separator orientation='vertical' />
<HoverCard>
<HoverCardTrigger>
<div className={cn('flex items-center gap-2 text-ink-gray-5 text-sm', className)}>
<ReceiptTextIcon className='w-4 h-4' />
<span className='text-sm cursor-pointer hover:underline underline-offset-4'>{invoices.length === 0 ? _("No invoice linked") : invoices.length === 1 ? _("1 invoice") : _("{} invoices", [invoices.length.toString()])}</span>
</div>
</HoverCardTrigger>
<HoverCardContent className='w-full p-2' align='end'>
<div className='flex flex-col gap-2'>
{invoices.map((invoice) => (
<Table>
<TableHeader>
<TableRow>
<TableHead>{_("Document")}</TableHead>
<TableHead>{_("Invoice No")}</TableHead>
<TableHead>{_("Due Date")}</TableHead>
<TableHead className='text-end'>{_("Grand Total")}</TableHead>
<TableHead className='text-end'>{_("Allocated")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell><a href={`/desk/${slug(invoice.reference_doctype)}/${invoice.reference_name}`} target='_blank' className='underline underline-offset-4'>{invoice.reference_doctype}: {invoice.reference_name}</a></TableCell>
<TableCell>{invoice.bill_no ?? "-"}</TableCell>
<TableCell>{formatDate(invoice.due_date)}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(invoice.total_amount, currency ?? '')}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(invoice.allocated_amount, currency ?? '')}</TableCell>
</TableRow>
</TableBody>
</Table>
))}
</div>
</HoverCardContent>
</HoverCard>
</div>
}
const TransferDetails = ({ item, className }: { item: ActionLogItem, className?: string }) => {
const { banks } = useGetBankAccounts()
const bank = useMemo(() => {
const isWithdrawal = item.bankTransaction.withdrawal && item.bankTransaction.withdrawal > 0
let transferAccount = ""
if (isWithdrawal) {
transferAccount = (item.voucher.doc as PaymentEntry).paid_to
} else {
transferAccount = (item.voucher.doc as PaymentEntry).paid_from
}
const transferBankAccount = banks?.find((bank) => bank.account === transferAccount)
return transferBankAccount
}, [banks, item])
return <div className={cn('flex items-center gap-2 text-ink-gray-5 text-sm', className)}>
<BankLogo bank={bank} className='h-5 mb-0' iconSize='16px' imageClassName='max-h-5' />
<span className='text-sm'>{bank?.account}</span>
</div>
}
const ACTION_TYPE_MAP = {
'bank_entry': _("Bank Entry"),
'payment': _("Payment"),
'transfer': _("Transfer"),
'match': _("Match"),
}
const CancelActionLogItem = ({ item, type, timestamp, bank }: { item: ActionLogItem, type: ActionLogType['type'], timestamp: number, bank?: SelectedBank | null }) => {
const [isOpen, setIsOpen] = useState(false)
const { call, loading, error } = useFrappePostCall('erpnext.accounts.doctype.bank_transaction.bank_transaction.unreconcile_transaction_entry')
const { mutate } = useSWRConfig()
const actionLog = useSetAtom(bankRecActionLog)
const dates = useAtomValue(bankRecDateAtom)
const matchFilters = useAtomValue(bankRecMatchFilters)
const selectedBank = useAtomValue(selectedBankAccountAtom)
const onUndo = () => {
call({
bank_transaction_id: item.bankTransaction.name,
voucher_type: item.voucher.reference_doctype,
voucher_id: item.voucher.reference_name,
}).then(() => {
toast.success(type === 'match' ? _("Unmatched") : _("Cancelled"))
if (selectedBank?.name === item.bankTransaction.bank_account) {
mutate(`bank-reconciliation-unreconciled-transactions-${selectedBank?.name}-${dates.fromDate}-${dates.toDate}`)
mutate(`bank-reconciliation-account-closing-balance-${selectedBank?.name}-${dates.toDate}`)
// Update the matching vouchers for the selected transaction
mutate(`bank-reconciliation-vouchers-${item.bankTransaction.name}-${dates.fromDate}-${dates.toDate}-${matchFilters.join(',')}`)
}
setTimeout(() => {
actionLog((prev) => {
// Find the action and then remove the item from the action. If the action is empty, remove the action from the array
const action = prev.find((action) => action.timestamp === timestamp)
if (action) {
action.items = action.items.filter((i) => i.bankTransaction.name !== item.bankTransaction.name)
}
// If the action is empty, remove the action from the array
if (action && action.items.length === 0) {
return prev.filter((a) => a.timestamp !== timestamp)
} else {
return prev.map((a) => a.timestamp === timestamp ? { ...a, items: action?.items ?? [] } : a)
}
})
}, 100)
setIsOpen(false)
}).catch((error) => {
toast.error(_("There was an error while performing the action."), {
duration: 5000,
description: getErrorMessage(error),
})
})
}
return <AlertDialog open={isOpen} onOpenChange={setIsOpen}>
<Tooltip>
<TooltipTrigger asChild>
<AlertDialogTrigger asChild>
<Button
variant={'ghost'}
isIconButton
theme='red'
title={_("Cancel")}
className='hover:text-ink-red-3 hover:bg-destructive/5 text-ink-gray-5 hidden group-hover:inline-flex'>
<CircleXIcon className='w-8 h-8' />
</Button>
</AlertDialogTrigger>
</TooltipTrigger>
<TooltipContent>
{_("Cancel")}
</TooltipContent>
</Tooltip>
<AlertDialogContent className='min-w-3xl'>
<AlertDialogHeader>
<AlertDialogTitle>{type === 'match' ? _("Unmatch Transaction?") : _("Undo {}?", [item.voucher.reference_doctype])}</AlertDialogTitle>
<AlertDialogDescription>{type === 'match' ? _("Are you sure you want to unmatch the voucher from this transaction?") : _("Are you sure you want to cancel this {} {}?", [_(item.voucher.reference_doctype), item.voucher.reference_name])}</AlertDialogDescription>
</AlertDialogHeader>
{error && <ErrorBanner error={error} />}
<div className='flex flex-col gap-2'>
<SelectedTransactionDetails transaction={item.bankTransaction} />
<Table>
<TableRow>
<TableHead>{_("Action Type")}</TableHead>
<TableCell>{ACTION_TYPE_MAP[type]}</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Voucher Type")}</TableHead>
<TableCell>{_(item.voucher.reference_doctype)}</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Voucher Name")}</TableHead>
<TableCell><a href={`/desk/${slug(item.voucher.reference_doctype)}/${item.voucher.reference_name}`} target='_blank' className='underline underline-offset-4'>{item.voucher.reference_name}</a></TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Posting Date")}</TableHead>
<TableCell>{formatDate(item.voucher.posting_date, 'Do MMM YYYY')}</TableCell>
</TableRow>
{type === 'transfer' && item.voucher.doc && <TableRow>
<TableHead>{_("Transfer Account")}</TableHead>
<TableCell>
<TransferDetails item={item} className='text-ink-gray-8' />
</TableCell>
</TableRow>}
{type === 'payment' && item.voucher.doc && <TableRow>
<TableHead>{_("Payment Details")}</TableHead>
<TableCell>
<PaymentEntryDetails item={item} className='text-ink-gray-8' />
</TableCell>
</TableRow>}
{type === 'bank_entry' && item.voucher.doc && <TableRow>
<TableHead>{_("Account")}</TableHead>
<TableCell><JournalEntryAccountsTable item={item} bank={bank} /></TableCell>
</TableRow>}
</Table>
</div>
<AlertDialogFooter>
<AlertDialogCancel disabled={loading}>
{_("Close")}
</AlertDialogCancel>
<Button theme="red" size='md' disabled={loading} onClick={onUndo}>
{loading ? <Loader2Icon className='w-4 h-4 animate-spin' /> : _(("Undo"))}
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
}
export default ActionLogDialogBody

View File

@@ -0,0 +1,334 @@
import { useAtomValue, useSetAtom } from "jotai"
import { bankRecClosingBalanceAtom, bankRecDateAtom, SelectedBank, selectedBankAccountAtom } from "./bankRecAtoms"
import { FrappeConfig, FrappeContext, useFrappeGetDocCount, useFrappeGetDocList, useFrappePostCall, useSWRConfig } from "frappe-react-sdk"
import { BankTransaction } from "@/types/Accounts/BankTransaction"
import { Progress } from "@/components/ui/progress"
import { useGetAccountClosingBalance, useGetAccountClosingBalanceAsPerStatement, useGetAccountOpeningBalance, useGetUnreconciledTransactions } from "./utils"
import { flt, formatCurrency } from "@/lib/numbers"
import { Skeleton } from "@/components/ui/skeleton"
import { StatContainer, StatLabel, StatValue } from "@/components/ui/stats"
import { Edit, Info, Trash2 } from "lucide-react"
import { H4, Paragraph } from "@/components/ui/typography"
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card"
import { getCompanyCurrency } from "@/lib/company"
import _ from "@/lib/translate"
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { formatDate } from "@/lib/date"
import { Form } from "@/components/ui/form"
import { CurrencyFormField } from "@/components/ui/form-elements"
import { useForm } from "react-hook-form"
import { Button } from "@/components/ui/button"
import { useContext, useState } from "react"
import { Separator } from "@/components/ui/separator"
import { BankAccountBalance } from "@/types/Accounts/BankAccountBalance"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { toast } from "sonner"
import ErrorBanner from "@/components/ui/error-banner"
const BankBalance = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
if (!bankAccount) {
return null
}
return (
<div className="flex justify-between">
<div className="w-[80%] flex flex-wrap justify-between gap-2 pe-8 border-e-border border-e">
<OpeningBalance />
<ClosingBalance />
<ClosingBalanceAsPerStatement />
<Difference />
</div>
<ReconcileProgress />
</div>
)
}
const OpeningBalance = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const { data, isLoading } = useGetAccountOpeningBalance()
return <StatContainer className="min-w-48">
<StatLabel>{_("Opening Balance")}</StatLabel>
{isLoading ? <Skeleton className="w-[150px] h-5 rounded-sm" /> : <StatValue className="font-numeric">{formatCurrency(flt(data?.message, 2), bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? ''))}</StatValue>}
</StatContainer>
}
const ClosingBalance = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const { data, isLoading } = useGetAccountClosingBalance()
return (
<StatContainer className="min-w-48">
<div className="flex items-start gap-1">
<StatLabel>
{_("Closing Balance as per system")}
</StatLabel>
<HoverCard openDelay={100}>
<HoverCardTrigger>
<Info className="size-3.5 text-ink-gray-6 -mt-px" />
</HoverCardTrigger>
<HoverCardContent className="w-96" align="start" side="right">
<H4 className="text-base">{_("Closing balance as per system")}</H4>
<Paragraph className="mt-2 text-p-sm">
{_("This is what the system expects the closing balance to be in your bank statement.")}
<br />
{_("It takes into account all the transactions that have been posted and subtracts the transactions that have not cleared yet.")}
<br />
{_("If your bank statement shows a different closing balance, it is because all transactions have not reconciled yet.")}
<br /><br />
For more information, click on the <strong>Bank Reconciliation Statement</strong> tab below.
</Paragraph>
</HoverCardContent>
</HoverCard>
</div>
{isLoading ? <Skeleton className="w-[150px] h-5 rounded-sm" /> : <StatValue className="font-numeric">{formatCurrency(flt(data?.message, 2), bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? ''))}</StatValue>}
</StatContainer>
)
}
const Difference = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const { data, isLoading } = useGetAccountClosingBalance()
const value = useAtomValue(bankRecClosingBalanceAtom(bankAccount?.name ?? ''))
const difference = flt(value.value - (data?.message ?? 0))
const isError = difference !== 0
return <StatContainer className="w-fit text-end sm:min-w-56">
<StatLabel className="text-end">{_("Difference")}</StatLabel>
{isLoading ? <Skeleton className="w-[150px] h-5 self-end rounded-sm" /> : <StatValue className={isError ? 'text-ink-red-3 font-numeric' : 'font-numeric'}>
{formatCurrency(difference,
bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? ''))
}</StatValue>}
</StatContainer>
}
const ReconcileProgress = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const { data: totalCount } = useFrappeGetDocCount<BankTransaction>('Bank Transaction', [
["bank_account", "=", bankAccount?.name ?? ''],
['docstatus', '=', 1],
['date', '<=', dates?.toDate],
['date', '>=', dates?.fromDate]
], false, undefined, {
revalidateOnFocus: false
})
const { data: unreconciledTransactions, } = useGetUnreconciledTransactions()
const reconciledCount = (totalCount ?? 0) - (unreconciledTransactions?.message?.length ?? 0)
const progress = (totalCount ? reconciledCount / totalCount : 0) * 100
return <div className="w-[18%] flex flex-col gap-1 items-end">
<div className="w-full">
<Progress
value={progress}
max={100}
size="md"
label="Progress"
hint
hintText={`${reconciledCount} / ${totalCount} ${_("reconciled")}`} />
</div>
</div>
}
const ClosingBalanceAsPerStatement = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const setValue = useSetAtom(bankRecClosingBalanceAtom(bankAccount?.name ?? ''))
const { data, isLoading } = useGetAccountClosingBalanceAsPerStatement({
onSuccess: (data) => {
if (data?.message && data?.message?.balance) {
setValue({
value: data?.message?.balance,
stringValue: data?.message?.balance.toString()
})
}
}
})
const isDateSame = data?.message?.date === dates.toDate
const [isOpen, setIsOpen] = useState(false)
return <StatContainer className="min-w-48">
<StatLabel>{_("Closing Balance as per statement")}</StatLabel>
<div className="flex flex-col gap-2 items-start">
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogTrigger>
<Tooltip>
<TooltipTrigger asChild>
<div className="flex items-center gap-4 underline cursor-pointer underline-offset-6" role="button">
{isLoading ? <Skeleton className="w-[150px] h-5 rounded-sm" /> : <StatValue className="font-numeric">{formatCurrency(flt(data?.message?.balance, 2), bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? ''))}</StatValue>}
<Edit className="w-4 h-4" />
</div>
</TooltipTrigger>
<TooltipContent>
{_("Click to set the closing balance as per statement")}
</TooltipContent>
</Tooltip>
</DialogTrigger>
<DialogContent className="min-w-xl">
<ClosingBalanceForm
defaultBalance={data?.message?.balance ?? 0}
date={dates.toDate}
bankAccount={bankAccount}
onClose={() => setIsOpen(false)}
/>
</DialogContent>
</Dialog>
{!isDateSame && data?.message.date && <span className="text-xs font-medium text-ink-red-3">{_("As of {0}", [formatDate(data?.message?.date ?? '', 'Do MMM YYYY')])}</span>}
</div>
</StatContainer>
}
const ClosingBalanceForm = ({ defaultBalance, date, bankAccount, onClose }: { defaultBalance: number, date: string, bankAccount: SelectedBank | null, onClose: VoidFunction }) => {
const { mutate } = useSWRConfig()
const form = useForm<{ balance: number }>({
defaultValues: {
balance: defaultBalance
}
})
const setValue = useSetAtom(bankRecClosingBalanceAtom(bankAccount?.name ?? ''))
const { call, loading, error } = useFrappePostCall("erpnext.accounts.doctype.bank_account.bank_account.set_closing_balance_as_per_statement")
const onSubmit = (data: { balance: number }) => {
if (data.balance) {
call({
bank_account: bankAccount?.name ?? '',
date: date,
balance: data.balance
})
.then(() => {
// Mutate the closing balance as per statement
mutate(`bank-reconciliation-account-closing-balance-as-per-statement-${bankAccount?.name}-${date}`)
setValue({
value: data.balance,
stringValue: data.balance.toString()
})
toast.success(_("Closing balance set."))
onClose()
})
} else {
toast.error(_("Closing balance is required."))
}
}
const currency = bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? '')
return <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<DialogHeader>
<DialogTitle>{_("Set closing balance as per bank statement")}</DialogTitle>
<DialogDescription>
{_("Enter the closing balance you see in your bank statement for {0} as of the {1}", [bankAccount?.account_name ?? bankAccount?.name ?? '', formatDate(date, 'Do MMM YYYY')])}
</DialogDescription>
</DialogHeader>
{error && <ErrorBanner error={error} />}
<div className="py-4">
<CurrencyFormField
name="balance"
label={_("Closing balance on bank statement as of {0}", [formatDate(date, 'Do MMM YYYY')])}
isRequired
currency={currency}
/>
</div>
<DialogFooter>
<DialogClose asChild>
<Button variant={'outline'} size='md' disabled={loading}>{_("Cancel")}</Button>
</DialogClose>
<Button type='submit' size='md' disabled={loading}>{_("Save")}</Button>
</DialogFooter>
<ClosingBalancesList bankAccount={bankAccount} date={date} />
</form>
</Form>
}
const ClosingBalancesList = ({ bankAccount, date }: { bankAccount: SelectedBank | null, date: string }) => {
const { data, mutate } = useFrappeGetDocList<BankAccountBalance>("Bank Account Balance", {
filters: [["bank_account", "=", bankAccount?.name ?? ''], ["date", "<=", date]],
orderBy: {
field: "date",
order: "desc"
},
fields: ["date", "balance", "name"],
limit: 10
})
const { db } = useContext(FrappeContext) as FrappeConfig
const onDelete = (name: string) => {
toast.promise(db.deleteDoc("Bank Account Balance", name).then(() => {
mutate()
}), {
loading: _("Deleting closing balance..."),
success: _("Closing balance deleted."),
error: _("Failed to delete closing balance.")
})
}
if (data?.length === 0) {
return null
}
return <div>
<Separator className="my-8" />
<p className="text-sm text-center">{_("Balances as per bank statement before {0}", [formatDate(date, 'Do MMM YYYY')])}</p>
<Table>
<TableHeader>
<TableRow>
<TableHead>{_("Date")}</TableHead>
<TableHead className="text-end">{_("Balance")}</TableHead>
<TableHead></TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data?.map((item) => (
<TableRow key={item.name}>
<TableCell>{formatDate(item.date, 'Do MMM YYYY')}</TableCell>
<TableCell className="text-end">{formatCurrency(flt(item.balance, 2), bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? ''))}</TableCell>
<TableCell className="text-end">
<Button
title={_("Delete")}
type='button' isIconButton variant='ghost' onClick={() => onDelete(item.name)}>
<Trash2 />
</Button>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
}
export default BankBalance

View File

@@ -0,0 +1,355 @@
import { useAtomValue } from "jotai"
import { MissingFiltersBanner } from "./MissingFiltersBanner"
import { bankRecDateAtom, SelectedBank, selectedBankAccountAtom } from "./bankRecAtoms"
import { useCurrentCompany } from "@/hooks/useCurrentCompany"
import { Paragraph } from "@/components/ui/typography"
import type { ColumnDef } from "@tanstack/react-table"
import { useCallback, useMemo, useState } from "react"
import { useFrappeGetCall, useFrappePostCall, useSWRConfig } from "frappe-react-sdk"
import { QueryReportReturnType } from "@/types/custom/Reports"
import { formatDate } from "@/lib/date"
import { ListView, type ListViewColumnMeta } from "@/components/ui/list-view"
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { formatCurrency } from "@/lib/numbers"
import { getCompanyCurrency } from "@/lib/company"
import { slug } from "@/lib/frappe"
import { CheckCircle2, ReceiptTextIcon, XCircle } from "lucide-react"
import ErrorBanner from "@/components/ui/error-banner"
import { Badge } from "@/components/ui/badge"
import _ from "@/lib/translate"
import { useCopyToClipboard } from "usehooks-ts"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { toast } from "sonner"
import { Button } from "@/components/ui/button"
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"
import { Form } from "@/components/ui/form"
import { useForm } from "react-hook-form"
import { DateField } from "@/components/ui/form-elements"
import { Empty, EmptyMedia, EmptyHeader, EmptyTitle, EmptyDescription } from "@/components/ui/empty"
const BankClearanceSummary = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
if (!bankAccount) {
return <MissingFiltersBanner text={_("Please select a bank account to view the bank clearance summary.")} />
}
if (!dates) {
return <MissingFiltersBanner text={_("Please select dates to view the bank clearance summary.")} />
}
return <BankClearanceSummaryView />
}
interface BankClearanceSummaryEntry {
payment_document_type: string
payment_entry: string
posting_date: string,
cheque_no?: string,
amount: number,
against: string,
clearance_date: string,
}
const BankClearanceSummaryView = () => {
const companyID = useCurrentCompany()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const filters = useMemo(() => {
return JSON.stringify({
account: bankAccount?.account,
from_date: dates.fromDate,
to_date: dates.toDate
})
}, [bankAccount, dates])
const { data, error, mutate } = useFrappeGetCall<{ message: QueryReportReturnType<BankClearanceSummaryEntry> }>('frappe.desk.query_report.run', {
report_name: 'Bank Clearance Summary',
filters,
ignore_prepared_report: 1,
are_default_filters: false,
}, `Report-Bank Clearance Summary-${filters}`, { keepPreviousData: true, revalidateOnFocus: false }, 'POST')
const formattedFromDate = formatDate(dates.fromDate)
const formattedToDate = formatDate(dates.toDate)
const [, copyToClipboard] = useCopyToClipboard()
const onCopy = useCallback(
(text: string) => {
copyToClipboard(text).then(() => {
toast.success(_("Copied to clipboard"))
})
},
[copyToClipboard],
)
const accountCurrency = useMemo(
() => bankAccount?.account_currency ?? getCompanyCurrency(companyID),
[bankAccount?.account_currency, companyID],
)
const clearanceColumns = useMemo<ColumnDef<BankClearanceSummaryEntry, unknown>[]>(
() => [
{
accessorKey: "payment_document_type",
header: _("Document Type"),
size: 140,
cell: ({ row }) => _(row.original.payment_document_type),
},
{
id: "payment_entry",
header: _("Payment Document"),
size: 160,
meta: {
getTooltipText: (r) => {
const x = r as BankClearanceSummaryEntry
return [x.payment_document_type, x.payment_entry].filter(Boolean).join(" · ") || undefined
},
} satisfies ListViewColumnMeta,
cell: ({ row }) => (
<a
target="_blank"
rel="noreferrer"
className="text-ink-gray-8 block min-w-0 w-full underline underline-offset-4"
href={`/desk/${slug(row.original.payment_document_type)}/${row.original.payment_entry}`}
>
{row.original.payment_entry}
</a>
),
},
{
accessorKey: "posting_date",
header: _("Posting Date"),
size: 118,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.posting_date),
},
{
accessorKey: "cheque_no",
header: _("Cheque/Reference Number"),
size: 160,
cell: ({ row }) => {
const ref = row.original.cheque_no ?? ""
return (
<Tooltip delayDuration={500}>
<TooltipTrigger asChild>
<button
type="button"
className="text-ink-gray-8 hover:underline min-w-0 w-full cursor-pointer truncate text-start underline-offset-4"
onClick={() => onCopy(ref)}
>
{ref}
</button>
</TooltipTrigger>
<TooltipContent>
{ref}
</TooltipContent>
</Tooltip>
)
},
},
{
accessorKey: "clearance_date",
header: _("Clearance Date"),
size: 118,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.clearance_date),
},
{
accessorKey: "against",
header: _("Against Account"),
size: 250,
},
{
accessorKey: "amount",
header: _("Amount"),
size: 150,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => <span className="font-numeric">{formatCurrency(row.original.amount, accountCurrency)}</span>,
},
{
id: "status",
header: _("Status"),
size: 200,
meta: { truncate: false, truncateTooltip: false } satisfies ListViewColumnMeta,
cell: ({ row }) => {
const r = row.original
return r.clearance_date ? (
<Badge theme="green">
<CheckCircle2 />
{_("Cleared")}
</Badge>
) : (
<div className="flex min-w-0 flex-wrap items-center gap-2">
<Badge theme="red">
<XCircle />
{_("Not Cleared")}
</Badge>
<SetClearanceDateButton
voucher={r}
bankAccount={bankAccount}
companyID={companyID}
mutate={mutate}
/>
</div>
)
},
},
],
[accountCurrency, bankAccount, companyID, mutate, onCopy],
)
return <div className="space-y-4 py-2">
<div>
<Paragraph className="text-sm">
<span dangerouslySetInnerHTML={{
__html: _("Below is a list of all accounting entries posted against the bank account {0} between {1} and {2}.", [`<strong>${bankAccount?.account}</strong>`, `<strong>${formattedFromDate}</strong>`, `<strong>${formattedToDate}</strong>`])
}} />
</Paragraph>
</div>
{error && <ErrorBanner error={error} />}
{data && data.message.result.length > 0 ? (
<ListView
data={data.message.result}
columns={clearanceColumns}
getRowId={(row) => `${row.payment_entry}-${row.posting_date}`}
maxHeight="calc(100vh - 200px)"
scrollAreaClassName="min-h-[calc(100vh-200px)]"
emptyState={_("No rows to display.")}
/>
) : null}
{data && data.message.result.length == 0 &&
<Empty>
<EmptyMedia>
<ReceiptTextIcon />
</EmptyMedia>
<EmptyHeader>
<EmptyTitle>{_("No entries found")}</EmptyTitle>
<EmptyDescription>{_("There are no accounting entries in the system for the selected account and dates.")}</EmptyDescription>
</EmptyHeader>
</Empty>
}
</div>
}
const SetClearanceDateButton = ({ voucher, bankAccount, companyID, mutate }: { voucher: BankClearanceSummaryEntry, bankAccount: SelectedBank | null, companyID: string, mutate: VoidFunction }) => {
const [open, setOpen] = useState(false)
const onClose = () => {
setOpen(false)
mutate()
}
return <Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger disabled={!bankAccount}>
<Tooltip delayDuration={500}>
<TooltipTrigger>
<Button variant='link' size="sm" className="px-0" theme="red">{_("Force Clear")}</Button>
</TooltipTrigger>
<TooltipContent align='start'>
{_("Set the clearance date for this voucher without reconciling with a bank transaction.")}
</TooltipContent>
</Tooltip>
</DialogTrigger>
<DialogContent className="min-w-2xl">
{bankAccount && <ForceClearVoucherForm voucher={voucher} bankAccount={bankAccount} companyID={companyID} onClose={onClose} />}
</DialogContent>
</Dialog>
}
const ForceClearVoucherForm = ({ voucher, bankAccount, companyID, onClose }: { voucher: BankClearanceSummaryEntry, bankAccount: SelectedBank, companyID: string, onClose: () => void }) => {
const { mutate } = useSWRConfig()
const dates = useAtomValue(bankRecDateAtom)
const form = useForm<{ clearance_date: string }>({
defaultValues: {
clearance_date: voucher.posting_date,
}
})
const { call, loading, error } = useFrappePostCall('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.update_clearance_date')
const onSubmit = (data: { clearance_date: string }) => {
call({
payment_document: voucher.payment_document_type,
payment_entry: voucher.payment_entry,
account: bankAccount.account,
clearance_date: data.clearance_date,
})
.then(() => {
toast.success(_("Clearance date updated"))
onClose()
mutate(`bank-reconciliation-account-closing-balance-${bankAccount?.name}-${dates.toDate}`)
})
}
return <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div className='flex flex-col gap-4'>
<DialogHeader>
<DialogTitle>{_("Force Clear Voucher")}</DialogTitle>
<DialogDescription>
{_("Set the clearance date for this voucher without reconciling with a bank transaction.")}
</DialogDescription>
</DialogHeader>
{error && <ErrorBanner error={error} />}
<div>
<Table>
<TableHeader>
<TableRow>
<TableHead>{_("Payment Document")}</TableHead>
<TableCell><a target="_blank" className="underline underline-offset-4"
href={`/desk/${slug(voucher.payment_document_type)}/${voucher.payment_entry}`}>{_(voucher.payment_document_type)} : {voucher.payment_entry}</a></TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Posting Date")}</TableHead>
<TableCell>{formatDate(voucher.posting_date)}</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Cheque/Reference Number")}</TableHead>
<TableCell title={voucher.cheque_no}>{voucher.cheque_no?.slice(0, 40)}{voucher.cheque_no?.length && voucher.cheque_no?.length > 40 ? "..." : ""}</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Amount")}</TableHead>
<TableCell className="text-end">{formatCurrency(voucher.amount, bankAccount?.account_currency ?? getCompanyCurrency(companyID))}</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Against Account")}</TableHead>
<TableCell><a target="_blank" className="underline underline-offset-4" href={`/desk/account/${voucher.against}`}>{voucher.against}</a></TableCell>
</TableRow>
</TableHeader>
</Table>
</div>
<DateField
name='clearance_date'
label={_("Clearance Date")}
isRequired
inputProps={{ autoFocus: true }}
/>
<DialogFooter>
<DialogClose asChild>
<Button variant={'outline'} disabled={loading} size='md'>{_("Cancel")}</Button>
</DialogClose>
<Button type='submit' disabled={loading} size='md'>{_("Submit")}</Button>
</DialogFooter>
</div>
</form>
</Form>
}
export default BankClearanceSummary

View File

@@ -0,0 +1,32 @@
import { useAtom } from "jotai"
import { bankRecRecordJournalEntryModalAtom } from "./bankRecAtoms"
import { Dialog, DialogContent, DialogTitle, DialogDescription, DialogHeader } from "@/components/ui/dialog"
import { ModalContentFallback } from "@/components/ui/modal-content-fallback"
import _ from "@/lib/translate"
import { lazy, Suspense } from "react"
const RecordBankEntryModalContent = lazy(() => import('./BankEntryModalContent'))
const BankEntryModal = () => {
const [isOpen, setIsOpen] = useAtom(bankRecRecordJournalEntryModalAtom)
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent className='min-w-[95vw]'>
<DialogHeader>
<DialogTitle>{_("Bank Entry")}</DialogTitle>
<DialogDescription>
{_("Record a journal entry for expenses, income or split transactions.")}
</DialogDescription>
</DialogHeader>
{isOpen && (
<Suspense fallback={<ModalContentFallback />}>
<RecordBankEntryModalContent />
</Suspense>
)}
</DialogContent>
</Dialog>
)
}
export default BankEntryModal

View File

@@ -0,0 +1,811 @@
import { useAtomValue, useSetAtom } from "jotai"
import { bankRecRecordJournalEntryModalAtom, bankRecSelectedTransactionAtom, bankRecUnreconcileModalAtom, selectedBankAccountAtom } from "./bankRecAtoms"
import { DialogFooter, DialogClose } from "@/components/ui/dialog"
import _ from "@/lib/translate"
import { UnreconciledTransaction, useGetRuleForTransaction, useRefreshUnreconciledTransactions, useUpdateActionLog } from "./utils"
import { useFieldArray, useForm, useFormContext, useWatch } from "react-hook-form"
import { JournalEntry } from "@/types/Accounts/JournalEntry"
import { getCompanyCostCenter, getCompanyCurrency } from "@/lib/company"
import { FrappeConfig, FrappeContext, useFrappePostCall } from "frappe-react-sdk"
import { toast } from "sonner"
import ErrorBanner from "@/components/ui/error-banner"
import { Button } from "@/components/ui/button"
import SelectedTransactionDetails from "./SelectedTransactionDetails"
import { AccountFormField, CurrencyFormField, DataField, DateField, LinkFormField, PartyTypeFormField, SmallTextField } from "@/components/ui/form-elements"
import { Form } from "@/components/ui/form"
import { useCallback, useContext, useMemo, useRef, useState } from "react"
import { useMultiFileUploadProgress } from "@/hooks/useMultiFileUploadProgress"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { Checkbox } from "@/components/ui/checkbox"
import { ArrowDownRight, ArrowUpRight, Plus, Trash2 } from "lucide-react"
import { flt, formatCurrency } from "@/lib/numbers"
import { cn } from "@/lib/utils"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import SelectedTransactionsTable from "./SelectedTransactionsTable"
import { JournalEntryAccount } from "@/types/Accounts/JournalEntryAccount"
import { BankTransaction } from "@/types/Accounts/BankTransaction"
import FileUploadBanner from "@/components/common/FileUploadBanner"
import { Label } from "@/components/ui/label"
import { FileDropzone } from "@/components/ui/file-dropzone"
import { useGetAccounts } from "@/components/common/AccountsDropdown"
import { useHotkeys } from "react-hotkeys-hook"
const RecordBankEntryModalContent = () => {
const selectedBankAccount = useAtomValue(selectedBankAccountAtom)
const selectedTransaction = useAtomValue(bankRecSelectedTransactionAtom(selectedBankAccount?.name ?? ''))
if (!selectedTransaction || !selectedBankAccount || selectedTransaction.length === 0) {
return <div className='p-4'>
<span className='text-center'>{_("No transaction selected")}</span>
</div>
}
if (selectedTransaction.length === 1) {
return <BankEntryForm
selectedTransaction={selectedTransaction[0]} />
}
return <BulkBankEntryForm
selectedTransactions={selectedTransaction}
/>
}
const BulkBankEntryForm = ({ selectedTransactions }: { selectedTransactions: UnreconciledTransaction[] }) => {
const form = useForm<{
account: string
}>({
defaultValues: {
account: ''
}
})
const { call, loading, error } = useFrappePostCall<{ message: { transaction: BankTransaction, journal_entry: JournalEntry }[] }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.create_bulk_bank_entry_and_reconcile')
const onReconcile = useRefreshUnreconciledTransactions()
const addToActionLog = useUpdateActionLog()
const setIsOpen = useSetAtom(bankRecRecordJournalEntryModalAtom)
const onSubmit = (data: { account: string }) => {
call({
bank_transactions: selectedTransactions.map(transaction => transaction.name),
account: data.account
}).then(({ message }) => {
addToActionLog({
type: 'bank_entry',
timestamp: (new Date()).getTime(),
isBulk: true,
items: message.map((item) => ({
bankTransaction: item.transaction,
voucher: {
reference_doctype: "Journal Entry",
reference_name: item.journal_entry.name,
doc: item.journal_entry,
posting_date: item.journal_entry.posting_date,
}
})),
bulkCommonData: {
account: data.account,
}
})
toast.success(_("Bank Entries Created"), {
duration: 4000,
})
// Set this to the last selected transaction
onReconcile(selectedTransactions[selectedTransactions.length - 1])
setIsOpen(false)
})
}
return <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div className="flex flex-col gap-4">
{error && <ErrorBanner error={error} />}
<SelectedTransactionsTable />
<div className="grid grid-cols-3 gap-4">
<AccountFormField
name='account'
filterFunction={(acc) => {
// Do not allow payable and receivable accounts
return acc.account_type !== 'Payable' && acc.account_type !== 'Receivable'
}}
label={_('Account')}
isRequired
/>
</div>
<DialogFooter>
<DialogClose asChild>
<Button size='md' variant={'outline'} disabled={loading}>{_("Cancel")}</Button>
</DialogClose>
<Button size='md' type='submit' disabled={loading}>{_("Submit")}</Button>
</DialogFooter>
</div>
</form>
</Form>
}
interface BankEntryFormData extends Pick<JournalEntry, 'voucher_type' | 'cheque_date' | 'posting_date' | 'cheque_no' | 'user_remark'> {
entries: JournalEntry['accounts']
}
const BankEntryForm = ({ selectedTransaction }: { selectedTransaction: UnreconciledTransaction }) => {
const selectedBankAccount = useAtomValue(selectedBankAccountAtom)
const { data: rule } = useGetRuleForTransaction(selectedTransaction)
const setIsOpen = useSetAtom(bankRecRecordJournalEntryModalAtom)
const onClose = () => {
setIsOpen(false)
}
const isWithdrawal = (selectedTransaction.withdrawal && selectedTransaction.withdrawal > 0) ? true : false
const defaultAccounts = useMemo(() => {
const isWithdrawal = (selectedTransaction.withdrawal && selectedTransaction.withdrawal > 0) ? true : false
const accounts: Partial<JournalEntryAccount>[] = [
{
account: selectedBankAccount?.account ?? '',
bank_account: selectedTransaction.bank_account,
// Bank is debited if it's a deposit
debit: isWithdrawal ? 0 : selectedTransaction.unallocated_amount,
credit: isWithdrawal ? selectedTransaction.unallocated_amount : 0,
party_type: '',
party: '',
cost_center: ''
}]
// If there is no rule, we can just add the entries for the bank account transaction and the other side will be the reverse
if (!rule) {
accounts.push(
{
account: '',
// Amounts will be the reverse of the bank account transaction
debit: isWithdrawal ? selectedTransaction.unallocated_amount : 0,
credit: isWithdrawal ? 0 : selectedTransaction.unallocated_amount,
cost_center: getCompanyCostCenter(selectedTransaction.company ?? '') ?? '',
}
)
} else {
// Rule exists, so we need to check the type of rule
if (!rule.bank_entry_type || rule.bank_entry_type === "Single Account") {
// Only a single account needs to be added
accounts.push({
account: rule.account ?? '',
// Amounts will be the reverse of the bank account transaction
debit: isWithdrawal ? selectedTransaction.unallocated_amount : 0,
credit: isWithdrawal ? 0 : selectedTransaction.unallocated_amount,
cost_center: getCompanyCostCenter(selectedTransaction.company ?? '') ?? '',
})
} else {
// For multiple accounts, we need to loop over and add entries for each
// The last row will just be the remaining amount
let hasTotallyEmptyRowEarlier = false;
let totalDebits = isWithdrawal ? 0 : selectedTransaction.unallocated_amount ?? 0
let totalCredits = isWithdrawal ? selectedTransaction.unallocated_amount ?? 0 : 0
for (let i = 0; i < (rule.accounts?.length ?? 0); i++) {
const acc = rule.accounts?.[i]
// If it's the last row, add the difference amount
if (i === (rule.accounts?.length ?? 0) - 1 && !hasTotallyEmptyRowEarlier) {
const differenceAmount = flt(totalDebits - totalCredits, 2)
accounts.push({
account: acc?.account ?? '',
debit: differenceAmount > 0 ? 0 : Math.abs(differenceAmount),
credit: differenceAmount > 0 ? Math.abs(differenceAmount) : 0,
cost_center: getCompanyCostCenter(selectedTransaction.company ?? '') ?? '',
user_remark: acc?.user_remark ?? '',
})
} else {
/**
* The debit and credit amounts can also be expressions - like "transaction_amount * 0.5"
* So we need to compute the value of the expression
* We can use the eval function to do this. But we need to expose certain variables to the expression.
* One of them is transaction_amount which is the unallocated amount of the selected transaction
* @param expression - The expression to compute
* @returns The computed value
*/
const computeExpression = (expression: string) => {
const script = `
const transaction_amount = ${selectedTransaction.unallocated_amount ?? 0}
${expression};
`
let value = 0;
try {
value = window.eval(script);
} catch (error: unknown) {
console.error(error);
value = 0;
}
return value;
}
if (!acc?.debit && !acc?.credit) {
hasTotallyEmptyRowEarlier = true;
}
const computedDebit = acc?.debit ? flt(computeExpression(acc.debit), 2) : 0
const computedCredit = acc?.credit ? flt(computeExpression(acc.credit), 2) : 0
totalDebits = flt(totalDebits + computedDebit, 2)
totalCredits = flt(totalCredits + computedCredit, 2)
accounts.push({
account: acc?.account ?? '',
debit: computedDebit,
credit: computedCredit,
cost_center: getCompanyCostCenter(selectedTransaction.company ?? '') ?? '',
user_remark: acc?.user_remark ?? '',
})
}
}
}
}
return accounts
}, [rule, selectedTransaction, selectedBankAccount])
const form = useForm<BankEntryFormData>({
defaultValues: {
voucher_type: selectedBankAccount?.is_credit_card ? 'Credit Card Entry' : 'Bank Entry',
cheque_date: selectedTransaction.date,
posting_date: selectedTransaction.date,
cheque_no: (selectedTransaction.reference_number || selectedTransaction.description || '').slice(0, 140),
user_remark: selectedTransaction.description,
entries: defaultAccounts,
}
})
const onReconcile = useRefreshUnreconciledTransactions()
const { call: createBankEntry, loading, error, isCompleted } = useFrappePostCall<{ message: { transaction: BankTransaction, journal_entry: JournalEntry } }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.create_bank_entry_and_reconcile')
const setBankRecUnreconcileModalAtom = useSetAtom(bankRecUnreconcileModalAtom)
const addToActionLog = useUpdateActionLog()
const { file: frappeFile } = useContext(FrappeContext) as FrappeConfig
const [isUploading, setIsUploading] = useState(false)
const { uploadProgress, startTracking, updateFileProgress, resetProgress } = useMultiFileUploadProgress()
const [files, setFiles] = useState<File[]>([])
const onSubmit = (data: BankEntryFormData) => {
createBankEntry({
bank_transaction_name: selectedTransaction.name,
...data
}).then(async ({ message }) => {
addToActionLog({
type: 'bank_entry',
isBulk: false,
timestamp: (new Date()).getTime(),
items: [
{
bankTransaction: message.transaction,
voucher: {
reference_doctype: "Journal Entry",
reference_name: message.journal_entry.name,
reference_no: message.journal_entry.cheque_no,
reference_date: message.journal_entry.cheque_date,
posting_date: message.journal_entry.posting_date,
doc: message.journal_entry,
}
}
]
})
toast.success(_("Bank Entry Created"), {
duration: 4000,
closeButton: true,
action: {
label: _("Undo"),
onClick: () => setBankRecUnreconcileModalAtom(selectedTransaction.name)
},
actionButtonStyle: {
backgroundColor: "rgb(0, 138, 46)"
}
})
if (files.length > 0) {
setIsUploading(true)
startTracking(files.length)
const uploadPromises = files.map((f, fileIndex) => {
return frappeFile.uploadFile(f, {
isPrivate: true,
doctype: "Journal Entry",
docname: message.journal_entry.name,
}, (_bytesUploaded, _totalBytes, progress) => {
updateFileProgress(fileIndex, progress?.progress ?? 0)
})
})
return Promise.all(uploadPromises).then(() => {
resetProgress()
setIsUploading(false)
}).catch((error) => {
console.error(error)
toast.error(_("Error uploading attachments"), {
duration: 4000,
})
resetProgress()
setIsUploading(false)
})
} else {
return Promise.resolve()
}
}).then(() => {
onReconcile(selectedTransaction)
onClose()
})
}
useHotkeys('meta+s', () => {
form.handleSubmit(onSubmit)()
}, {
enabled: true,
preventDefault: true,
enableOnFormTags: true
})
if (isUploading && isCompleted) {
return <FileUploadBanner uploadProgress={uploadProgress} />
}
return <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div className='flex flex-col gap-4'>
{error && <ErrorBanner error={error} />}
<div className='grid grid-cols-2 gap-4'>
<SelectedTransactionDetails transaction={selectedTransaction} />
<div className='flex flex-col gap-4'>
<div className='grid grid-cols-2 gap-4'>
<DateField
name='posting_date'
label={_("Posting Date")}
isRequired
inputProps={{ autoFocus: false }}
/>
<DateField
name='cheque_date'
label={_("Reference Date")}
isRequired
inputProps={{ autoFocus: false }}
rules={{
required: _("Reference Date is required"),
}}
/>
</div>
<DataField name='cheque_no' label={_("Reference")} isRequired inputProps={{ autoFocus: false }}
rules={{
required: _("Reference is required"),
}} />
</div>
</div>
<div>
<Entries company={selectedTransaction.company ?? ''} isWithdrawal={isWithdrawal} currency={selectedTransaction.currency ?? getCompanyCurrency(selectedTransaction.company ?? '')} />
</div>
<div className='flex flex-col gap-2'>
<div className='grid grid-cols-2 gap-4'>
<SmallTextField
name='user_remark'
label={_("Remarks")}
/>
<div
data-slot="form-item"
className="flex flex-col gap-2"
>
<Label>{_("Attachments")}</Label>
<FileDropzone files={files} setFiles={setFiles} />
</div>
</div>
</div>
<DialogFooter>
<DialogClose asChild>
<Button size='md' variant={'outline'} disabled={loading}>{_("Cancel")}</Button>
</DialogClose>
<Button size='md' type='submit' disabled={loading}>{_("Submit")}</Button>
</DialogFooter>
</div>
</form>
</Form>
}
const Entries = ({ company, isWithdrawal, currency }: { company: string, isWithdrawal: boolean, currency: string }) => {
const { getValues, setValue, control } = useFormContext<BankEntryFormData>()
const { call } = useContext(FrappeContext) as FrappeConfig
const partyMapRef = useRef<Record<string, string>>({})
const onPartyChange = (value: string, index: number) => {
// Get the account for the party type
if (value) {
if (partyMapRef.current[value]) {
setValue(`entries.${index}.account`, partyMapRef.current[value])
} else {
call.get('erpnext.accounts.party.get_party_account', {
party: value,
party_type: getValues(`entries.${index}.party_type`),
company: company
}).then((result: { message: string }) => {
setValue(`entries.${index}.account`, result.message)
partyMapRef.current[value] = result.message
})
}
} else {
setValue(`entries.${index}.account`, '')
}
}
const { data: accounts } = useGetAccounts()
const onAccountChange = (value: string, index: number) => {
// If it's an income or expense account, get the default cost center
if (value) {
const account = accounts?.find((acc) => acc.name === value)
if (account && account.report_type === "Profit and Loss") {
// Set the default company cost center
setValue(`entries.${index}.cost_center`, getCompanyCostCenter(company) ?? '')
return
}
}
setValue(`entries.${index}.cost_center`, '')
}
const { fields, append, remove } = useFieldArray({
control: control,
name: 'entries'
})
const onAdd = useCallback(() => {
const existingEntries = getValues('entries')
const totalDebits = existingEntries.reduce((acc, curr) => flt(acc + (curr.debit ?? 0), 2), 0)
const totalCredits = existingEntries.reduce((acc, curr) => flt(acc + (curr.credit ?? 0), 2), 0)
const remainingAmount = flt(totalDebits - totalCredits, 2)
// Remaining amount is credit if it's positive - since some debit is pending to be cleared.
const debitAmount = remainingAmount > 0 ? 0 : Math.abs(remainingAmount)
const creditAmount = remainingAmount > 0 ? Math.abs(remainingAmount) : 0
append({
party_type: '',
party: '',
account: '',
debit: debitAmount,
credit: creditAmount,
cost_center: getCompanyCostCenter(company) ?? ''
} as JournalEntryAccount, {
focusName: `entries.${existingEntries.length}.account`
})
}, [company, append, getValues])
const [selectedRows, setSelectedRows] = useState<number[]>([])
const onSelectRow = useCallback((index: number) => {
setSelectedRows(prev => {
if (prev.includes(index)) {
return prev.filter(i => i !== index)
}
return [...prev, index]
})
}, [])
const onSelectAll = useCallback(() => {
setSelectedRows(prev => {
if (prev.length === fields.length) {
return []
}
return [...fields.map((_, index) => index)]
})
}, [fields])
const onRemove = useCallback(() => {
// Do not remove the first row
remove(selectedRows.filter(index => index !== 0))
setSelectedRows([])
}, [remove, selectedRows])
/**
* When add difference is clicked, check if the last row has nothing filled in.
* If last row is empty (no debit or credit), then set that row's amount. Else, add a new row with the difference amount.
*/
const onAddDifferenceClicked = () => {
const existingEntries = getValues('entries')
const totalDebits = existingEntries.reduce((acc, curr) => flt(acc + (curr.debit ?? 0), 2), 0)
const totalCredits = existingEntries.reduce((acc, curr) => flt(acc + (curr.credit ?? 0), 2), 0)
const lastIndex = existingEntries.length - 1
const isLastRowEmpty = (existingEntries[lastIndex]?.debit === 0 || existingEntries[lastIndex]?.debit === undefined) && (existingEntries[lastIndex]?.credit === 0 || existingEntries[lastIndex]?.credit === undefined)
const remainingAmount = flt(totalDebits - totalCredits, 2)
// Remaining amount is credit if it's positive - since some debit is pending to be cleared.
const debitAmount = remainingAmount > 0 ? 0 : Math.abs(remainingAmount)
const creditAmount = remainingAmount > 0 ? Math.abs(remainingAmount) : 0
if (isLastRowEmpty) {
setValue(`entries.${lastIndex}.debit`, debitAmount)
setValue(`entries.${lastIndex}.credit`, creditAmount)
} else {
append({
party_type: '',
party: '',
account: '',
debit: debitAmount,
credit: creditAmount,
cost_center: getCompanyCostCenter(company) ?? ''
} as JournalEntryAccount, {
focusName: `entries.${existingEntries.length}.account`
})
}
}
return <div className="flex flex-col gap-2">
<Table>
<TableHeader>
<TableRow>
<TableHead><Checkbox
disabled={fields.length === 0}
// Make this accessible to screen readers
aria-label={_("Select all")}
checked={selectedRows.length > 0 && selectedRows.length === fields.length}
onCheckedChange={onSelectAll} /></TableHead>
<TableHead>{_("Party")}</TableHead>
<TableHead>{_("Account")}</TableHead>
<TableHead>{_("Cost Center")}</TableHead>
<TableHead>{_("Remarks")}</TableHead>
<TableHead className="text-end">{_("Debit")}</TableHead>
<TableHead className="text-end">{_("Credit")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{fields.map((field, index) => (
<TableRow key={field.id} className={index === 0 ? 'bg-surface-gray-1 cursor-not-allowed' : ''} title={index === 0 ? _("This is the bank account entry. You cannot edit it.") : ''}>
<TableCell>
<Checkbox
checked={selectedRows.includes(index)}
onCheckedChange={() => onSelectRow(index)}
// Make this accessible to screen readers
aria-label={_("Select row {0}", [String(index + 1)])}
disabled={index === 0}
/>
</TableCell>
<TableCell className="align-top">
<div className="flex">
<PartyTypeFormField
name={`entries.${index}.party_type`}
label={_("Party Type")}
isRequired
readOnly={index === 0}
hideLabel
inputProps={{
type: isWithdrawal ? 'Payable' : 'Receivable',
triggerProps: {
className: 'rounded-e-none',
tabIndex: -1
},
readOnly: index === 0,
}} />
<PartyField index={index} onChange={onPartyChange} readOnly={index === 0} />
</div>
</TableCell>
<TableCell className="align-top">
<AccountFormField
name={`entries.${index}.account`}
label={_("Account")}
rules={{
required: _("Account is required"),
onChange: (event) => {
onAccountChange(event.target.value, index)
}
}}
buttonClassName="min-w-64"
readOnly={index === 0}
isRequired
hideLabel
/>
</TableCell>
<TableCell className="align-top">
<LinkFormField
doctype="Cost Center"
name={`entries.${index}.cost_center`}
label={_("Cost Center")}
filters={[["company", "=", company], ["is_group", "=", 0], ["disabled", "=", 0]]}
buttonClassName="min-w-48"
readOnly={index === 0}
hideLabel
/>
</TableCell>
<TableCell className="align-top">
<DataField
name={`entries.${index}.user_remark`}
label={_("Remarks")}
readOnly={index === 0}
inputProps={{
placeholder: _("e.g. Bank Charges"),
className: 'min-w-64',
readOnly: index === 0
}}
hideLabel
/>
</TableCell>
<TableCell className={cn("text-end align-top")}>
<CurrencyFormField
name={`entries.${index}.debit`}
label={_("Debit")}
isRequired
hideLabel
readOnly={index === 0}
style={index === 0 ? !isWithdrawal ? {
color: "var(--color-ink-gray-8)",
} : {} : {}}
currency={currency}
leftSlot={index === 0 && !isWithdrawal ? <Tooltip>
<TooltipTrigger asChild><ArrowDownRight className="text-ink-green-3" /></TooltipTrigger>
<TooltipContent>{_("Bank account debit for deposit")}</TooltipContent>
</Tooltip> : undefined}
/>
</TableCell>
<TableCell className={cn("text-end align-top")}>
<CurrencyFormField
name={`entries.${index}.credit`}
style={index === 0 && isWithdrawal ? {
color: "var(--color-ink-gray-8)",
} : {}}
label={_("Credit")}
isRequired
hideLabel
readOnly={index === 0}
currency={currency}
leftSlot={index === 0 && isWithdrawal ? <Tooltip>
<TooltipTrigger asChild><ArrowUpRight className="text-ink-red-3" /></TooltipTrigger>
<TooltipContent>{_("Bank account credit for withdrawal")}</TooltipContent>
</Tooltip> : undefined}
/>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
<div className="flex justify-between gap-2">
<div className="flex gap-2 justify-end">
<div>
<Button size='sm' type='button' variant={'outline'} onClick={onAdd}><Plus /> {_("Add Row")}</Button>
</div>
{selectedRows.length > 0 && <div>
<Button size='sm' type='button' theme="red" onClick={onRemove}><Trash2 /> {_("Remove")}</Button>
</div>}
</div>
<Summary currency={currency} addRow={onAddDifferenceClicked} />
</div>
</div>
}
const PartyField = ({ index, onChange, readOnly }: { index: number, onChange: (value: string, index: number) => void, readOnly: boolean }) => {
const { control } = useFormContext<BankEntryFormData>()
const party_type = useWatch({
control,
name: `entries.${index}.party_type`
})
if (!party_type) {
return <DataField
name={`entries.${index}.party`}
label={_("Party")}
isRequired
inputProps={{
disabled: true,
className: 'rounded-s-none border-s-0 min-w-64'
}}
hideLabel
/>
}
return <LinkFormField
name={`entries.${index}.party`}
label={_("Party")}
rules={{
onChange: (event) => {
onChange(event.target.value, index)
},
}}
hideLabel
readOnly={readOnly}
buttonClassName="rounded-s-none border-s-0 min-w-64"
doctype={party_type}
/>
}
const Summary = ({ currency, addRow }: { currency: string, addRow: () => void }) => {
const { control } = useFormContext<BankEntryFormData>()
const entries = useWatch({ control, name: 'entries' })
const { total, totalCredits, totalDebits } = useMemo(() => {
// Do a total debits - total credits
const totalDebits = entries.reduce((acc, curr) => flt(acc + (curr.debit ?? 0), 2), 0)
const totalCredits = entries.reduce((acc, curr) => flt(acc + (curr.credit ?? 0), 2), 0)
return { total: flt(totalDebits - totalCredits, 2), totalDebits, totalCredits }
}, [entries])
const onAddRow = useCallback(() => {
addRow()
}, [addRow])
const TextComponent = ({ className, children }: { className?: string, children: React.ReactNode }) => {
return <span className={cn("w-32 text-end font-medium text-sm font-numeric", className)}>{children}</span>
}
return <div className="flex flex-col gap-2 items-end">
<div className="flex gap-2 justify-between">
<TextComponent>{_("Total Debit")}</TextComponent>
<TextComponent>{formatCurrency(totalDebits, currency)}</TextComponent>
</div>
<div className="flex gap-2 justify-between">
<TextComponent>{_("Total Credit")}</TextComponent>
<TextComponent>{formatCurrency(totalCredits, currency)}</TextComponent>
</div>
{total !== 0 && <div className="flex gap-2 justify-between">
<TextComponent>{_("Difference")}</TextComponent>
<Tooltip>
<TooltipTrigger asChild>
<Button type='button' variant='link' className="p-0 text-ink-red-3 underline h-fit" role='button' onClick={onAddRow}>
<TextComponent className='text-ink-red-3'>{formatCurrency(total, currency)}</TextComponent>
</Button>
</TooltipTrigger>
<TooltipContent>
{_("Add a row with the difference amount")}
</TooltipContent>
</Tooltip>
</div>}
</div>
}
export default RecordBankEntryModalContent

View File

@@ -0,0 +1,134 @@
import { useAtom } from "jotai"
import { SelectedBank, selectedBankAccountAtom } from "./bankRecAtoms"
import { useCallback } from "react"
import { useGetBankAccounts, useGetUnreconciledTransactions } from "./utils"
import { cn } from "@/lib/utils"
import { getTimeago } from "@/lib/date"
import ErrorBanner from "@/components/ui/error-banner"
import _ from "@/lib/translate"
import { Badge } from "@/components/ui/badge"
import { useTheme } from "@/components/ui/theme-provider"
import BankLogo from "@/components/common/BankLogo"
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty"
import { LandmarkIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { useCurrentCompany } from "@/hooks/useCurrentCompany"
const BankPicker = ({ className }: { className?: string }) => {
const [selectedBank, setSelectedBank] = useAtom(selectedBankAccountAtom)
const onLoadingSuccess = useCallback((data?: SelectedBank[]) => {
// If the bank is already selected, then don't set it again
if (selectedBank) {
// Check if selected bank is in the data
if (data?.some((bank: SelectedBank) => bank.name === selectedBank.name)) {
return
}
}
if (!data) return
if (data.length === 1) {
setSelectedBank(data[0])
} else if (data.length > 1) {
const defaultBank = data.find((bank: SelectedBank) => bank.is_default)
if (defaultBank) {
setSelectedBank(defaultBank)
} else {
// Select the first available bank account
setSelectedBank(data[0])
}
}
}, [setSelectedBank, selectedBank])
const selectedCompany = useCurrentCompany()
const { banks, isLoading, error } = useGetBankAccounts(onLoadingSuccess)
const { themeValue } = useTheme()
if (isLoading) {
return null
}
if (error) {
return <ErrorBanner error={error} />
}
if (banks?.length === 0) {
return <Empty>
<EmptyMedia>
<LandmarkIcon />
</EmptyMedia>
<EmptyHeader>
<EmptyTitle>{_("No bank accounts found")}</EmptyTitle>
<EmptyDescription>{_("You have not added any bank accounts to your company.")}</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button asChild>
<a href={`/desk/bank-account?company=${encodeURIComponent(selectedCompany)}&is_company_account=1`}>
{_("Configure Bank Accounts")}
</a>
</Button>
</EmptyContent>
</Empty>
}
return (
<div
className={cn("flex gap-3 items-stretch w-full overflow-x-auto pe-4",
banks?.length > 4 ? 'pb-2' : '', className,
)}
style={{
scrollbarWidth: 'thin',
scrollbarColor: themeValue === 'Dark' ? 'var(--surface-gray-2) var(--surface-gray-1)' : 'rgb(209 213 219) rgb(243 244 246)',
}}
>
{
banks?.map((bank) => (
<BankPickerItem key={bank.name} bank={bank} />
))
}
</div>
)
}
const BankPickerItem = ({ bank }: { bank: SelectedBank }) => {
const [selectedBank, setSelectedBank] = useAtom(selectedBankAccountAtom)
const isSelected = selectedBank?.name === bank.name
const { mutate } = useGetUnreconciledTransactions()
const onSelect = () => {
setSelectedBank(bank)
mutate()
}
return <div
role="button"
title={`Select ${bank.account_name}`}
onClick={onSelect}
className={cn('rounded-md border border-outline-gray-1 max-w-60 min-w-60 p-2 overflow-hidden cursor-pointer',
isSelected ? 'border-outline-gray-5 bg-surface-gray-1' : 'hover:bg-surface-gray-1'
)}
>
<BankLogo bank={bank} className="mb-2" />
<div className="flex flex-col gap-1">
<div className="flex gap-2 items-center">
<span className={cn("text-sm font-medium line-clamp-1 text-ink-gray-8")}>{bank.account_name}</span>
{bank.account_type && <Badge variant='subtle' size='sm' theme='gray'>
{bank.account_type?.slice(0, 24)}
</Badge>}
</div>
<span title={_("GL Account")} className={cn("text-ellipsis line-clamp-1 text-sm text-ink-gray-6")}>{bank.account}</span>
{bank.last_integration_date && <span className="text-xs text-ink-gray-5">{_("Last Synced Transaction")}: {getTimeago(bank.last_integration_date)}</span>}
</div>
</div >
}
export default BankPicker

View File

@@ -0,0 +1,275 @@
import { useAtom } from 'jotai'
import { bankRecDateAtom } from './bankRecAtoms'
import { useMemo, useState } from 'react'
import { AVAILABLE_TIME_PERIODS, formatDate, getDatesForTimePeriod, TimePeriod } from '@/lib/date'
import { Button } from '@/components/ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { ChevronDownIcon, ChevronLeftIcon, ChevronRight } from 'lucide-react'
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from '@/components/ui/command'
import { parse } from "chrono-node"
import { Calendar } from '@/components/ui/calendar'
import useFiscalYear from '@/hooks/useFiscalYear'
import dayjs from 'dayjs'
import _ from '@/lib/translate'
import { useDirection } from '@/components/ui/direction'
const BankRecDateFilter = () => {
const [bankRecDate, setBankRecDate] = useAtom(bankRecDateAtom)
const { data: fiscalYear } = useFiscalYear()
const timePeriodOptions = useMemo(() => {
const standardOptions = AVAILABLE_TIME_PERIODS.map((period) => {
const dates = getDatesForTimePeriod(period)
return {
label: period,
fromDate: dates.fromDate,
toDate: dates.toDate,
format: dates.format,
translatedLabel: dates.translatedLabel
}
})
if (fiscalYear?.message) {
// For a fiscal year, we need to replace "Last Year", "This Year", and add options for quarters
const fiscalYearStart = fiscalYear.message.year_start_date
const fiscalYearEnd = fiscalYear.message.year_end_date
const q1 = {
label: `Q1: ${fiscalYear.message.name}`,
translatedLabel: `${_("Q1")}: ${fiscalYear.message.name}`,
fromDate: fiscalYearStart,
toDate: dayjs(fiscalYearStart).add(3, 'month').format('YYYY-MM-DD'),
format: 'MMM YYYY'
}
const q2 = {
label: `Q2: ${fiscalYear.message.name}`,
translatedLabel: `${_("Q2")}: ${fiscalYear.message.name}`,
fromDate: dayjs(fiscalYearStart).add(3, 'month').format('YYYY-MM-DD'),
toDate: dayjs(fiscalYearStart).add(6, 'month').format('YYYY-MM-DD'),
format: 'MMM YYYY'
}
const q3 = {
label: `Q3: ${fiscalYear.message.name}`,
translatedLabel: `${_("Q3")}: ${fiscalYear.message.name}`,
fromDate: dayjs(fiscalYearStart).add(6, 'month').format('YYYY-MM-DD'),
toDate: dayjs(fiscalYearStart).add(9, 'month').format('YYYY-MM-DD'),
format: 'MMM YYYY'
}
const q4 = {
label: `Q4: ${fiscalYear.message.name}`,
translatedLabel: `${_("Q4")}: ${fiscalYear.message.name}`,
fromDate: dayjs(fiscalYearStart).add(9, 'month').format('YYYY-MM-DD'),
toDate: fiscalYearEnd,
format: 'MMM YYYY'
}
const thisYear = {
label: `This Fiscal Year`,
translatedLabel: `${_("This Fiscal Year")}`,
fromDate: fiscalYearStart,
toDate: fiscalYearEnd,
format: 'MMM YYYY'
}
const lastYear = {
label: `Last Fiscal Year`,
translatedLabel: `${_("Last Fiscal Year")}`,
fromDate: dayjs(fiscalYearStart).subtract(1, 'year').format('YYYY-MM-DD'),
toDate: dayjs(fiscalYearEnd).subtract(1, 'year').format('YYYY-MM-DD'),
format: 'MMM YYYY'
}
// Sort the options so that we get "This Month", "Last Month", quarters, fiscal year, then the rest of the standard options
const topRankedItems = standardOptions.filter((option) => {
return option.label === "This Month" || option.label === "Last Month"
})
const bottomRankedItems = standardOptions.filter((option) => {
return option.label !== "This Month" && option.label !== "Last Month"
})
return [...topRankedItems, q1, q2, q3, q4, thisYear, lastYear, ...bottomRankedItems]
}
return standardOptions
}, [fiscalYear])
const [open, setOpen] = useState(false)
const [value, setValue] = useState("")
const timePeriod: TimePeriod | string = useMemo(() => {
if (bankRecDate.fromDate && bankRecDate.toDate) {
// Check if the from and to dates match any predefined time period
for (const period of timePeriodOptions) {
if (period.fromDate === bankRecDate.fromDate && period.toDate === bankRecDate.toDate) {
return period.label;
}
}
return "Date Range";
} else {
return "Date Range";
}
}, [bankRecDate.fromDate, bankRecDate.toDate, timePeriodOptions]);
const handleTimePeriodChange = (fromDate: string, toDate: string) => {
setBankRecDate({ fromDate, toDate })
setOpen(false)
}
const dateObj = useMemo(() => {
return {
from: new Date(bankRecDate.fromDate),
to: new Date(bankRecDate.toDate)
}
}, [bankRecDate.fromDate, bankRecDate.toDate])
const direction = useDirection()
return <div className='flex items-center'>
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant={'outline'}
aria-expanded={open}
size='md'
className='rounded-e-none border-e-0'
role="combobox">
{timePeriodOptions.find((period) => period.label === timePeriod)?.translatedLabel ?? _(timePeriod)}
<ChevronDownIcon />
</Button>
</PopoverTrigger>
<PopoverContent className="w-84 p-1" align='start'>
<Command>
<CommandInput placeholder="e.g. Last 3 weeks" onValueChange={setValue} value={value} />
<CommandList className='max-h-fit'>
<CommandEmpty className='text-start p-2 hover:bg-surface-gray-1'>
<EmptyState onSelect={handleTimePeriodChange} value={value} />
</CommandEmpty>
{timePeriodOptions.map((period) => (
<CommandItem key={period.label} className='flex justify-between' onSelect={() => handleTimePeriodChange(period.fromDate, period.toDate)}>
<span>
{period.translatedLabel ?? _(period.label)}
</span>
<span className='text-xs text-ink-gray-5 flex items-center gap-1 text-end whitespace-nowrap'>
{formatDate(period.fromDate, period.format)} {direction === 'ltr' ? <ChevronRight className='text-[12px] text-ink-gray-5/70' /> : <ChevronLeftIcon className='text-[12px] text-ink-gray-5/70' />} {formatDate(period.toDate, period.format)}
</span>
</CommandItem>
))}
</CommandList>
</Command>
</PopoverContent>
</Popover>
<Popover>
<PopoverTrigger asChild>
<Button variant={'outline'} className='rounded-s-none' size='md'>
{formatDate(bankRecDate.fromDate)} - {formatDate(bankRecDate.toDate)}
</Button>
</PopoverTrigger>
<PopoverContent className='w-auto overflow-hidden p-0' align='end'>
<Calendar
mode='range'
captionLayout='dropdown'
selected={{
from: dateObj.from,
to: dateObj.to
}}
numberOfMonths={2}
defaultMonth={dateObj.from}
onSelect={(date) => {
if (date) {
setBankRecDate({ fromDate: formatDate(date.from, 'YYYY-MM-DD'), toDate: formatDate(date.to, 'YYYY-MM-DD') })
}
}}
/>
</PopoverContent>
</Popover>
</div>
}
const referentialKeywords = ["last", "this", "next", "previous"]
const EmptyState = ({ onSelect, value }: { onSelect: (fromDate: string, toDate: string) => void, value: string }) => {
const dates = useMemo(() => {
if (value) {
// Try parsing the value
const parsedDate = parse(value, undefined, { forwardDate: false })
if (parsedDate && parsedDate.length > 0) {
const startDate = parsedDate[0].start.date()
const endDate = parsedDate[0].end?.date()
if (!endDate) {
const today = new Date()
// If today is greater than the start date, use today as the end date
if (startDate.getTime() > today.getTime()) {
return { fromDate: today, toDate: startDate }
} else {
// Check if the user only wants a specific month like "May 2025"
// If the "known values" just has month and year, then we need to get the first day of the month and the last day of the month
// @ts-expect-error - "Known Values" is available in the start "ParsingComponents"
if (parsedDate[0].start.knownValues?.month && !parsedDate[0].start.knownValues?.day) {
return {
fromDate: startDate,
toDate: dayjs(startDate).endOf('month').toDate()
}
// @ts-expect-error - "Known Values" is available in the start "ParsingComponents"
} else if (parsedDate[0].start.knownValues?.month && parsedDate[0].start.knownValues?.day && !referentialKeywords.some(keyword => value.toLowerCase().includes(keyword))) {
// If month and day is known, then we should not assume that the user wants to get everything until today
return {
fromDate: startDate,
toDate: startDate,
}
}
return {
fromDate: startDate,
toDate: today
}
}
} else {
return { fromDate: startDate, toDate: endDate }
}
}
}
}, [value])
const onClick = (fromDate: Date, toDate: Date) => {
onSelect(formatDate(fromDate, 'YYYY-MM-DD'), formatDate(toDate, 'YYYY-MM-DD'))
}
const isEqual = dates?.fromDate && dates?.toDate && dayjs(dates.fromDate).isSame(dates.toDate, 'date')
return <div>
{dates ?
<div className='flex gap-2 items-center justify-between cursor-pointer' onClick={() => onClick(dates.fromDate, dates.toDate)}>
<span className='text-sm text-ink-gray-5 max-w-[30%]'>
{value}
</span>
{isEqual ? <span className='text-xs text-ink-gray-5 text-balance flex items-center gap-1'>
{formatDate(dates.fromDate, 'Do MMM YYYY')}
</span> :
<span className='text-xs text-ink-gray-5 flex items-center gap-1'>
{formatDate(dates.fromDate, 'Do MMM YY')} <ChevronRight size='16' className='text-ink-gray-5' /> {formatDate(dates.toDate, 'Do MMM YY')}
</span>}
</div> :
<span className='text-sm text-ink-gray-5'>
No results found
</span>
}
</div>
}
export default BankRecDateFilter

View File

@@ -0,0 +1,315 @@
import { useAtomValue } from "jotai"
import { MissingFiltersBanner } from "./MissingFiltersBanner"
import { bankRecDateAtom, selectedBankAccountAtom } from "./bankRecAtoms"
import { useCurrentCompany } from "@/hooks/useCurrentCompany"
import { Paragraph } from "@/components/ui/typography"
import { useCallback, useMemo } from "react"
import type { ColumnDef } from "@tanstack/react-table"
import { useFrappeGetCall } from "frappe-react-sdk"
import { QueryReportReturnType } from "@/types/custom/Reports"
import { formatDate } from "@/lib/date"
import { ListView, type ListViewColumnMeta } from "@/components/ui/list-view"
import { formatCurrency } from "@/lib/numbers"
import { getCompanyCurrency } from "@/lib/company"
import { slug } from "@/lib/frappe"
import { ScrollTextIcon } from "lucide-react"
import ErrorBanner from "@/components/ui/error-banner"
import { StatContainer, StatLabel, StatValue } from "@/components/ui/stats"
import _ from "@/lib/translate"
import { toast } from "sonner"
import { useCopyToClipboard } from "usehooks-ts"
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty"
const BankReconciliationStatement = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
if (!bankAccount) {
return <MissingFiltersBanner text={_("Please select a bank account to view the bank reconciliation statement.")} />
}
if (!dates) {
return <MissingFiltersBanner text={_("Please select dates to view the bank reconciliation statement.")} />
}
return <BankReconciliationStatementView />
}
interface BankClearanceSummaryEntry {
payment_document: string
payment_entry: string
posting_date: string,
reference_no: string,
credit: number,
debit: number,
against_account: string,
ref_date: string,
account_currency: string,
clearance_date: string
}
const BankReconciliationStatementView = () => {
const companyID = useCurrentCompany()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const filters = useMemo(() => {
return JSON.stringify({
account: bankAccount?.account,
report_date: dates.toDate,
company: companyID
})
}, [bankAccount, dates, companyID])
const { data, error } = useFrappeGetCall<{ message: QueryReportReturnType }>('frappe.desk.query_report.run', {
report_name: 'Bank Reconciliation Statement',
filters,
ignore_prepared_report: 1,
are_default_filters: false,
}, `Report-Bank Reconciliation Statement-${filters}`, { keepPreviousData: true, revalidateOnFocus: false }, 'POST')
const [, copyToClipboard] = useCopyToClipboard()
const onCopy = useCallback(
(text: string) => {
copyToClipboard(text).then(() => {
toast.success(_("Copied to clipboard"))
})
},
[copyToClipboard],
)
const statementColumns = useMemo<ColumnDef<BankClearanceSummaryEntry, unknown>[]>(
() => [
{
accessorKey: "posting_date",
header: _("Posting Date"),
size: 118,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.posting_date),
},
{
accessorKey: "payment_document",
header: _("Document Type"),
size: 140,
cell: ({ row }) => _(row.original.payment_document),
},
{
id: "payment_entry",
header: _("Payment Document"),
size: 300,
meta: {
getTooltipText: (r) => {
const x = r as BankClearanceSummaryEntry
const parts = [x.payment_document, x.payment_entry].filter(Boolean)
return parts.length ? parts.join(" · ") : undefined
},
} satisfies ListViewColumnMeta,
cell: ({ row }) => {
const { payment_document, payment_entry } = row.original
return payment_document ? (
<a
target="_blank"
rel="noreferrer"
className="text-ink-gray-8 block min-w-0 w-full underline underline-offset-4"
href={`/desk/${slug(payment_document)}/${payment_entry}`}
>
{payment_entry}
</a>
) : (
payment_entry
)
},
},
{
accessorKey: "debit",
header: _("Debit"),
size: 112,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => <span className="font-numeric">{formatCurrency(row.original.debit, row.original.account_currency)}</span>,
},
{
accessorKey: "credit",
header: _("Credit"),
size: 112,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => <span className="font-numeric">{formatCurrency(row.original.credit, row.original.account_currency)}</span>,
},
{
accessorKey: "against_account",
header: _("Against Account"),
meta: { gridWidth: "minmax(0,1.25fr)" } satisfies ListViewColumnMeta,
cell: ({ row }) => (
<a
target="_blank"
rel="noreferrer"
className="text-ink-gray-8 block min-w-0 w-full underline underline-offset-4"
href={`/desk/account/${row.original.against_account}`}
>
{row.original.against_account}
</a>
),
},
{
accessorKey: "reference_no",
header: _("Reference #"),
cell: ({ row }) => {
const ref = row.original.reference_no
return (
<button
type="button"
className="text-ink-gray-8 hover:underline min-w-0 w-full cursor-pointer truncate text-start underline-offset-4"
onClick={() => onCopy(ref)}
>
{ref}
</button>
)
},
},
{
accessorKey: "ref_date",
header: _("Reference Date"),
size: 118,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.ref_date),
},
{
accessorKey: "clearance_date",
header: _("Clearance Date"),
size: 118,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.clearance_date),
},
],
[onCopy],
)
const statementRows = useMemo(() => {
if (!data?.message.result) return []
return data.message.result.filter((row: BankClearanceSummaryEntry) => Boolean(row.payment_entry))
}, [data])
return <div className="space-y-4 py-2">
<div>
<Paragraph className="text-sm">
<span dangerouslySetInnerHTML={{
__html: _("Below is a list of all entries posted against the bank account {0} which have not been cleared till {1}.", [`<strong>${bankAccount?.account}</strong>`, `<strong>${formatDate(dates.toDate)}</strong>`])
}} />
</Paragraph>
</div>
{error && <ErrorBanner error={error} />}
{data && <SummarySection data={data} />}
{data && data.message.result.length > 0 && (
<div className="space-y-2">
<p className="text-ink-gray-5 text-sm">{_("Bank Reconciliation Statement")}</p>
<ListView
data={statementRows}
columns={statementColumns}
getRowId={(row) => row.payment_entry}
maxHeight="min(70vh, 640px)"
emptyState={_("No entries with a payment document in this list.")}
/>
</div>
)}
{data && data.message.result.length === 0 &&
<Empty>
<EmptyMedia>
<ScrollTextIcon />
</EmptyMedia>
<EmptyHeader>
<EmptyTitle>{_("No entries found")}</EmptyTitle>
<EmptyDescription>{_("There are no accounting entries in the system for the selected account and dates.")}</EmptyDescription>
</EmptyHeader>
</Empty>
}
</div>
}
const SummarySection = ({ data }: { data: { message: QueryReportReturnType } }) => {
const company = useCurrentCompany()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const { bankStatementBalanceAsPerGL, outstandingChecksDebit, outstandingChecksCredit, incorrectlyClearedEntriesDebit, incorrectlyClearedEntriesCredit, calculatedBankStatementBalance } = useMemo(() => {
// Loop over the results and find the corresponding rows
let bankStatementBalanceAsPerGL = 0
let outstandingChecksDebit = 0
let outstandingChecksCredit = 0
let incorrectlyClearedEntriesDebit = 0
let incorrectlyClearedEntriesCredit = 0
let calculatedBankStatementBalance = 0
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?.message.result.forEach((r: any) => {
if (r.payment_entry === 'Bank Statement balance as per General Ledger') {
bankStatementBalanceAsPerGL = r.debit - r.credit
}
if (r.payment_entry === 'Outstanding Checks and Deposits to clear') {
outstandingChecksDebit = r.debit
outstandingChecksCredit = r.credit
}
if (r.payment_entry === 'Checks and Deposits incorrectly cleared') {
incorrectlyClearedEntriesDebit = r.debit
incorrectlyClearedEntriesCredit = r.credit
}
if (r.payment_entry === 'Calculated Bank Statement balance') {
calculatedBankStatementBalance = r.debit - r.credit
}
})
return {
bankStatementBalanceAsPerGL,
outstandingChecksDebit,
outstandingChecksCredit,
incorrectlyClearedEntriesDebit,
incorrectlyClearedEntriesCredit,
calculatedBankStatementBalance
}
}, [data])
const currency = bankAccount?.account_currency ?? getCompanyCurrency(company)
return <div className="flex gap-4 items-start justify-between">
<StatContainer>
<StatLabel>{_("Bank Statement Balance as per General Ledger")}</StatLabel>
<StatValue className="font-numeric">{formatCurrency(bankStatementBalanceAsPerGL, currency)}</StatValue>
</StatContainer>
<StatContainer>
<StatLabel>{_("Outstanding Checks and Deposits to clear")}</StatLabel>
<StatValue className="font-numeric">{formatCurrency(outstandingChecksDebit - outstandingChecksCredit, currency)}</StatValue>
</StatContainer>
{(incorrectlyClearedEntriesDebit > 0 || incorrectlyClearedEntriesCredit > 0) && <StatContainer>
<StatLabel className="text-ink-red-3">{_("Checks and Deposits incorrectly cleared")}</StatLabel>
<StatValue className="text-ink-red-3 font-numeric">{formatCurrency(incorrectlyClearedEntriesDebit - incorrectlyClearedEntriesCredit)}</StatValue>
{/* <div className="" divider={<StackDivider height='20px' />}>
{incorrectlyClearedEntriesDebit !== 0 && <StatHelpText>Debit: {formatCurrency(incorrectlyClearedEntriesDebit)}</StatHelpText>}
{incorrectlyClearedEntriesCredit !== 0 && <StatHelpText>Credit: {formatCurrency(incorrectlyClearedEntriesCredit)}</StatHelpText>}
</div> */}
</StatContainer>}
<StatContainer>
<StatLabel>{_("Calculated Bank Statement Balance")}</StatLabel>
<StatValue className="font-numeric">{formatCurrency(calculatedBankStatementBalance)}</StatValue>
</StatContainer>
</div>
}
export default BankReconciliationStatement

View File

@@ -0,0 +1,422 @@
import { useAtomValue, useSetAtom } from "jotai"
import { MissingFiltersBanner } from "./MissingFiltersBanner"
import { bankRecDateAtom, bankRecUnreconcileModalAtom, selectedBankAccountAtom } from "./bankRecAtoms"
import { Paragraph } from "@/components/ui/typography"
import { formatDate } from "@/lib/date"
import { ListView, type ListViewColumnMeta } from "@/components/ui/list-view"
import { formatCurrency, getCurrencyFormatInfo } from "@/lib/numbers"
import { getCompanyCurrency } from "@/lib/company"
import { ArrowDownRight, ArrowUpRight, CheckCircle2, ChevronDown, DollarSign, ExternalLink, ImportIcon, ListIcon, Search, Undo2, XCircle } from "lucide-react"
import ErrorBanner from "@/components/ui/error-banner"
import { Badge } from "@/components/ui/badge"
import { useGetBankTransactions } from "./utils"
import { BankTransaction } from "@/types/Accounts/BankTransaction"
import { Button } from "@/components/ui/button"
import _ from "@/lib/translate"
import { Input } from "@/components/ui/input"
import CurrencyInput from "react-currency-input-field"
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
import { getCurrencySymbol } from "@/lib/currency"
import { useDebounceValue } from "usehooks-ts"
import type { ColumnDef } from "@tanstack/react-table"
import { useCallback, useMemo, useState } from "react"
import { Link } from "react-router"
import { Empty, EmptyTitle, EmptyHeader, EmptyMedia, EmptyDescription, EmptyContent } from "@/components/ui/empty"
import { InputGroup, InputGroupAddon } from "@/components/ui/input-group"
const BankTransactions = () => {
const selectedBank = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
if (!selectedBank || !dates) {
return <MissingFiltersBanner text={_("Please select a bank and set the date range")} />
}
return <>
<BankTransactionListView />
</>
}
const BankTransactionListView = () => {
const { data, error } = useGetBankTransactions()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const formattedFromDate = formatDate(dates.fromDate)
const formattedToDate = formatDate(dates.toDate)
const setBankRecUnreconcileModalAtom = useSetAtom(bankRecUnreconcileModalAtom)
const onUndo = useCallback(
(transaction: BankTransaction) => {
setBankRecUnreconcileModalAtom(transaction.name)
},
[setBankRecUnreconcileModalAtom],
)
const accountCurrency = useMemo(
() => bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? ""),
[bankAccount?.account_currency, bankAccount?.company],
)
const transactionColumns = useMemo<ColumnDef<BankTransaction, unknown>[]>(
() => [
{
accessorKey: "date",
header: _("Date"),
size: 112,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.date),
},
{
accessorKey: "description",
header: _("Description"),
size: 250,
// meta: { gridWidth: "minmax(0,2fr)" } satisfies ListViewColumnMeta,
cell: ({ row }) => row.original.description,
},
{
accessorKey: "reference_number",
header: _("Reference #"),
size: 128,
cell: ({ row }) => row.original.reference_number,
},
{
accessorKey: "withdrawal",
header: _("Withdrawal"),
size: 120,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => <span className="font-numeric">{formatCurrency(row.original.withdrawal, accountCurrency)}</span>,
},
{
accessorKey: "deposit",
header: _("Deposit"),
size: 120,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => <span className="font-numeric">{formatCurrency(row.original.deposit, accountCurrency)}</span>,
},
{
accessorKey: "unallocated_amount",
header: _("Unallocated"),
size: 120,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => <span className="font-numeric">{formatCurrency(row.original.unallocated_amount, accountCurrency)}</span>,
},
{
accessorKey: "transaction_type",
header: _("Type"),
size: 112,
cell: ({ row }) =>
row.original.transaction_type ? <Badge>{row.original.transaction_type}</Badge> : null,
},
{
id: "status",
header: _("Status"),
size: 168,
meta: { truncate: false, truncateTooltip: false } satisfies ListViewColumnMeta,
cell: ({ row }) => {
const tx = row.original
if (!tx.allocated_amount || (tx.allocated_amount && tx.allocated_amount === 0)) {
return (
<Badge theme="red">
<XCircle />
{_("Not Reconciled")}
</Badge>
)
}
if (tx.allocated_amount && tx.allocated_amount > 0 && tx.unallocated_amount !== 0) {
return (
<Badge theme="orange">
<CheckCircle2 />
{_("Partially Reconciled")}
</Badge>
)
}
return (
<Badge theme="green">
<CheckCircle2 />
{_("Reconciled")}
</Badge>
)
},
},
{
id: "actions",
header: _("Actions"),
size: 200,
enableResizing: false,
meta: { truncate: false, truncateTooltip: false } satisfies ListViewColumnMeta,
cell: ({ row }) => (
<div className="flex gap-2 ps-0.5 items-center">
<Button variant="ghost" asChild size='sm'>
<a
href={`/desk/bank-transaction/${row.original.name}`}
target="_blank"
rel="noreferrer"
// className="text-ink-gray-8 underline underline-offset-4 inline-flex gap-2"
>
{_("View")} <ExternalLink className="w-4 h-4" />
</a>
</Button>
{row.original.allocated_amount && row.original.allocated_amount > 0 ? (
<Button
variant="ghost"
onClick={() => onUndo(row.original)}
size="sm"
theme='red'
>
<Undo2 />
{_("Undo")}
</Button>
) : null}
</div>
),
},
],
[accountCurrency, onUndo],
)
const [search, setSearch] = useDebounceValue('', 250)
const [amountFilter, setAmountFilter] = useState<{ value: number, stringValue?: string | number }>({ value: 0, stringValue: '0.00' })
const [typeFilter, setTypeFilter] = useState('All')
const [status, setStatus] = useState<'Reconciled' | 'Unreconciled' | 'All' | 'Partially Reconciled'>('All')
const onSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setSearch(e.target.value)
}
const filteredResults = useMemo(() => {
if (!data) {
return []
}
return data.message.filter((transaction) => {
if (search && !transaction.description?.toLowerCase().includes(search.toLowerCase())) {
return false
}
if (typeFilter !== 'All') {
if (typeFilter === 'Debits' && transaction.deposit && transaction.deposit > 0) {
return false
}
if (typeFilter === 'Credits' && transaction.withdrawal && transaction.withdrawal > 0) {
return false
}
}
if (status !== 'All') {
if (status === 'Reconciled' && transaction.status !== 'Reconciled') {
return false
}
if (status === 'Unreconciled') {
if (transaction.status === 'Reconciled') {
return false
}
// Filter out partially reconciled transactions
if (transaction.allocated_amount && transaction.allocated_amount > 0 && transaction.unallocated_amount !== 0) {
return false
}
}
if (status === 'Partially Reconciled') {
if (transaction.status === 'Reconciled') {
return false
}
if ((transaction.allocated_amount ?? 0) === 0) {
return false
}
}
}
if (amountFilter.value > 0 && transaction.withdrawal !== amountFilter.value && transaction.deposit !== amountFilter.value) {
return false
}
return true
})
}, [data, search, amountFilter, typeFilter, status])
return <div className="space-y-2 py-2">
<div className="flex gap-2 justify-between items-center">
<Paragraph className="text-sm">
<span dangerouslySetInnerHTML={{
__html: _("Below is a list of all bank transactions imported in the system for the bank account {0} between {1} and {2}.", [`<strong>${bankAccount?.account_name}</strong>`, `<strong>${formattedFromDate}</strong>`, `<strong>${formattedToDate}</strong>`])
}} />
</Paragraph>
<Button size='md' variant='subtle' asChild>
<Link to="/statement-importer">
<ImportIcon />
{_("Import Bank Statement")}
</Link>
</Button>
</div>
{error && <ErrorBanner error={error} />}
<Filters
onSearchChange={onSearchChange}
search={search}
results={filteredResults}
setAmountFilter={setAmountFilter}
amountFilter={amountFilter}
onTypeFilterChange={setTypeFilter}
typeFilter={typeFilter}
status={status}
setStatus={setStatus}
/>
<ListView
data={filteredResults}
columns={transactionColumns}
getRowId={(row) => row.name}
maxHeight="calc(100vh - 200px)"
scrollAreaClassName="min-h-[calc(100vh-200px)]"
emptyState={<Empty>
<EmptyMedia>
<ListIcon />
</EmptyMedia>
<EmptyHeader>
<EmptyTitle>{_("No bank transactions found")}</EmptyTitle>
<EmptyDescription>{_("There are no transactions in the system for the selected bank account and dates that match the filters.")}</EmptyDescription>
</EmptyHeader>
{data && data.message.length === 0 ? <EmptyContent>
<Button type='button' asChild variant='outline'>
<Link to="/statement-importer">
{_("Import Bank Statement")}
</Link>
</Button>
</EmptyContent> : null}
</Empty>}
/>
</div>
}
interface FilterProps {
onSearchChange: (e: React.ChangeEvent<HTMLInputElement>) => void
search: string
results: BankTransaction[]
setAmountFilter: (value: { value: number, stringValue?: string | number }) => void
amountFilter: { value: number, stringValue?: string | number }
onTypeFilterChange: (type: string) => void
typeFilter: string
status: 'Reconciled' | 'Unreconciled' | 'All' | 'Partially Reconciled'
setStatus: (status: 'Reconciled' | 'Unreconciled' | 'All' | 'Partially Reconciled') => void
}
const Filters = ({
onSearchChange,
search,
results,
setAmountFilter,
amountFilter,
onTypeFilterChange,
typeFilter,
status,
setStatus,
}: FilterProps) => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const currency = bankAccount?.account_currency ?? getCompanyCurrency(bankAccount?.company ?? '')
const currencySymbol = getCurrencySymbol(currency)
const formatInfo = getCurrencyFormatInfo(currency)
const groupSeparator = formatInfo.group_sep || ","
const decimalSeparator = formatInfo.decimal_str || "."
return <div className="flex py-2 w-full gap-2">
<InputGroup variant='outline'>
<label className="sr-only">{_("Search transactions")}</label>
<InputGroupAddon>
<Search className="w-4 h-4 text-ink-gray-5" />
</InputGroupAddon>
<Input
placeholder={_("Search")} type='search' onChange={onSearchChange} variant='outline' defaultValue={search}
className="border-none px-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0" />
<InputGroupAddon align='inline-end'>
<span className="text-sm text-ink-gray-5 text-nowrap whitespace-nowrap">{results?.length} {_(results?.length === 1 ? "result" : "results")}</span>
</InputGroupAddon>
</InputGroup>
<div className="w-[25%]">
<label className="sr-only">{_("Filter by amount")}</label>
<CurrencyInput
groupSeparator={groupSeparator}
decimalSeparator={decimalSeparator}
placeholder={`${currencySymbol}0${decimalSeparator}00`}
decimalsLimit={2}
value={amountFilter.stringValue}
maxLength={12}
decimalScale={2}
prefix={currencySymbol}
onValueChange={(v, _n, values) => {
// If the input ends with a decimal or a decimal with trailing zeroes, store the string since we need the user to be able to type the decimals.
// When the user eventually types the decimals or blurs out, the value is formatted anyway.
// Otherwise store the float value
// Check if the value ends with a decimal or a decimal with trailing zeroes
const isDecimal = v?.endsWith(decimalSeparator) || v?.endsWith(decimalSeparator + '0')
const newValue = isDecimal ? v : values?.float ?? ''
setAmountFilter({
value: Number(newValue),
stringValue: newValue
})
}}
// @ts-expect-error - CurrencyInputProps doesn't have a variant prop but Input does
variant={"outline"}
customInput={Input}
/>
</div>
<div className="w-[25%]">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size='md' className="min-w-32 w-full text-start justify-between">
<div className="flex gap-2 items-center">
{typeFilter === 'All' ? <DollarSign className="w-4 h-4 text-ink-gray-5" /> : typeFilter === 'Debits' ? <ArrowUpRight className="w-4 h-4 text-ink-red-3" /> : <ArrowDownRight className="w-4 h-4 text-ink-green-3" />}
{_(typeFilter)}
</div>
<ChevronDown className="w-4 h-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem onClick={() => onTypeFilterChange('All')}><DollarSign /> {_("All")}</DropdownMenuItem>
<DropdownMenuItem onClick={() => onTypeFilterChange('Debits')}><ArrowUpRight className="text-ink-red-3" /> {_("Debits")}</DropdownMenuItem>
<DropdownMenuItem onClick={() => onTypeFilterChange('Credits')}><ArrowDownRight className="text-ink-green-3" /> {_("Credits")}</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
<div className="w-[25%]">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size='md' className="min-w-32 w-full text-start justify-between">
<div className="flex gap-2 items-center">
{status === 'All' ? <ListIcon className="w-4 h-4 text-ink-gray-5" /> :
status === 'Reconciled' ? <CheckCircle2 className="w-4 h-4 text-ink-green-3" /> :
status === 'Unreconciled' ? <XCircle className="w-4 h-4 text-ink-red-3" /> :
<CheckCircle2 className="w-4 h-4 text-yellow-500" />}
{_(status)}
</div>
<ChevronDown className="w-4 h-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem onClick={() => setStatus('All')}>{<ListIcon className="w-4 h-4 text-ink-gray-5" />} {_("All")}</DropdownMenuItem>
<DropdownMenuItem onClick={() => setStatus('Reconciled')}>{<CheckCircle2 className="w-4 h-4 text-ink-green-3" />} {_("Reconciled")}</DropdownMenuItem>
<DropdownMenuItem onClick={() => setStatus('Unreconciled')}>{<XCircle className="w-4 h-4 text-ink-red-3" />} {_("Unreconciled")}</DropdownMenuItem>
<DropdownMenuItem onClick={() => setStatus('Partially Reconciled')}>{<CheckCircle2 className="w-4 h-4 text-yellow-500" />} {_("Partially Reconciled")}</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
}
export default BankTransactions

View File

@@ -0,0 +1,52 @@
import {
AlertDialog,
AlertDialogContent,
AlertDialogDescription,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog"
import { useAtom } from "jotai"
import { Loader2Icon } from "lucide-react"
import { lazy, Suspense } from "react"
import { bankRecUnreconcileModalAtom } from "./bankRecAtoms"
import _ from "@/lib/translate"
const BankTransactionUnreconcileModalBody = lazy(() => import('./BankTransactionUnreconcileModalBody'))
const BankTransactionUnreconcileModalFallback = () => (
<div className="flex items-center justify-center py-16">
<Loader2Icon className="size-6 animate-spin text-muted-foreground" />
</div>
)
const BankTransactionUnreconcileModal = () => {
const [unreconcileModal, setBankRecUnreconcileModal] = useAtom(bankRecUnreconcileModalAtom)
const onOpenChange = (v: boolean) => {
if (!v) {
setBankRecUnreconcileModal('')
}
}
if (!unreconcileModal) {
return null
}
return (
<AlertDialog open onOpenChange={onOpenChange}>
<AlertDialogContent className="min-w-2xl">
<AlertDialogHeader>
<AlertDialogTitle>{_("Undo Transaction Reconciliation")}</AlertDialogTitle>
<AlertDialogDescription>
{_("Are you sure you want to unreconcile this transaction?")}
</AlertDialogDescription>
</AlertDialogHeader>
<Suspense fallback={<BankTransactionUnreconcileModalFallback />}>
<BankTransactionUnreconcileModalBody />
</Suspense>
</AlertDialogContent>
</AlertDialog>
)
}
export default BankTransactionUnreconcileModal

View File

@@ -0,0 +1,109 @@
import { AlertDialogAction, AlertDialogCancel, AlertDialogFooter } from "@/components/ui/alert-dialog"
import { useAtom, useAtomValue } from "jotai"
import { bankRecDateAtom, bankRecUnreconcileModalAtom, selectedBankAccountAtom } from "./bankRecAtoms"
import { useMemo } from "react"
import { useFrappeGetDoc, useFrappePostCall, useSWRConfig } from "frappe-react-sdk"
import { BankTransaction } from "@/types/Accounts/BankTransaction"
import { toast } from "sonner"
import ErrorBanner from "@/components/ui/error-banner"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { formatCurrency } from "@/lib/numbers"
import { Badge } from "@/components/ui/badge"
import { slug } from "@/lib/frappe"
import SelectedTransactionDetails from "./SelectedTransactionDetails"
import _ from "@/lib/translate"
const BankTransactionUnreconcileModalBody = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const { mutate } = useSWRConfig()
const [unreconcileModal, setBankRecUnreconcileModal] = useAtom(bankRecUnreconcileModalAtom)
const { data: transaction, error, isLoading } = useFrappeGetDoc<BankTransaction>('Bank Transaction', unreconcileModal)
const { call, loading, error: unreconcileError } = useFrappePostCall('erpnext.accounts.doctype.bank_transaction.bank_transaction.unreconcile_transaction')
const onUnreconcile = (event: React.MouseEvent<HTMLButtonElement>) => {
call({
transaction_name: unreconcileModal
}).then(() => {
mutate(`bank-reconciliation-bank-transactions-${bankAccount?.name}-${dates.fromDate}-${dates.toDate}`)
mutate(`bank-reconciliation-unreconciled-transactions-${bankAccount?.name}-${dates.fromDate}-${dates.toDate}`)
mutate(`bank-reconciliation-account-closing-balance-${bankAccount?.name}-${dates.toDate}`)
toast.success(_("Transaction Unreconciled"))
setBankRecUnreconcileModal('')
})
event.preventDefault()
}
const vouchersWhichWillBeCancelled = useMemo(() => {
return transaction?.payment_entries?.filter((payment) => payment.reconciliation_type === 'Voucher Created')
}, [transaction])
return (
<>
<div className="flex flex-col gap-3">
{error && <ErrorBanner error={error} />}
{unreconcileError && <ErrorBanner error={unreconcileError} />}
{transaction && <SelectedTransactionDetails transaction={transaction} />}
<span className="font-medium text-sm">{_("This transaction has been reconciled with the following document(s):")}</span>
<Table>
<TableHeader>
<TableRow>
<TableHead>{_("Document")}</TableHead>
<TableHead>{_("Amount")}</TableHead>
<TableHead>{_("Reconciliation Type")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{transaction?.payment_entries?.map((voucher) => {
return (
<TableRow key={voucher.name}>
<TableCell>
<a
className="underline underline-offset-4"
target="_blank"
rel="noopener noreferrer"
href={`/desk/${slug(voucher.payment_document as string)}/${voucher.payment_entry}`}
>
{`${_(voucher.payment_document)}: ${voucher.payment_entry}`}
</a>
</TableCell>
<TableCell>{formatCurrency(voucher.allocated_amount)}</TableCell>
<TableCell>
{voucher.reconciliation_type === 'Voucher Created' ?
<Badge theme="green">{_(voucher.reconciliation_type)}</Badge> :
<Badge theme="blue">{_(voucher.reconciliation_type ?? "Matched")}</Badge>}
</TableCell>
</TableRow>
)
})}
</TableBody>
</Table>
<div className="py-4">
{vouchersWhichWillBeCancelled && vouchersWhichWillBeCancelled?.length > 0 && (
<span>The following documents will be <strong>cancelled</strong>:</span>
)}
{vouchersWhichWillBeCancelled && vouchersWhichWillBeCancelled?.length > 0 && (
<ol className="ms-6 list-disc [&>li]:mt-2">
{vouchersWhichWillBeCancelled?.map((voucher) => {
return <li key={voucher.name}>{_(voucher.payment_document)}: {voucher.payment_entry}</li>
})}
</ol>
)}
</div>
</div>
<AlertDialogFooter>
<AlertDialogCancel disabled={loading}>{_("Cancel")}</AlertDialogCancel>
<AlertDialogAction onClick={onUnreconcile} theme="red" disabled={loading || isLoading}>
{_("Unreconcile")}
</AlertDialogAction>
</AlertDialogFooter>
</>
)
}
export default BankTransactionUnreconcileModalBody

View File

@@ -0,0 +1,92 @@
import { Button } from "@/components/ui/button"
import { selectedCompanyAtom, useCurrentCompany } from "@/hooks/useCurrentCompany"
import { useSetAtom } from "jotai"
import { Building2, Check, ChevronDown } from "lucide-react"
import { useState } from "react"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
} from "@/components/ui/command"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
import { cn } from "@/lib/utils"
import _ from "@/lib/translate"
import { selectedBankAccountAtom } from "./bankRecAtoms"
const CompanySelector = ({ onChange }: { onChange?: (company: string) => void }) => {
const [open, setOpen] = useState(false)
const [searchQuery, setSearchQuery] = useState("")
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const options = window.frappe?.boot?.docs?.filter((doc: Record<string, any>) => doc.doctype === ":Company").map((company: Record<string, any>) => company.name) || []
const setSelectedCompany = useSetAtom(selectedCompanyAtom)
const setSelectedBankAccount = useSetAtom(selectedBankAccountAtom)
const selectedCompany = useCurrentCompany()
const handleSelectCompany = (company: string) => {
setSelectedCompany(company)
setSearchQuery("")
setOpen(false)
// Only reset bank account if the company is changed
if (selectedCompany !== company) {
setSelectedBankAccount(null)
onChange?.(company)
}
}
return (<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
type='button'
role="combobox"
size='md'
aria-expanded={open}
className="justify-between"
>
<div className="flex items-center gap-2">
<Building2 />
{selectedCompany}
</div>
<ChevronDown className="text-ink-gray-4" />
</Button>
</PopoverTrigger>
<PopoverContent className="min-w-56 w-fit p-0">
<Command value={selectedCompany}>
{options.length > 5 && <CommandInput placeholder={_("Search company...")} className="h-9" />}
<CommandList>
<CommandEmpty>{_("No company found.")}</CommandEmpty>
<CommandGroup>
{options.map((option: string) => (
<CommandItem
key={option}
value={option}
onSelect={(currentValue) => {
handleSelectCompany(currentValue)
}}
>
{option}
<Check
className={cn(
"ms-auto",
searchQuery === option ? "opacity-100" : "opacity-0"
)}
/>
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>)
}
export default CompanySelector

View File

@@ -0,0 +1,229 @@
import { useAtomValue } from "jotai"
import { MissingFiltersBanner } from "./MissingFiltersBanner"
import { bankRecDateAtom, selectedBankAccountAtom } from "./bankRecAtoms"
import { useCurrentCompany } from "@/hooks/useCurrentCompany"
import { Paragraph } from "@/components/ui/typography"
import type { ColumnDef } from "@tanstack/react-table"
import { useCallback, useMemo } from "react"
import { useFrappeGetCall, useFrappePostCall } from "frappe-react-sdk"
import { QueryReportReturnType } from "@/types/custom/Reports"
import { formatDate } from "@/lib/date"
import { ListView, type ListViewColumnMeta } from "@/components/ui/list-view"
import { formatCurrency } from "@/lib/numbers"
import { getCompanyCurrency } from "@/lib/company"
import { getErrorMessage, slug } from "@/lib/frappe"
import { Button } from "@/components/ui/button"
import { toast } from "sonner"
import { PartyPopper } from "lucide-react"
import ErrorBanner from "@/components/ui/error-banner"
import _ from "@/lib/translate"
import { Empty, EmptyTitle, EmptyDescription, EmptyMedia, EmptyHeader } from "@/components/ui/empty"
const IncorrectlyClearedEntries = () => {
const companyID = useCurrentCompany()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
if (!companyID || !bankAccount || !dates) {
const missingFields = []
if (!companyID) {
missingFields.push('Company')
}
if (!bankAccount) {
missingFields.push('Bank Account')
}
if (!dates) {
missingFields.push('Dates')
}
return <MissingFiltersBanner text={`Please select ${missingFields.join(', ')} to view the incorrectly cleared entries.`} />
}
return <IncorrectlyClearedEntriesView />
}
interface IncorrectlyClearedEntry {
payment_document: string
payment_entry: string
debit: number
credit: number
posting_date: string,
clearance_date: string,
}
const IncorrectlyClearedEntriesView = () => {
const companyID = useCurrentCompany()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const filters = useMemo(() => {
return JSON.stringify({
company: companyID,
account: bankAccount?.account,
report_date: dates.toDate
})
}, [companyID, bankAccount, dates])
const { data, error, mutate } = useFrappeGetCall<{ message: QueryReportReturnType<IncorrectlyClearedEntry> }>('frappe.desk.query_report.run', {
report_name: 'Cheques and Deposits Incorrectly cleared',
filters,
ignore_prepared_report: 1,
are_default_filters: false,
}, `Report-Cheques and Deposits Incorrectly cleared-${filters}`, { keepPreviousData: true, revalidateOnFocus: false }, 'POST')
const formattedToDate = formatDate(dates.toDate)
const { call: clearClearingDate } = useFrappePostCall('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.clear_clearing_date')
const onClearClick = useCallback(
(voucher_type: string, voucher_name: string) => {
clearClearingDate({ voucher_type, voucher_name })
.then(() => {
toast.success(_("Cleared"), {
duration: 1000,
})
mutate()
})
.catch((e) => {
toast.error(_("There was an error while performing the action."), {
description: getErrorMessage(e),
duration: 5000,
})
})
},
[clearClearingDate, mutate],
)
const accountCurrency = useMemo(
() => bankAccount?.account_currency ?? getCompanyCurrency(companyID),
[bankAccount?.account_currency, companyID],
)
const incorrectlyClearedColumns = useMemo<ColumnDef<IncorrectlyClearedEntry, unknown>[]>(
() => [
{
accessorKey: "payment_document",
header: _("Document Type"),
size: 128,
cell: ({ row }) => _(row.original.payment_document),
},
{
id: "payment_entry",
header: _("Payment Document"),
size: 160,
meta: {
getTooltipText: (r) => {
const x = r as IncorrectlyClearedEntry
return [x.payment_document, x.payment_entry].filter(Boolean).join(" · ") || undefined
},
} satisfies ListViewColumnMeta,
cell: ({ row }) => (
<a
target="_blank"
rel="noreferrer"
className="text-ink-gray-8 block min-w-0 w-full underline underline-offset-4"
href={`/desk/${slug(row.original.payment_document)}/${row.original.payment_entry}`}
>
{row.original.payment_entry}
</a>
),
},
{
accessorKey: "debit",
header: _("Debit"),
size: 120,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => formatCurrency(row.original.debit, accountCurrency),
},
{
accessorKey: "credit",
header: _("Credit"),
size: 120,
meta: { align: "right" } satisfies ListViewColumnMeta,
cell: ({ row }) => formatCurrency(row.original.credit, accountCurrency),
},
{
accessorKey: "posting_date",
header: _("Posting Date"),
size: 118,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.posting_date),
},
{
accessorKey: "clearance_date",
header: _("Clearance Date"),
size: 118,
meta: { tabularNums: true } satisfies ListViewColumnMeta,
cell: ({ row }) => formatDate(row.original.clearance_date),
},
{
id: "actions",
header: _("Actions"),
size: 180,
enableResizing: false,
meta: { truncate: false, truncateTooltip: false } satisfies ListViewColumnMeta,
cell: ({ row }) => (
<Button
variant="link"
size="sm"
className="text-ink-red-3 px-0"
onClick={() => onClearClick(row.original.payment_document, row.original.payment_entry)}
>
{_("Reset Clearing Date")}
</Button>
),
},
],
[accountCurrency, onClearClick],
)
return <div className="space-y-4 py-2">
<div>
<Paragraph className="text-sm">
<span dangerouslySetInnerHTML={{
__html: _("This report shows all entries in the system where the <strong>clearance date is before the posting date</strong> which is incorrect.")
}} />
<br />
{data && data.message.result.length > 0 && <span>
<span dangerouslySetInnerHTML={{
__html: _("Entries below have a posting date after {0} but the clearance date is before {1}.", [`<strong>${formattedToDate}</strong>`, `<strong>${formattedToDate}</strong>`])
}} />
<br />
{_("You can reset the clearing dates of these entries here.")}
</span>}
</Paragraph>
</div>
{error && <ErrorBanner error={error} />}
{data && data.message.result.length > 0 && (
<div className="space-y-2">
<p className="text-ink-gray-5 text-sm">{_("Incorrectly cleared entries as per the report.")}</p>
<ListView
data={data.message.result}
columns={incorrectlyClearedColumns}
getRowId={(row) => `${row.payment_entry}-${row.posting_date}`}
maxHeight="min(70vh, 640px)"
emptyState={_("No rows to display.")}
/>
</div>
)}
{data && data.message.result.length === 0 &&
<Empty>
<EmptyMedia>
<PartyPopper />
</EmptyMedia>
<EmptyHeader>
<EmptyTitle>{_("It's all good!")}</EmptyTitle>
<EmptyDescription>{_("There are no entries in the system where the clearance date is before the posting date.")}</EmptyDescription>
</EmptyHeader>
</Empty>
}
</div>
}
export default IncorrectlyClearedEntries

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
import { Button } from '@/components/ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import _ from '@/lib/translate'
import { FilterIcon } from 'lucide-react'
import { bankRecMatchFilters } from './bankRecAtoms'
import { useAtom } from 'jotai'
import { Switch } from '@/components/ui/switch'
import { Label } from '@/components/ui/label'
import { Separator } from '@/components/ui/separator'
import { useFrappeGetCall } from 'frappe-react-sdk'
import { scrub } from '@/lib/frappe'
import { useMemo } from 'react'
const MatchFilters = () => {
return (
<Popover>
<Tooltip>
<PopoverTrigger asChild>
<TooltipTrigger asChild>
<Button size='md' isIconButton variant='outline' aria-label={_("Configure match filters for vouchers")}>
<FilterIcon />
</Button>
</TooltipTrigger>
</PopoverTrigger>
<TooltipContent>
{_("Configure match filters for vouchers")}
</TooltipContent>
</Tooltip>
<PopoverContent>
<div className="flex flex-col gap-4">
<ToggleSwitch label={_("Show Only Exact Amount")} id="exact_match" />
<Separator />
<MatchFiltersContent />
<ToggleSwitch label={_("Bank Transaction")} id="bank_transaction" />
</div>
</PopoverContent>
</Popover>
)
}
const MatchFiltersContent = () => {
const { data } = useFrappeGetCall<{ message: string[] }>("erpnext.accounts.doctype.bank_transaction.bank_transaction.get_doctypes_for_bank_reconciliation", undefined,
"bank_rec_doctypes", {
revalidateOnFocus: false,
revalidateIfStale: false,
revalidateOnReconnect: false,
}
)
const doctypes = useMemo(() => {
const STANDARD_DOCTYPES = ["Payment Entry", "Journal Entry", "Purchase Invoice", "Sales Invoice"]
if (data) {
return data.message.map(doctype => ({
label: doctype,
id: scrub(doctype),
}))
} else {
return STANDARD_DOCTYPES.map(doctype => ({
label: doctype,
id: scrub(doctype),
}))
}
}, [data])
return (
<div className="flex flex-col gap-4">
{doctypes.map((doctype) => (
<ToggleSwitch key={doctype.id} label={doctype.label} id={doctype.id} />
))}
</div>
)
}
const ToggleSwitch = ({ label, id }: { label: string, id: string }) => {
const [matchFilters, setMatchFilters] = useAtom(bankRecMatchFilters)
return <div className="flex items-center space-x-2">
<Switch id={id} checked={matchFilters.includes(id)} onCheckedChange={(checked) => {
if (checked) {
setMatchFilters([...matchFilters, id])
} else {
setMatchFilters(matchFilters.filter(filter => filter !== id))
}
}} />
<Label htmlFor={id}>{label}</Label>
</div>
}
export default MatchFilters

View File

@@ -0,0 +1,10 @@
import { Paragraph } from "@/components/ui/typography"
import { cn } from "@/lib/utils"
import { ReactNode } from "react"
export const MissingFiltersBanner = ({ text, className }: { text: ReactNode, className?: string }) => {
return <div className={cn("min-h-[50vh] flex items-center justify-center", className)}>
<Paragraph>{text}</Paragraph>
</div>
}

View File

@@ -0,0 +1,32 @@
import { useAtom } from "jotai"
import { bankRecRecordPaymentModalAtom } from "./bankRecAtoms"
import { Dialog, DialogContent, DialogTitle, DialogDescription, DialogHeader } from "@/components/ui/dialog"
import { ModalContentFallback } from "@/components/ui/modal-content-fallback"
import _ from "@/lib/translate"
import { lazy, Suspense } from "react"
const RecordPaymentModalContent = lazy(() => import('./RecordPaymentModalContent'))
const RecordPaymentModal = () => {
const [isOpen, setIsOpen] = useAtom(bankRecRecordPaymentModalAtom)
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent className='min-w-[95vw]'>
<DialogHeader>
<DialogTitle>{_("Record Payment")}</DialogTitle>
<DialogDescription>
{_("Record a payment entry against a customer or supplier")}
</DialogDescription>
</DialogHeader>
{isOpen && (
<Suspense fallback={<ModalContentFallback />}>
<RecordPaymentModalContent />
</Suspense>
)}
</DialogContent>
</Dialog>
)
}
export default RecordPaymentModal

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
import { Button } from "@/components/ui/button"
import ErrorBanner from "@/components/ui/error-banner"
import { Form } from "@/components/ui/form"
import { useCurrentCompany } from "@/hooks/useCurrentCompany"
import _ from "@/lib/translate"
import { BankTransactionRule } from "@/types/Accounts/BankTransactionRule"
import { useFrappeCreateDoc } from "frappe-react-sdk"
import { toast } from "sonner"
import { RuleForm } from "./RuleForm"
import { useForm } from "react-hook-form"
import { SettingsPanelHeader, SettingsPanelDescription, SettingsPanelTitle, SettingsPanelContent } from "@/components/ui/settings-dialog"
import { useHotkeys } from "react-hotkeys-hook"
type Props = {
onCreate: VoidFunction
}
const CreateNewRule = ({ onCreate }: Props) => {
const currentCompany = useCurrentCompany()
const form = useForm<BankTransactionRule>({
defaultValues: {
rule_name: "",
company: currentCompany,
rule_description: "",
transaction_type: "Any",
classify_as: 'Bank Entry',
bank_entry_type: "Single Account",
description_rules: [{
check: "Contains",
}]
}
})
const { createDoc, loading, error } = useFrappeCreateDoc<BankTransactionRule>()
const onSubmit = (data: BankTransactionRule) => {
createDoc("Bank Transaction Rule", data)
.then(() => {
toast.success(_("Rule created successfully"))
onCreate()
})
}
useHotkeys('meta+s', () => {
form.handleSubmit(onSubmit)()
}, {
enabled: true,
preventDefault: true,
enableOnFormTags: true
})
return (
<>
<SettingsPanelHeader
actions={
<div className="flex items-center gap-2">
<Button variant='outline' size='md' type='button' onClick={() => onCreate()}>{_("Cancel")}</Button>
<Button type='submit' form='rule-form' size='md' disabled={loading}>
{_("Save")}
</Button>
</div>
}
>
<SettingsPanelTitle>
{_("New Rule")}
</SettingsPanelTitle>
<SettingsPanelDescription>
{_("Create a new rule to automatically classify transactions.")}
</SettingsPanelDescription>
</SettingsPanelHeader>
<SettingsPanelContent className="px-0">
<Form {...form}>
<form id='rule-form' onSubmit={form.handleSubmit(onSubmit)} className="flex flex-col justify-between h-full overflow-y-auto px-2">
<div className="flex flex-col gap-4">
{error && <ErrorBanner error={error} />}
<RuleForm />
</div>
</form>
</Form>
</SettingsPanelContent>
</>
)
}
export default CreateNewRule

View File

@@ -0,0 +1,101 @@
import { Button } from "@/components/ui/button"
import ErrorBanner from "@/components/ui/error-banner"
import { Form } from "@/components/ui/form"
import _ from "@/lib/translate"
import { BankTransactionRule } from "@/types/Accounts/BankTransactionRule"
import { FrappeError, useFrappeGetDoc, useFrappeUpdateDoc } from "frappe-react-sdk"
import { toast } from "sonner"
import { RuleForm } from "./RuleForm"
import { useForm } from "react-hook-form"
import { Skeleton } from "@/components/ui/skeleton"
import { SettingsPanelContent, SettingsPanelDescription, SettingsPanelHeader, SettingsPanelTitle } from "@/components/ui/settings-dialog"
import { useHotkeys } from "react-hotkeys-hook"
type Props = {
onClose: VoidFunction,
ruleID: string
}
const EditRule = ({ onClose, ruleID }: Props) => {
const { data: rule, isValidating, error, mutate } = useFrappeGetDoc<BankTransactionRule>("Bank Transaction Rule", ruleID, undefined, {
revalidateOnMount: true
})
const { updateDoc, loading, error: updateError } = useFrappeUpdateDoc<BankTransactionRule>()
const onSubmit = (data: BankTransactionRule) => {
updateDoc("Bank Transaction Rule", ruleID, data)
.then(() => {
toast.success(_("Rule updated."))
mutate()
onClose()
})
}
return <>
<SettingsPanelHeader
actions={
<div className="flex items-center gap-2">
<Button variant='outline' size='md' type='button' onClick={() => onClose()}>{_("Cancel")}</Button>
<Button type='submit' form='rule-form' size='md' disabled={isValidating || loading}>
{_("Save")}
</Button>
</div>
}
>
<SettingsPanelTitle>
{rule?.rule_name}
</SettingsPanelTitle>
<SettingsPanelDescription className="sr-only">
{_("Edit this rule")}
</SettingsPanelDescription>
</SettingsPanelHeader>
<SettingsPanelContent className="px-0">
{isValidating && <div className="px-4 flex flex-col gap-4 h-full">
<Skeleton className="h-10 w-full" />
<Skeleton className="h-10 w-full" />
<Skeleton className="h-10 w-full" />
<Skeleton className="h-10 w-full" />
<Skeleton className="h-10 w-full" />
</div>}
{error && <div className="px-4 flex flex-col gap-4 h-full">
<ErrorBanner error={error} />
</div>}
{rule && <EditRuleForm rule={rule} onSubmit={onSubmit} error={updateError} />}
</SettingsPanelContent>
</>
}
const EditRuleForm = ({ rule, onSubmit, error }: { rule: BankTransactionRule, onSubmit: (data: BankTransactionRule) => void, error?: FrappeError | null }) => {
const form = useForm<BankTransactionRule>({
defaultValues: {
...rule,
}
})
useHotkeys('meta+s', () => {
form.handleSubmit(onSubmit)()
}, {
enabled: true,
preventDefault: true,
enableOnFormTags: true
})
return (
<Form {...form}>
<form id='rule-form' onSubmit={form.handleSubmit(onSubmit)} className="flex flex-col justify-between h-full overflow-y-auto px-2">
<div className="flex flex-col gap-4">
{error && <ErrorBanner error={error} />}
<RuleForm isEdit />
</div>
</form>
</Form>
)
}
export default EditRule

View File

@@ -0,0 +1,799 @@
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { Dialog, DialogTitle, DialogContent, DialogHeader, DialogDescription } from "@/components/ui/dialog"
import { FormField, FormItem, FormLabel, FormControl } from "@/components/ui/form"
import { AccountFormField, CurrencyFormField, DataField, LinkFormField, PartyTypeFormField, SelectFormField, SmallTextField } from "@/components/ui/form-elements"
import { Label } from "@/components/ui/label"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
import { SelectItem } from "@/components/ui/select"
import { Separator } from "@/components/ui/separator"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { H4, Paragraph } from "@/components/ui/typography"
import { today } from "@/lib/date"
import _ from "@/lib/translate"
import { cn } from "@/lib/utils"
import { BankTransactionRule } from "@/types/Accounts/BankTransactionRule"
import { BankTransactionRuleAccounts } from "@/types/Accounts/BankTransactionRuleAccounts"
import { FrappeConfig, FrappeContext } from "frappe-react-sdk"
import { ArrowDownRight, ArrowDownUp, ArrowRightLeftIcon, ArrowUpRight, LandmarkIcon, Plus, PlusCircleIcon, ReceiptIcon, Settings, Trash2 } from "lucide-react"
import { ChangeEvent, useCallback, useContext, useMemo, useRef, useState } from "react"
import { useFieldArray, useFormContext, useWatch } from "react-hook-form"
export const RuleForm = ({ isEdit = false }: { isEdit?: boolean }) => {
return <div className="flex flex-col gap-4">
<DataField
name='rule_name'
label={_("Rule Name")}
disabled={isEdit}
isRequired
inputProps={{
maxLength: 140,
disabled: isEdit,
placeholder: _("Bank Charges, Salary, etc."),
autoFocus: true,
className: "dark:disabled:bg-surface-gray-2"
}}
rules={{
required: _("Rule name is required")
}}
/>
<CompanySelector />
<SmallTextField
name='rule_description'
label={_("Rule Description")}
inputProps={{
placeholder: _("Any debit transaction with the keyword 'Bank Fee'.")
}}
/>
<TransactionTypeSelector />
<div className="grid grid-cols-2 gap-2 pt-1">
<CurrencyFormField
name='min_amount'
label={_("Minimum Amount")}
/>
<CurrencyFormField
name='max_amount'
label={_("Maximum Amount")}
/>
</div>
<DescriptionRules />
<Separator />
<RuleAction />
</div>
}
const CompanySelector = () => {
const { setValue } = useFormContext<BankTransactionRule>()
return <LinkFormField
name='company'
label={_("Company")}
doctype="Company"
isRequired
rules={{
required: _("Company is required"),
onChange: () => {
setValue('account', '')
}
}}
/>
}
/** Component to render a radio group as a toggle group with options for All, Withdrawal, Deposit */
const TransactionTypeSelector = () => {
const { control } = useFormContext<BankTransactionRule>()
return (
<FormField
control={control}
name='transaction_type'
render={({ field }) => (
<FormItem className="space-y-1">
<FormLabel className="text-sm font-medium">
{_("Transaction Type")}<span className="text-ink-red-3">*</span>
</FormLabel>
<FormControl>
<RadioGroup
onValueChange={field.onChange}
value={field.value}
className="grid grid-cols-3 gap-2 w-full"
>
<FormItem className="flex items-center">
<FormControl>
<RadioGroupItem
value="Any"
className="peer sr-only hidden"
/>
</FormControl>
<FormLabel
className={cn(
"w-full flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-md border cursor-pointer transition-all hover:bg-surface-gray-1 hover:text-ink-gray-8",
"peer-data-[state=checked]:bg-surface-gray-7 peer-data-[state=checked]:text-ink-white peer-data-[state=checked]:border-outline-gray-5 peer-data-[state=checked]:hover:bg-surface-gray-7 peer-data-[state=checked]:hover:text-ink-white"
)}
>
<ArrowDownUp className="w-5 h-5" />
{_("All")}
</FormLabel>
</FormItem>
<FormItem className="flex items-center">
<FormControl>
<RadioGroupItem
value="Withdrawal"
className="peer sr-only hidden"
/>
</FormControl>
<FormLabel
className={cn(
"w-full flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-md border cursor-pointer transition-all hover:bg-surface-gray-1 hover:text-ink-gray-8",
"peer-data-[state=checked]:bg-surface-red-5 peer-data-[state=checked]:text-white peer-data-[state=checked]:border-bg-surface-red-5 peer-data-[state=checked]:hover:bg-surface-red-5 peer-data-[state=checked]:hover:text-white"
)}
>
<ArrowUpRight className="w-5 h-5 peer-data-[state=checked]:text-ink-red-3" />
{_("Withdrawal")}
</FormLabel>
</FormItem>
<FormItem className="flex items-center">
<FormControl>
<RadioGroupItem
value="Deposit"
className="peer sr-only hidden"
/>
</FormControl>
<FormLabel
className={cn(
"w-full flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-md border cursor-pointer transition-all hover:bg-surface-gray-1 hover:text-ink-gray-8",
"peer-data-[state=checked]:bg-surface-green-5 peer-data-[state=checked]:text-white peer-data-[state=checked]:border-surface-green-5 peer-data-[state=checked]:hover:bg-surface-green-5 peer-data-[state=checked]:hover:text-white"
)}
>
<ArrowDownRight className="w-5 h-5 peer-data-[state=checked]:text-white" />
{_("Deposit")}
</FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
</FormItem>
)}
/>
)
}
const DescriptionRules = () => {
const { control } = useFormContext<BankTransactionRule>()
const { fields, append, remove } = useFieldArray({
control,
name: "description_rules"
})
const addRow = () => {
// @ts-expect-error - we don't need all fields here
append({ check: "Contains" })
}
return (
<div className="flex flex-col gap-2 pt-1">
<span className="text-sm font-medium">{_("Rules to match against the transaction description")} <span className="text-ink-red-3">*</span></span>
{fields.map((field, index) => (
<div key={field.id} className="flex w-full items-center gap-2">
<div className="min-w-36">
<SelectFormField
label={_("Type of check")}
hideLabel
name={`description_rules.${index}.check`}
rules={{
required: _("This is required")
}}>
<SelectItem value="Contains">{_("Contains")}</SelectItem>
<SelectItem value="Starts With">{_("Starts with")}</SelectItem>
<SelectItem value="Ends With">{_("Ends with")}</SelectItem>
<SelectItem value="Regex">{_("Regex")}</SelectItem>
</SelectFormField>
</div>
<div className="w-full">
<DataField
name={`description_rules.${index}.value`}
label={_("Value")}
hideLabel
inputProps={{
placeholder: _("Bank Fee, Salary, etc."),
}}
/>
</div>
<div>
<Button variant="ghost" theme='red' type='button' isIconButton onClick={() => remove(index)} disabled={fields.length === 1}>
<Trash2 />
</Button>
</div>
</div>
))}
<div>
<Button variant="outline" type='button' onClick={addRow}>
<PlusCircleIcon />
{_("Add Rule")}
</Button>
</div>
</div>
)
}
const RuleAction = () => {
const { control } = useFormContext<BankTransactionRule>()
const classify_as = useWatch({ control, name: "classify_as" })
const party_type = useWatch({ control, name: "party_type" })
const bank_entry_type = useWatch({ control, name: "bank_entry_type" })
const accountType = useMemo(() => {
if (classify_as === "Payment Entry") {
return party_type === "Supplier" ? ["Payable"] : ["Receivable"]
}
if (classify_as === "Transfer") {
return ["Bank", "Cash", "Temporary"]
}
return undefined
}, [classify_as, party_type])
return (
<div className="flex flex-col gap-4">
<H4 className="text-base text-ink-gray-7">{_("If rule matches, then:")}</H4>
<SelectFormField
name='classify_as'
isRequired
label={_("Suggest creating a")}
formDescription={_("This will just suggest creating a new entry, and will not automatically create it.")}
rules={{
required: _("This is required")
}}
>
<SelectItem value="Bank Entry"><LandmarkIcon /> {_("Bank Entry")}</SelectItem>
<SelectItem value="Payment Entry"><ReceiptIcon /> {_("Payment Entry")}</SelectItem>
<SelectItem value="Transfer"><ArrowRightLeftIcon /> {_("Transfer")}</SelectItem>
</SelectFormField>
{classify_as === "Bank Entry" && (<SelectFormField
name='bank_entry_type'
isRequired
label={_("Create Bank Entry against")}
rules={{
required: _("This is required")
}}
>
<SelectItem value="Single Account">{_("Single Account")}</SelectItem>
<SelectItem value="Multiple Accounts">{_("Multiple Accounts (Journal Template)")}</SelectItem>
</SelectFormField>)}
{classify_as === "Payment Entry" && (
<div className='grid grid-cols-4 gap-4'>
<div className="col-span-1">
<PartyTypeFormField
name='party_type'
label={_("Party Type")}
isRequired
inputProps={{
triggerProps: {
className: 'w-full'
},
}}
rules={{
required: "Party Type is required"
}}
/>
</div>
<div className="col-span-3">
<PartyField />
</div>
</div>
)}
{(((bank_entry_type === "Single Account" || !bank_entry_type) && classify_as === "Bank Entry") || classify_as !== "Bank Entry") && (<AccountFormField
name='account'
label={_("Account")}
isRequired
rules={{
required: _("Account is required")
}}
account_type={accountType}
/>)}
{bank_entry_type === "Multiple Accounts" && classify_as === "Bank Entry" && <MultipleAccountsSelection />}
</div>
)
}
const PartyField = () => {
const { control, setValue } = useFormContext<BankTransactionRule>()
const party_type = useWatch({
control,
name: `party_type`
})
const { call } = useContext(FrappeContext) as FrappeConfig
const company = useWatch({ control, name: 'company' })
const onChange = (event: ChangeEvent<HTMLInputElement>) => {
// Fetch the party and account
if (event.target.value) {
call.get('erpnext.accounts.doctype.payment_entry.payment_entry.get_party_details', {
company: company,
party_type: party_type,
party: event.target.value,
date: today()
}).then((res) => {
setValue('account', res.message.party_account)
})
} else {
// Clear the account
setValue('account', '')
}
}
if (!party_type) {
return <DataField
name={`party`}
label={_("Party")}
isRequired
inputProps={{
disabled: true,
}}
/>
}
return <LinkFormField
name={`party`}
label={_("Party")}
rules={{
onChange
}}
doctype={party_type}
/>
}
const MultipleAccountsSelection = () => {
const { control } = useFormContext<BankTransactionRule>()
const accounts = useWatch({
control,
name: 'accounts'
}) ?? []
const [isConfigureAccountsModalOpen, setIsConfigureAccountsModalOpen] = useState(false)
return <div className="flex flex-col gap-2">
<div className="flex justify-between gap-2">
<Label>{_("Journal Template Accounts")}<span className="text-ink-red-3">*</span></Label>
<Button variant="outline" type="button" onClick={() => setIsConfigureAccountsModalOpen(true)}><Settings /> {_("Configure Accounts")}</Button>
</div>
<Table>
<TableHeader>
<TableRow>
<TableHead>{_("Account")}</TableHead>
<TableHead className="text-end">{_("Debit")}</TableHead>
<TableHead className="text-end">{_("Credit")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{accounts.length === 0 && (
<TableRow>
<TableCell colSpan={3} className="text-center">
<div className="py-2 flex flex-col gap-2 items-center">
<span>{_("No accounts configured")}</span>
<Button variant="subtle" type="button" onClick={() => setIsConfigureAccountsModalOpen(true)}>{_("Configure Accounts")}</Button>
</div>
</TableCell>
</TableRow>
)}
{accounts.map((account, index) => (
<TableRow key={index}>
<TableCell>{account.account}</TableCell>
{index === accounts.length - 1 ? <TableCell className="text-end bg-surface-gray-1" colSpan={2}>
<Tooltip>
<TooltipTrigger asChild>
<span className="text-ink-gray-5">{_("This is auto computed to balance the journal entry.")}</span>
</TooltipTrigger>
<TooltipContent>
{_("Based on the above entries, the balance amount (debit or credit) will be set for the last row to balance the journal entry.")}
</TooltipContent>
</Tooltip>
</TableCell> : <>
<TableCell className="font-numeric text-end"><AmountFormulaRenderer value={account.debit} /></TableCell>
<TableCell className="font-numeric text-end"><AmountFormulaRenderer value={account.credit} /></TableCell>
</>}
</TableRow>
))}
</TableBody>
</Table>
<ConfigureAccountsModal open={isConfigureAccountsModalOpen} onClose={() => setIsConfigureAccountsModalOpen(false)} />
</div>
}
const AmountFormulaRenderer = ({ value }: { value?: string }) => {
// If it's a string and cannot be a number, then show it as a formula
if (isNaN(Number(value))) {
let calculatedValue = "";
try {
calculatedValue = window.eval(`const transaction_amount = 200; ${value}`);
} catch (error: unknown) {
console.error(error);
calculatedValue = "Error";
}
const isComputationValid = !isNaN(Number(calculatedValue)) && calculatedValue !== undefined && calculatedValue !== null;
return <Tooltip>
<TooltipTrigger asChild>
<span className={cn("font-numeric text-end tabular-nums underline underline-offset-4", isComputationValid ? "" : "text-ink-red-3")}>{value}</span>
</TooltipTrigger>
<TooltipContent className={isComputationValid ? "" : "bg-surface-red-5"} arrowClassName={isComputationValid ? "" : "bg-surface-red-5 fill-surface-red-5"}>
<p className="text-sm">
{isComputationValid ? _("This is a formula based value.") : _("This is not a valid formula. Check the variable used in the formula.")}
<br /><br />
{_("Example: If the transaction amount is 200, then this will be calculated as {} = {}", [value ?? "", calculatedValue])}
</p>
</TooltipContent>
</Tooltip>
}
return <span className="font-numeric text-end tabular-nums">{value}</span>
}
const ConfigureAccountsModal = ({ open, onClose }: { open: boolean, onClose: () => void }) => {
return <Dialog
open={open}
onOpenChange={onClose}
>
<DialogContent className='min-w-[95vw]'>
<ConfigureAccountsModalContent />
</DialogContent>
</Dialog>
}
const ConfigureAccountsModalContent = () => {
const { control, getValues, setValue } = useFormContext<BankTransactionRule>()
const { call } = useContext(FrappeContext) as FrappeConfig
// const costCenterMapRef = useRef<Record<string, string>>({})
const partyMapRef = useRef<Record<string, string>>({})
const onPartyChange = (value: string, index: number) => {
// Get the account for the party type
if (value) {
if (partyMapRef.current[value]) {
setValue(`accounts.${index}.account`, partyMapRef.current[value])
} else {
call.get('erpnext.accounts.party.get_party_account', {
party: value,
party_type: getValues(`accounts.${index}.party_type`),
company: company
}).then((result: { message: string }) => {
setValue(`accounts.${index}.account`, result.message)
partyMapRef.current[value] = result.message
})
}
} else {
setValue(`accounts.${index}.account`, '')
}
}
const transaction_type = useWatch({
name: 'transaction_type',
control,
})
const { fields, append, remove } = useFieldArray({
control,
name: 'accounts'
})
const [selectedRows, setSelectedRows] = useState<number[]>([])
const onSelectRow = useCallback((index: number) => {
setSelectedRows(prev => {
if (prev.includes(index)) {
return prev.filter(i => i !== index)
}
return [...prev, index]
})
}, [])
const onSelectAll = useCallback(() => {
setSelectedRows(prev => {
if (prev.length === fields.length) {
return []
}
return [...fields.map((_, index) => index)]
})
}, [fields])
const onAdd = () => {
append({
party_type: '',
party: '',
account: '',
debit: '',
credit: '',
user_remark: ''
} as BankTransactionRuleAccounts, {
focusName: `accounts.${fields.length}.account`
})
}
const onRemove = useCallback(() => {
remove(selectedRows)
setSelectedRows([])
}, [remove, selectedRows])
const isWithdrawal = transaction_type === 'Withdrawal'
const company = useWatch({
name: 'company',
control,
})
return <>
<DialogHeader>
<DialogTitle>{_("Configure Accounts for Bank Entry")}</DialogTitle>
<DialogDescription>{_("Add all accounts that you want to split the transaction into.")}</DialogDescription>
</DialogHeader>
<div className="flex flex-col gap-2">
<Table>
<TableHeader>
<TableRow>
<TableHead><Checkbox
disabled={fields.length === 0}
// Make this accessible to screen readers
aria-label={_("Select all")}
checked={selectedRows.length > 0 && selectedRows.length === fields.length}
onCheckedChange={onSelectAll} /></TableHead>
<TableHead>{_("Party")}</TableHead>
<TableHead>{_("Account")} <span className="text-ink-red-3">*</span></TableHead>
{/* <TableHead>{_("Cost Center")}</TableHead> */}
<TableHead>{_("Remarks")}</TableHead>
<TableHead className="text-end">{_("Debit")}</TableHead>
<TableHead className="text-end">{_("Credit")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow className="bg-surface-gray-1 cursor-not-allowed" title={_("This is the row for the bank account. It will be auto populated based on the bank transaction.")}>
<TableCell>
<Checkbox disabled />
</TableCell>
<TableCell className="align-top">
</TableCell>
<TableCell className="align-top text-ink-gray-5">
<span className="px-2">
Bank GL Account
</span>
</TableCell>
<TableCell className="align-top">
</TableCell>
<TableCell className={"align-top text-end"}>
<span className="text-ink-gray-5 text-sm">
{transaction_type === "Withdrawal" || transaction_type === "Any" ? _("Will be auto-populated") : ""}
</span>
</TableCell>
<TableCell className={"text-end align-top"}>
<span className="text-ink-gray-5 text-sm">
{transaction_type === "Deposit" || transaction_type === "Any" ? _("Will be auto-populated") : ""}
</span>
</TableCell>
</TableRow>
{fields.map((field, index) => (
<TableRow key={field.id}>
<TableCell>
<Checkbox
checked={selectedRows.includes(index)}
onCheckedChange={() => onSelectRow(index)}
// Make this accessible to screen readers
aria-label={_("Select row {0}", [String(index + 1)])}
/>
</TableCell>
<TableCell className="align-top">
<div className="flex">
<PartyTypeFormField
name={`accounts.${index}.party_type`}
label={_("Party Type")}
isRequired
hideLabel
inputProps={{
type: isWithdrawal ? 'Payable' : 'Receivable',
triggerProps: {
className: 'rounded-e-none',
tabIndex: -1
},
}} />
<PartyRowField index={index} onChange={onPartyChange} />
</div>
</TableCell>
<TableCell className="align-top">
<AccountFormField
name={`accounts.${index}.account`}
label={_("Account")}
rules={{
required: _("Account is required"),
// onChange: (event) => {
// onAccountChange(event.target.value, index)
// }
}}
buttonClassName="min-w-64"
isRequired
hideLabel
/>
</TableCell>
{/* <TableCell className="align-top">
<LinkFormField
doctype="Cost Center"
name={`accounts.${index}.cost_center`}
label={_("Cost Center")}
filters={[["company", "=", company], ["is_group", "=", 0], ["disabled", "=", 0]]}
buttonClassName="min-w-48"
readOnly={index === 0}
hideLabel
/>
</TableCell> */}
<TableCell className="align-top">
<DataField
name={`accounts.${index}.user_remark`}
label={_("Remarks")}
inputProps={{
placeholder: _("e.g. Bank Charges"),
className: 'min-w-64',
}}
hideLabel
/>
</TableCell>
<TableCell
className={cn("text-end align-top", index === fields.length - 1 ? "cursor-not-allowed" : "")}
title={index === fields.length - 1 ? _("This is the last row. It will be auto populated based on the bank transaction.") : ""}>
<DataField
name={`accounts.${index}.debit`}
label={_("Debit")}
disabled={index === fields.length - 1}
inputProps={{
className: 'text-end',
placeholder: _("0.00"),
disabled: index === fields.length - 1
}}
hideLabel
/>
</TableCell>
<TableCell
className={cn("text-end align-top", index === fields.length - 1 ? "cursor-not-allowed" : "")}
title={index === fields.length - 1 ? _("This is the last row. It will be auto populated based on the bank transaction.") : ""}>
<DataField
name={`accounts.${index}.credit`}
label={_("Credit")}
disabled={index === fields.length - 1}
inputProps={{
className: 'text-end',
placeholder: _("0.00"),
disabled: index === fields.length - 1
}}
hideLabel
/>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
<div className="flex justify-between gap-2">
<div className="flex gap-2 justify-end">
<div>
<Button size='sm' type='button' variant={'outline'} onClick={onAdd}><Plus /> {_("Add Row")}</Button>
</div>
{selectedRows.length > 0 && <div>
<Button size='sm' type='button' theme="red" onClick={onRemove}><Trash2 /> {_("Remove")}</Button>
</div>}
</div>
</div>
<div className="py-4">
<Separator />
</div>
<div className="flex flex-col gap-2">
<H4 className="text-base text-ink-gray-7">{_("Help")}</H4>
<Paragraph className="text-p-sm">{(_("You can set up the rule to split the transaction across multiple accounts."))}
<br />{_("You can also add credit or debit values to pre-fill - these support both static values (like 200) or formulas (like transaction_amount * 0.25).")}
<br />
<br />
<span className="font-medium">{_("Example")}:</span>
<br />
<span className="font-numeric text-sm">
transaction_amount * 0.25
</span>
<br />
<span>
{_("In this case, the amount will be calculated as 25% of the transaction amount. If the transaction amount is 200, then this will be calculated as 200 * 0.25 = 50.")}
</span>
</Paragraph>
</div>
</div>
</>
}
const PartyRowField = ({ index, onChange }: { index: number, onChange: (value: string, index: number) => void }) => {
const { control } = useFormContext<BankTransactionRule>()
const party_type = useWatch({
control,
name: `accounts.${index}.party_type`
})
if (!party_type) {
return <DataField
name={`accounts.${index}.party`}
label={_("Party")}
isRequired
inputProps={{
disabled: true,
className: 'rounded-s-none border-s-0 min-w-64'
}}
hideLabel
/>
}
return <LinkFormField
name={`accounts.${index}.party`}
label={_("Party")}
rules={{
onChange: (event) => {
onChange(event.target.value, index)
},
}}
hideLabel
buttonClassName="rounded-s-none border-s-0 min-w-64"
doctype={party_type}
/>
}

View File

@@ -0,0 +1,73 @@
import { useMemo } from 'react'
import { ArrowDownRight, ArrowUpRight, Calendar } from 'lucide-react'
import { formatCurrency } from '@/lib/numbers'
import { formatDate } from '@/lib/date'
import { UnreconciledTransaction, useGetBankAccounts } from './utils'
import { getCompanyCurrency } from '@/lib/company'
import { Card, CardContent } from '@/components/ui/card'
import { cn } from '@/lib/utils'
import _ from '@/lib/translate'
import BankLogo from '@/components/common/BankLogo'
type Props = {
transaction: UnreconciledTransaction,
showAccount?: boolean,
account?: string
}
const SelectedTransactionDetails = ({ transaction, showAccount = false, account }: Props) => {
const isWithdrawal = transaction.withdrawal && transaction.withdrawal > 0
const { banks } = useGetBankAccounts()
const bank = useMemo(() => {
if (transaction.bank_account) {
return banks?.find((bank) => bank.name === transaction.bank_account)
}
return null
}, [transaction.bank_account, banks])
const amount = transaction.withdrawal ? transaction.withdrawal : transaction.deposit
const currency = transaction.currency || getCompanyCurrency(transaction.company ?? '')
return (
<Card className='py-4'>
<CardContent className='px-4'>
<div className='flex flex-col gap-2'>
<div className='flex justify-between'>
<div className='flex flex-col gap-2'>
<div className='flex flex-col gap-1'>
<BankLogo bank={bank} iconSize='30px' imageClassName='h-10 max-w-20' />
<span className='font-medium text-sm'>{transaction.bank_account}</span>
</div>
<div className='flex items-center gap-1'>
<Calendar size='16px' />
<span className='text-sm'>{formatDate(transaction.date, 'Do MMM YYYY')}</span>
</div>
</div>
<div className='flex flex-col gap-1'>
<div className={cn('flex items-center gap-1 text-end px-0 justify-end py-1 rounded-sm',
isWithdrawal ? 'text-ink-red-3' : 'text-ink-green-3'
)}>
{isWithdrawal ? <ArrowUpRight className="w-5 h-5 text-ink-red-3" /> : <ArrowDownRight className="w-5 h-5 text-ink-green-3" />}
<span className='text-sm font-semibold uppercase'>{isWithdrawal ? _('Spent') : _('Received')}</span>
</div>
<span className='font-semibold font-numeric text-lg text-end pe-0.5'>{formatCurrency(amount, currency)}</span>
{transaction.unallocated_amount && transaction.unallocated_amount !== amount ? <span className='text-ink-gray-5'>{_("Unallocated")}: {formatCurrency(transaction.unallocated_amount)}</span> : null}
</div>
</div>
<div className='flex flex-col gap-1'>
<span className='text-sm'>{transaction.description}</span>
{transaction.reference_number ? <span className='text-sm text-ink-gray-5'>{_("Ref")}: {transaction.reference_number}</span> : null}
{showAccount && account ? <span className='text-sm text-ink-gray-5'>{_("GL Account")}: {account}</span> : null}
</div>
</div>
</CardContent >
</Card >
)
}
export default SelectedTransactionDetails

View File

@@ -0,0 +1,47 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'
import _ from '@/lib/translate'
import { useAtomValue } from 'jotai'
import { bankRecSelectedTransactionAtom, selectedBankAccountAtom } from './bankRecAtoms'
import { formatDate } from '@/lib/date'
import { formatCurrency } from '@/lib/numbers'
import { ArrowDownRight, ArrowUpRight } from 'lucide-react'
const SelectedTransactionsTable = () => {
const selectedBankAccount = useAtomValue(selectedBankAccountAtom)
const transactions = useAtomValue(bankRecSelectedTransactionAtom(selectedBankAccount?.name ?? ''))
return (
<Table>
<TableHeader>
<TableRow>
<TableHead>
{_("Date")}
</TableHead>
<TableHead>
{_("Description")}
</TableHead>
<TableHead className="text-end">
{_("Amount")}
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{transactions.map((transaction) => (
<TableRow key={transaction.name}>
<TableCell>{formatDate(transaction.date)}</TableCell>
<TableCell className="max-w-96 text-ellipsis overflow-hidden" title={transaction.description}>{transaction.description}</TableCell>
<TableCell className="text-end flex items-center justify-end gap-1">
{transaction.withdrawal && transaction.withdrawal > 0 ? <ArrowUpRight className="w-4 h-4 text-ink-red-3" /> : <ArrowDownRight className="w-4 h-4 text-ink-green-3" />}
<span className="font-numeric font-medium">
{formatCurrency(transaction.unallocated_amount, transaction.currency ?? '')}
</span>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)
}
export default SelectedTransactionsTable

View File

@@ -0,0 +1,32 @@
import { useAtom } from 'jotai'
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { ModalContentFallback } from '@/components/ui/modal-content-fallback'
import _ from '@/lib/translate'
import { lazy, Suspense } from 'react'
import { bankRecTransferModalAtom } from './bankRecAtoms'
const TransferModalContent = lazy(() => import('./TransferModalContent'))
const TransferModal = () => {
const [isOpen, setIsOpen] = useAtom(bankRecTransferModalAtom)
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent className='min-w-7xl'>
<DialogHeader>
<DialogTitle>{_("Transfer")}</DialogTitle>
<DialogDescription>
{_("Record an internal transfer to another bank/credit card/cash account.")}
</DialogDescription>
</DialogHeader>
{isOpen && (
<Suspense fallback={<ModalContentFallback />}>
<TransferModalContent />
</Suspense>
)}
</DialogContent>
</Dialog>
)
}
export default TransferModal

View File

@@ -0,0 +1,530 @@
import { useAtomValue, useSetAtom } from 'jotai'
import { bankRecSelectedTransactionAtom, bankRecTransferModalAtom, bankRecUnreconcileModalAtom, SelectedBank, selectedBankAccountAtom } from './bankRecAtoms'
import { DialogFooter, DialogClose } from '@/components/ui/dialog'
import _ from '@/lib/translate'
import { UnreconciledTransaction, useGetBankAccounts, useGetRuleForTransaction, useRefreshUnreconciledTransactions, useUpdateActionLog } from './utils'
import { Button } from '@/components/ui/button'
import SelectedTransactionDetails from './SelectedTransactionDetails'
import { PaymentEntry } from '@/types/Accounts/PaymentEntry'
import { useForm, useFormContext, useWatch } from 'react-hook-form'
import { FrappeConfig, FrappeContext, useFrappeGetCall, useFrappePostCall } from 'frappe-react-sdk'
import { toast } from 'sonner'
import ErrorBanner from '@/components/ui/error-banner'
import { H4 } from '@/components/ui/typography'
import { cn } from '@/lib/utils'
import { ArrowRight, Banknote, BadgeCheck, Calendar, ArrowUpRight, ArrowDownRight, CheckIcon, CheckCircle, ArrowLeft } from 'lucide-react'
import { Separator } from '@/components/ui/separator'
import { Form } from '@/components/ui/form'
import { AccountFormField, DataField, DateField, SmallTextField } from '@/components/ui/form-elements'
import SelectedTransactionsTable from './SelectedTransactionsTable'
import { useCurrentCompany } from '@/hooks/useCurrentCompany'
import { useMultiFileUploadProgress } from '@/hooks/useMultiFileUploadProgress'
import { formatDate } from '@/lib/date'
import { useContext, useMemo, useState } from 'react'
import { formatCurrency } from '@/lib/numbers'
import { Label } from '@/components/ui/label'
import { FileDropzone } from '@/components/ui/file-dropzone'
import FileUploadBanner from '@/components/common/FileUploadBanner'
import { BankTransaction } from '@/types/Accounts/BankTransaction'
import { useHotkeys } from 'react-hotkeys-hook'
import { useDirection } from '@/components/ui/direction'
import BankLogo from '@/components/common/BankLogo'
const TransferModalContent = () => {
const selectedBankAccount = useAtomValue(selectedBankAccountAtom)
const selectedTransaction = useAtomValue(bankRecSelectedTransactionAtom(selectedBankAccount?.name ?? ''))
if (!selectedTransaction || !selectedBankAccount || selectedTransaction.length === 0) {
return <div className='p-4'>
<span className='text-center'>{_("No transaction selected")}</span>
</div>
}
if (selectedTransaction.length === 1) {
return <InternalTransferForm
selectedBankAccount={selectedBankAccount}
selectedTransaction={selectedTransaction[0]} />
}
return <BulkInternalTransferForm transactions={selectedTransaction} />
}
const BulkInternalTransferForm = ({ transactions }: { transactions: UnreconciledTransaction[] }) => {
const form = useForm<{
bank_account: string
}>()
const setIsOpen = useSetAtom(bankRecTransferModalAtom)
const { call: createPaymentEntry, loading, error } = useFrappePostCall<{ message: { transaction: BankTransaction, payment_entry: PaymentEntry }[] }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.create_bulk_internal_transfer')
const onReconcile = useRefreshUnreconciledTransactions()
const addToActionLog = useUpdateActionLog()
const onSubmit = (data: { bank_account: string }) => {
createPaymentEntry({
bank_transaction_names: transactions.map((transaction) => transaction.name),
bank_account: data.bank_account
}).then(({ message }) => {
addToActionLog({
type: 'transfer',
timestamp: (new Date()).getTime(),
isBulk: true,
items: message.map((item) => ({
bankTransaction: item.transaction,
voucher: {
reference_doctype: "Payment Entry",
reference_name: item.payment_entry.name,
posting_date: item.payment_entry.posting_date,
doc: item.payment_entry,
}
})),
bulkCommonData: {
bank_account: data.bank_account,
}
})
toast.success(_("Transfer Recorded"), {
duration: 4000,
closeButton: true,
})
onReconcile(transactions[transactions.length - 1])
setIsOpen(false)
})
}
const onAccountChange = (account: string) => {
form.setValue('bank_account', account)
}
const selectedAccount = useWatch({ control: form.control, name: 'bank_account' })
const currentCompany = useCurrentCompany()
const company = transactions && transactions.length > 0 ? transactions[0].company : (currentCompany ?? '')
return <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div className='flex flex-col gap-4'>
{error && <ErrorBanner error={error} />}
<SelectedTransactionsTable />
<BankOrCashPicker company={company} bankAccount={transactions[0]?.bank_account ?? ''} onAccountChange={onAccountChange} selectedAccount={selectedAccount} />
<DialogFooter>
<DialogClose asChild>
<Button size='md' variant={'outline'} disabled={loading}>{_("Cancel")}</Button>
</DialogClose>
<Button size='md' type='submit' disabled={loading}>{_("Transfer")}</Button>
</DialogFooter>
</div>
</form>
</Form>
}
interface InternalTransferFormFields extends PaymentEntry {
mirror_transaction_name?: string
}
const InternalTransferForm = ({ selectedBankAccount, selectedTransaction }: { selectedBankAccount: SelectedBank, selectedTransaction: UnreconciledTransaction }) => {
const setIsOpen = useSetAtom(bankRecTransferModalAtom)
const onClose = () => {
setIsOpen(false)
}
const { data: rule } = useGetRuleForTransaction(selectedTransaction)
const isWithdrawal = (selectedTransaction.withdrawal && selectedTransaction.withdrawal > 0) ? true : false
const form = useForm<InternalTransferFormFields>({
defaultValues: {
payment_type: 'Internal Transfer',
company: selectedTransaction?.company,
// If the transaction is a withdrawal, set the paid from to the selected bank account
paid_from: isWithdrawal ? selectedBankAccount.account : (rule?.account ?? ''),
// If the transaction is a deposit, set the paid to to the selected bank account
paid_to: !isWithdrawal ? selectedBankAccount.account : (rule?.account ?? ''),
// Set the amount to the amount of the selected transaction
paid_amount: selectedTransaction.unallocated_amount,
received_amount: selectedTransaction.unallocated_amount,
reference_date: selectedTransaction.date,
posting_date: selectedTransaction.date,
reference_no: (selectedTransaction.reference_number || selectedTransaction.description || '').slice(0, 140),
}
})
const onReconcile = useRefreshUnreconciledTransactions()
const { call: createPaymentEntry, loading, error, isCompleted } = useFrappePostCall<{ message: { transaction: BankTransaction, payment_entry: PaymentEntry } }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.create_internal_transfer')
const setBankRecUnreconcileModalAtom = useSetAtom(bankRecUnreconcileModalAtom)
const addToActionLog = useUpdateActionLog()
const { file: frappeFile } = useContext(FrappeContext) as FrappeConfig
const [isUploading, setIsUploading] = useState(false)
const { uploadProgress, startTracking, updateFileProgress, resetProgress } = useMultiFileUploadProgress()
const [files, setFiles] = useState<File[]>([])
const onSubmit = (data: InternalTransferFormFields) => {
createPaymentEntry({
bank_transaction_name: selectedTransaction.name,
...data,
custom_remarks: data.remarks ? true : false,
// Pass this to reconcile both at the same time
mirror_transaction_name: data.mirror_transaction_name
}).then(async ({ message }) => {
addToActionLog({
type: 'transfer',
timestamp: (new Date()).getTime(),
isBulk: false,
items: [
{
bankTransaction: message.transaction,
voucher: {
reference_doctype: "Payment Entry",
reference_name: message.payment_entry.name,
reference_no: message.payment_entry.reference_no,
reference_date: message.payment_entry.reference_date,
posting_date: message.payment_entry.posting_date,
doc: message.payment_entry,
}
}
]
})
toast.success(_("Transfer Recorded"), {
duration: 4000,
closeButton: true,
action: {
label: _("Undo"),
onClick: () => setBankRecUnreconcileModalAtom(selectedTransaction.name)
},
actionButtonStyle: {
backgroundColor: "rgb(0, 138, 46)"
}
})
if (files.length > 0) {
setIsUploading(true)
startTracking(files.length)
const uploadPromises = files.map((f, fileIndex) => {
return frappeFile.uploadFile(f, {
isPrivate: true,
doctype: "Payment Entry",
docname: message.payment_entry.name,
}, (_bytesUploaded, _totalBytes, progress) => {
updateFileProgress(fileIndex, progress?.progress ?? 0)
})
})
return Promise.all(uploadPromises).then(() => {
resetProgress()
setIsUploading(false)
})
} else {
return Promise.resolve()
}
}).then(() => {
resetProgress()
setIsUploading(false)
onReconcile(selectedTransaction)
onClose()
})
}
useHotkeys('meta+s', () => {
form.handleSubmit(onSubmit)()
}, {
enabled: true,
preventDefault: true,
enableOnFormTags: true
})
const onAccountChange = (account: string, is_mirror: boolean = false) => {
//If the transaction is a withdrawal, set the paid to to the selected account - since this is the account where the money is deposited into
if (selectedTransaction.withdrawal && selectedTransaction.withdrawal > 0) {
form.setValue('paid_to', account)
} else {
form.setValue('paid_from', account)
}
if (!is_mirror) {
// Reset the mirror transaction name
form.setValue('mirror_transaction_name', '')
}
}
const selectedAccount = useWatch({ control: form.control, name: (selectedTransaction.deposit && selectedTransaction.deposit > 0) ? 'paid_from' : 'paid_to' })
const direction = useDirection()
if (isUploading && isCompleted) {
return <FileUploadBanner uploadProgress={uploadProgress} />
}
return <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div className='flex flex-col gap-4'>
{error && <ErrorBanner error={error} />}
<div className='grid grid-cols-2 gap-4'>
<SelectedTransactionDetails transaction={selectedTransaction} />
<div className='flex flex-col gap-4'>
<div className='grid grid-cols-2 gap-4'>
<DateField
name='posting_date'
label={_("Posting Date")}
isRequired
inputProps={{ autoFocus: false }}
/>
<DateField
name='reference_date'
label={_("Reference Date")}
isRequired
inputProps={{ autoFocus: false }}
/>
</div>
<DataField name='reference_no' label={_("Reference")} isRequired inputProps={{ autoFocus: false }} />
</div>
</div>
<div className='flex flex-col gap-2'>
<H4 className='text-base'>{isWithdrawal ? _('Transferred to') : _('Transferred from')}</H4>
<RecommendedTransferAccount transaction={selectedTransaction} onAccountChange={onAccountChange} />
<BankOrCashPicker company={selectedTransaction.company ?? ''} bankAccount={selectedTransaction.bank_account ?? ''} onAccountChange={onAccountChange} selectedAccount={selectedAccount} />
</div>
<div className='flex flex-col gap-2 py-2'>
<div className='flex items-end justify-between gap-4'>
<div className='flex-1'>
<AccountFormField
name="paid_from"
label={_("Paid From")}
account_type={['Bank', 'Cash']}
readOnly={isWithdrawal}
filterFunction={(account) => account.name !== selectedBankAccount.account}
isRequired
/>
</div>
<div className='pb-2'>
{direction === 'ltr' ? <ArrowRight /> : <ArrowLeft />}
</div>
<div className='flex-1'>
<AccountFormField
name="paid_to"
label={_("Paid To")}
account_type={['Bank', 'Cash']}
isRequired
readOnly={!isWithdrawal}
filterFunction={(account) => account.name !== selectedBankAccount.account}
/>
</div>
</div>
</div>
<Separator />
<div className='flex flex-col gap-2'>
<div className='grid grid-cols-2 gap-4'>
<SmallTextField
name='remarks'
label={_("Custom Remarks")}
formDescription={_("This will be auto-populated if not set.")}
/>
<div
data-slot="form-item"
className="flex flex-col gap-2"
>
<Label>{_("Attachments")}</Label>
<FileDropzone files={files} setFiles={setFiles} />
</div>
</div>
</div>
<DialogFooter>
<DialogClose asChild>
<Button size='md' variant={'outline'} disabled={loading}>{_("Cancel")}</Button>
</DialogClose>
<Button size='md' type='submit' disabled={loading}>{_("Transfer")}</Button>
</DialogFooter>
</div>
</form>
</Form>
}
const BankOrCashPicker = ({ bankAccount, onAccountChange, selectedAccount, company }: { selectedAccount: string, bankAccount: string, onAccountChange: (account: string) => void, company?: string }) => {
const { banks } = useGetBankAccounts(undefined, (bank) => bank.name !== bankAccount)
return <div className='grid grid-cols-4 gap-4'>
{banks.map((bank) => (
<button
className={cn('text-left border p-2 rounded-md flex items-center gap-2 cursor-pointer outline-[0.5px] transition-all duration-200 hover:bg-surface-gray-1 dark:hover:bg-surface-gray-3',
selectedAccount === bank.account ? 'border-outline-gray-5 outline-outline-gray-5 bg-surface-gray-1 dark:bg-surface-gray-3' : 'border-outline-gray-2 outline-outline-gray-2'
)}
type='button'
key={bank.account}
onClick={() => onAccountChange(bank.account ?? '')}
>
<BankLogo bank={bank} iconSize='24px' imageClassName='w-12 h-12' />
<div className='flex flex-col gap-1'>
<span className='font-semibold text-sm'>{bank.account_name} {bank.bank_account_no && <span className='text-xs text-ink-gray-5'>({bank.bank_account_no})</span>}</span>
<span className='text-xs text-ink-gray-5'>{bank.account}</span>
</div>
</button>
))}
<CashPicker company={company ?? ''} selectedAccount={selectedAccount} setSelectedAccount={onAccountChange} />
</div>
}
const CashPicker = ({ company, selectedAccount, setSelectedAccount }: { company: string, selectedAccount: string, setSelectedAccount: (account: string) => void }) => {
const { data } = useFrappeGetCall('frappe.client.get_value', {
doctype: 'Company',
filters: company,
fieldname: 'default_cash_account'
}, undefined, {
revalidateOnFocus: false,
revalidateIfStale: false,
})
const account = data?.message?.default_cash_account
if (account) {
return <button className={cn('text-left border p-2 rounded-md flex items-center gap-2 cursor-pointer outline-[0.5px] transition-all duration-200 hover:bg-surface-gray-1 dark:hover:bg-surface-gray-3',
selectedAccount === account ? 'border-outline-gray-5 outline-outline-gray-5 bg-surface-gray-1 dark:bg-surface-gray-3' : 'border-outline-gray-2 outline-outline-gray-2'
)}
type='button'
onClick={() => setSelectedAccount(account ?? '')}
>
<div className='flex items-center justify-center h-10 w-10'>
<Banknote size='24px' />
</div>
<div className='flex flex-col gap-1'>
<span className='font-semibold text-sm'>Cash</span>
<span className='text-xs text-ink-gray-5'>{data?.message?.default_cash_account}</span>
</div>
</button>
}
return null
}
const RecommendedTransferAccount = ({ transaction, onAccountChange }: { transaction: UnreconciledTransaction, onAccountChange: (account: string, is_mirror: boolean) => void }) => {
const { setValue, watch } = useFormContext<InternalTransferFormFields>()
const mirrorTransactionName = watch('mirror_transaction_name')
const paid_from = watch('paid_from')
const paid_to = watch('paid_to')
const { data } = useFrappeGetCall('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.search_for_transfer_transaction', {
transaction_id: transaction.name
}, undefined, {
revalidateOnFocus: false,
revalidateIfStale: false,
})
// Get bank accounts to find the logo
const { banks } = useGetBankAccounts()
const bank = useMemo(() => {
if (data?.message?.bank_account && banks) {
return banks.find(bank => bank.name === data.message.bank_account)
}
return null
}, [data?.message?.bank_account, banks])
const selectTransaction = () => {
if (data?.message) {
setValue('mirror_transaction_name', data.message.name)
onAccountChange(data.message.account, true)
}
}
if (data?.message) {
const isWithdrawal = data.message.withdrawal && data.message.withdrawal > 0
const amount = isWithdrawal ? data.message.withdrawal : data.message.deposit
const currency = data.message.currency
const isAccountSelected = isWithdrawal ? paid_from === data.message.account : paid_to === data.message.account
const isSuggested = mirrorTransactionName === data?.message?.name && isAccountSelected
return (<div className='pb-2'>
<div className={cn("flex justify-between items-start gap-3 p-3 border rounded-lg shadow-sm",
isSuggested ? "border-outline-green-4 bg-surface-green-1" : "border-outline-violet-2 bg-surface-violet-2/50")}>
<div>
<div className='flex flex-col gap-3'>
<div className={cn("flex items-center gap-2 shrink-0",
isSuggested ? "text-ink-green-4" : "text-ink-violet-4"
)}>
<BadgeCheck className="w-4 h-4" />
<span className="text-sm font-medium">{_("Suggested Transfer to {0}", [data.message.account])}</span>
</div>
<div className='flex flex-col gap-1'>
<span className='text-p-sm'>{_("The system found a mirror transaction ({0}) in another account with the same amount and date.", [data.message.name])}</span>
<span className='text-p-sm'>{_("Accepting the suggestion will reconcile both transactions.")}</span>
</div>
<div className='flex flex-col gap-1.5'>
<div className='flex items-center gap-1'>
<Calendar size='16px' />
<span className='text-sm'>{formatDate(data.message.date, 'Do MMM YYYY')}</span>
</div>
<span className='text-sm line-clamp-1' title={data.message.description}>{data.message.description}</span>
</div>
</div>
</div>
<div className='flex flex-col items-end justify-between gap-2 h-full w-[30%]'>
<div className="flex items-center gap-2">
<BankLogo bank={bank} iconSize='24px' imageClassName='h-8 max-w-24' iconClassName={cn(isSuggested ? "text-ink-green-3" : "text-purple-600")} />
</div>
<div className='flex gap-1'>
<div className={cn('flex items-center gap-1 text-end px-0 justify-end py-1 rounded-sm',
isWithdrawal ? 'text-ink-red-3' : 'text-ink-green-3'
)}>
{isWithdrawal ? <ArrowUpRight className="w-5 h-5 text-ink-red-3" /> : <ArrowDownRight className="w-5 h-5 text-ink-green-3" />}
<span className='text-sm font-semibold uppercase'>{isWithdrawal ? _('Transferred Out') : _('Received')}</span>
</div>
</div>
<span className='font-semibold font-numeric text-lg text-end pe-0.5'>{formatCurrency(amount, currency)}</span>
<div className='pt-1'>
<Button
onClick={selectTransaction}
theme={isSuggested ? "green" : "violet"}
size="md"
type='button'
>
{isSuggested ? <CheckCircle /> : <CheckIcon />}
{isSuggested ? _("Accepted") : _("Use Suggestion")}
</Button>
</div>
</div>
</div>
</div>
)
}
return null
}
export default TransferModalContent

View File

@@ -0,0 +1,85 @@
import { BankAccount } from "@/types/Accounts/BankAccount";
import { getDatesForTimePeriod } from "@/lib/date";
import { atom } from "jotai";
import { atomWithStorage, createJSONStorage } from "jotai/utils";
import { atomFamily } from 'jotai-family'
import { UnreconciledTransaction } from "./utils";
import { BankTransaction } from "@/types/Accounts/BankTransaction";
import { PaymentEntry } from "@/types/Accounts/PaymentEntry";
import { JournalEntry } from "@/types/Accounts/JournalEntry";
export interface SelectedBank extends Pick<BankAccount, 'name' | 'bank' | 'is_credit_card' | 'company' | 'account_name' | 'bank_account_no' | 'account' | 'account_type' | 'integration_id' | 'is_default' | 'last_integration_date'> {
logo?: string,
logoDark?: string,
darkModeInvert?: boolean,
logoClassName?: string,
account_currency?: string
}
export const selectedBankAccountAtom = atomWithStorage<SelectedBank | null>('bank-rec-selected-bank', null, undefined, {
getOnInit: true
})
export const bankRecDateAtom = atomWithStorage<{ fromDate: string, toDate: string }>("bank-rec-date", {
fromDate: getDatesForTimePeriod('This Month').fromDate,
toDate: getDatesForTimePeriod('This Month').toDate
})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const bankRecClosingBalanceAtom = atomFamily((_id: string) => {
return atom<{ value: number, stringValue: string | number | undefined }>({
value: 0,
stringValue: '0.00'
})
})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const bankRecSelectedTransactionAtom = atomFamily((_id: string) => {
return atom<UnreconciledTransaction[]>([])
})
/** Action Modals */
export const bankRecTransferModalAtom = atom(false)
export const bankRecRecordPaymentModalAtom = atom(false)
export const bankRecRecordJournalEntryModalAtom = atom(false)
export const bankRecUnreconcileModalAtom = atom<string>('')
export const bankRecMatchFilters = atomWithStorage<string[]>('bank-rec-match-filters', ['payment_entry', 'journal_entry'])
export const bankRecSearchText = atom<string>('')
export const bankRecAmountFilter = atom<{ value: number, stringValue?: string | number }>({
value: 0,
stringValue: '0.00'
})
export const bankRecTransactionTypeFilter = atom<string>('All')
export interface ActionLog {
type: 'match' | 'payment' | 'transfer' | 'bank_entry'
isBulk: boolean
timestamp: number,
items: ActionLogItem[],
bulkCommonData?: {
party_type?: string,
party?: string,
account?: string,
bank_account?: string,
}
}
export interface ActionLogItem {
bankTransaction: BankTransaction,
voucher: {
reference_doctype: string,
reference_name: string,
reference_no?: string,
reference_date?: string,
posting_date: string,
doc?: PaymentEntry | JournalEntry
},
}
const actionLogStorage = createJSONStorage<ActionLog[]>(() => sessionStorage)
export const bankRecActionLog = atomWithStorage<ActionLog[]>('bank-rec-action-log', [], actionLogStorage, {
getOnInit: true,
})

View File

@@ -0,0 +1,410 @@
export const BANK_LOGOS: { keywords: string[], logo: string, locale?: string[], logoDark?: string, darkModeInvert?: boolean, logoClassName?: string }[] = [
// United States + International
{
keywords: ['American Express', 'Amex'],
logo: 'Amex.svg',
locale: ['Global', 'United States']
},
{
keywords: ['Bank of America', 'BOA'],
logo: 'Bank_of_America.png',
darkModeInvert: true,
locale: ['United States']
},
{
keywords: ['Barclays'],
logo: 'Barclays.svg',
locale: ['Global', 'United Kingdom'],
logoClassName: 'h-12',
},
{
keywords: ['BNP Paribas'],
logo: 'BNP_Paribas.svg',
logoDark: 'BNP_Paribas-Dark.svg',
locale: ['Global', 'France'],
logoClassName: 'max-w-24'
},
{
keywords: ['Bank of New York Mellon', 'BNY Mellon', 'BNY'],
logo: 'BNY_Mellon.svg',
locale: ['Global', 'United States'],
logoDark: 'BNY_Mellon-Dark.svg',
},
{
keywords: ['Capital One'],
logo: 'Capital_One.png',
locale: ['United States'],
darkModeInvert: true
},
{
keywords: ['Charles Schwab', 'Schwab'],
logo: 'Charles_Schwab.svg',
locale: ['United States'],
logoClassName: 'h-7'
},
{
keywords: ['Chase'],
logo: 'chase.svg',
locale: ['Global', 'United States'],
logoDark: 'chase-Dark.svg',
},
{
keywords: ['Citi', 'Citibank', 'Citi Group', 'Citi Financial Services'],
logo: 'Citi.svg',
locale: ['Global', 'United States']
},
{
keywords: ['Deutsche Bank'],
logo: 'Deutsche_Bank.svg',
locale: ['Global', 'Germany'],
darkModeInvert: true,
},
{
keywords: ['Goldman Sachs'],
logo: 'Goldman_Sachs.svg',
locale: ['Global', 'United States'],
darkModeInvert: true,
},
{
keywords: ['HSBC'],
logo: 'HSBC.svg',
locale: ['Global', 'United Kingdom'],
logoDark: 'HSBC-dark.svg',
},
{
keywords: ['JPMorgan Chase', 'JPMorgan', 'JP Morgan', 'JP Morgan Chase', 'JPMorgan Chase & Co', 'JPM', 'JPMC'],
logo: 'jpmc.svg',
locale: ['Global', 'United States'],
darkModeInvert: true,
},
{
keywords: ['Morgan Stanley'],
logo: 'Morgan_Stanley.png',
locale: ['Global', 'United States'],
darkModeInvert: true,
},
{
keywords: ['PNC', 'PNC Financial Services Group', 'PNC Financial Services', 'Pittsburgh National Corporation'],
logo: 'PNC.png',
locale: ['United States']
},
{
keywords: ['Santander'],
logo: 'Santander.svg',
locale: ['Global']
},
{
keywords: ['TD Bank', 'Toronto Dominion Bank'],
logo: 'Toronto_Dominion_Bank.png',
locale: ['Canada']
},
{
keywords: ['Truist'],
logo: 'Truist.svg',
locale: ['United States'],
darkModeInvert: true,
logoClassName: 'h-8'
},
{
keywords: ['UBS'],
logo: 'UBS.svg',
locale: ['Global', 'Switzerland'],
logoDark: 'UBS-dark.svg',
},
{
keywords: ['US Bank', 'USBank', 'U.S. Bank', 'U.S. Bancorp'],
logo: 'USBank.svg',
locale: ['United States'],
logoDark: 'USBank-dark.svg',
},
{
keywords: ['Wells Fargo', 'Wells Fargo'],
logo: 'Wells_Fargo.svg',
locale: ['United States'],
logoClassName: 'h-7'
},
{
keywords: ['OakStar', 'Oakstar', 'Oakstar'],
logo: 'Oakstar.png',
logoDark: 'Oakstar-dark.webp',
locale: ['United States'],
logoClassName: 'h-7'
},
{
keywords: ['PlainsCapital', 'Plains Capital'],
logo: 'PlainsCapitalBank.png',
locale: ['United States'],
logoClassName: 'h-7'
},
{
keywords: ["Standard Chartered"],
logo: 'Standard_Chartered.png',
logoDark: 'Standard_Chartered-dark.png',
locale: ['Global'],
},
// India
{
keywords: ['HDFC Bank', 'HDFC'],
logo: 'HDFC.svg',
locale: ['India'],
},
{
keywords: ['ICICI Bank', 'ICICI'],
logo: 'ICICI.svg',
logoDark: 'ICICI-dark.svg',
locale: ['India'],
},
{
keywords: ['SBI', 'State Bank of India'],
logo: 'State_Bank_of_India.svg',
logoDark: 'State_bank_of_India-Dark.svg',
locale: ['India'],
logoClassName: 'h-4.5'
},
{
keywords: ['Punjab National Bank', 'PNB'],
logo: 'Punjab_National_Bank.svg',
locale: ['India']
},
{
keywords: ['Union Bank of India', 'Union Bank'],
logo: 'Union_Bank_of_India.svg',
locale: ['India']
},
{
keywords: ['Yes Bank', 'Yes'],
logo: 'Yes_Bank.svg',
locale: ['India'],
logoDark: 'Yes_Bank-dark.svg',
},
{
keywords: ['RBL Bank', 'RBL'],
logo: 'RBL_Bank.svg',
locale: ['India'],
logoDark: 'RBL_Bank-dark.svg',
},
{
keywords: ['Axis Bank', 'Axis'],
logo: 'Axis_Bank.svg',
locale: ['India'],
darkModeInvert: true
},
{
keywords: ['Bank of Baroda', 'BOB'],
logo: 'Bank_of_Baroda.svg',
locale: ['India', 'Kenya'],
logoClassName: 'h-7'
},
{
keywords: ['Bank of India', 'BOI'],
logo: 'Bank_of_India.png',
locale: ['India'],
logoClassName: 'h-7'
},
{
keywords: ['Bank of Maharashtra', 'BOM'],
logo: 'Bank_of_Maharashtra.png',
locale: ['India'],
logoClassName: 'min-w-24'
},
{
keywords: ['Kotak Mahindra Bank', 'Kotak'],
logo: 'Kotak_Mahindra.svg',
locale: ['India']
},
{
keywords: ['IndusInd Bank', 'IndusInd'],
logo: 'IndusInd_Bank.svg',
locale: ['India'],
darkModeInvert: true,
},
{
keywords: ['IDBI Bank', 'IDBI'],
logo: 'IDBI_Bank.svg',
locale: ['India']
},
{
keywords: ['IDFC First Bank', 'IDFC First'],
logo: 'IDFC_First_Bank.svg',
locale: ['India']
},
{
keywords: ['Federal Bank'],
logo: 'Federal_Bank.png',
logoDark: 'Federal_Bank-dark.png',
locale: ['India']
},
{
keywords: ['Fi Bank'],
logo: 'Fi_Bank.svg',
locale: ['India']
},
{
keywords: ['RazorpayX', 'Razorpay'],
logo: 'Razorpay.svg',
logoDark: 'Razorpay-dark.svg',
locale: ['India']
},
{
keywords: ['Revolut'],
logo: 'Revolut.png',
locale: ['Global'],
darkModeInvert: true
},
{
keywords: ['Starling Bank'],
logo: 'Starling_Bank.png',
logoDark: 'Starling_Bank-dark.png',
locale: ['Global', 'UK'],
logoClassName: 'h-10'
},
// Australia and New Zealand
{
keywords: ["Commonwealth Bank", "CBA"],
logo: "Commonwealth_Bank.svg",
locale: ['Australia', 'New Zealand'],
},
{
keywords: ["Airwallex"],
logo: "Airwallex.png",
logoDark: "Airwallex-dark.png",
locale: ['Global']
},
{
keywords: ["Judo Bank"],
logo: "Judo_Bank.svg",
logoDark: "Judo_Bank-dark.svg",
locale: ['Australia', 'New Zealand']
},
{
keywords: ["Alpha"], // This might conflict with Alpha Bank in Greece
logo: "Alpha_Bank.svg",
darkModeInvert: true,
logoClassName: 'h-4.5',
locale: ['Australia', 'New Zealand']
},
{
keywords: ["Australian Tax Office", "Australian Taxation Office"],
logo: "Australian_Tax_Office.png",
darkModeInvert: true,
locale: ['Australia']
},
{
keywords: ["Westpac"],
logo: "Westpac.svg",
locale: ['Australia']
},
{
keywords: ["ANZ", "ANZ Bank", "Australia and New Zealand Banking Group"],
logo: "ANZ.png",
locale: ['Australia', 'New Zealand']
},
{
keywords: ["Macquarie Group", "Macquarie Bank"],
logo: "Macquarie.svg",
darkModeInvert: true,
locale: ['Australia']
},
// Nicaragua
{
keywords: ["Banco Atlantida", "Banco Atlántida"],
logo: "Banco_Atlantida.png",
locale: ['Nicaragua']
},
{
keywords: ["Banco de Finanzas"],
logo: "Banco_de_Finanzas.svg",
locale: ['Nicaragua'],
logoClassName: 'h-4.5'
},
{
keywords: ["Avanz"],
logo: "Avanz.svg",
logoDark: "Avanz-dark.svg",
locale: ['Nicaragua'],
logoClassName: 'h-7'
},
{
keywords: ["Ficohsa"],
logo: "Ficohsa.svg",
locale: ['Nicaragua']
},
{
keywords: ["BAC", "BAC Credomatic"],
logo: "BAC_Credomatic.svg",
locale: ['Nicaragua'],
logoClassName: 'h-4.5'
},
{
keywords: ["Banco Lafise"],
logo: "Banco_Lafise.png",
darkModeInvert: true,
locale: ['Nicaragua']
},
// German
{
keywords: ["Sparkasse"],
logo: "Sparkasse.png",
locale: ['Germany']
},
{
keywords: ["Volksbank", "Raiffeisenbank", "VR-Bank"],
logo: "Volksbanken_Raiffeisenbanken.svg",
locale: ['Germany'],
logoClassName: 'min-w-32'
},
// Kenya
{
keywords: ["KCB Bank", "KCB"],
logo: "KCB_Bank_Kenya.png",
locale: ['Kenya']
},
{
keywords: ["Equity Bank"],
logo: "Equity_Bank.png",
logoDark: "Equity_Bank-dark.png",
locale: ['Kenya'],
},
{
keywords: ["I&M"],
logo: "I&M.png",
locale: ['Kenya']
},
{
keywords: ["ABSA"],
logo: "ABSA.png",
locale: ['Kenya'],
darkModeInvert: true,
logoClassName: 'h-7'
},
{
keywords: ["Stanbic"],
logo: "Stanbic.png",
locale: ['Kenya'],
logoClassName: 'h-7'
},
{
keywords: ["DTB", "Diamond Trust Bank"],
logo: "Diamond_Trust_Bank.png",
locale: ['Kenya']
},
{
keywords: ["Prime Bank"],
logo: "Prime_Bank.png",
locale: ['Kenya'],
logoClassName: 'max-w-28'
},
{
keywords: ["Stripe"],
logo: "Stripe.svg",
locale: ['Global'],
logoClassName: 'h-6',
darkModeInvert: true,
},
{
keywords: ["PayPal"],
logo: "PayPal.png",
locale: ['Global'],
logoClassName: 'h-6',
}
]

View File

@@ -0,0 +1,457 @@
import { ActionLog, bankRecActionLog, bankRecAmountFilter, bankRecDateAtom, bankRecMatchFilters, bankRecSearchText, bankRecSelectedTransactionAtom, bankRecTransactionTypeFilter, bankRecUnreconcileModalAtom, SelectedBank, selectedBankAccountAtom } from './bankRecAtoms'
import { useAtom, useAtomValue, useSetAtom } from 'jotai'
import { useMemo } from 'react'
import { SWRConfiguration, useFrappeGetCall, useFrappeGetDoc, useFrappePostCall, useSWRConfig } from 'frappe-react-sdk'
import { BankTransaction } from '@/types/Accounts/BankTransaction'
import { BankAccount } from '@/types/Accounts/BankAccount'
import dayjs from 'dayjs'
import { toast } from 'sonner'
import { BANK_LOGOS } from './logos'
import { getErrorMessage } from '@/lib/frappe'
import { useCurrentCompany } from '@/hooks/useCurrentCompany'
import _ from '@/lib/translate'
import { BankTransactionRule } from '@/types/Accounts/BankTransactionRule'
import { useRef } from 'react'
import type { DebouncedState } from 'usehooks-ts'
import { useDebounceCallback } from 'usehooks-ts'
import Fuse from 'fuse.js'
export const useGetAccountOpeningBalance = () => {
const companyID = useCurrentCompany()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const args = useMemo(() => {
return {
bank_account: bankAccount?.name,
company: companyID,
till_date: dayjs(dates.fromDate).subtract(1, 'days').format('YYYY-MM-DD'),
}
}, [companyID, bankAccount?.name, dates.fromDate])
return useFrappeGetCall('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_account_balance', args, undefined, {
revalidateOnFocus: false
})
}
export const useGetAccountClosingBalance = () => {
const companyID = useCurrentCompany()
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const args = useMemo(() => {
return {
bank_account: bankAccount?.name,
company: companyID,
till_date: dates.toDate,
}
}, [companyID, bankAccount?.name, dates.toDate])
return useFrappeGetCall('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_account_balance', args,
`bank-reconciliation-account-closing-balance-${bankAccount?.name}-${dates.toDate}`,
{
revalidateOnFocus: false
}
)
}
/**
* Hook to fetch the closing balance set in the database for the given bank and date
*/
export const useGetAccountClosingBalanceAsPerStatement = (swrConfig: SWRConfiguration = {}) => {
const dates = useAtomValue(bankRecDateAtom)
const bankAccount = useAtomValue(selectedBankAccountAtom)
return useFrappeGetCall<{ message: { balance: number, date?: string } }>("erpnext.accounts.doctype.bank_account.bank_account.get_closing_balance_as_per_statement", {
bank_account: bankAccount?.name,
date: dates.toDate
}, `bank-reconciliation-account-closing-balance-as-per-statement-${bankAccount?.name}-${dates.toDate}`, {
revalidateOnFocus: false,
...swrConfig
})
}
export type UnreconciledTransaction = Pick<BankTransaction, 'name' | 'matched_transaction_rule' | 'date' | 'withdrawal' | 'deposit' | 'currency' | 'description' | 'status' | 'transaction_type' | 'reference_number' | 'party_type' | 'party' | 'bank_account' | 'company' | 'unallocated_amount'>
export const useGetUnreconciledTransactions = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
return useFrappeGetCall<{ message: UnreconciledTransaction[] }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_bank_transactions', {
bank_account: bankAccount?.name,
from_date: dates.fromDate,
to_date: dates.toDate
}, bankAccount ? `bank-reconciliation-unreconciled-transactions-${bankAccount?.name}-${dates.fromDate}-${dates.toDate}` : null, {
revalidateOnFocus: false,
revalidateIfStale: false
})
}
export interface LinkedPayment {
rank: number,
doctype: string,
name: string,
paid_amount: number,
reference_no: string,
reference_date: string,
posting_date: string,
party_type?: string,
party?: string,
currency: string
}
export const useGetBankTransactions = () => {
const bankAccount = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
return useFrappeGetCall<{ message: BankTransaction[] }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_bank_transactions', {
bank_account: bankAccount?.name,
from_date: dates.fromDate,
to_date: dates.toDate,
all_transactions: true
}, bankAccount ? `bank-reconciliation-bank-transactions-${bankAccount?.name}-${dates.fromDate}-${dates.toDate}` : null)
}
export const useGetVouchersForTransaction = (transaction: UnreconciledTransaction) => {
const dates = useAtomValue(bankRecDateAtom)
const matchFilters = useAtomValue(bankRecMatchFilters)
return useFrappeGetCall<{ message: LinkedPayment[] }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_linked_payments', {
bank_transaction_name: transaction.name,
document_types: matchFilters ?? ['payment_entry', 'journal_entry'],
from_date: dates.fromDate,
to_date: dates.toDate,
filter_by_reference_date: 0
}, `bank-reconciliation-vouchers-${transaction.name}-${dates.fromDate}-${dates.toDate}-${matchFilters.join(',')}`, {
revalidateOnFocus: false
})
}
/**
* Common hook to refresh the unreconciled transactions list after a transaction is reconciled
* @returns function to call to refresh the unreconciled transactions list AFTER the operation is done
*/
export const useRefreshUnreconciledTransactions = () => {
const selectedBank = useAtomValue(selectedBankAccountAtom)
const dates = useAtomValue(bankRecDateAtom)
const matchFilters = useAtomValue(bankRecMatchFilters)
const setSelectedTransaction = useSetAtom(bankRecSelectedTransactionAtom(selectedBank?.name || ''))
const { mutate } = useSWRConfig()
const searchString = useAtomValue(bankRecSearchText)
const typeFilter = useAtomValue(bankRecTransactionTypeFilter)
const amountFilter = useAtomValue(bankRecAmountFilter)
const { data: unreconciledTransactions } = useGetUnreconciledTransactions()
/**
* This function should be called after a transaction is reconciled
* It will get the next unreconciled transaction and select it
* And then refresh the balance + unreconciled transactions list
*/
const onReconcileTransaction = (transaction: UnreconciledTransaction, updatedTransaction?: BankTransaction) => {
// If the updated transaction has an unallocated amount of 0, then we need to select the next unreconciled transaction
if (updatedTransaction && updatedTransaction?.unallocated_amount !== 0) {
mutate(`bank-reconciliation-unreconciled-transactions-${selectedBank?.name}-${dates.fromDate}-${dates.toDate}`)
mutate(`bank-reconciliation-account-closing-balance-${selectedBank?.name}-${dates.toDate}`)
// Update the matching vouchers for the selected transaction
mutate(`bank-reconciliation-vouchers-${transaction.name}-${dates.fromDate}-${dates.toDate}-${matchFilters.join(',')}`)
return
}
// From unreconciled transactions list, first apply the filters based on the search criteria and other filters
const searchIndex = unreconciledTransactions ? new Fuse(unreconciledTransactions.message, {
keys: ['description', 'reference_number'],
threshold: 0.5,
includeScore: true
}) : null
const results = getSearchResults(searchIndex, searchString, typeFilter, amountFilter.value, unreconciledTransactions?.message)
const currentIndex = results.findIndex(t => t.name === transaction.name)
let nextTransaction = null
if (currentIndex !== -1) {
// Check if there is a next transaction
if (currentIndex < (results.length || 0) - 1) {
nextTransaction = results[currentIndex + 1]
}
}
// We need to select the next unreconciled transaction for a better UX
mutate(`bank-reconciliation-unreconciled-transactions-${selectedBank?.name}-${dates.fromDate}-${dates.toDate}`)
.then(res => {
if (nextTransaction) {
// Check if next transaction is there in the response
const nextTransactionObj = res?.message.find((t: UnreconciledTransaction) => t.name === nextTransaction.name)
if (nextTransactionObj) {
setSelectedTransaction([nextTransactionObj])
} else {
// If the next transaction is not there in the response, we need to clear the selection
setSelectedTransaction([])
}
} else {
// If there is no next transaction, we need to clear the selection
setSelectedTransaction([])
}
})
mutate(`bank-reconciliation-account-closing-balance-${selectedBank?.name}-${dates.toDate}`)
}
return onReconcileTransaction
}
export const useReconcileTransaction = () => {
const { call, loading } = useFrappePostCall<{ message: BankTransaction }>('erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.reconcile_vouchers')
const onReconcileTransaction = useRefreshUnreconciledTransactions()
const setBankRecUnreconcileModalAtom = useSetAtom(bankRecUnreconcileModalAtom)
const addToActionLog = useUpdateActionLog()
const reconcileTransaction = (transaction: UnreconciledTransaction, voucher: LinkedPayment) => {
call({
bank_transaction_name: transaction.name,
vouchers: JSON.stringify([{
"payment_doctype": voucher.doctype,
"payment_name": voucher.name,
"amount": voucher.paid_amount
}])
}).then((res) => {
addToActionLog({
type: 'match',
timestamp: (new Date()).getTime(),
isBulk: false,
items: [
{
bankTransaction: res.message,
voucher: {
reference_doctype: voucher.doctype,
reference_name: voucher.name,
reference_no: voucher.reference_no,
reference_date: voucher.reference_date,
posting_date: voucher.posting_date,
}
}
]
})
onReconcileTransaction(transaction, res.message)
toast.success(_("Reconciled"), {
duration: 4000,
closeButton: true,
action: {
label: _("Undo"),
onClick: () => setBankRecUnreconcileModalAtom(transaction.name)
},
actionButtonStyle: {
backgroundColor: "rgb(0, 138, 46)"
}
})
}).catch((error) => {
console.error(error)
toast.error(_("Error"), {
duration: 5000,
description: getErrorMessage(error)
})
})
}
return { reconcileTransaction, loading }
}
interface BankAccountWithCurrency extends Pick<BankAccount, 'name' | 'bank' | 'account_name' | 'is_credit_card' | 'company' | 'account' | 'account_type' | 'account_subtype' | 'bank_account_no' | 'last_integration_date'> {
account_currency?: string
}
type BankLogoEntry = (typeof BANK_LOGOS)[number]
/** Prefer the longest keyword match so short tokens (e.g. "anz" in "finanzas") do not beat full bank names. */
function findBankLogoForName(bankName: string | undefined | null): BankLogoEntry | undefined {
if (!bankName) return undefined
const haystack = bankName.toLowerCase()
let best: BankLogoEntry | undefined
let bestKeywordLen = 0
for (const entry of BANK_LOGOS) {
for (const keyword of entry.keywords) {
const needle = keyword.toLowerCase()
if (needle.length === 0) continue
if (haystack.includes(needle) && needle.length > bestKeywordLen) {
bestKeywordLen = needle.length
best = entry
}
}
}
return best
}
export const useGetBankAccounts = (onSuccess?: (data?: Omit<SelectedBank, 'logo'>[]) => void, filterFn?: (bank: SelectedBank) => boolean) => {
const company = useCurrentCompany()
const { data, isLoading, error } = useFrappeGetCall<{ message: BankAccountWithCurrency[] }>('erpnext.accounts.doctype.bank_account.bank_account.get_list', {
company: company
}, undefined, {
revalidateOnFocus: false,
revalidateIfStale: false,
onSuccess: (data) => {
onSuccess?.(data?.message)
}
})
const banks = useMemo(() => {
// Match the bank account to the logo
const banksWithLogos = data?.message.map((bank) => {
const logo = findBankLogoForName(bank.bank)
return {
...bank,
logo: logo?.logo,
logoDark: logo?.logoDark,
darkModeInvert: logo?.darkModeInvert,
logoClassName: logo?.logoClassName
}
}) ?? []
if (filterFn) {
return banksWithLogos.filter(filterFn)
}
return banksWithLogos
}, [data, filterFn])
return {
banks,
isLoading,
error
}
}
export const useIsTransactionWithdrawal = (transaction: UnreconciledTransaction) => {
return useMemo(() => {
const isWithdrawal = transaction.withdrawal && transaction.withdrawal > 0
const isDeposit = transaction.deposit && transaction.deposit > 0
return {
amount: isWithdrawal ? transaction.withdrawal : transaction.deposit,
isWithdrawal,
isDeposit
}
}, [transaction])
}
export const useGetRuleForTransaction = (transaction: UnreconciledTransaction) => {
return useFrappeGetDoc<BankTransactionRule>('Bank Transaction Rule', transaction.matched_transaction_rule,
transaction.matched_transaction_rule ? undefined : null, {
revalidateOnFocus: false,
revalidateIfStale: false
}
)
}
/** Hook to handle the search input while maintaining debouncing and global state. */
export function useTransactionSearch(): [string, DebouncedState<(value: string) => void>] {
const delay = 500
const unwrappedInitialValue = ''
const eq = (left: string, right: string) => left === right
const [debouncedValue, setDebouncedValue] = useAtom(bankRecSearchText)
const previousValueRef = useRef<string | undefined>(unwrappedInitialValue)
const updateDebouncedValue = useDebounceCallback(
setDebouncedValue,
delay,
)
// Update the debounced value if the initial value changes
if (!eq(previousValueRef.current as string, unwrappedInitialValue)) {
updateDebouncedValue(unwrappedInitialValue)
previousValueRef.current = unwrappedInitialValue
}
return [debouncedValue, updateDebouncedValue]
}
/** Utility function to get the search results based on the search index, search string, type filter, amount filter and unreconciled transactions */
export const getSearchResults = (
/** Fuse index of the unreconciled transactions */
searchIndex: Fuse<UnreconciledTransaction> | null,
/** Search string */
search: string,
/** Type filter */
typeFilter: string,
/** Amount filter */
amountFilter: number,
/** Unreconciled transactions */
unreconciledTransactions?: UnreconciledTransaction[]) => {
let r = []
if (!searchIndex || !search) {
r = unreconciledTransactions ?? []
} else {
r = searchIndex.search(search).map((result) => result.item)
}
if (typeFilter !== 'All') {
r = r.filter((transaction) => {
if (typeFilter === 'Debits') {
return transaction.withdrawal && transaction.withdrawal > 0
}
if (typeFilter === 'Credits') {
return transaction.deposit && transaction.deposit > 0
}
})
}
if (amountFilter > 0) {
r = r.filter((transaction) => {
if (transaction.withdrawal && transaction.withdrawal > 0) {
return transaction.withdrawal === amountFilter
}
if (transaction.deposit && transaction.deposit > 0) {
return transaction.deposit === amountFilter
}
return false
})
}
return r
}
export const useUpdateActionLog = () => {
const setActionLog = useSetAtom(bankRecActionLog)
const addToActionLog = (action: ActionLog) => {
// Store at max 100 actions
setActionLog((prev) => {
const newActions = [action, ...prev]
if (newActions.length > 100) {
return newActions.slice(0, 100)
}
return newActions
})
}
return addToActionLog
}

View File

@@ -0,0 +1,19 @@
import CSVRawDataPreview from './CSVRawDataPreview'
import StatementDetails from './StatementDetails'
import { GetStatementDetailsResponse } from '../import_utils'
const CSVImport = ({ data, mutate }: { data: { message: GetStatementDetailsResponse }, mutate: () => void }) => {
return (
<div className="w-full flex">
<div className="w-[50%] p-4 h-[calc(100vh-72px)] overflow-scroll">
<StatementDetails data={data.message} />
</div>
<div className="w-[50%] border-s border-t pe-1 ps-0 border-outline-gray-2 h-[calc(100vh-72px)] overflow-scroll">
<CSVRawDataPreview data={data.message} mutate={mutate} />
</div>
</div>
)
}
export default CSVImport

View File

@@ -0,0 +1,104 @@
import { useEffect, useRef, useState } from "react"
import { toast } from "sonner"
import _ from "@/lib/translate"
import RawTableGrid from "../RawTableGrid"
import {
applyColumnMappingChange,
ColumnMapsTo,
GetStatementDetailsResponse,
useSetHeaderIndex,
useUpdateColumnMapping,
} from "../import_utils"
import { BankStatementImportLogColumnMap } from "@/types/Accounts/BankStatementImportLogColumnMap"
type Mapping = Pick<BankStatementImportLogColumnMap, "index" | "maps_to" | "header_text" | "variable">
const toMapping = (columns?: BankStatementImportLogColumnMap[]): Mapping[] =>
(columns ?? []).map((c) => ({
index: c.index,
maps_to: c.maps_to,
header_text: c.header_text,
variable: c.variable,
}))
const headerToState = (index?: number) => (index != null && index >= 0 ? index : null)
const CSVRawDataPreview = ({
data,
mutate,
}: {
data: GetStatementDetailsResponse
mutate: () => void
}) => {
const isCompleted = data.doc.status === "Completed"
const [mapping, setMapping] = useState<Mapping[]>(() => toMapping(data.doc.column_mapping))
const [headerIndex, setHeaderIndex] = useState<number | null>(() =>
headerToState(data.doc.detected_header_index),
)
const { call: updateMapping, loading: savingMapping } = useUpdateColumnMapping()
const { call: setHeader, loading: savingHeader } = useSetHeaderIndex()
const mappingRef = useRef(mapping)
const saveTimer = useRef<ReturnType<typeof setTimeout>>(undefined)
useEffect(() => () => clearTimeout(saveTimer.current), [])
const columnMappingRecord: Record<number, ColumnMapsTo> = {}
mapping.forEach((c) => {
if (c.maps_to) columnMappingRecord[c.index] = c.maps_to as ColumnMapsTo
})
const commitMapping = (next: Mapping[]) => {
mappingRef.current = next
setMapping(next)
}
// Persist mapping edits (debounced) so the transaction preview updates in realtime.
const scheduleSaveMapping = () => {
if (isCompleted) return
clearTimeout(saveTimer.current)
saveTimer.current = setTimeout(() => {
updateMapping({ statement_import_id: data.doc.name, column_mapping: mappingRef.current })
.then(() => mutate())
.catch(() => toast.error(_("Could not save the column mapping.")))
}, 500)
}
const onChangeMapping = (columnIndex: number, mapsTo: ColumnMapsTo) => {
if (isCompleted) return
commitMapping(applyColumnMappingChange(mappingRef.current, columnIndex, mapsTo))
scheduleSaveMapping()
}
const onSetHeader = (rowIndex: number | null) => {
if (isCompleted) return
setHeaderIndex(rowIndex)
setHeader({ statement_import_id: data.doc.name, header_index: rowIndex ?? -1 })
.then((res) => {
// The backend re-derives the mapping for the new header; sync local state.
const doc = res?.message?.doc
if (doc) {
commitMapping(toMapping(doc.column_mapping))
setHeaderIndex(headerToState(doc.detected_header_index))
}
mutate()
})
.catch(() => toast.error(_("Could not update the header row.")))
}
return (
<RawTableGrid
rows={data.raw_data}
columnMapping={columnMappingRecord}
headerIndex={headerIndex}
editable={!isCompleted}
disabled={isCompleted || savingMapping || savingHeader}
onChangeMapping={onChangeMapping}
onSetHeader={onSetHeader}
/>
)
}
export default CSVRawDataPreview

View File

@@ -0,0 +1,360 @@
import _ from '@/lib/translate'
import { GetStatementDetailsResponse } from '../import_utils'
import { flt, formatCurrency } from '@/lib/numbers'
import { formatDate } from '@/lib/date'
import { bankRecDateAtom } from '../../BankReconciliation/bankRecAtoms'
import { AlertCircleIcon, ChevronLeftIcon, ChevronRightIcon, ExternalLinkIcon, InfoIcon, Loader2Icon } from 'lucide-react'
import { H2, H3, Paragraph } from '@/components/ui/typography'
import { FileTypeIcon } from '@/components/ui/file-dropzone'
import { getFileExtension } from '@/lib/file'
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'
import { Separator } from '@/components/ui/separator'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useFrappeEventListener, useFrappePostCall } from 'frappe-react-sdk'
import { toast } from 'sonner'
import ErrorBanner from '@/components/ui/error-banner'
import { Link, useNavigate } from 'react-router-dom'
import { useMemo, useState } from 'react'
import { Progress } from '@/components/ui/progress'
import { useSetAtom } from 'jotai'
import { useDirection } from '@/components/ui/direction'
import BankLogo from '@/components/common/BankLogo'
import { useGetBankAccounts } from '../../BankReconciliation/utils'
import { BankStatementImportLog } from '@/types/Accounts/BankStatementImportLog'
import { Badge } from '@/components/ui/badge'
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
const parseDateFormat = (dateFormat: string) => {
const charMap = {
"%d": "DD",
"%m": "MM",
"%Y": "YYYY",
"%y": "YY",
"%b": "MMM",
"%B": "MMMM",
}
let label = dateFormat
Object.keys(charMap).forEach((char) => {
label = label.replace(char, charMap[char as keyof typeof charMap])
})
return dateFormat
}
type Props = {
data: GetStatementDetailsResponse,
}
const StatementDetails = ({ data }: Props) => {
const dateFormat = parseDateFormat(data.date_format)
const { call, loading, error } = useFrappePostCall<{ docs: BankStatementImportLog[] }>('run_doc_method')
const navigate = useNavigate()
const setDates = useSetAtom(bankRecDateAtom)
const direction = useDirection()
const onImport = () => {
call({
docs: data.doc,
method: 'insert_transactions'
}).then((response) => {
const doc = response.docs ? response.docs[0] : undefined
if (doc && doc.start_date && doc.end_date) {
setDates({
fromDate: doc.start_date,
toDate: doc.end_date,
})
}
toast.success(_("Bank statement imported."))
navigate(`/`)
}).catch(() => {
toast.error(_("There was an error while importing the bank statement."))
})
}
const [progress, setProgress] = useState(0)
useFrappeEventListener("bank-rec-statement-import-progress", (event) => {
setProgress(event.progress)
})
const file_name = data.doc.file.split("/").pop() ?? ""
const { banks } = useGetBankAccounts()
const bank = useMemo(() => {
return banks?.find((bank) => bank.name === data.doc.bank_account)
}, [data.doc.bank_account, banks])
return (
<div className='flex flex-col gap-4'>
<div className='flex flex-col gap-4'>
<div className='flex justify-between items-center'>
<Button size='sm' variant='outline' asChild>
<Link to="/statement-importer">
{direction === 'ltr' ? <ChevronLeftIcon /> : <ChevronRightIcon />}
{_("Back")}
</Link>
</Button>
{data.doc.status === 'Completed' ? <Badge theme='green'>{_("Completed")}</Badge> :
<Button onClick={onImport} disabled={loading || data.final_transactions?.length === 0} size='sm' type='button'>
{loading ? <Loader2Icon className='size-4 animate-spin' /> : null}
{loading ? _("Importing...") : _("Import {0} transactions", [data.final_transactions?.length?.toString() || "0"])}</Button>
}
</div>
<div className='flex items-start gap-4'>
<div className='flex flex-col gap-1'>
<H2 className='text-lg border-0 p-0'>{_("Statement Details")}</H2>
<Paragraph className='text-p-sm'><span>
{_("We've auto-detected the details of the statement file.")}
</span><br />
<span>
{_("Please review the details below and click the 'Import' button to proceed.")}
</span>
</Paragraph>
</div>
</div>
{progress > 0 && <div className='flex flex-col gap-2'><Progress value={progress} max={100} size="lg" />
<span className='text-sm'>{_("Importing {0} transactions", [progress.toString()])}
</span>
</div>}
{error && <ErrorBanner error={error} />}
<Table>
<TableBody>
<TableRow>
<TableHead>{_("Bank Account")}</TableHead>
<TableCell>
<div className='flex items-center gap-2'>
<BankLogo bank={bank} />
<span className="text-sm">{bank?.account_name}</span>
</div>
</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Account")}</TableHead>
<TableCell>
<span title="GL Account" className="text-sm">{bank?.account}</span>
</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Statement File")}</TableHead>
<TableCell>
<div className='flex items-center gap-2'>
<FileTypeIcon fileType={getFileExtension(file_name)} size='md' showBackground={false} />
{file_name}
</div>
</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Transaction Dates")}</TableHead>
{data.doc.start_date && data.doc.end_date ? (
<TableCell>{_("{0} to {1}", [formatDate(data.doc.start_date, "Do MMMM YYYY"), formatDate(data.doc.end_date, "Do MMMM YYYY")])}</TableCell>
) : (
<TableCell>-</TableCell>
)}
</TableRow>
<TableRow>
<TableHead>{_("Number of Transactions")}</TableHead>
<TableCell>{data.doc.number_of_transactions}</TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Total Debits")}</TableHead>
<TableCell><span className='font-numeric'>{formatCurrency(flt(data.doc.total_debits, 2), data.currency)}</span> <span className='text-ink-gray-5 font-sans'>({data.doc.total_debit_transactions} {data.doc.total_debit_transactions === 1 ? _("transaction") : _("transactions")})</span></TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Total Credits")}</TableHead>
<TableCell><span className='font-numeric'>{formatCurrency(flt(data.doc.total_credits, 2), data.currency)}</span> <span className='text-ink-gray-5 font-sans'>({data.doc.total_credit_transactions} {data.doc.total_credit_transactions === 1 ? _("transaction") : _("transactions")})</span></TableCell>
</TableRow>
<TableRow>
<TableHead>{_("Closing Balance as of {}", [formatDate(data.doc.end_date, "Do MMMM YYYY")])}</TableHead>
<TableCell className='font-numeric'>{formatCurrency(flt(data.doc.closing_balance, 2), data.currency)}</TableCell>
</TableRow>
<TableRow>
<TableHead>
<div className='flex items-center gap-2'>
{_("Detected Amount Format")} <Tooltip>
<TooltipTrigger><InfoIcon size={16} /></TooltipTrigger>
<TooltipContent>
{_("The amount format detected in the statement file. This is used to parse the deposit and withdrawal values from each row.")}
</TooltipContent>
</Tooltip>
</div>
</TableHead>
<TableCell>{data.doc.detected_amount_format}</TableCell>
</TableRow>
<TableRow>
<TableHead>
<div className='flex items-center gap-2'>
{_("Detected Date Format")}
<Tooltip>
<TooltipTrigger><InfoIcon size={16} /></TooltipTrigger>
<TooltipContent>
{_("The date format detected in the statement file. This is used to parse the date values.")}
</TooltipContent>
</Tooltip>
</div>
</TableHead>
<TableCell>
{dateFormat || data.date_format} (e.g.{" "}
{formatDate(new Date(), dateFormat || "YYYY-MM-DD")})
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
{data.doc.status === "Not Started" ? <>
<ConflictingTransactions transactions={data.conflicting_transactions} />
<Separator />
<div className='flex flex-col gap-4'>
<div className='flex flex-col gap-1'>
<H3 className='text-base border-0 p-0'>{_("Preview Transactions")}</H3>
{data.final_transactions?.length === 1 ? (
<Paragraph className='text-p-sm'>{_("We've found 1 transaction in the statement file that will be imported into the system. Please review the details below and click the 'Import' button to proceed.")}</Paragraph>
) : (
<Paragraph className='text-p-sm'>{_("{0} transactions will be imported into the system. Please review the details below and click the 'Import' button to proceed.", [data.final_transactions?.length?.toString() || "0"])}</Paragraph>
)}
</div>
<div className='max-h-[400px] overflow-scroll pb-2'>
<Table>
<TableCaption>{_("Transactions to be imported into the system")}</TableCaption>
<TableHeader>
<TableRow>
<TableHead className='w-8'>#</TableHead>
<TableHead>{_("Date")}</TableHead>
<TableHead>{_("Description")}</TableHead>
<TableHead>{_("Ref.")}</TableHead>
<TableHead className='text-end'>{_("Withdrawal")}</TableHead>
<TableHead className='text-end'>{_("Deposit")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.final_transactions?.map((transaction, index) => (
<TableRow key={index}>
<TableCell className='w-8'>{index + 1}</TableCell>
<TableCell>{formatDate(transaction.date)}</TableCell>
<TableCell className='max-w-[200px] w-fit overflow-hidden text-ellipsis'>{transaction.description}</TableCell>
<TableCell className='max-w-[100px] w-fit overflow-hidden text-ellipsis'>{transaction.reference}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(transaction.withdrawal, data.currency)}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(transaction.deposit, data.currency)}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</div>
</> : null}
</div>
)
}
const ConflictingTransactions = ({ transactions }: { transactions: GetStatementDetailsResponse["conflicting_transactions"] }) => {
if (transactions.length === 0) {
return null
}
return <>
<Alert theme="red">
<AlertCircleIcon />
<AlertTitle>{_("Conflicting Transactions")}</AlertTitle>
<AlertDescription>
{transactions.length === 1 ? _("We've found 1 existing transaction in the system that conflicts with the transactions in the statement file. Are you sure you want to proceed with the import?")
: _("We've found {0} existing transactions in the system that conflict with the transactions in the statement file. Are you sure you want to proceed with the import?", [transactions.length.toString()])}
<div className='py-2'>
<Dialog>
<DialogTrigger asChild>
<Button
size='sm'
type='button'
theme='red'
variant='solid'>
<span>{transactions.length > 1 ? _("View transactions") : _("View transaction")}</span>
</Button>
</DialogTrigger>
<DialogContent className='min-w-7xl'>
<DialogHeader>
<DialogTitle>{_("Conflicting Transactions")}</DialogTitle>
<DialogDescription>
{transactions.length === 1 ? _("We've found 1 existing transaction in the system that conflicts with the transactions in the statement file. Are you sure you want to proceed with the import?")
: _("We've found {0} existing transactions in the system that conflict with the transactions in the statement file. Are you sure you want to proceed with the import?", [transactions.length.toString()])}
</DialogDescription>
</DialogHeader>
<div className='max-h-[400px] overflow-scroll pb-2'>
<Table>
<TableCaption>{_("Existing transactions in the system belonging to the same bank account and date range")}</TableCaption>
<TableHeader>
<TableRow>
<TableHead>{_("Date")}</TableHead>
<TableHead>{_("Description")}</TableHead>
<TableHead>{_("Ref.")}</TableHead>
<TableHead className='text-end'>{_("Withdrawal")}</TableHead>
<TableHead className='text-end'>{_("Deposit")}</TableHead>
<TableHead></TableHead>
</TableRow>
</TableHeader>
<TableBody>
{transactions.map((transaction) => (
<TableRow key={transaction.name}>
<TableCell>{formatDate(transaction.date)}</TableCell>
<TableCell title={transaction.description} className='max-w-[200px] w-fit overflow-hidden text-ellipsis'>{transaction.description}</TableCell>
<TableCell title={transaction.reference_number} className='max-w-[100px] w-fit overflow-hidden text-ellipsis'>{transaction.reference_number ? transaction.reference_number : "-"}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(transaction.withdrawal, transaction.currency)}</TableCell>
<TableCell className='text-end font-numeric'>{formatCurrency(transaction.deposit, transaction.currency)}</TableCell>
<TableCell className='text-end'>
<Tooltip>
<TooltipTrigger asChild>
<Button variant='link' isIconButton asChild className='text-ink-gray-5 hover:text-black p-0 h-4'>
<a href={`/desk/bank-transaction/${transaction.name}`} target='_blank' rel='noopener noreferrer'>
<ExternalLinkIcon />
</a>
</Button>
</TooltipTrigger>
<TooltipContent>
{_("Open {0} in a new tab", [transaction.name])}
</TooltipContent>
</Tooltip>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
<DialogFooter>
<DialogClose asChild>
<Button variant={'outline'} size='md' type='button'>{_("Close")}</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
</div>
</AlertDescription>
</Alert>
</>
}
export default StatementDetails

View File

@@ -0,0 +1,129 @@
import { RefObject, useEffect, useRef, useState } from 'react'
import { cn } from '@/lib/utils'
type Bbox = [number, number, number, number]
const MIN_SIZE = 8 // PDF points
// Keep the box valid: normalise flipped edges, enforce a min size, clamp to the page.
const clampBbox = (bbox: Bbox, pageWidth: number, pageHeight: number): Bbox => {
let [x0, top, x1, bottom] = bbox
if (x1 < x0) [x0, x1] = [x1, x0]
if (bottom < top) [top, bottom] = [bottom, top]
x0 = Math.max(0, Math.min(x0, pageWidth - MIN_SIZE))
top = Math.max(0, Math.min(top, pageHeight - MIN_SIZE))
x1 = Math.min(pageWidth, Math.max(x1, x0 + MIN_SIZE))
bottom = Math.min(pageHeight, Math.max(bottom, top + MIN_SIZE))
return [x0, top, x1, bottom]
}
const HANDLES = [
{ id: 'nw', className: 'left-0 top-0 -translate-x-1/2 -translate-y-1/2 cursor-nwse-resize' },
{ id: 'ne', className: 'right-0 top-0 translate-x-1/2 -translate-y-1/2 cursor-nesw-resize' },
{ id: 'sw', className: 'left-0 bottom-0 -translate-x-1/2 translate-y-1/2 cursor-nesw-resize' },
{ id: 'se', className: 'right-0 bottom-0 translate-x-1/2 translate-y-1/2 cursor-nwse-resize' },
]
type Props = {
bbox: Bbox
pageWidth: number
pageHeight: number
color: { border: string; bg: string; swatch: string }
label: string
included: boolean
disabled?: boolean
containerRef: RefObject<HTMLDivElement | null>
onCommit: (bbox: Bbox) => void
}
/** A draggable + corner-resizable rectangle over a rendered PDF page. Coordinates are in PDF
* points (top-left origin); pixel deltas are converted using the container's rendered size. */
const BBoxOverlay = ({ bbox, pageWidth, pageHeight, color, label, included, disabled, containerRef, onCommit }: Props) => {
const [draft, setDraft] = useState<Bbox>(bbox)
const draftRef = useRef<Bbox>(bbox)
const drag = useRef<{ mode: string; startX: number; startY: number; start: Bbox } | null>(null)
// Reset to the authoritative bbox whenever it changes (e.g. after a server re-extract).
useEffect(() => {
setDraft(bbox)
draftRef.current = bbox
}, [bbox])
const apply = (next: Bbox) => {
draftRef.current = next
setDraft(next)
}
const onPointerDown = (e: React.PointerEvent) => {
if (disabled) return
e.preventDefault()
e.stopPropagation()
const mode = (e.target as HTMLElement).dataset.handle ?? 'move'
;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId)
drag.current = { mode, startX: e.clientX, startY: e.clientY, start: draftRef.current }
}
const onPointerMove = (e: React.PointerEvent) => {
if (!drag.current || !containerRef.current) return
const rect = containerRef.current.getBoundingClientRect()
const dx = ((e.clientX - drag.current.startX) / rect.width) * pageWidth
const dy = ((e.clientY - drag.current.startY) / rect.height) * pageHeight
let [x0, top, x1, bottom] = drag.current.start
const m = drag.current.mode
if (m === 'move') {
x0 += dx
x1 += dx
top += dy
bottom += dy
} else {
if (m.includes('w')) x0 += dx
if (m.includes('e')) x1 += dx
if (m.includes('n')) top += dy
if (m.includes('s')) bottom += dy
}
apply(clampBbox([x0, top, x1, bottom], pageWidth, pageHeight))
}
const onPointerUp = (e: React.PointerEvent) => {
if (!drag.current) return
;(e.currentTarget as HTMLElement).releasePointerCapture(e.pointerId)
drag.current = null
onCommit(draftRef.current)
}
const [x0, top, x1, bottom] = draft
return (
<div
className={cn(
'absolute touch-none border-2',
color.border,
included ? color.bg : 'opacity-40',
disabled ? 'pointer-events-none' : 'cursor-move',
)}
style={{
left: `${(x0 / pageWidth) * 100}%`,
top: `${(top / pageHeight) * 100}%`,
width: `${((x1 - x0) / pageWidth) * 100}%`,
height: `${((bottom - top) / pageHeight) * 100}%`,
}}
onPointerDown={onPointerDown}
onPointerMove={onPointerMove}
onPointerUp={onPointerUp}
>
<span className={cn('pointer-events-none absolute -top-5 left-0 rounded px-1 text-[10px] font-medium text-white', color.swatch)}>
{label}
</span>
{!disabled &&
HANDLES.map((handle) => (
<span
key={handle.id}
data-handle={handle.id}
className={cn('absolute size-2.5 rounded-sm border border-white', color.swatch, handle.className)}
/>
))}
</div>
)
}
export default BBoxOverlay

View File

@@ -0,0 +1,23 @@
import StatementDetails from '../CSV/StatementDetails'
import PDFTableEditor from './PDFTableEditor'
import { GetStatementDetailsResponse } from '../import_utils'
type Props = {
data: { message: GetStatementDetailsResponse }
mutate: () => void
}
const PDFImport = ({ data, mutate }: Props) => {
return (
<div className="w-full flex">
<div className="w-[45%] p-4 h-[calc(100vh-72px)] overflow-scroll">
<StatementDetails data={data.message} />
</div>
<div className="w-[55%] border-s pe-1 ps-0 border-outline-gray-2 h-[calc(100vh-72px)] overflow-scroll">
<PDFTableEditor data={data.message} mutate={mutate} />
</div>
</div>
)
}
export default PDFImport

View File

@@ -0,0 +1,362 @@
import { useEffect, useMemo, useRef, useState } from 'react'
import { toast } from 'sonner'
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, FileTextIcon, Loader2Icon, TableIcon } from 'lucide-react'
import _ from '@/lib/translate'
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'
import { Switch } from '@/components/ui/switch'
import { Label } from '@/components/ui/label'
import { H3, Paragraph } from '@/components/ui/typography'
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
import ErrorBanner from '@/components/ui/error-banner'
import RawTableGrid from '../RawTableGrid'
import BBoxOverlay from './BBoxOverlay'
import {
applyColumnMappingChange,
ColumnMapsTo,
GetStatementDetailsResponse,
PDFTable,
useReextractPDFTable,
useSetPDFTableHeader,
useUpdatePDFTables,
} from '../import_utils'
type Props = {
data: GetStatementDetailsResponse
mutate: () => void
}
// Distinct overlay colours per table on a page.
const OVERLAY_COLORS = [
{ border: 'border-blue-500', bg: 'bg-blue-500/10', swatch: 'bg-blue-500' },
{ border: 'border-purple-500', bg: 'bg-purple-500/10', swatch: 'bg-purple-500' },
{ border: 'border-amber-500', bg: 'bg-amber-500/10', swatch: 'bg-amber-500' },
{ border: 'border-teal-500', bg: 'bg-teal-500/10', swatch: 'bg-teal-500' },
]
const columnMappingRecord = (table: PDFTable): Record<number, ColumnMapsTo> => {
const map: Record<number, ColumnMapsTo> = {}
table.column_mapping?.forEach((col) => {
map[col.index] = col.maps_to
})
return map
}
const PDFTableEditor = ({ data, mutate }: Props) => {
const isCompleted = data.doc.status === 'Completed'
const [tables, setTables] = useState<PDFTable[]>(() => data.pdf_tables ?? [])
const [viewMode, setViewMode] = useState<'pdf' | 'table'>('pdf')
const [pageIndex, setPageIndex] = useState(0)
const [collapsed, setCollapsed] = useState<Set<number>>(new Set())
const toggleCollapsed = (tableIndex: number) =>
setCollapsed((prev) => {
const next = new Set(prev)
if (next.has(tableIndex)) {
next.delete(tableIndex)
} else {
next.add(tableIndex)
}
return next
})
const { call, loading, error } = useUpdatePDFTables()
const { call: reextract, loading: reextracting } = useReextractPDFTable()
const { call: setHeaderCall, loading: settingHeader } = useSetPDFTableHeader()
const busy = loading || reextracting || settingHeader
// Persist edits automatically (debounced) so the transaction preview updates in realtime.
const tablesRef = useRef(tables)
const saveTimer = useRef<ReturnType<typeof setTimeout>>(undefined)
const reextractTimer = useRef<ReturnType<typeof setTimeout>>(undefined)
const scheduleSave = () => {
if (isCompleted) return
clearTimeout(saveTimer.current)
saveTimer.current = setTimeout(() => {
call({ statement_import_id: data.doc.name, tables: tablesRef.current })
.then(() => mutate())
.catch(() => toast.error(_('Could not save the table settings.')))
}, 500)
}
// After a bbox change, re-extract that table's rows from the new region (debounced).
// The target is read inside the timeout so it always reflects the committed bbox.
const scheduleReextract = (tableIndex: number) => {
if (isCompleted) return
clearTimeout(reextractTimer.current)
reextractTimer.current = setTimeout(() => {
const target = tablesRef.current[tableIndex]
reextract({
statement_import_id: data.doc.name,
page: target.page,
table_index: target.table_index,
bbox: target.bbox,
})
.then((res) => {
commitTables(res?.message?.pdf_tables ?? [])
mutate()
})
.catch(() => toast.error(_('Could not re-extract the table.')))
}, 500)
}
useEffect(() => () => {
clearTimeout(saveTimer.current)
clearTimeout(reextractTimer.current)
}, [])
const pages = useMemo(() => Array.from(new Set(tables.map((t) => t.page))).sort((a, b) => a - b), [tables])
const currentPage = pages[pageIndex]
// Keep the table's position in the flat array so edits target the right one.
const pageTables = useMemo(
() => tables.map((table, index) => ({ table, index })).filter((t) => t.table.page === currentPage),
[tables, currentPage],
)
// Keep tablesRef in sync synchronously so the debounced save/re-extract never read stale state.
const commitTables = (next: PDFTable[]) => {
tablesRef.current = next
setTables(next)
}
const updateTable = (tableIndex: number, updater: (table: PDFTable) => PDFTable) => {
commitTables(tablesRef.current.map((t, i) => (i === tableIndex ? updater(t) : t)))
scheduleSave()
}
const onChangeMapping = (tableIndex: number, columnIndex: number, mapsTo: ColumnMapsTo) => {
updateTable(tableIndex, (table) => ({
...table,
column_mapping: applyColumnMappingChange(table.column_mapping, columnIndex, mapsTo),
}))
}
const onToggleIncluded = (tableIndex: number, included: boolean) =>
updateTable(tableIndex, (table) => ({ ...table, included }))
const onBboxCommit = (tableIndex: number, bbox: [number, number, number, number]) => {
commitTables(tablesRef.current.map((t, i) => (i === tableIndex ? { ...t, bbox } : t)))
scheduleReextract(tableIndex)
}
// Set/clear the header row of a table; the backend re-derives the column mapping.
const onSetHeader = (tableIndex: number, headerIndex: number | null) => {
commitTables(tablesRef.current.map((t, i) => (i === tableIndex ? { ...t, header_index: headerIndex } : t)))
const target = tablesRef.current[tableIndex]
setHeaderCall({
statement_import_id: data.doc.name,
page: target.page,
table_index: target.table_index,
header_index: headerIndex ?? -1,
})
.then((res) => {
commitTables(res?.message?.pdf_tables ?? [])
mutate()
})
.catch(() => toast.error(_('Could not update the header row.')))
}
if (tables.length === 0) {
return (
<div className="p-4">
<Paragraph className="text-p-sm text-ink-gray-5">
{_('No tables were extracted from this PDF.')}
</Paragraph>
</div>
)
}
return (
<div className="flex flex-col gap-3 p-4">
<div className="flex flex-col gap-1">
<H3 className="text-base border-0 p-0">{_('Detected Tables')}</H3>
<Paragraph className="text-p-sm">
{_('Review each page. In the Table view, map each column, click a row number to set/clear the header row, and exclude anything that is not transactions (ads, summaries).')}
</Paragraph>
</div>
{error && <ErrorBanner error={error} />}
<div className="flex items-center justify-between gap-2">
<Tabs value={viewMode} onValueChange={(v) => setViewMode(v as 'pdf' | 'table')}>
<TabsList variant="subtle">
<TabsTrigger value="pdf"><FileTextIcon />{_('PDF')}</TabsTrigger>
<TabsTrigger value="table"><TableIcon />{_('Table')}</TabsTrigger>
</TabsList>
</Tabs>
<div className="flex items-center gap-1">
{busy && (
<span className="flex items-center gap-1 pe-1 text-xs text-ink-gray-5">
<Loader2Icon className="size-3 animate-spin" />
{reextracting ? _('Re-extracting') : _('Saving')}
</span>
)}
<Button
variant="ghost"
isIconButton
disabled={pageIndex === 0}
onClick={() => setPageIndex((i) => Math.max(0, i - 1))}
>
<ChevronLeftIcon />
</Button>
<span className="min-w-24 text-center text-sm text-ink-gray-7">
{_('Page {0} of {1}', [currentPage.toString(), pages.length.toString()])}
</span>
<Button
variant="ghost"
isIconButton
disabled={pageIndex >= pages.length - 1}
onClick={() => setPageIndex((i) => Math.min(pages.length - 1, i + 1))}
>
<ChevronRightIcon />
</Button>
</div>
</div>
{viewMode === 'pdf' ? (
<PageView
pageTables={pageTables}
disabled={isCompleted}
onToggleIncluded={onToggleIncluded}
onBboxCommit={onBboxCommit}
/>
) : (
<div className="flex flex-col gap-4">
{pageTables.map(({ table, index }, position) => {
const isCollapsed = collapsed.has(index)
return (
<div
key={index}
className={cn('flex flex-col rounded border border-outline-gray-2', !table.included && 'opacity-60')}
>
<div className="flex items-center justify-between p-2">
<span className="ps-1 text-sm font-medium text-ink-gray-8">
{_('Table {0}', [(position + 1).toString()])}
</span>
<div className="flex items-center gap-2">
<IncludeToggle
id={`tbl-${index}`}
checked={table.included}
disabled={isCompleted}
onCheckedChange={(c) => onToggleIncluded(index, c)}
/>
<Button variant="ghost" size="sm" isIconButton onClick={() => toggleCollapsed(index)}>
<ChevronDownIcon className={cn('transition-transform', isCollapsed && '-rotate-90')} />
</Button>
</div>
</div>
{!isCollapsed && (
<div className="overflow-auto border-t border-outline-gray-2">
<RawTableGrid
rows={table.rows}
columnMapping={columnMappingRecord(table)}
headerIndex={table.header_index}
editable
disabled={isCompleted}
onChangeMapping={(columnIndex, mapsTo) => onChangeMapping(index, columnIndex, mapsTo)}
onSetHeader={(rowIndex) => onSetHeader(index, rowIndex)}
/>
</div>
)}
</div>
)
})}
</div>
)}
</div>
)
}
type PageViewProps = {
pageTables: { table: PDFTable; index: number }[]
disabled: boolean
onToggleIncluded: (tableIndex: number, included: boolean) => void
onBboxCommit: (tableIndex: number, bbox: [number, number, number, number]) => void
}
const PageView = ({ pageTables, disabled, onToggleIncluded, onBboxCommit }: PageViewProps) => {
const containerRef = useRef<HTMLDivElement>(null)
const pageImage = pageTables[0]?.table.page_image
const pageWidth = pageTables[0]?.table.page_width ?? 1
const pageHeight = pageTables[0]?.table.page_height ?? 1
if (!pageImage) {
return (
<Paragraph className="text-p-sm text-ink-gray-5">
{_('No page image is available for this page.')}
</Paragraph>
)
}
return (
<div className="flex flex-col gap-3">
{!disabled && (
<Paragraph className="text-xs text-ink-gray-5">
{_('Drag a box to move it, or drag a corner to resize. The table is re-read from the new region automatically.')}
</Paragraph>
)}
<div ref={containerRef} className="relative w-full overflow-auto rounded border border-outline-gray-2 bg-surface-gray-1">
<img src={pageImage} alt={_('Page preview')} className="w-full" />
{pageTables.map(({ table, index }, position) => {
const color = OVERLAY_COLORS[position % OVERLAY_COLORS.length]
return (
<BBoxOverlay
key={index}
bbox={table.bbox}
pageWidth={pageWidth}
pageHeight={pageHeight}
color={color}
label={_('Table {0}', [(position + 1).toString()])}
included={table.included}
disabled={disabled}
containerRef={containerRef}
onCommit={(bbox) => onBboxCommit(index, bbox)}
/>
)
})}
</div>
<div className="flex flex-col gap-1.5">
{pageTables.map(({ table, index }, position) => {
const color = OVERLAY_COLORS[position % OVERLAY_COLORS.length]
return (
<div key={index} className="flex items-center justify-between rounded border border-outline-gray-2 px-2 py-1.5">
<div className="flex items-center gap-2">
<span className={cn('size-3 rounded-sm', color.swatch)} />
<span className="text-xs">{_('Table {0}', [(position + 1).toString()])}</span>
</div>
<IncludeToggle
id={`pdf-tbl-${index}`}
checked={table.included}
disabled={disabled}
onCheckedChange={(c) => onToggleIncluded(index, c)}
/>
</div>
)
})}
</div>
</div>
)
}
const IncludeToggle = ({
id,
checked,
disabled,
onCheckedChange,
}: {
id: string
checked: boolean
disabled: boolean
onCheckedChange: (checked: boolean) => void
}) => (
<div className="flex items-center gap-2">
<Label htmlFor={id} className="text-xs text-ink-gray-6">{_('Include')}</Label>
<Switch id={id} checked={checked} disabled={disabled} onCheckedChange={onCheckedChange} />
</div>
)
export default PDFTableEditor

View File

@@ -0,0 +1,222 @@
import { useMemo } from 'react'
import {
ArrowDownRightIcon,
ArrowUpDownIcon,
ArrowUpRightIcon,
BanknoteIcon,
CalendarIcon,
DollarSignIcon,
FileTextIcon,
ListIcon,
ReceiptIcon,
} from 'lucide-react'
import _ from '@/lib/translate'
import { cn } from '@/lib/utils'
import { Table, TableBody, TableCell, TableHead, TableRow } from '@/components/ui/table'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import { COLUMN_MAPS_TO_OPTIONS, ColumnMapsTo } from './import_utils'
const AMOUNT_COLUMNS: ColumnMapsTo[] = ['Amount', 'Withdrawal', 'Deposit', 'Balance']
const DATE_LIKE = /\d{1,4}[/\-.\s]\d{1,2}[/\-.\s]\d{1,4}|\d{1,2}[\s-][a-z]{3}/i
type Props = {
rows: string[][]
/** Column index -> mapped field */
columnMapping: Record<number, ColumnMapsTo>
headerIndex: number | null
editable?: boolean
disabled?: boolean
onChangeMapping?: (columnIndex: number, mapsTo: ColumnMapsTo) => void
/** Set the header row (or null to mark the table as having no header). */
onSetHeader?: (rowIndex: number | null) => void
}
/**
* A preview of extracted rows with CSV-style colour coding: the header row is highlighted,
* detected transaction rows are green, and mapped columns are emphasised. When `editable`, a
* compact row of column -> field dropdowns sits at the top, and row numbers can be clicked to
* set/clear the header row.
*/
const RawTableGrid = ({ rows, columnMapping, headerIndex, editable, disabled, onChangeMapping, onSetHeader }: Props) => {
// Tabular (XLSX) cells can be numbers/dates, not strings - coerce so .trim()/render are safe.
const stringRows = useMemo(
() => rows.map((row) => row.map((cell) => (cell == null ? '' : String(cell)))),
[rows],
)
const numColumns = useMemo(() => stringRows.reduce((max, row) => Math.max(max, row.length), 0), [stringRows])
const validColumns = useMemo(
() => Object.entries(columnMapping).filter(([, m]) => m && m !== 'Do not import').map(([i]) => Number(i)),
[columnMapping],
)
const dateColumn = useMemo(() => Object.entries(columnMapping).find(([, m]) => m === 'Date')?.[0], [columnMapping])
const amountColumns = useMemo(
() => Object.entries(columnMapping).filter(([, m]) => ['Amount', 'Withdrawal', 'Deposit'].includes(m)).map(([i]) => Number(i)),
[columnMapping],
)
// Approximate the backend's transaction-row detection so the highlighting tracks edits live.
const transactionRows = useMemo(() => {
const set = new Set<number>()
if (dateColumn === undefined) return set
const dateIdx = Number(dateColumn)
stringRows.forEach((row, index) => {
if (index === headerIndex) return
const dateCell = (row[dateIdx] ?? '').trim()
if (!dateCell || !DATE_LIKE.test(dateCell)) return
if (amountColumns.some((c) => (row[c] ?? '').trim() !== '')) set.add(index)
})
return set
}, [stringRows, headerIndex, dateColumn, amountColumns])
return (
<Table containerClassName="rounded-none">
<TableBody>
{editable && (
<TableRow className="border-b border-outline-gray-2 bg-surface-white hover:bg-surface-white">
<TableHead className="w-8 p-1" />
{Array.from({ length: numColumns }).map((_unused, columnIndex) => (
<TableHead key={columnIndex} className="p-1 align-top">
<Select
disabled={disabled}
value={columnMapping[columnIndex] ?? 'Do not import'}
onValueChange={(value) => onChangeMapping?.(columnIndex, value as ColumnMapsTo)}
>
<SelectTrigger variant="outline" inputSize="sm" className="h-7 w-full">
<SelectValue />
</SelectTrigger>
<SelectContent>
{COLUMN_MAPS_TO_OPTIONS.map((option) => (
<SelectItem key={option} value={option}>
<span className="flex items-center gap-1.5">
<ColumnHeaderIcon columnType={option} />
{_(option)}
</span>
</SelectItem>
))}
</SelectContent>
</Select>
</TableHead>
))}
</TableRow>
)}
{stringRows.map((row, index) => {
const isHeaderRow = index === headerIndex
const isTransactionRow = transactionRows.has(index)
return (
<TableRow
key={index}
className={cn({
'bg-green-50 hover:bg-green-50 dark:bg-green-700 dark:hover:bg-green-700': isTransactionRow,
'bg-yellow-100 hover:bg-yellow-100 dark:bg-yellow-400': isHeaderRow,
'text-ink-gray-5/70': !isTransactionRow && !isHeaderRow,
})}
>
{editable && onSetHeader ? (
<TableCell className="h-px w-8 p-0 text-center">
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
disabled={disabled}
onClick={() => onSetHeader(isHeaderRow ? null : index)}
className={cn(
'flex h-full w-full items-center justify-center px-1 text-ink-gray-6 hover:bg-surface-gray-3',
isHeaderRow && 'font-semibold text-ink-gray-8',
)}
>
{index + 1}
</button>
</TooltipTrigger>
<TooltipContent>
{isHeaderRow
? _('This is the header row. Click to mark the table as having no header.')
: _('Click to set this as the header row.')}
</TooltipContent>
</Tooltip>
</TableCell>
) : (
<TableCell className="w-8 px-1 py-0.5 text-center text-ink-gray-6">{index + 1}</TableCell>
)}
{Array.from({ length: numColumns }).map((_unused, cellIndex) => {
const columnType = columnMapping[cellIndex]
const isValidColumn = validColumns.includes(cellIndex)
const isAmountColumn = AMOUNT_COLUMNS.includes(columnType)
const cellText = row[cellIndex] ?? ''
// Read-only header row: icon + label.
if (isHeaderRow) {
return (
<TableCell key={cellIndex} className="max-w-[200px] overflow-hidden text-ellipsis py-1">
<div className="flex items-center gap-1 px-1 text-xs font-medium text-ink-gray-8">
{columnType && (
<Tooltip>
<TooltipTrigger>
<ColumnHeaderIcon columnType={columnType} />
</TooltipTrigger>
<TooltipContent>{_(columnType)}</TooltipContent>
</Tooltip>
)}
{cellText}
</div>
</TableCell>
)
}
return (
<TableCell
key={cellIndex}
className={cn('max-w-[200px] overflow-hidden text-ellipsis py-0.5', {
'bg-green-100 dark:bg-green-400 hover:bg-green-100 dark:hover:bg-green-400': isValidColumn && isTransactionRow,
'text-ink-gray-5': !isValidColumn && isTransactionRow,
})}
>
<div
className={cn('min-h-5 flex items-center px-1 text-xs', {
'justify-end': isAmountColumn && isValidColumn && isTransactionRow,
})}
title={cellText}
>
{cellText}
</div>
</TableCell>
)
})}
</TableRow>
)
})}
</TableBody>
</Table>
)
}
const ColumnHeaderIcon = ({ columnType }: { columnType?: ColumnMapsTo }) => {
switch (columnType) {
case 'Amount':
return <DollarSignIcon className="size-4" />
case 'Withdrawal':
return <ArrowUpRightIcon className="size-4 text-ink-red-3" />
case 'Deposit':
return <ArrowDownRightIcon className="size-4 text-ink-green-3" />
case 'Balance':
return <BanknoteIcon className="size-4" />
case 'Date':
return <CalendarIcon className="size-4" />
case 'Description':
return <FileTextIcon className="size-4" />
case 'Reference':
return <ReceiptIcon className="size-4" />
case 'Transaction Type':
return <ListIcon className="size-4" />
case 'Debit/Credit':
return <ArrowUpDownIcon className="size-4" />
default:
return null
}
}
export default RawTableGrid

View File

@@ -0,0 +1,154 @@
import { BankStatementImportLog } from "@/types/Accounts/BankStatementImportLog"
import { useFrappeGetCall, useFrappePostCall } from "frappe-react-sdk"
export type ColumnMapsTo =
| "Do not import"
| "Date"
| "Withdrawal"
| "Deposit"
| "Amount"
| "Description"
| "Reference"
| "Transaction Type"
| "Debit/Credit"
| "Balance"
| "Included Fee"
| "Excluded Fee"
| "Party Name/Account Holder"
| "Party Account No."
| "Party IBAN"
export type ColumnMappingEntry = {
index: number
maps_to: ColumnMapsTo | string
header_text?: string
variable?: string
}
/** Apply a column mapping change, clearing the same mapping from any other column. */
export function applyColumnMappingChange<T extends ColumnMappingEntry>(
columns: T[],
columnIndex: number,
mapsTo: ColumnMapsTo,
): T[] {
const previous = columns.find((c) => c.index === columnIndex)
const cleared =
mapsTo === "Do not import"
? columns
: columns.map((c) =>
c.index !== columnIndex && c.maps_to === mapsTo
? { ...c, maps_to: "Do not import" as ColumnMapsTo }
: c,
)
return [
...cleared.filter((c) => c.index !== columnIndex),
{
index: columnIndex,
maps_to: mapsTo,
header_text: previous?.header_text ?? "",
variable: previous?.variable ?? `column_${columnIndex}`,
} as T,
].sort((a, b) => a.index - b.index)
}
export const COLUMN_MAPS_TO_OPTIONS: ColumnMapsTo[] = [
"Do not import",
"Date",
"Description",
"Reference",
"Withdrawal",
"Deposit",
"Amount",
"Balance",
"Debit/Credit",
"Transaction Type",
"Included Fee",
"Excluded Fee",
"Party Name/Account Holder",
"Party Account No.",
"Party IBAN",
]
export interface PDFTableColumn {
index: number
header_text: string
variable?: string
maps_to: ColumnMapsTo
}
export interface PDFTable {
page: number
table_index: number
bbox: [number, number, number, number]
page_width: number
page_height: number
page_image: string | null
render_scale: number | null
rows: string[][]
header_index: number | null
column_mapping: PDFTableColumn[]
date_format?: string
amount_format?: string
included: boolean
}
export interface GetStatementDetailsResponse {
doc: BankStatementImportLog,
conflicting_transactions: Array<{
name: string,
date: string,
withdrawal: number,
deposit: number,
description: string,
reference_number: string,
currency: string,
}>,
final_transactions: Array<{
date: string,
withdrawal: number,
deposit: number,
description: string,
reference: string,
transaction_type?: string,
debit_credit?: string,
included_fee?: number,
excluded_fee?: number,
party_name?: string,
party_account_number?: string,
party_iban?: string,
}>,
date_format: string,
raw_data: Array<Array<string>>,
currency: string,
pdf_tables?: PDFTable[],
}
export const useGetStatementDetails = (id: string) => {
return useFrappeGetCall<{ message: GetStatementDetailsResponse }>("erpnext.accounts.doctype.bank_statement_import_log.bank_statement_import_log.get_statement_details", {
statement_import_id: id,
}, undefined, {
revalidateOnFocus: false
})
}
export const useUpdatePDFTables = () => {
return useFrappePostCall<{ message: GetStatementDetailsResponse }>("erpnext.accounts.doctype.bank_statement_import_log.bank_statement_import_log.update_pdf_tables")
}
export const useReextractPDFTable = () => {
return useFrappePostCall<{ message: GetStatementDetailsResponse }>("erpnext.accounts.doctype.bank_statement_import_log.bank_statement_import_log.reextract_pdf_table")
}
export const useSetPDFTableHeader = () => {
return useFrappePostCall<{ message: GetStatementDetailsResponse }>("erpnext.accounts.doctype.bank_statement_import_log.bank_statement_import_log.set_pdf_table_header")
}
export const useUpdateColumnMapping = () => {
return useFrappePostCall<{ message: GetStatementDetailsResponse }>("erpnext.accounts.doctype.bank_statement_import_log.bank_statement_import_log.update_column_mapping")
}
export const useSetHeaderIndex = () => {
return useFrappePostCall<{ message: GetStatementDetailsResponse }>("erpnext.accounts.doctype.bank_statement_import_log.bank_statement_import_log.set_header_index")
}

View File

@@ -0,0 +1,115 @@
import { Badge } from '@/components/ui/badge'
import { Kbd, KbdGroup } from '@/components/ui/kbd'
import { KeyboardMetaKeyIcon } from '@/components/ui/keyboard-keys'
import { SettingsPanelDescription, SettingsPanelTitle, SettingsPanelHeader, SettingsPanelContent } from '@/components/ui/settings-dialog'
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'
import _ from '@/lib/translate'
import { ArrowRightLeftIcon, HistoryIcon, LandmarkIcon, OptionIcon, ReceiptIcon, SaveIcon, SettingsIcon, ZapIcon } from 'lucide-react'
const Shortcuts = [
{
shortcut: <KbdGroup><Kbd><KeyboardMetaKeyIcon /></Kbd><Kbd>B</Kbd></KbdGroup>,
action: {
icon: <LandmarkIcon />,
label: _("Bank Entry"),
description: _("Record a bank journal entry for expenses, income or split transactions")
}
},
{
shortcut: <KbdGroup><Kbd><KeyboardMetaKeyIcon /></Kbd><Kbd>P</Kbd></KbdGroup>,
action: {
icon: <ReceiptIcon />,
label: _("Record Payment"),
description: _("Record a payment against a customer or supplier")
}
},
{
shortcut: <KbdGroup><Kbd><KeyboardMetaKeyIcon /></Kbd><Kbd>I</Kbd></KbdGroup>,
action: {
icon: <ArrowRightLeftIcon />,
label: _("Transfer"),
description: _("Record a transfer between two bank accounts")
}
},
{
shortcut: <KbdGroup><Kbd><OptionIcon /></Kbd><Kbd>R</Kbd></KbdGroup>,
action: {
icon: <ZapIcon />,
label: _("Accept Matching Rule"),
description: _("Accept the rule for the selected transaction")
}
},
{
shortcut: <KbdGroup><Kbd><KeyboardMetaKeyIcon /></Kbd><Kbd>S</Kbd></KbdGroup>,
action: {
icon: <SaveIcon />,
label: _("Save"),
description: _("Save the currently opened form")
}
},
{
shortcut: <KbdGroup><Kbd><KeyboardMetaKeyIcon /></Kbd><Kbd>Z</Kbd></KbdGroup>,
action: {
icon: <HistoryIcon />,
label: _("Reconciliation History"),
description: _("View all reconciliation actions taken in this session")
}
},
{
shortcut: <KbdGroup><Kbd><KeyboardMetaKeyIcon /></Kbd><Kbd></Kbd><Kbd>G</Kbd></KbdGroup>,
action: {
icon: <SettingsIcon />,
label: _("Settings"),
description: _("Open the settings dialog")
}
}
]
const KeyboardShortcuts = () => {
return (
<>
<SettingsPanelHeader>
<SettingsPanelTitle>{_("Keyboard Shortcuts")}</SettingsPanelTitle>
<SettingsPanelDescription>{_("Get around the system quickly with keyboard shortcuts")}</SettingsPanelDescription>
</SettingsPanelHeader>
<SettingsPanelContent>
<div className='flex flex-col gap-3'>
<p className='text-p-sm text-ink-gray-6'>
{_("Transaction actions work when one or more unreconciled transactions are selected.")}
<br />
{_("To select more than one transaction at a time, press and hold the shift key.")}
</p>
<Table containerClassName='dark:border-outline-gray-2'>
<TableHeader>
<TableRow>
<TableHead>{_("Shortcut")}</TableHead>
<TableHead>{_("Action")}</TableHead>
<TableHead>{_("Description")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{Shortcuts.map((shortcut) => (
<TableRow className='hover:bg-surface-gray-2'>
<TableCell>
{shortcut.shortcut}
</TableCell>
<TableCell>
<Badge size='lg' variant='outline'>
{shortcut.action.icon}
{shortcut.action.label}
</Badge>
</TableCell>
<TableCell>
<p className='text-p-sm text-ink-gray-6 text-wrap'>{shortcut.action.description}</p>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</SettingsPanelContent>
</>
)
}
export default KeyboardShortcuts

View File

@@ -0,0 +1,46 @@
import { Button } from '@/components/ui/button'
import { SettingsPanelTitle, SettingsPanelHeader, SettingsPanelDescription, SettingsPanelContent } from '@/components/ui/settings-dialog'
import _ from '@/lib/translate'
import { PlusIcon } from 'lucide-react'
import { useState } from 'react'
import RuleList, { RunRulesButton } from './Rules/RuleList'
import CreateNewRule from '../BankReconciliation/Rules/CreateNewRule'
import EditRule from '../BankReconciliation/Rules/EditRule'
const MatchingRules = () => {
const [selectedRule, setSelectedRule] = useState<string | null>(null)
const [isNewRule, setIsNewRule] = useState(false)
if (isNewRule) {
return <CreateNewRule onCreate={() => setIsNewRule(false)} />
}
if (selectedRule) {
return <EditRule onClose={() => setSelectedRule(null)} ruleID={selectedRule} />
}
return (
<>
<SettingsPanelHeader
actions={
<div className='flex gap-2 items-center'>
<RunRulesButton />
<Button type='button' onClick={() => setIsNewRule(true)}><PlusIcon /> {_("Add Rule")}</Button>
</div>
}
>
<SettingsPanelTitle>{_("Transaction Matching Rules")}</SettingsPanelTitle>
<SettingsPanelDescription>
{_("Set up rules to automatically classify transactions. Drag and drop rules to reorder their priority.")}
</SettingsPanelDescription>
</SettingsPanelHeader>
<SettingsPanelContent>
<RuleList setSelectedRule={setSelectedRule} />
</SettingsPanelContent>
</>
)
}
export default MatchingRules

View File

@@ -0,0 +1,261 @@
import ErrorBanner from "@/components/ui/error-banner"
import { Label } from "@/components/ui/label"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { Separator } from "@/components/ui/separator"
import { SettingsPanelDescription, SettingsPanelHeader, SettingsPanelTitle, SettingsPanelContent } from "@/components/ui/settings-dialog"
import { Switch } from "@/components/ui/switch"
import { useTheme } from "@/components/ui/theme-provider"
import _ from "@/lib/translate"
import { AccountsSettings } from "@/types/Accounts/AccountsSettings"
import { useFrappeGetDoc, useFrappeUpdateDoc } from "frappe-react-sdk"
import { toast } from "sonner"
export const Preferences = () => {
const { data: accountsSettings, mutate, error: fetchError, isLoading } = useFrappeGetDoc<AccountsSettings>("Accounts Settings", "Accounts Settings", undefined, {
revalidateOnFocus: false
})
const { updateDoc, error } = useFrappeUpdateDoc<AccountsSettings>()
const onUpdate = <K extends keyof AccountsSettings>(field: K, value: AccountsSettings[K]) => {
mutate(updateDoc("Accounts Settings", "Accounts Settings", {
[field]: value
}), {
optimisticData: {
...accountsSettings as AccountsSettings,
[field]: value
},
revalidate: false,
}).then(() => {
toast.success(_("Preferences updated"), {
dismissible: true,
duration: 500,
})
})
}
return <>
<SettingsPanelHeader>
<SettingsPanelTitle>{_("Preferences")}</SettingsPanelTitle>
<SettingsPanelDescription>{_("Configure settings for the banking module")}</SettingsPanelDescription>
</SettingsPanelHeader>
<SettingsPanelContent>
<div className='flex flex-col gap-4 w-full'>
{fetchError && <ErrorBanner error={fetchError} />}
{error && <ErrorBanner error={error} />}
<div className="flex flex-col flex-1">
<ThemeSwitcher />
<div className="flex justify-between items-center gap-8 py-3">
<div className="flex flex-col">
<Label htmlFor="transfer_match_days" className="text-p-base text-ink-gray-6">{_("Number of days to match transfers")}</Label>
<p className="text-p-sm text-ink-gray-5">
{_("For example, if set to 4, the system will try to find matching transfer transactions in other banks 4 days before and after the transaction date. This is because transactions can clear on different days on different bank accounts.")}
</p>
</div>
<div className="min-w-40 flex justify-end">
<Select disabled={isLoading} onValueChange={(value) => onUpdate("transfer_match_days", Number(value))} value={accountsSettings?.transfer_match_days?.toString()}>
<SelectTrigger id="transfer_match_days" className="min-w-32">
<SelectValue placeholder={_("Select number of days")} />
</SelectTrigger>
<SelectContent>
<SelectItem value="0">{_("Same day")}</SelectItem>
<SelectItem value="1">{_("Within 1 day")}</SelectItem>
<SelectItem value="2">{_("Within 2 days")}</SelectItem>
<SelectItem value="3">{_("Within 3 days")}</SelectItem>
<SelectItem value="4">{_("Within 4 days")}</SelectItem>
<SelectItem value="5">{_("Within 5 days")}</SelectItem>
</SelectContent>
</Select>
</div>
</div>
<Separator />
<div className="flex justify-between items-center gap-8 py-3">
<div className="flex flex-col">
<Label htmlFor="automatically_run_rules_on_unreconciled_transactions" className="text-p-base text-ink-gray-6">{_("Automatically run rules on unreconciled transactions")}</Label>
<p className="text-p-sm text-ink-gray-5">
{_("This will automatically run transaction matching rules on unreconciled transactions every hour.")}
</p>
</div>
<div className="flex justify-end">
<Switch
id="automatically_run_rules_on_unreconciled_transactions"
className="dark:disabled:bg-surface-gray-2"
disabled={isLoading}
checked={accountsSettings?.automatically_run_rules_on_unreconciled_transactions === 1}
onCheckedChange={(checked) => onUpdate("automatically_run_rules_on_unreconciled_transactions", checked ? 1 : 0)}
/>
</div>
</div>
<Separator />
<div className="flex justify-between items-center gap-8 py-3">
<div className="flex flex-col">
<Label htmlFor="enable_party_matching" className="text-p-base text-ink-gray-6">{_("Enable automatic party matching")}</Label>
<p className="text-p-sm text-ink-gray-5">
{_("The system will attempt to automatically match a party to a bank transaction based on account number or IBAN.")}
</p>
</div>
<div className="flex justify-end">
<Switch
id="enable_party_matching"
className="dark:disabled:bg-surface-gray-2"
disabled={isLoading}
checked={accountsSettings?.enable_party_matching === 1}
onCheckedChange={(checked) => onUpdate("enable_party_matching", checked ? 1 : 0)}
/>
</div>
</div>
<Separator />
<div className="flex justify-between items-center gap-8 py-3">
<div className="flex flex-col">
<Label htmlFor="enable_fuzzy_matching" className="text-p-base text-ink-gray-6">{_("Enable party name/description fuzzy matching")}</Label>
<p className="text-p-sm text-ink-gray-5">
{_("If a party cannot be matched by account number or IBAN, the system will try fuzzy matching using the party name and transaction description.")}
</p>
</div>
<div className="flex justify-end">
<Switch
id="enable_fuzzy_matching"
className="dark:disabled:bg-surface-gray-2"
disabled={accountsSettings?.enable_party_matching !== 1 || isLoading}
checked={accountsSettings?.enable_fuzzy_matching === 1}
onCheckedChange={(checked) => onUpdate("enable_fuzzy_matching", checked ? 1 : 0)}
/>
</div>
</div>
</div>
{/* <DataField
name='transfer_match_days'
label={_("Number of days to match transfers")}
isRequired
inputProps={{
type: 'number',
inputMode: 'numeric',
}}
formDescription={_("For example, if set to 4, the system will try to find matching transactions in other banks 4 days before and after the transaction date. This is because transactions can clear on different days on different bank accounts.")}
/> */}
</div>
</SettingsPanelContent>
</>
}
const ThemeSwitcher = () => {
const { theme, setTheme } = useTheme()
const themeCards: Array<{ value: "Light" | "Dark" | "Automatic", label: string }> = [
{
value: "Light",
label: _("Light"),
},
{
value: "Dark",
label: _("Dark"),
},
{
value: "Automatic",
label: _("System"),
},
]
return <div className="flex flex-col gap-3 pb-3">
<div className="flex flex-col">
<Label className="text-p-base text-ink-gray-6">{_("Theme")}</Label>
<p className="text-p-sm text-ink-gray-5">
{_("Switch between light, dark, or system theme")}
</p>
</div>
<div className="flex gap-3">
{themeCards.map((option) => {
const selected = theme === option.value
return (
<button
key={option.value}
type="button"
onClick={() => setTheme(option.value)}
aria-pressed={selected}
className={`flex-1 basis-0 min-w-0 overflow-hidden rounded-lg border cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-outline-blue-4 ${selected ? "border-outline-gray-5" : "border-outline-gray-modals hover:border-outline-gray-4"}`}
>
{option.value === "Automatic" ? (
<div className="flex w-full min-w-0">
<ThemePreviewWindow theme="light" roundedClass="rounded-tl-[10.5px]" />
<ThemePreviewWindow theme="dark" roundedClass="rounded-tr-[10.5px]" />
</div>
) : (
<ThemePreviewWindow theme={option.value === "Light" ? "light" : "dark"} roundedClass="rounded-t-[10.5px]" />
)}
<div className="flex items-center justify-between px-3 py-2 border-t border-outline-gray-modals">
<div className="text-base text-ink-gray-7">{option.label}</div>
<span className={`rounded-full size-3.5 ${selected ? "border-4 border-outline-gray-5" : "border border-outline-gray-4"}`} />
</div>
</button>
)
})}
</div>
</div>
}
const ThemePreviewWindow = ({ theme, roundedClass }: { theme: "light" | "dark", roundedClass: string }) => {
const isLight = theme === "light"
const frameClass = isLight ? "bg-white border-gray-100" : "bg-gray-900 border-gray-800"
const subtleSurfaceClass = isLight ? "bg-gray-50" : "bg-gray-800"
const mutedLineClass = isLight ? "bg-gray-200" : "bg-gray-700"
const mutedLineStrongClass = isLight ? "bg-gray-300" : "bg-gray-600"
const dividerClass = isLight ? "border-gray-100" : "border-gray-800"
const cardClass = isLight ? "bg-white border-gray-200" : "bg-gray-900 border-gray-700"
return <div className={`flex flex-1 min-w-0 pl-5 pt-3.5 ${isLight ? "bg-surface-gray-2" : "bg-surface-gray-3"} ${roundedClass}`}>
<div className={`w-full rounded-tl-sm border ${frameClass}`}>
<div className={`flex gap-[3px] py-[3px] px-1 border-b ${dividerClass}`}>
<div className="size-1.5 bg-[#FF5F57] rounded-full" />
<div className="size-1.5 bg-[#FEBC2D] rounded-full" />
<div className="size-1.5 bg-[#28C840] rounded-full" />
</div>
<div className="p-1.5">
<div className={`flex items-center gap-1.5 p-1 rounded-sm border ${subtleSurfaceClass} ${dividerClass}`}>
<div className={`h-2 w-8 rounded-full ${mutedLineStrongClass}`} />
<div className={`h-2 w-6 rounded-full ${mutedLineClass}`} />
<div className={`h-2 w-7 rounded-full ml-auto ${mutedLineClass}`} />
</div>
<div className="grid grid-cols-2 gap-1 mt-1.5">
<div className={`rounded-sm border p-1 ${cardClass}`}>
<div className={`h-1.5 w-full rounded-full ${mutedLineStrongClass}`} />
<div className={`h-1.5 w-4/5 rounded-full mt-1 ${mutedLineClass}`} />
<div className={`h-1.5 w-3/5 rounded-full mt-1 ${mutedLineClass}`} />
</div>
<div className={`rounded-sm border p-1 ${cardClass}`}>
<div className="flex items-center justify-between gap-1">
<div className={`h-1.5 w-2/5 rounded-full ${mutedLineStrongClass}`} />
{/* <div className={`h-2.5 w-5 rounded-sm border ${chipClass}`} /> */}
</div>
<div className={`h-1.5 w-full rounded-full mt-1 ${mutedLineClass}`} />
<div className={`h-1.5 w-3/4 rounded-full mt-1 ${mutedLineClass}`} />
</div>
</div>
</div>
</div>
</div>
}

View File

@@ -0,0 +1,314 @@
import { Button } from "@/components/ui/button"
import ErrorBanner from "@/components/ui/error-banner"
import { Skeleton } from "@/components/ui/skeleton"
import { Badge } from "@/components/ui/badge"
import _ from "@/lib/translate"
import { BankTransactionRule } from "@/types/Accounts/BankTransactionRule"
import { FrappeConfig, FrappeContext, useFrappeGetCall, useFrappeGetDocList, useFrappePostCall } from "frappe-react-sdk"
import { ArrowDownRight, ArrowDownUp, ArrowUpRight, MoreVertical, Trash2, GripVertical, Play, RefreshCw, ZapIcon, CalendarSyncIcon } from "lucide-react"
import { useContext, useState } from "react"
import { toast } from "sonner"
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, DropdownMenuSeparator, DropdownMenuCheckboxItem } from "@/components/ui/dropdown-menu"
import {
DndContext,
closestCenter,
KeyboardSensor,
PointerSensor,
useSensor,
useSensors,
DragEndEvent,
} from '@dnd-kit/core'
import {
arrayMove,
SortableContext,
sortableKeyboardCoordinates,
verticalListSortingStrategy,
} from '@dnd-kit/sortable'
import {
useSortable,
} from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities'
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty"
import { cn } from "@/lib/utils"
const useGetRuleList = () => {
return useFrappeGetDocList<BankTransactionRule>("Bank Transaction Rule", {
fields: ["name", "rule_name", "rule_description", "transaction_type", "priority"],
orderBy: {
field: 'priority',
order: 'asc'
},
limit: 100
})
}
export const RunRulesButton = () => {
const { data } = useGetRuleList()
const { call: runRuleEvaluation, loading: isRunningRules } = useFrappePostCall('erpnext.accounts.doctype.bank_transaction_rule.bank_transaction_rule.run_rule_evaluation')
const handleRunRules = async (forceEvaluate: boolean = false) => {
try {
await runRuleEvaluation({
force_evaluate: forceEvaluate
})
toast.success(forceEvaluate ? _("Rules evaluation started") : _("Rules evaluation completed"))
} catch (error) {
toast.error(_("Failed to run rules evaluation"))
console.error("Error running rules evaluation:", error)
}
}
if (!data || data.length === 0) {
return null
}
return <DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="sm" disabled={isRunningRules}>
{isRunningRules ? (
<RefreshCw className="animate-spin" />
) : (
<Play />
)}
{isRunningRules ? _("Running...") : _("Run Rules")}
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start">
<DropdownMenuItem onClick={() => handleRunRules(false)} disabled={isRunningRules} title={_("Run rules on unreconciled transactions that haven't been evaluated yet")}>
<Play />
{_("Run on new transactions")}
</DropdownMenuItem>
<DropdownMenuItem onClick={() => handleRunRules(true)} disabled={isRunningRules} title={_("Force re-evaluate all unreconciled transactions, even if they were previously evaluated")}>
<RefreshCw />
{_("Force evaluate all")}
</DropdownMenuItem>
<DropdownMenuSeparator />
<AutoRunRuleItem />
</DropdownMenuContent>
</DropdownMenu>
}
const AutoRunRuleItem = () => {
const { db } = useContext(FrappeContext) as FrappeConfig
const { data: accountsSetting, mutate: setAutomaticallyRunRulesOnUnreconciledTransactions } = useFrappeGetCall("frappe.client.get_single_value", {
"doctype": "Accounts Settings",
"field": "automatically_run_rules_on_unreconciled_transactions"
})
const automaticallyRunRulesOnUnreconciledTransactions = accountsSetting?.message ? true : false
const onAutoClassifyTransactions = (checked: boolean) => {
toast.promise(db.setValue("Accounts Settings", "Accounts Settings", "automatically_run_rules_on_unreconciled_transactions", checked ? 1 : 0).then(() => {
setAutomaticallyRunRulesOnUnreconciledTransactions({
message: {
automatically_run_rules_on_unreconciled_transactions: checked ? 1 : 0,
}
}, {
revalidate: false
})
}), {
loading: _("Updating..."),
success: checked ? _("Scheduled job enabled. Transactions will be auto classified.") : _("Scheduled job disabled. Transactions will not be auto classified."),
error: _("Failed to update auto classify transactions settings")
})
}
return <DropdownMenuCheckboxItem
checked={automaticallyRunRulesOnUnreconciledTransactions}
onCheckedChange={onAutoClassifyTransactions}>
<CalendarSyncIcon />
{_("Run rules automatically")}
</DropdownMenuCheckboxItem>
}
const RuleList = ({ setSelectedRule }: { setSelectedRule: (rule: string) => void }) => {
const { data, error, isLoading, mutate } = useGetRuleList()
const { db } = useContext(FrappeContext) as FrappeConfig
const sensors = useSensors(
useSensor(PointerSensor),
useSensor(KeyboardSensor, {
coordinateGetter: sortableKeyboardCoordinates,
})
)
const onDeleteRule = (ruleID: string) => {
toast.promise(db.deleteDoc("Bank Transaction Rule", ruleID).then(() => {
mutate()
}), {
loading: _("Deleting rule..."),
success: _("Rule deleted."),
error: _("Failed to delete rule.")
})
}
const handleDragEnd = async (event: DragEndEvent) => {
const { active, over } = event
if (active.id !== over?.id && data) {
const oldIndex = data.findIndex((rule) => rule.name === active.id)
const newIndex = data.findIndex((rule) => rule.name === over?.id)
const newData = arrayMove(data, oldIndex, newIndex)
// Update priorities based on new order
const updatePromises = newData.map((rule, index) => {
const newPriority = index + 1
if (rule.priority !== newPriority) {
return db.setValue("Bank Transaction Rule", rule.name, "priority", newPriority)
}
return Promise.resolve()
})
try {
await Promise.all(updatePromises)
toast.success(_("Rule priorities updated"))
mutate() // Refresh the data
} catch (error) {
toast.error(_("Failed to update rule priorities"))
console.error("Error updating priorities:", error)
}
}
}
return (
<>
<div className="overflow-y-auto">
{isLoading && <div className="flex flex-col gap-2">
<Skeleton className="w-full h-10" />
<Skeleton className="w-full h-10" />
<Skeleton className="w-full h-10" />
<Skeleton className="w-full h-10" />
<Skeleton className="w-full h-10" />
</div>}
{error && <ErrorBanner error={error} />}
{data && data.length === 0 && <Empty className="h-96">
<EmptyMedia>
<ZapIcon />
</EmptyMedia>
<EmptyHeader>
<EmptyTitle>{_("No rules setup yet")}</EmptyTitle>
<EmptyDescription>{_("Configure rules to save time when reconciling transactions.")}</EmptyDescription>
</EmptyHeader>
</Empty>}
{data && data.length > 0 && (
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
onDragEnd={handleDragEnd}
>
<SortableContext
items={data.map(rule => rule.name)}
strategy={verticalListSortingStrategy}
>
<ul className="space-2 divide-y divide-outline-gray-modals">
{data?.map((rule) => (
<SortableRuleItem
key={rule.name}
rule={rule}
setSelectedRule={setSelectedRule}
onDeleteRule={onDeleteRule}
/>
))}
</ul>
</SortableContext>
</DndContext>
)}
</div>
</>
)
}
const SortableRuleItem = ({
rule,
setSelectedRule,
onDeleteRule
}: {
rule: BankTransactionRule
setSelectedRule: (rule: string) => void
onDeleteRule: (ruleID: string) => void
}) => {
const {
attributes,
listeners,
setNodeRef,
transform,
transition,
isDragging,
} = useSortable({ id: rule.name })
const style = {
transform: CSS.Transform.toString(transform),
transition,
opacity: isDragging ? 0.5 : 1,
}
const [isDropdownOpen, setIsDropdownOpen] = useState(false)
return (
<li ref={setNodeRef} style={style}>
<div className={cn("flex justify-between items-center py-2 my-0.5 h-full hover:bg-surface-gray-1 pe-2 rounded", isDropdownOpen && "bg-surface-gray-1")}>
<div className="flex items-center gap-2">
<div
{...attributes}
{...listeners}
className="cursor-grab active:cursor-grabbing p-1 rounded"
title={_("Drag to reorder")}
>
<GripVertical className="w-4 h-4 text-ink-gray-5" />
</div>
<Badge theme="gray" className="font-numeric tabular-nums">
{rule.priority}
</Badge>
<div className="flex flex-col gap-1">
<div className="flex items-center gap-2">
<Button
variant='link'
size='sm'
className="p-0 h-fit text-start cursor-pointer no-underline hover:underline"
onClick={() => setSelectedRule(rule.name)}>
{rule.rule_name}
</Button>
<div title={rule.transaction_type === "Any" ? _("Applies to withdrawals and deposits") : rule.transaction_type === "Withdrawal" ? _("Applies to withdrawals") : _("Applies to deposits")}>
{rule.transaction_type === "Any" ? <ArrowDownUp className="text-ink-gray-5 w-4 h-4" /> : rule.transaction_type === "Withdrawal" ? <ArrowUpRight className="text-ink-red-3 w-5 h-5" /> : <ArrowDownRight className="text-ink-green-3 w-5 h-5" />}
</div>
</div>
<span className="text-sm text-ink-gray-5">
{rule.rule_description}
</span>
</div>
</div>
<div className="flex items-center gap-2 h-full justify-center">
<DropdownMenu open={isDropdownOpen} onOpenChange={setIsDropdownOpen}>
<DropdownMenuTrigger asChild>
<Button variant='ghost' isIconButton className="hover:bg-transparent">
<MoreVertical />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => onDeleteRule(rule.name)}>
<Trash2 />
{_("Delete")}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
</li>
)
}
export default RuleList

View File

@@ -0,0 +1,42 @@
import { Button } from '@/components/ui/button'
import { Dialog, DialogTrigger } from '@/components/ui/dialog'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import _ from '@/lib/translate'
import { SettingsIcon } from 'lucide-react'
import { useState } from 'react'
import { useHotkeys } from 'react-hotkeys-hook'
import SettingsDialogContent from './SettingsDialogContent'
const Settings = () => {
const [isOpen, setIsOpen] = useState(false)
useHotkeys('shift+meta+g', () => {
setIsOpen(x => !x)
}, {
enabled: true,
preventDefault: true,
enableOnFormTags: false
})
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<Tooltip>
<TooltipTrigger asChild>
<DialogTrigger asChild>
<Button variant={'outline'} isIconButton size='md' aria-label={_("Settings")}>
<SettingsIcon />
</Button>
</DialogTrigger>
</TooltipTrigger>
<TooltipContent>
{_("Settings")}
</TooltipContent>
</Tooltip>
{isOpen && (
<SettingsDialogContent onClose={() => setIsOpen(false)} />
)}
</Dialog>
)
}
export default Settings

View File

@@ -0,0 +1,52 @@
import {
SettingsDialog,
SettingsPanels,
SettingsTabGroup,
SettingsTabItem,
SettingsTabs,
} from '@/components/ui/settings-dialog'
import _ from '@/lib/translate'
import { KeyboardIcon, Loader2Icon, SlidersVerticalIcon, ZapIcon } from 'lucide-react'
import { lazy, Suspense } from 'react'
const SettingsPanelsContent = lazy(() => import('./SettingsPanelsContent'))
const SettingsPanelsFallback = () => (
<div className="flex flex-1 items-center justify-center min-h-full">
<Loader2Icon className="size-6 animate-spin text-muted-foreground" />
</div>
)
const SettingsDialogContent = ({ onClose }: { onClose: () => void }) => {
return (
<SettingsDialog defaultValue="preferences" onClose={onClose}>
<SettingsTabs>
<SettingsTabGroup header={_("Settings")}>
<SettingsTabItem
icon={<SlidersVerticalIcon />}
label={_("Preferences")}
value="preferences"
/>
<SettingsTabItem
icon={<ZapIcon />}
label={_("Matching Rules")}
value="rules"
/>
<SettingsTabItem
icon={<KeyboardIcon />}
label={_("Keyboard Shortcuts")}
value="keyboard-shortcuts"
/>
</SettingsTabGroup>
</SettingsTabs>
<SettingsPanels>
<Suspense fallback={<SettingsPanelsFallback />}>
<SettingsPanelsContent />
</Suspense>
</SettingsPanels>
</SettingsDialog>
)
}
export default SettingsDialogContent

View File

@@ -0,0 +1,24 @@
import { SettingsPanel } from '@/components/ui/settings-dialog'
import { Preferences } from './Preferences'
import MatchingRules from './MatchingRules'
import KeyboardShortcuts from './KeyboardShortcuts'
const SettingsPanelsContent = () => {
return (
<>
<SettingsPanel value="preferences">
<Preferences />
</SettingsPanel>
<SettingsPanel value="rules">
<MatchingRules />
</SettingsPanel>
<SettingsPanel value="bank-accounts" />
<SettingsPanel value="masters" />
<SettingsPanel value="keyboard-shortcuts">
<KeyboardShortcuts />
</SettingsPanel>
</>
)
}
export default SettingsPanelsContent

View File

@@ -0,0 +1,196 @@
import * as React from "react"
import { AlertDialog as AlertDialogPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
function AlertDialog({
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
}
function AlertDialogTrigger({
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
return (
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
)
}
function AlertDialogPortal({
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
return (
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
)
}
function AlertDialogOverlay({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
return (
<AlertDialogPrimitive.Overlay
data-slot="alert-dialog-overlay"
className={cn(
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black-200 dark:bg-black-700",
className
)}
{...props}
/>
)
}
function AlertDialogContent({
className,
size = "default",
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
size?: "default" | "sm"
}) {
return (
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
data-slot="alert-dialog-content"
data-size={size}
className={cn(
"bg-surface-modal shadow-xl rounded-xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 p-6 duration-200 data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg",
className
)}
{...props}
/>
</AlertDialogPortal>
)
}
function AlertDialogHeader({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="alert-dialog-header"
className={cn(
"grid grid-rows-[auto_1fr] place-items-center gap-1.5 has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-start sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
className
)}
{...props}
/>
)
}
function AlertDialogFooter({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="alert-dialog-footer"
className={cn(
"flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
className
)}
{...props}
/>
)
}
function AlertDialogTitle({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
return (
<AlertDialogPrimitive.Title
data-slot="alert-dialog-title"
className={cn(
"text-2xl leading-6 text-ink-gray-8 font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
className
)}
{...props}
/>
)
}
function AlertDialogDescription({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
return (
<AlertDialogPrimitive.Description
data-slot="alert-dialog-description"
className={cn("text-ink-gray-7 text-p-base", className)}
{...props}
/>
)
}
function AlertDialogMedia({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="alert-dialog-media"
className={cn(
"bg-surface-gray-1 mb-2 inline-flex size-16 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
className
)}
{...props}
/>
)
}
function AlertDialogAction({
className,
variant = "solid",
size = "md",
theme = "red",
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
Pick<React.ComponentProps<typeof Button>, "variant" | "size" | "theme">) {
return (
<Button variant={variant} size={size} theme={theme} asChild>
<AlertDialogPrimitive.Action
data-slot="alert-dialog-action"
className={cn(className)}
{...props}
/>
</Button>
)
}
function AlertDialogCancel({
className,
variant = "outline",
size = "md",
theme = "gray",
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
Pick<React.ComponentProps<typeof Button>, "variant" | "size" | "theme">) {
return (
<Button variant={variant} size={size} theme={theme} asChild>
<AlertDialogPrimitive.Cancel
data-slot="alert-dialog-cancel"
className={cn(className)}
{...props}
/>
</Button>
)
}
export {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogMedia,
AlertDialogOverlay,
AlertDialogPortal,
AlertDialogTitle,
AlertDialogTrigger,
}

View File

@@ -0,0 +1,104 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const alertVariants = cva(
"relative w-full rounded-lg border px-4 py-3.5 text-base grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-1 [&>svg]:text-current",
{
variants: {
variant: {
subtle: "bg-surface-white",
outline: "border border-outline-gray-3",
},
theme: {
gray: "text-ink-gray-8",
blue: "text-ink-blue-3",
green: "text-ink-green-3",
red: "text-ink-red-3",
amber: "text-ink-amber-3",
}
},
compoundVariants: [
// Subtle alerts
{
theme: "gray",
variant: "subtle",
className: "bg-surface-gray-2 border-outline-gray-1"
},
{
theme: "blue",
variant: "subtle",
className: "bg-surface-blue-2 border-surface-blue-2"
},
{
theme: "green",
variant: "subtle",
className: "bg-surface-green-2 border-surface-green-2"
},
{
theme: "red",
variant: "subtle",
className: "bg-surface-red-2 border-surface-red-2"
},
{
theme: "amber",
variant: "subtle",
className: "bg-surface-amber-2 border-surface-amber-2"
}
],
defaultVariants: {
variant: "subtle",
theme: "gray",
},
}
)
export type AlertProps = React.ComponentProps<"div"> & VariantProps<typeof alertVariants>
function Alert({
className,
variant,
theme,
...props
}: AlertProps) {
return (
<div
data-slot="alert"
role="alert"
className={cn(alertVariants({ variant, theme }), className)}
{...props}
/>
)
}
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="alert-title"
className={cn(
"col-start-2 min-h-4 text-ink-gray-8 font-medium text-p-base",
className
)}
{...props}
/>
)
}
function AlertDescription({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="alert-description"
className={cn(
"text-ink-gray-6 col-start-2 grid justify-items-start gap-1 text-p-base",
className
)}
{...props}
/>
)
}
export { Alert, AlertTitle, AlertDescription }

View File

@@ -0,0 +1,188 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Slot } from "radix-ui"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
"inline-flex items-center justify-center select-none rounded-full whitespace-nowrap gap-1 w-fit shrink-0 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",
{
variants: {
variant: {
solid: "",
subtle: "",
outline: "bg-transparent border",
ghost: "bg-transparent",
},
size: {
sm: 'h-4 text-xs px-1.5 [&>svg]:size-2.5',
md: 'h-5 text-xs px-1.5 [&>svg]:size-3',
lg: 'h-6 text-sm px-2 [&>svg]:size-3',
},
theme: {
gray: "",
blue: "",
green: "",
red: "",
orange: "",
violet: "",
}
},
compoundVariants: [
// Solid badges
{
variant: "solid",
theme: "gray",
className: "text-ink-white bg-surface-gray-7 [a&]:hover:bg-surface-gray-8"
},
{
variant: "solid",
theme: "blue",
className: "text-ink-blue-1 bg-surface-blue-5 [a&]:hover:bg-surface-blue-6"
},
{
variant: "solid",
theme: "green",
className: "text-ink-green-1 bg-surface-green-5 [a&]:hover:bg-surface-green-6"
},
{
variant: "solid",
theme: "orange",
className: "text-ink-amber-1 bg-surface-amber-5 [a&]:hover:bg-surface-amber-6"
},
{
variant: "solid",
theme: "red",
className: "text-ink-red-1 bg-surface-red-5 [a&]:hover:bg-surface-red-6"
},
{
variant: "solid",
theme: "violet",
className: "text-ink-violet-1 bg-surface-violet-5 [a&]:hover:bg-surface-violet-6"
},
// Subtle badge
{
variant: "subtle",
theme: "gray",
className: "text-ink-gray-6 bg-surface-gray-2 [a&]:hover:bg-surface-gray-3"
},
{
variant: "subtle",
theme: "blue",
className: "text-ink-blue-4 bg-surface-blue-2 [a&]:hover:bg-surface-blue-3"
},
{
variant: "subtle",
theme: "green",
className: "text-ink-green-4 bg-surface-green-2 [a&]:hover:bg-surface-green-3"
},
{
variant: "subtle",
theme: "orange",
className: "text-ink-amber-4 bg-surface-amber-2 [a&]:hover:bg-surface-amber-3"
},
{
variant: "subtle",
theme: "red",
className: "text-ink-red-4 bg-surface-red-2 [a&]:hover:bg-surface-red-3"
},
{
variant: "subtle",
theme: "violet",
className: "text-ink-violet-4 bg-surface-violet-2 [a&]:hover:bg-surface-violet-3"
},
// Outline badge
{
variant: "outline",
theme: "gray",
className: "text-ink-gray-6 border-outline-gray-2 [a&]:hover:bg-surface-gray-2"
},
{
variant: "outline",
theme: "blue",
className: "text-ink-blue-4 border-outline-blue-2 [a&]:hover:bg-surface-blue-2"
},
{
variant: "outline",
theme: "green",
className: "text-ink-green-4 border-outline-green-2 [a&]:hover:bg-surface-green-2"
},
{
variant: "outline",
theme: "orange",
className: "text-ink-amber-4 border-outline-amber-2 [a&]:hover:bg-surface-amber-2"
},
{
variant: "outline",
theme: "red",
className: "text-ink-red-4 border-outline-red-2 [a&]:hover:bg-surface-red-2"
},
{
variant: "outline",
theme: "violet",
className: "text-ink-violet-4 border-outline-violet-2 [a&]:hover:bg-surface-violet-2"
},
// Ghost badge
{
variant: "ghost",
theme: "gray",
className: "text-ink-gray-6"
},
{
variant: "ghost",
theme: "blue",
className: "text-ink-blue-4"
},
{
variant: "ghost",
theme: "green",
className: "text-ink-green-4"
},
{
variant: "ghost",
theme: "orange",
className: "text-ink-amber-4"
},
{
variant: "ghost",
theme: "red",
className: "text-ink-red-4"
},
{
variant: "ghost",
theme: "violet",
className: "text-ink-violet-4"
}
],
defaultVariants: {
variant: "subtle",
size: "md",
theme: "gray",
},
}
)
function Badge({
className,
variant = "subtle",
size = "md",
theme = "gray",
asChild = false,
...props
}: React.ComponentProps<"span"> &
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
const Comp = asChild ? Slot.Root : "span"
return (
<Comp
data-slot="badge"
data-variant={variant}
data-size={size}
data-theme={theme}
className={cn(badgeVariants({ variant, size, theme }), className)}
{...props}
/>
)
}
export { Badge, badgeVariants }

View File

@@ -0,0 +1,109 @@
import * as React from "react"
import { MoreHorizontal } from "lucide-react"
import { Slot } from "radix-ui"
import { cn } from "@/lib/utils"
function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />
}
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
return (
<ol
data-slot="breadcrumb-list"
className={cn(
"text-ink-gray-5 flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
className
)}
{...props}
/>
)
}
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
return (
<li
data-slot="breadcrumb-item"
className={cn("inline-flex items-center gap-1.5", className)}
{...props}
/>
)
}
function BreadcrumbLink({
asChild,
className,
...props
}: React.ComponentProps<"a"> & {
asChild?: boolean
}) {
const Comp = asChild ? Slot.Root : "a"
return (
<Comp
data-slot="breadcrumb-link"
className={cn("text-ink-gray-5 font-medium text-lg hover:text-ink-gray-7 active:text-ink-gray-7 transition-colors", className)}
{...props}
/>
)
}
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
return (
<span
data-slot="breadcrumb-page"
role="link"
aria-disabled="true"
aria-current="page"
className={cn("text-ink-gray-8 text-lg font-medium text-balance tracking-wide", className)}
{...props}
/>
)
}
function BreadcrumbSeparator({
children,
className,
...props
}: React.ComponentProps<"li">) {
return (
<li
data-slot="breadcrumb-separator"
role="presentation"
aria-hidden="true"
className={cn("[&>svg]:size-3.5", className)}
{...props}
>
{children ?? <span className="text-ink-gray-4 text-base">/</span>}
</li>
)
}
function BreadcrumbEllipsis({
className,
...props
}: React.ComponentProps<"span">) {
return (
<span
data-slot="breadcrumb-ellipsis"
role="presentation"
aria-hidden="true"
className={cn("flex size-9 items-center justify-center", className)}
{...props}
>
<MoreHorizontal className="size-4" />
<span className="sr-only">More</span>
</span>
)
}
export {
Breadcrumb,
BreadcrumbList,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbPage,
BreadcrumbSeparator,
BreadcrumbEllipsis,
}

View File

@@ -0,0 +1,263 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Slot } from "radix-ui"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap transition-all disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:shadow-focus-red aria-invalid:border-outline-red-3",
{
variants: {
variant: {
solid: "text-ink-white",
subtle: "",
ghost: "bg-transparent",
outline: "bg-surface-white border",
link: "bg-transparent underline-offset-4 underline",
},
size: {
sm: "h-7 text-base px-2 rounded [&_svg:not([class*='size-'])]:size-4",
md: "h-8 text-base font-medium px-2.5 rounded [&_svg:not([class*='size-'])]:size-4.5",
lg: "h-10 text-lg font-medium px-3 rounded-md [&_svg:not([class*='size-'])]:size-5",
xl: "h-11.5 text-xl font-medium px-3.5 rounded-lg [&_svg:not([class*='size-'])]:size-6",
"2xl": "h-13 text-2xl font-medium px-3.5 rounded-xl [&_svg:not([class*='size-'])]:size-6",
},
theme: {
gray: "focus-visible:shadow-focus-gray",
blue: "focus-visible:shadow-focus-blue",
green: "focus-visible:shadow-focus-green",
red: "focus-visible:shadow-focus-red",
amber: "focus-visible:shadow-focus-amber",
violet: "focus-visible:shadow-focus-violet",
},
isIconButton: {
true: "px-0",
false: ""
}
},
compoundVariants: [
// Icon only buttons - Sizes
{
isIconButton: true,
size: "sm",
className: "size-7"
},
{
isIconButton: true,
size: "md",
className: "size-8"
},
{
isIconButton: true,
size: "lg",
className: "size-10"
},
{
isIconButton: true,
size: "xl",
className: "size-11.5"
},
{
isIconButton: true,
size: "2xl",
className: "size-13"
},
// Solid buttons
{
variant: "solid",
theme: "gray",
className: "bg-surface-gray-7 hover:bg-surface-gray-6 active:bg-surface-gray-5 disabled:bg-surface-gray-2 disabled:text-ink-gray-4"
},
{
variant: "solid",
theme: "blue",
className: "bg-surface-blue-5 text-ink-blue-1 hover:bg-surface-blue-6 active:bg-surface-blue-7 disabled:bg-surface-blue-2 disabled:text-ink-blue-2"
},
{
variant: "solid",
theme: "green",
className: "bg-surface-green-5 text-ink-green-1 hover:bg-surface-green-6 active:bg-surface-green-7 disabled:bg-surface-green-2 disabled:text-ink-green-2"
},
{
variant: "solid",
theme: "red",
className: "bg-surface-red-5 text-ink-red-1 hover:bg-surface-red-6 active:bg-surface-red-7 disabled:bg-surface-red-2 disabled:text-ink-red-2"
},
{
variant: "solid",
theme: "violet",
className: "bg-surface-violet-5 text-ink-violet-1 hover:bg-surface-violet-6 active:bg-surface-violet-7 disabled:bg-surface-violet-2 disabled:text-ink-violet-2"
},
{
variant: "solid",
theme: "amber",
className: "bg-surface-amber-5 text-ink-amber-1 hover:bg-surface-amber-6 active:bg-surface-amber-7 disabled:bg-surface-amber-2 disabled:text-ink-amber-2"
},
// Subtle Buttons
{
variant: "subtle",
theme: "gray",
className: "text-ink-gray-7 bg-surface-gray-2 hover:bg-surface-gray-3 active:bg-surface-gray-4 disabled:bg-surface-gray-2 disabled:text-ink-gray-4"
},
{
variant: "subtle",
theme: "blue",
className: "text-ink-blue-4 bg-surface-blue-2 hover:bg-surface-blue-3 active:bg-surface-blue-4 disabled:bg-surface-blue-2 disabled:text-ink-blue-2"
},
{
variant: "subtle",
theme: "green",
className: "text-ink-green-4 bg-surface-green-2 hover:bg-surface-green-3 active:bg-surface-green-4 disabled:bg-surface-green-2 disabled:text-ink-green-2"
},
{
variant: "subtle",
theme: "red",
className: "text-ink-red-4 bg-surface-red-2 hover:bg-surface-red-3 active:bg-surface-red-4 disabled:bg-surface-red-2 disabled:text-ink-red-2"
},
{
variant: "subtle",
theme: "violet",
className: "text-ink-violet-4 bg-surface-violet-2 hover:bg-surface-violet-3 active:bg-surface-violet-4 disabled:bg-surface-violet-2 disabled:text-ink-violet-2"
},
{
variant: "subtle",
theme: "amber",
className: "text-ink-amber-4 bg-surface-amber-2 hover:bg-surface-amber-3 active:bg-surface-amber-4 disabled:bg-surface-amber-2 disabled:text-ink-amber-2"
},
// Outline buttons
{
variant: "outline",
theme: "gray",
className:
"text-ink-gray-7 border-outline-gray-2 hover:border-outline-gray-3 active:border-outline-gray-4 active:bg-surface-gray-4 disabled:bg-surface-gray-2 disabled:text-ink-gray-4 disabled:border-outline-gray-2"
},
{
variant: "outline",
theme: "blue",
className:
"text-ink-blue-4 border-outline-blue-2 hover:border-outline-blue-3 active:border-outline-blue-4 active:bg-surface-blue-4 disabled:bg-surface-blue-2 disabled:text-ink-blue-2 disabled:border-outline-blue-2"
},
{
variant: "outline",
theme: "green",
className:
"text-ink-green-4 border-outline-green-2 hover:border-outline-green-3 active:border-outline-green-4 active:bg-surface-green-4 disabled:bg-surface-green-2 disabled:text-ink-green-2 disabled:border-outline-green-2"
},
{
variant: "outline",
theme: "red",
className:
"text-ink-red-4 border-outline-red-2 hover:border-outline-red-3 active:border-outline-red-4 active:bg-surface-red-4 disabled:bg-surface-red-2 disabled:text-ink-red-2 disabled:border-outline-red-2"
},
{
variant: "outline",
theme: "violet",
className: "text-ink-violet-4 border-outline-violet-2 hover:border-outline-violet-3 active:border-outline-violet-4 active:bg-surface-violet-4 disabled:bg-surface-violet-2 disabled:text-ink-violet-2 disabled:border-outline-violet-2"
},
{
variant: "outline",
theme: "amber",
className: "text-ink-amber-4 border-outline-amber-2 hover:border-outline-amber-3 active:border-outline-amber-4 active:bg-surface-amber-4 disabled:bg-surface-amber-2 disabled:text-ink-amber-2 disabled:border-outline-amber-2"
},
// Ghost buttons
{
variant: "ghost",
theme: "gray",
className:
"text-ink-gray-7 hover:bg-surface-gray-3 active:bg-surface-gray-4 disabled:text-ink-gray-4"
},
{
variant: "ghost",
theme: "blue",
className:
"text-ink-blue-4 hover:bg-surface-blue-3 active:bg-surface-blue-4 disabled:text-ink-blue-2"
},
{
variant: "ghost",
theme: "green",
className:
"text-ink-green-4 hover:bg-surface-green-3 active:bg-surface-green-4 disabled:text-ink-green-2"
},
{
variant: "ghost",
theme: "red",
className:
"text-ink-red-4 hover:bg-surface-red-3 active:bg-surface-red-4 disabled:text-ink-red-2"
},
{
variant: "ghost",
theme: "violet",
className: "text-ink-violet-4 hover:bg-surface-violet-3 active:bg-surface-violet-4 disabled:text-ink-violet-2"
},
{
variant: "ghost",
theme: "amber",
className: "text-ink-amber-4 hover:bg-surface-amber-3 active:bg-surface-amber-4 disabled:text-ink-amber-2"
},
//Link buttons
{
variant: "link",
theme: "gray",
className: "text-ink-gray-8 hover:text-ink-gray-8 active:text-ink-gray-8 disabled:text-ink-gray-4"
},
{
variant: "link",
theme: "blue",
className: "text-ink-blue-3 hover:text-ink-blue-4 active:text-ink-blue-4 disabled:text-ink-blue-link"
},
{
variant: "link",
theme: "green",
className: "text-ink-green-3 hover:text-ink-green-4 active:text-ink-green-4 disabled:text-ink-green-2"
},
{
variant: "link",
theme: "red",
className: "text-ink-red-3 hover:text-ink-red-4 active:text-red-4 disabled:text-ink-red-2"
},
{
variant: "link",
theme: "violet",
className: "text-ink-violet-3 hover:text-ink-violet-4 active:text-ink-violet-4 disabled:text-ink-violet-2"
},
{
variant: "link",
theme: "amber",
className: "text-ink-amber-3 hover:text-ink-amber-4 active:text-ink-amber-4 disabled:text-ink-amber-2"
}
],
defaultVariants: {
variant: "solid",
size: "sm",
theme: "gray",
},
}
)
function Button({
className,
variant = "solid",
size = "sm",
theme = "gray",
isIconButton = false,
asChild = false,
...props
}: React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean
}) {
const Comp = asChild ? Slot.Root : "button"
return (
<Comp
data-slot="button"
data-variant={variant}
data-size={size}
data-theme={theme}
className={cn(buttonVariants({ variant, size, theme, className, isIconButton }))}
{...props}
/>
)
}
export { Button, buttonVariants }

View File

@@ -0,0 +1,218 @@
import * as React from "react"
import {
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
} from "lucide-react"
import {
DayPicker,
getDefaultClassNames,
type DayButton,
} from "react-day-picker"
import { cn } from "@/lib/utils"
import { Button, buttonVariants } from "@/components/ui/button"
function Calendar({
className,
classNames,
showOutsideDays = true,
captionLayout = "label",
buttonVariant = "ghost",
formatters,
components,
...props
}: React.ComponentProps<typeof DayPicker> & {
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
}) {
const defaultClassNames = getDefaultClassNames()
return (
<DayPicker
showOutsideDays={showOutsideDays}
className={cn(
"bg-surface-modal group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
className
)}
captionLayout={captionLayout}
formatters={{
formatMonthDropdown: (date) =>
date.toLocaleString("default", { month: "short" }),
...formatters,
}}
classNames={{
root: cn("w-fit", defaultClassNames.root),
months: cn(
"flex gap-4 flex-col md:flex-row relative",
defaultClassNames.months
),
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
nav: cn(
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
defaultClassNames.nav
),
button_previous: cn(
buttonVariants({ variant: buttonVariant }),
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
defaultClassNames.button_previous
),
button_next: cn(
buttonVariants({ variant: buttonVariant }),
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
defaultClassNames.button_next
),
month_caption: cn(
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
defaultClassNames.month_caption
),
dropdowns: cn(
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
defaultClassNames.dropdowns
),
dropdown_root: cn(
"relative has-focus:border-outline-gray-1 border border-outline-gray-2 shadow-xs has-focus:ring-outline-gray-1/50 has-focus:ring-[3px] rounded-md",
defaultClassNames.dropdown_root
),
dropdown: cn(
"absolute bg-surface-modal inset-0 opacity-0",
defaultClassNames.dropdown
),
caption_label: cn(
"select-none font-medium",
captionLayout === "label"
? "text-sm"
: "rounded-md ps-2 pe-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-ink-gray-5 [&>svg]:size-3.5",
defaultClassNames.caption_label
),
table: "w-full border-collapse",
weekdays: cn("flex", defaultClassNames.weekdays),
weekday: cn(
"text-ink-gray-5 rounded-md flex-1 font-normal text-[0.8rem] select-none",
defaultClassNames.weekday
),
week: cn("flex w-full mt-2", defaultClassNames.week),
week_number_header: cn(
"select-none w-(--cell-size)",
defaultClassNames.week_number_header
),
week_number: cn(
"text-[0.8rem] select-none text-ink-gray-5",
defaultClassNames.week_number
),
day: cn(
"relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-e-md group/day aspect-square select-none",
props.showWeekNumber
? "[&:nth-child(2)[data-selected=true]_button]:rounded-s-md"
: "[&:first-child[data-selected=true]_button]:rounded-s-md",
defaultClassNames.day
),
range_start: cn(
"rounded-s-md bg-surface-gray-1",
defaultClassNames.range_start
),
range_middle: cn("rounded-none", defaultClassNames.range_middle),
range_end: cn("rounded-e-md bg-surface-gray-1", defaultClassNames.range_end),
today: cn(
"bg-surface-gray-1 text-ink-gray-8 rounded-md data-[selected=true]:rounded-none",
defaultClassNames.today
),
outside: cn(
"text-ink-gray-5 aria-selected:text-ink-gray-5",
defaultClassNames.outside
),
disabled: cn(
"text-ink-gray-5 opacity-50",
defaultClassNames.disabled
),
hidden: cn("invisible", defaultClassNames.hidden),
...classNames,
}}
components={{
Root: ({ className, rootRef, ...props }) => {
return (
<div
data-slot="calendar"
ref={rootRef}
className={cn(className)}
{...props}
/>
)
},
Chevron: ({ className, orientation, ...props }) => {
if (orientation === "left") {
return (
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
)
}
if (orientation === "right") {
return (
<ChevronRightIcon
className={cn("size-4", className)}
{...props}
/>
)
}
return (
<ChevronDownIcon className={cn("size-4", className)} {...props} />
)
},
DayButton: CalendarDayButton,
WeekNumber: ({ children, ...props }) => {
return (
<td {...props}>
<div className="flex size-(--cell-size) items-center justify-center text-center">
{children}
</div>
</td>
)
},
...components,
}}
{...props}
/>
)
}
function CalendarDayButton({
className,
day,
modifiers,
...props
}: React.ComponentProps<typeof DayButton>) {
const defaultClassNames = getDefaultClassNames()
const ref = React.useRef<HTMLButtonElement>(null)
React.useEffect(() => {
if (modifiers.focused) ref.current?.focus()
}, [modifiers.focused])
return (
<Button
ref={ref}
variant="ghost"
isIconButton
data-day={day.date.toLocaleDateString()}
data-selected-single={
modifiers.selected &&
!modifiers.range_start &&
!modifiers.range_end &&
!modifiers.range_middle
}
data-range-start={modifiers.range_start}
data-range-end={modifiers.range_end}
data-range-middle={modifiers.range_middle}
className={cn(
"data-[selected-single=true]:bg-surface-gray-7 data-[selected-single=true]:text-ink-white data-[range-middle=true]:bg-surface-gray-1 data-[range-middle=true]:text-ink-gray-8 data-[range-start=true]:bg-surface-gray-7 data-[range-start=true]:text-ink-white data-[range-end=true]:bg-surface-gray-7 data-[range-end=true]:text-ink-white group-data-[focused=true]/day:border-outline-gray-1 group-data-[focused=true]/day:ring-outline-gray-1/50 dark:hover:text-ink-gray-8 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-e-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-s-md [&>span]:text-xs [&>span]:opacity-70",
defaultClassNames.day,
className
)}
{...props}
/>
)
}
export { Calendar, CalendarDayButton }

View File

@@ -0,0 +1,92 @@
import * as React from "react"
import { cn } from "@/lib/utils"
function Card({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card"
className={cn(
"bg-surface-cards text-ink-gray-8 flex flex-col gap-6 rounded-xl border py-6 shadow-xs",
className
)}
{...props}
/>
)
}
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-header"
className={cn(
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
className
)}
{...props}
/>
)
}
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-title"
className={cn("leading-none font-semibold", className)}
{...props}
/>
)
}
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-description"
className={cn("text-ink-gray-5 text-sm", className)}
{...props}
/>
)
}
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-action"
className={cn(
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
className
)}
{...props}
/>
)
}
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-content"
className={cn("px-6", className)}
{...props}
/>
)
}
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-footer"
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
{...props}
/>
)
}
export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardAction,
CardDescription,
CardContent,
}

View File

@@ -0,0 +1,44 @@
import * as React from "react"
import { CheckIcon } from "lucide-react"
import { Checkbox as CheckboxPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function Checkbox({
className,
size = "md",
...props
}: React.ComponentProps<typeof CheckboxPrimitive.Root> & { size?: "sm" | "md" }) {
return (
<CheckboxPrimitive.Root
data-slot="checkbox"
className={cn(
"peer border data-[state=checked]:text-ink-white shrink-0 transition-shadow outline-none align-middle",
"rounded-[4px]",
"border-ink-gray-4 data-[state=checked]:bg-ink-gray-8 data-[state=checked]:border-ink-gray-8",
// Hover state
"hover:border-ink-gray-5 hover:shadow-checkbox-hover hover:data-[state=checked]:bg-ink-gray-7 hover:data-[state=checked]:border-ink-gray-7",
// Active state
"active:border-ink-gray-6 active:data-[state=checked]:bg-ink-gray-6 active:data-[state=checked]:border-ink-gray-6",
// Focus state
"focus-visible:border-ink-gray-8 focus-visible:shadow-focus-gray focus-visible:data-[state=checked]:bg-ink-gray-8 focus-visible:data-[state=checked]:border-ink-gray-8",
// Disabled state
"disabled:border-ink-gray-3 disabled:bg-surface-gray-1 disabled:cursor-not-allowed disabled:data-[state=checked]:bg-surface-gray-3 disabled:data-[state=checked]:border-surface-gray-3 disabled:text-ink-gray-4",
// Invalid state
"aria-invalid:border-red-500",
size === "sm" ? "size-3.5" : "size-4",
className
)}
{...props}
>
<CheckboxPrimitive.Indicator
data-slot="checkbox-indicator"
className="grid place-content-center text-current transition-none"
>
<CheckIcon className={size === 'sm' ? "size-2.5" : "size-3"} />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
)
}
export { Checkbox }

View File

@@ -0,0 +1,183 @@
import * as React from "react"
import { Command as CommandPrimitive } from "cmdk"
import { SearchIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog"
function Command({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive>) {
return (
<CommandPrimitive
data-slot="command"
className={cn(
"bg-surface-modal flex h-full w-full flex-col overflow-hidden rounded-md",
className
)}
{...props}
/>
)
}
function CommandDialog({
title = "Command Palette",
description = "Search for a command to run...",
children,
className,
showCloseButton = true,
...props
}: React.ComponentProps<typeof Dialog> & {
title?: string
description?: string
className?: string
showCloseButton?: boolean
}) {
return (
<Dialog {...props}>
<DialogHeader className="sr-only">
<DialogTitle>{title}</DialogTitle>
<DialogDescription>{description}</DialogDescription>
</DialogHeader>
<DialogContent
className={cn("overflow-hidden p-0", className)}
showCloseButton={showCloseButton}
>
<Command className="[&_[cmdk-group-heading]]:text-ink-gray-4 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
{children}
</Command>
</DialogContent>
</Dialog>
)
}
function CommandInput({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
return (
<div
data-slot="command-input-wrapper"
className="flex items-center gap-2 m-1.5 h-8 rounded px-2.5 py-2 border border-transparent transition-all bg-surface-gray-2 not-focus-within:hover:bg-surface-gray-3 text-ink-gray-7 focus-within:bg-surface-white focus-within:border-outline-gray-4 focus-within:shadow-focus-gray"
>
<SearchIcon className="size-4 shrink-0 text-ink-gray-4" />
<CommandPrimitive.Input
data-slot="command-input"
className={cn(
"flex w-full bg-transparent outline-hidden text-base placeholder:text-ink-gray-4",
className
)}
{...props}
/>
</div>
)
}
function CommandList({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive.List>) {
return (
<CommandPrimitive.List
data-slot="command-list"
className={cn(
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
className
)}
{...props}
/>
)
}
function CommandEmpty({
...props
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
return (
<CommandPrimitive.Empty
data-slot="command-empty"
className="py-6 text-center text-sm"
{...props}
/>
)
}
function CommandGroup({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
return (
<CommandPrimitive.Group
data-slot="command-group"
className={cn(
"text-ink-gray-6 [&_[cmdk-group-heading]]:text-ink-gray-4 overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-medium",
className
)}
{...props}
/>
)
}
function CommandSeparator({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
return (
<CommandPrimitive.Separator
data-slot="command-separator"
className={cn("bg-outline-gray-modals mx-0.5 h-px my-1", className)}
{...props}
/>
)
}
function CommandItem({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
return (
<CommandPrimitive.Item
data-slot="command-item"
className={cn(
"py-1.5 px-2 flex cursor-default text-ink-gray-6 items-center gap-2 rounded text-base relative outline-hidden select-none",
"data-[selected=true]:bg-surface-gray-2 [&_svg:not([class*='text-'])]:text-ink-gray-6 data-[disabled=true]:pointer-events-none data-[disabled=true]:text-ink-gray-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
/>
)
}
function CommandShortcut({
className,
...props
}: React.ComponentProps<"span">) {
return (
<span
data-slot="command-shortcut"
className={cn(
"text-ink-gray-5 ms-auto text-xs tracking-widest",
className
)}
{...props}
/>
)
}
export {
Command,
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandShortcut,
CommandSeparator,
}

View File

@@ -0,0 +1,156 @@
import * as React from "react"
import { XIcon } from "lucide-react"
import { Dialog as DialogPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
function Dialog({
...props
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
return <DialogPrimitive.Root data-slot="dialog" {...props} />
}
function DialogTrigger({
...props
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
}
function DialogPortal({
...props
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
}
function DialogClose({
...props
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
}
function DialogOverlay({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
return (
<DialogPrimitive.Overlay
data-slot="dialog-overlay"
className={cn(
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black-200 dark:bg-black-700",
className
)}
{...props}
/>
)
}
function DialogContent({
className,
children,
showCloseButton = true,
...props
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
showCloseButton?: boolean
}) {
return (
<DialogPortal data-slot="dialog-portal">
<DialogOverlay />
<DialogPrimitive.Content
data-slot="dialog-content"
className={cn(
"bg-surface-modal shadow-xl rounded-xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 p-6 duration-200 outline-none sm:max-w-lg max-h-[90vh] overflow-y-auto",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
className="data-[state=open]:bg-surface-gray-1 data-[state=open]:text-ink-gray-8 absolute top-4 ltr:right-4 rtl:left-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
>
<XIcon className="w-4 h-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</DialogPortal>
)
}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2 sm:text-start", className)}
{...props}
/>
)
}
function DialogFooter({
className,
showCloseButton = false,
children,
...props
}: React.ComponentProps<"div"> & {
showCloseButton?: boolean
}) {
return (
<div
data-slot="dialog-footer"
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close asChild>
<Button variant="outline">Close</Button>
</DialogPrimitive.Close>
)}
</div>
)
}
function DialogTitle({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
className={cn("text-2xl leading-6 text-ink-gray-8 font-semibold", className)}
{...props}
/>
)
}
function DialogDescription({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn("text-ink-gray-7 text-p-base", className)}
{...props}
/>
)
}
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
}

View File

@@ -0,0 +1,20 @@
import * as React from "react"
import { Direction } from "radix-ui"
function DirectionProvider({
dir,
direction,
children,
}: React.ComponentProps<typeof Direction.DirectionProvider> & {
direction?: React.ComponentProps<typeof Direction.DirectionProvider>["dir"]
}) {
return (
<Direction.DirectionProvider dir={direction ?? dir}>
{children}
</Direction.DirectionProvider>
)
}
const useDirection = Direction.useDirection
export { DirectionProvider, useDirection }

View File

@@ -0,0 +1,262 @@
import * as React from "react"
import { CheckIcon, ChevronRightIcon } from "lucide-react"
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function DropdownMenu({
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
}
function DropdownMenuPortal({
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
return (
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
)
}
function DropdownMenuTrigger({
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
return (
<DropdownMenuPrimitive.Trigger
data-slot="dropdown-menu-trigger"
{...props}
/>
)
}
function DropdownMenuContent({
className,
sideOffset = 4,
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
return (
<DropdownMenuPrimitive.Portal>
<DropdownMenuPrimitive.Content
data-slot="dropdown-menu-content"
sideOffset={sideOffset}
className={cn(
"bg-surface-modal min-w-32 rounded-lg p-1 shadow-xl",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto",
className
)}
{...props}
/>
</DropdownMenuPrimitive.Portal>
)
}
function DropdownMenuGroup({
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
return (
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
)
}
const BASE_ITEM_STYLES = `outline-hidden select-none relative flex cursor-default items-center
gap-2 rounded px-2 py-1.5 text-base text-ink-gray-6 data-[variant=destructive]:text-ink-red-3
data-[variant=destructive]:*:[svg]:text-ink-red-3! [&_svg:not([class*='text-'])]:text-ink-gray-6 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0
data-disabled:pointer-events-none data-disabled:text-ink-gray-3 data-disabled:*:[svg]:text-ink-gray-3! focus:bg-surface-gray-2 data-inset:ps-8`
function DropdownMenuItem({
className,
inset,
variant = "default",
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean
variant?: "default" | "destructive"
}) {
return (
<DropdownMenuPrimitive.Item
data-slot="dropdown-menu-item"
data-inset={inset}
data-variant={variant}
className={cn(
BASE_ITEM_STYLES,
className
)}
{...props}
/>
)
}
function DropdownMenuCheckboxItem({
className,
children,
checked,
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
return (
<DropdownMenuPrimitive.CheckboxItem
data-slot="dropdown-menu-checkbox-item"
className={cn(
BASE_ITEM_STYLES,
className
)}
checked={checked}
{...props}
>
{children}
<span className="pointer-events-none flex size-4 ms-2 px-2 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<CheckIcon className="size-4" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
</DropdownMenuPrimitive.CheckboxItem>
)
}
function DropdownMenuRadioGroup({
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
return (
<DropdownMenuPrimitive.RadioGroup
data-slot="dropdown-menu-radio-group"
{...props}
/>
)
}
function DropdownMenuRadioItem({
className,
children,
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
return (
<DropdownMenuPrimitive.RadioItem
data-slot="dropdown-menu-radio-item"
className={cn(
BASE_ITEM_STYLES,
className
)}
{...props}
>
{children}
<span className="pointer-events-none flex size-4 ps-2 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<CheckIcon className="size-4" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
</DropdownMenuPrimitive.RadioItem>
)
}
function DropdownMenuLabel({
className,
inset,
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
inset?: boolean
}) {
return (
<DropdownMenuPrimitive.Label
data-slot="dropdown-menu-label"
data-inset={inset}
className={cn(
"px-2 py-1.5 text-sm font-medium text-ink-gray-4 data-inset:ps-8",
className
)}
{...props}
/>
)
}
function DropdownMenuSeparator({
className,
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
return (
<DropdownMenuPrimitive.Separator
data-slot="dropdown-menu-separator"
className={cn("bg-outline-gray-modals my-1 h-px mx-0.5", className)}
{...props}
/>
)
}
function DropdownMenuShortcut({
className,
...props
}: React.ComponentProps<"span">) {
return (
<span
data-slot="dropdown-menu-shortcut"
className={cn(
"text-ink-gray-5 ms-auto text-xs tabular-nums",
className
)}
{...props}
/>
)
}
function DropdownMenuSub({
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
}
function DropdownMenuSubTrigger({
className,
inset,
children,
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
inset?: boolean
}) {
return (
<DropdownMenuPrimitive.SubTrigger
data-slot="dropdown-menu-sub-trigger"
data-inset={inset}
className={cn(
BASE_ITEM_STYLES,
"data-[state=open]:bg-surface-gray-3",
className
)}
{...props}
>
{children}
<ChevronRightIcon className="ms-auto cn-rtl-flip size-4" />
</DropdownMenuPrimitive.SubTrigger>
)
}
function DropdownMenuSubContent({
className,
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
return (
<DropdownMenuPrimitive.SubContent
data-slot="dropdown-menu-sub-content"
className={cn(
"bg-surface-modal rounded-lg p-1 shadow-xl min-w-32 text-ink-gray-6 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden",
className
)}
{...props}
/>
)
}
export {
DropdownMenu,
DropdownMenuPortal,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuLabel,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuSubContent,
}

View File

@@ -0,0 +1,85 @@
import { cn } from "@/lib/utils"
function Empty({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty"
className={cn(
"flex min-w-0 min-h-64 flex-1 flex-col items-center justify-center gap-3 rounded-lg p-6 text-center text-balance",
className
)}
{...props}
/>
)
}
function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-header"
className={cn(
"flex flex-col items-center gap-1 text-center",
className
)}
{...props}
/>
)
}
function EmptyMedia({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-icon"
className={cn("flex justify-center items-center shrink-0 [&_svg]:pointer-events-none [&_svg]:shrink-0 bg-transparent size-7.5 [&_svg:not([class*='size-'])]:size-7.5 [&_svg:not([class*='text-'])]:text-ink-gray-5", className)}
{...props}
/>
)
}
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-title"
className={cn("text-lg font-medium text-ink-gray-7", className)}
{...props}
/>
)
}
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
return (
<div
data-slot="empty-description"
className={cn(
"text-center text-p-base text-ink-gray-6 [&>a:hover]:text-ink-gray-7 [&>a]:underline [&>a]:underline-offset-4",
className
)}
{...props}
/>
)
}
function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-content"
className={cn(
"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
className
)}
{...props}
/>
)
}
export {
Empty,
EmptyHeader,
EmptyTitle,
EmptyDescription,
EmptyContent,
EmptyMedia,
}

View File

@@ -0,0 +1,51 @@
import { getErrorMessages } from '@/lib/frappe'
import { FrappeError } from 'frappe-react-sdk'
import { Alert, AlertDescription, AlertProps, AlertTitle } from '@/components/ui/alert'
import { AlertCircle } from 'lucide-react'
import MarkdownRenderer from '@/components/ui/markdown'
import _ from '@/lib/translate'
import { useMemo } from 'react'
type ErrorBannerProps = AlertProps & {
error?: FrappeError | null,
overrideHeading?: string,
}
interface ParsedErrorMessage {
message: string,
title?: string,
indicator?: string,
}
const parseHeading = (message?: ParsedErrorMessage) => {
if (message?.title === 'Message' || message?.title === 'Error') return _("There was an error.")
return message?.title
}
const ErrorBanner = ({ error, overrideHeading, ...props }: ErrorBannerProps) => {
//exc_type: "ValidationError" or "PermissionError" etc
// exc: With entire traceback - useful for reporting maybe
// httpStatus and httpStatusText - not needed
// _server_messages: Array of messages - useful for showing to user
// console.log(JSON.parse(error?._server_messages!))
const messages = useMemo(() => {
return getErrorMessages(error)
}, [error])
return (
<Alert theme={messages[0]?.indicator === 'yellow' ? 'amber' : "red"} {...props}>
<AlertCircle />
<AlertTitle>{overrideHeading ?? parseHeading(messages[0])}</AlertTitle>
<AlertDescription>
{messages.map((m, i) => {
return <MarkdownRenderer content={m.message} key={i} />
})}
</AlertDescription>
</Alert>
)
}
export default ErrorBanner

View File

@@ -0,0 +1,289 @@
import _ from '@/lib/translate'
import { Dispatch, SetStateAction, useCallback } from 'react'
import { Accept, useDropzone } from 'react-dropzone'
import { cn } from '@/lib/utils'
import { formatBytes, getFileExtension } from '@/lib/file'
import { Button } from './button'
import { Trash2Icon } from 'lucide-react'
type Props = {
files: File[],
setFiles?: Dispatch<SetStateAction<File[]>>
accept?: Accept,
multiple?: boolean
onDrop?: (acceptedFiles: File[]) => void,
onUpdate?: VoidFunction
className?: string
}
export const FileDropzone = ({ files, setFiles, accept, multiple = true, onDrop, className, onUpdate }: Props) => {
const onFileDrop = useCallback((acceptedFiles: File[]) => {
// Do something with the files
if (multiple) {
setFiles?.((prev) => [...prev, ...acceptedFiles])
} else {
setFiles?.(acceptedFiles)
}
onDrop?.(acceptedFiles)
onUpdate?.()
}, [setFiles, onDrop, multiple, onUpdate])
const { getRootProps, getInputProps } = useDropzone({ onDrop: onFileDrop, accept, multiple })
return (
<div {...getRootProps()} className={cn('border border-outline-gray-2 border-dashed p-4 rounded bg-surface-gray-1 focus-within:bg-surface-gray-2 hover:bg-surface-gray-2 hover:border-outline-gray-3 focus-within:border-outline-gray-3 focus-within:outline-none', className)}>
<input {...getInputProps()} />
{files.length === 0 ? <p className='text-sm text-ink-gray-5 text-center h-8 flex items-center justify-center'>{multiple ? _("Drop some files here, or click to select files") : _("Drop a file here, or click to select a file")}</p> : null}
<div className='flex flex-col gap-4'>
{files.map(f => <div key={f.name} className='flex justify-between items-center'>
<div className='flex items-center gap-2'>
<FileTypeIcon fileType={getFileExtension(f.name)} size='sm' />
<div className='flex flex-col gap-0.5'>
<span className='text-ink-gray-7 text-sm'>{f.name}</span>
<span className='text-ink-gray-5 text-xs'>{formatBytes(f.size)}</span>
</div>
</div>
<Button type='button' variant='ghost' isIconButton
className='text-ink-gray-5 hover:text-ink-gray-8 hover:bg-transparent'
onClick={(e) => {
e.stopPropagation()
setFiles?.(files.filter(file => file.name !== f.name))
onUpdate?.()
}}>
<Trash2Icon className='w-4 h-4' />
</Button>
</div>)}
</div>
</div>
)
}
interface FileTypeIconProps {
fileType: string
size?: 'sm' | 'md' | 'lg' | 'xl'
className?: string
showBackground?: boolean
}
const sizeClasses = {
sm: 'h-8 w-8',
md: 'h-10 w-10',
lg: 'h-12 w-12',
xl: 'h-16 w-16'
}
const iconSizeClasses = {
sm: 'h-5 w-5',
md: 'h-6 w-6',
lg: 'h-8 w-8',
xl: 'h-10 w-10'
}
// Special sizing for PowerPoint icon due to different viewBox
const pptIconSizeClasses = {
sm: 'h-3.5 w-3.5',
md: 'h-4 w-4',
lg: 'h-5 w-5',
xl: 'h-6 w-6'
}
export const FileTypeIcon = ({
fileType,
size = 'md',
className,
showBackground = true
}: FileTypeIconProps) => {
const containerClass = cn(sizeClasses[size], className)
const RenderIcon = ({ className }: { className?: string }) => {
switch (fileType.toLowerCase()) {
case 'pdf':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M7 22.9c.1-.6.5-1 .9-1.4.5-.5 1.1-.8 1.8-1.2.7-.4 1.4-.7 2.1-1 .1 0 .2-.1.2-.2.6-1.2 1.2-2.4 1.7-3.6.3-.7.5-1.4.8-2.1v-.1c-.3-.7-.6-1.5-.7-2.3-.2-.8-.2-1.6-.1-2.4.1-.5.4-.9.8-1.3.1-.1.3-.1.5-.1h.8c.2 0 .4.1.5.3.3.2.5.5.7.8.2.4.2.8.3 1.2 0 1.2-.2 2.3-.4 3.4-.1.4-.2.7-.3 1.1v.1c.6 1.1 1.4 2.1 2.2 3 .1.1.1.1.3.1 1.1-.2 2.2-.2 3.2-.2.6 0 1.3.1 1.9.4.3.2.6.4.8.7.1.2.2.4.2.6v.7c0 .2-.1.4-.3.5-.2.2-.4.5-.8.5-.2 0-.5.1-.7.1-1.6.1-2.9-.4-4.2-1.3-.2-.2-.5-.4-.7-.6-.1 0-.1-.1-.2-.1-.6.1-1.2.2-1.8.4-.8.2-1.6.5-2.4.7-.1 0-.1.1-.2.1-.5.9-1.1 1.8-1.7 2.6-.5.6-1.1 1.2-1.7 1.7-.3.2-.7.4-1.1.5h-.8c-.2 0-.3 0-.5-.1-.5-.2-.9-.6-1-1.1-.1 0-.1-.2-.1-.4zm8.8-7c-.3.8-.7 1.6-1 2.4l2.4-.6c-.5-.6-1-1.3-1.4-1.8zm4.3 2.6c.6.4 1.3.7 2 .9.3.1.5 0 .7-.1.2-.1.3-.4.1-.5 0-.1-.1-.1-.2-.1-.2-.1-.5-.1-.8-.2-.6-.1-1.2-.1-1.8 0zm-9.4 2.8s-.1 0 0 0c-.6.3-1.2.7-1.7 1.1-.3.2-.5.5-.7.8v.2c.1.1.1.1.2.1.3-.2.5-.4.7-.5.6-.5 1-1.1 1.5-1.7zM15 11.2c.1 0 .1 0 0 0 .2-.6.3-1.2.3-1.7 0-.3 0-.6-.1-.9 0-.1-.1-.1-.2-.1s-.1.1-.2.1c-.2.3-.2.6-.2 1 0 .3 0 .5.1.8.2.2.2.5.3.8z" fill="currentColor" />
</svg>
)
case 'doc':
case 'docx':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M26 11.4V8.8c0-.4-.3-.8-.8-.8h-7.3V6.2h-1.4c-.2 0-.3.1-.5.1-.7.1-1.4.3-2.1.4-.7.1-1.4.2-2 .4-.7.1-1.4.2-2.2.4-.8.1-1.5.2-2.2.3-.5.1-1 .2-1.4.2H6v15.9c.8.1 1.6.3 2.4.4.8.1 1.7.3 2.5.4.8.1 1.6.3 2.4.4.8.1 1.7.3 2.5.5.3.1.7.1 1 .1h.9V24c0-.1 0-.1.1-.1h7.3c.1 0 .3 0 .4-.1.2 0 .3-.1.3-.3 0-.2.1-.3.1-.5V11.4c.1.1.1.1.1 0zm-11 1.5l-.9 3.9c-.2.7-.3 1.4-.5 2.2 0 .1-.1.1-.1.1-.2.1-.4 0-.6 0h-.6c-.1 0-.1 0-.1-.1-.1-.6-.3-1.3-.4-1.9-.2-.8-.3-1.6-.5-2.4 0 .2-.1.4-.1.6l-.6 3c0 .2-.1.5-.1.7 0 .1 0 .1-.1.1-.4 0-.8-.1-1.2-.1-.1 0-.1 0-.1-.1-.3-1.6-.6-3.2-1-4.9-.1-.3-.1-.7-.2-1v-.1h1.2c.2 1.4.5 2.8.7 4.3 0-.2.1-.4.1-.6.3-1.2.5-2.5.8-3.7 0-.1 0-.1.1-.1h1c.2 0 .2 0 .3.2.3 1.4.6 2.8.9 4.3v.1c.1-.8.3-1.6.4-2.4.1-.7.3-1.5.4-2.2 0 0 0-.1.1-.1.4 0 .8 0 1.3-.1h.1c-.2 0-.3.2-.3.3zm10.3-4.1s0 .1 0 0v14.5h-7.5v-1.8h5.9v-.9H18c-.1 0-.1 0-.1-.1v-.9c0-.1 0-.1.1-.1h5.8v-.9h-5.9v-1.1h5.8v-.9h-5.9v-1h5.8c.1 0 .1 0 .1-.1v-.7c0-.1 0-.1-.1-.1H18c-.1 0-.1 0-.1-.1v-1h5.9v-.9h-5.7c-.1 0-.1 0-.1-.1v-.9c0-.1 0-.1.1-.1h5.7v-.9h-5.9v-1.2h5.8c.1 0 .1 0 .1-.1v-.7c0-.1 0-.1-.1-.1h-5.9V9c0-.1 0-.1.1-.1h7.3c.1-.2.1-.2.1-.1z" fill="currentColor" />
</svg>
)
case 'xls':
case 'xlsx':
case 'csv':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M26 9.3v13.6c0 .1-.1.2-.1.3-.2.3-.5.5-.8.5h-7.7v2c-.3-.1-.7-.1-1-.2-.7-.1-1.5-.3-2.2-.4-.8-.1-1.6-.3-2.4-.4-.8-.1-1.6-.3-2.4-.4-.7-.1-1.5-.3-2.2-.4-.4-.1-.7-.1-1.1-.2V9c.1 0 .3-.1.4-.1.7-.5 1.5-.7 2.3-.8.7-.1 1.4-.3 2-.4.6-.1 1.3-.2 1.9-.4.7-.1 1.5-.3 2.2-.4.8-.1 1.5-.3 2.3-.4h.1v1.9h7.8c.4 0 .8.3.9.7v.2zm-.8-.1h-7.9v1.2H20v1.7h-2.7v.6H20v1.7h-2.7v.6H20v1.7h-2.7v.7h2.8v1.7h-2.8v.6H20v1.7h-2.7v1.2h7.9V9.2zM14.7 20.7s0-.1-.1-.1c-.7-1.4-1.5-2.8-2.2-4.2v-.2c.7-1.4 1.4-2.7 2.2-4.1V12h-.1c-.2 0-.5 0-.7.1-.3 0-.6 0-1 .1-.1 0-.1 0-.1.1-.3.6-.5 1.1-.8 1.7-.2.5-.4.9-.6 1.4-.1-.2-.1-.5-.2-.7-.3-.7-.6-1.5-.9-2.2-.1-.2-.1-.2-.3-.2-.4 0-.8.1-1.2.1h-.4v.1c.1.2.2.5.3.7l1.5 3v.1c-.6 1.2-1.3 2.4-1.9 3.6 0 .1-.1.1-.1.2h.6c.4 0 .7.1 1.1.1.1 0 .1 0 .1-.1.3-.6.6-1.2.9-1.9.1-.3.3-.6.4-.9 0-.1 0-.2.1-.3v.1c.1.2.1.4.2.5.4.8.7 1.6 1.1 2.5.1.1.1.2.3.2.5 0 1 .1 1.5.1.1.3.2.3.3.3z" fill="currentColor" />
<path d="M23.9 10.4v1.7h-3.1v-1.7h3.1zm-3.1 11.2v-1.7h3.1v1.7h-3.1zm0-4.7v-1.7h3.1v1.7h-3.1zm3.1-4.1v1.7h-3.1v-1.7h3.1zm0 4.8v1.7h-3.1v-1.7h3.1z" fill="currentColor" />
</svg>
)
case 'ppt':
case 'pptx':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 122.88 116.03" className={cn("text-white", pptIconSizeClasses[size], className)}>
<g>
<path d="M0.38,12.11L69.16,0.09L69.69,0v0.54v114.96v0.53l-0.53-0.09L0.38,104.63L0,104.57v-0.38V12.55v-0.38L0.38,12.11 L0.38,12.11z M76.29,17.01h43.79c0.77,0,1.47,0.32,1.98,0.82c0.51,0.51,0.82,1.21,0.82,1.98v76.75c0,0.78-0.32,1.5-0.84,2.01 s-1.23,0.84-2.01,0.84H76.29h-0.45v-0.45v-9.16v-0.45h0.45h33.62v-6.15H76.29h-0.45v-0.45v-7.17V75.1h0.45h33.62v-6.15H76.29h-0.45 v-0.45v-8.49v-0.88l0.71,0.51c1.32,0.94,2.79,1.68,4.36,2.18c1.52,0.48,3.14,0.74,4.82,0.74c4.38,0,8.34-1.78,11.21-4.64 c2.82-2.82,4.59-6.7,4.64-11H85.83h-0.45v-0.45V30.86c-1.56,0.03-3.06,0.29-4.47,0.74c-1.57,0.5-3.04,1.24-4.36,2.18l-0.71,0.51 v-0.88V17.46v-0.45H76.29L76.29,17.01z M99.26,32.75c-2.76-2.77-6.54-4.52-10.73-4.65v15.48h15.36 C103.79,39.35,102.04,35.53,99.26,32.75L99.26,32.75z M30.91,80.41V63.97v-0.45h0.45h6.22c2.41,0,4.56-0.35,6.45-1.05 c1.87-0.7,3.49-1.75,4.86-3.15c1.37-1.4,2.39-3.04,3.08-4.91c0.69-1.88,1.03-4,1.03-6.37c0-1.61-0.16-3.12-0.48-4.55 c-0.32-1.42-0.79-2.76-1.43-4.01c-0.63-1.25-1.4-2.36-2.29-3.32c-0.89-0.96-1.91-1.78-3.06-2.45c-2.31-1.35-4.97-2.03-7.98-2.03 H22.07v48.75H30.91L30.91,80.41z M37.76,55.2h-6.39h-0.45v-0.45V40.43v-0.45h0.45h6.51l0.01,0c0.95,0.01,1.81,0.21,2.57,0.59 c0.76,0.38,1.41,0.95,1.96,1.71h0c0.54,0.74,0.95,1.6,1.21,2.58c0.27,0.97,0.4,2.05,0.4,3.24c0,1.1-0.13,2.08-0.39,2.94h0 c-0.27,0.88-0.67,1.63-1.21,2.26c-0.54,0.63-1.21,1.11-2,1.43C39.65,55.05,38.76,55.2,37.76,55.2L37.76,55.2z" fill="currentColor" />
</g>
</svg>
)
case 'video':
case 'mp4':
case 'mov':
case 'mkv':
case 'avi':
case 'webm':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M16 4c-6.6 0-12 5.4-12 12s5.4 12 12 12 12-5.4 12-12S22.6 4 16 4zm-2 16.5V9.5l8 5.5-8 5.5z" fill="currentColor" />
</svg>
)
case 'audio':
case 'mp3':
case 'wav':
case 'ogg':
case 'flac':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M16 4c-6.6 0-12 5.4-12 12s5.4 12 12 12 12-5.4 12-12S22.6 4 16 4zm-2 16.5V9.5l8 5.5-8 5.5z" fill="currentColor" />
</svg>
)
case 'image':
case 'jpg':
case 'jpeg':
case 'png':
case 'gif':
case 'webp':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M26 4H6c-1.1 0-2 .9-2 2v20c0 1.1.9 2 2 2h20c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM6 26V6h20v20H6z" fill="currentColor" />
<path d="M10 12c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm12 8H10l4-6 3 4 2-3 7 5z" fill="currentColor" />
</svg>
)
case 'zip':
case 'rar':
case '7z':
case 'tar':
case 'gz':
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M26 4H6c-1.1 0-2 .9-2 2v20c0 1.1.9 2 2 2h20c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM6 26V6h20v20H6z" fill="currentColor" />
<path d="M10 8h12v2H10V8zm0 4h12v2H10v-2zm0 4h12v2H10v-2z" fill="currentColor" />
</svg>
)
default:
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className={cn("text-white", iconSizeClasses[size], className)}>
<path d="M18 22a2 2 0 0 0 2-2V8l-6-6H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12zM13 4l5 5h-5V4zM7 8h3v2H7V8zm0 4h10v2H7v-2zm0 4h10v2H7v-2z" fill="currentColor" />
</svg>
)
}
}
const getBackgroundColor = () => {
switch (fileType.toLowerCase()) {
case 'pdf':
return 'bg-red-700'
case 'doc':
case 'docx':
return 'bg-[#1A5CBD]'
case 'xls':
case 'xlsx':
case 'csv':
return 'bg-green-700'
case 'ppt':
case 'pptx':
return 'bg-[#ED6C47]'
case 'video':
case 'mp4':
case 'mov':
case 'mkv':
case 'avi':
case 'webm':
return 'bg-purple-600'
case 'audio':
case 'mp3':
case 'wav':
case 'ogg':
case 'flac':
return 'bg-purple-600'
case 'image':
case 'jpg':
case 'jpeg':
case 'png':
case 'gif':
case 'webp':
return 'bg-blue-600'
case 'zip':
case 'rar':
case '7z':
case 'tar':
case 'gz':
return 'bg-yellow-600'
default:
return 'bg-gray-500'
}
}
const getTextColor = () => {
switch (fileType.toLowerCase()) {
case 'pdf':
return 'text-ink-red-3'
case 'doc':
case 'docx':
return 'text-[#1A5CBD]'
case 'xls':
case 'xlsx':
case 'csv':
return 'text-green-700 dark:text-green-500'
case 'ppt':
case 'pptx':
return 'text-[#ED6C47]'
case 'video':
case 'mp4':
case 'mov':
case 'mkv':
case 'avi':
case 'webm':
return 'text-purple-600'
case 'audio':
case 'mp3':
case 'wav':
case 'ogg':
case 'flac':
return 'text-purple-600'
case 'image':
case 'jpg':
case 'jpeg':
case 'png':
case 'gif':
case 'webp':
return 'text-blue-600'
case 'zip':
case 'rar':
case '7z':
case 'tar':
case 'gz':
return 'text-yellow-600'
default:
return 'text-gray-50'
}
}
if (showBackground) {
return (
<div className={cn("rounded-md flex items-center justify-center", getBackgroundColor(), containerClass)}>
<RenderIcon />
</div>
)
}
return (
<div className={cn("flex items-center justify-center")}>
<RenderIcon className={getTextColor()} />
</div>
)
}

View File

@@ -0,0 +1,383 @@
import { FieldValues, RegisterOptions, useFormContext } from "react-hook-form"
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormRequiredIndicator, useFormField } from "@/components/ui/form"
import _ from "@/lib/translate"
import { Input } from "./input"
import { ComponentProps, FocusEventHandler, useCallback, useState } from "react"
import { parseDate } from "chrono-node"
import { formatDate, getUserDateFormat, toDate } from "@/lib/date"
import { Popover, PopoverContent, PopoverTrigger } from "./popover"
import { Button } from "./button"
import { CalendarIcon } from "lucide-react"
import { Calendar } from "./calendar"
import dayjs from "dayjs"
import { Textarea } from "./textarea"
import AccountsDropdown, { AccountsDropdownProps } from "../common/AccountsDropdown"
import PartyTypeDropdown, { PartyTypeDropdownProps } from "../common/PartyTypeDropdown"
import CurrencyInput from "react-currency-input-field"
import { getSystemDefault } from "@/lib/frappe"
import { getCurrencySymbol } from "@/lib/currency"
import { getCurrencyFormatInfo } from "@/lib/numbers"
import LinkFieldCombobox, { LinkFieldComboboxProps } from "../common/LinkFieldCombobox"
import { Select, SelectContent, SelectTrigger, SelectValue } from "./select"
import { InputGroup, InputGroupAddon } from "./input-group"
interface FormElementProps {
name: string,
rules?: Omit<RegisterOptions<FieldValues, string>, "disabled" | "valueAsNumber" | "valueAsDate" | "setValueAs">,
label: string,
isRequired?: boolean,
disabled?: boolean,
formDescription?: string,
hideLabel?: boolean,
readOnly?: boolean,
}
interface DataFieldProps extends FormElementProps {
inputProps?: Omit<ComponentProps<"input">, "value" | "onChange" | "onBlur" | "name" | "ref">
}
export const DataField = ({ name, rules, label, isRequired, formDescription, inputProps, hideLabel, disabled, readOnly }: DataFieldProps) => {
const { control } = useFormContext()
return <FormField
control={control}
disabled={disabled}
name={name}
rules={rules}
render={({ field }) => (
<FormItem className='flex flex-col'>
<FormLabel className={hideLabel ? 'sr-only' : ''}>{label}{isRequired && <FormRequiredIndicator />}</FormLabel>
<FormControl>
<Input {...field} maxLength={140} aria-readonly={readOnly} readOnly={readOnly} {...inputProps} />
</FormControl>
{formDescription && <FormDescription>{formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}
interface SelectFieldProps extends FormElementProps {
children: React.ReactNode
}
export const SelectFormField = ({ name, rules, label, isRequired, formDescription, hideLabel, children, disabled, readOnly }: SelectFieldProps) => {
const { control } = useFormContext()
return <FormField
control={control}
name={name}
disabled={disabled}
rules={rules}
render={({ field }) => (
<FormItem>
<FormLabel className={hideLabel ? 'sr-only' : ''}>{label}{isRequired && <FormRequiredIndicator />}</FormLabel>
<FormControl>
<Select onValueChange={field.onChange} value={field.value} disabled={disabled || readOnly} aria-readonly={readOnly}>
<FormControl>
<SelectTrigger className="w-full">
<SelectValue />
</SelectTrigger>
</FormControl>
<SelectContent>
{children}
</SelectContent>
</Select>
</FormControl>
{formDescription && <FormDescription>{formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}
interface DateFieldProps extends FormElementProps {
inputProps?: Omit<ComponentProps<"input">, "value" | "onChange" | "onBlur" | "name" | "ref">
}
export const DateField = ({ name, rules, label, isRequired, formDescription, inputProps, hideLabel, disabled }: DateFieldProps) => {
const { control } = useFormContext()
const DatePicker = ({ field }: { field: FieldValues }) => {
const userDateFormat = getUserDateFormat()
const [open, setOpen] = useState(false)
const [value, setValue] = useState<string | undefined>(field.value ? formatDate(field.value) : undefined)
const date = field.value ? toDate(field.value) : undefined
return <div className="relative flex gap-2">
<FormControl>
<Input className="pe-10"
name={field.name}
onBlur={() => {
setValue(formatDate(field.value))
field.onBlur()
}}
placeholder={userDateFormat}
value={value}
onChange={(e) => {
setValue(e.target.value)
if (e.target.value) {
// On change in value, try computing date usning standard formats first
const dateObj = toDate(e.target.value, userDateFormat)
// If we find a valid date, use it
if (dateObj && !isNaN(dateObj.getTime())) {
field.onChange(formatDate(dateObj, "YYYY-MM-DD"))
} else {
// If not, try parsing using chrono-node for things like "1st July 2025"
const date = parseDate(e.target.value)
if (date) {
field.onChange(formatDate(date, "YYYY-MM-DD"))
}
}
} else {
field.onChange("")
}
}}
onKeyDown={(e) => {
if (e.key === "ArrowDown") {
e.preventDefault()
setOpen(true)
}
}}
maxLength={140}
{...inputProps} />
</FormControl>
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
id="date-picker-button"
variant="ghost"
className="absolute top-1/2 ltr:right-2 rtl:left-2 size-6 -translate-y-1/2"
>
<CalendarIcon className="size-3.5" />
<span className="sr-only">{_("Select date")}</span>
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto overflow-hidden p-0" align="center">
<Calendar
mode="single"
selected={date}
fixedWeeks
endMonth={dayjs().add(1, "year").toDate()}
captionLayout="dropdown"
defaultMonth={date}
onSelect={(date) => {
setValue(formatDate(date))
field.onChange(formatDate(date, "YYYY-MM-DD"))
setOpen(false)
}}
/>
</PopoverContent>
</Popover>
</div>
}
return <FormField
control={control}
name={name}
disabled={disabled}
rules={rules}
render={({ field }) => (
<FormItem className='flex flex-col'>
<FormLabel className={hideLabel ? 'sr-only' : ''}>{label}{isRequired && <FormRequiredIndicator />}</FormLabel>
<DatePicker field={field} />
{formDescription && <FormDescription>{formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}
interface SmallTextFieldProps extends FormElementProps {
inputProps?: Omit<ComponentProps<"textarea">, "value" | "onChange" | "onBlur" | "name" | "ref">
}
export const SmallTextField = ({ name, rules, label, isRequired, formDescription, inputProps, hideLabel, disabled, readOnly }: SmallTextFieldProps) => {
const { control } = useFormContext()
return <FormField
control={control}
name={name}
disabled={disabled}
rules={rules}
render={({ field }) => (
<FormItem className='flex flex-col'>
<FormLabel className={hideLabel ? 'sr-only' : ''}>{label}{isRequired && <FormRequiredIndicator />}</FormLabel>
<FormControl>
<Textarea {...field} {...inputProps} readOnly={readOnly} aria-readonly={readOnly} />
</FormControl>
{formDescription && <FormDescription>{formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}
interface AccountFormFieldProps extends Omit<AccountsDropdownProps, 'value' | 'onChange'>, FormElementProps {
}
export const AccountFormField = (props: AccountFormFieldProps) => {
const { control } = useFormContext()
return <FormField
control={control}
disabled={props.disabled}
name={props.name}
rules={props.rules}
render={({ field }) => (
<FormItem className='flex flex-col'>
<FormLabel className={props.hideLabel ? 'sr-only' : ''}>{props.label}{props.isRequired && <FormRequiredIndicator />}</FormLabel>
<AccountsDropdown {...props} value={field.value} onChange={field.onChange} useInForm readOnly={props.readOnly} />
{props.formDescription && <FormDescription>{props.formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}
interface PartyTypeFormField extends FormElementProps {
inputProps?: Omit<PartyTypeDropdownProps, 'value' | 'onChange'>
}
export const PartyTypeFormField = ({ name, rules, label, isRequired, formDescription, hideLabel, inputProps, disabled, readOnly }: PartyTypeFormField) => {
const { control } = useFormContext()
return <FormField
control={control}
disabled={disabled}
name={name}
rules={rules}
render={({ field }) => (
<FormItem className='flex flex-col'>
<FormLabel className={hideLabel ? 'sr-only' : ''}>{label}{isRequired && <FormRequiredIndicator />}</FormLabel>
<PartyTypeDropdown {...inputProps} value={field.value} onChange={field.onChange} useInForm readOnly={readOnly} />
{formDescription && <FormDescription>{formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}
interface CurrencyFormFieldProps extends FormElementProps {
currency?: string,
style?: React.CSSProperties,
leftSlot?: React.ReactNode,
}
export const CurrencyFormField = ({ name, rules, label, isRequired, formDescription, hideLabel, currency, disabled, readOnly, style = {}, leftSlot }: CurrencyFormFieldProps) => {
const { control } = useFormContext()
const defaultCurrency = getSystemDefault("currency")
const currencySymbol = getCurrencySymbol(currency ?? defaultCurrency)
const CurrencyField = ({ field }: { field: FieldValues }) => {
const onFocus: FocusEventHandler<HTMLInputElement> = useCallback((e) => {
// When the input is focused, select the text
// A short timeout is needed so that the input selects the text after the focus event
setTimeout(() => {
// Check if the input is focused - do not select text if the input is not focused
if (e.target.contains(document.activeElement)) {
e.target.select()
}
}, 100)
}, [])
const { formItemId } = useFormField()
// Get the correct separators for the currency
const formatInfo = getCurrencyFormatInfo(currency ?? defaultCurrency)
const groupSeparator = formatInfo.group_sep || ","
const decimalSeparator = formatInfo.decimal_str || "."
return <CurrencyInput
ref={field.ref}
name={field.name}
style={{
textAlign: 'right',
...style
}}
id={formItemId}
onBlur={field.onBlur}
disabled={field.disabled}
readOnly={readOnly}
aria-readonly={readOnly}
onFocus={onFocus}
groupSeparator={groupSeparator}
decimalSeparator={decimalSeparator}
placeholder={`${currencySymbol} 0${decimalSeparator}00`}
decimalsLimit={2}
value={field.value}
maxLength={12}
decimalScale={2}
prefix={currencySymbol + " "}
onValueChange={(v, _n, values) => {
// If the input ends with a decimal or a decimal with trailing zeroes, store the string since we need the user to be able to type the decimals.
// When the user eventually types the decimals or blurs out, the value is formatted anyway.
// Otherwise store the float value
// Check if the value ends with a decimal or a decimal with trailing zeroes
const isDecimal = v?.endsWith(decimalSeparator) || v?.endsWith(decimalSeparator + '0')
const newValue = isDecimal ? v : values?.float ?? ''
field.onChange(newValue)
}}
customInput={Input}
/>
}
return <FormField
control={control}
disabled={disabled}
name={name}
rules={rules}
render={({ field }) => (
<FormItem className='flex flex-col'>
<FormLabel className={hideLabel ? 'sr-only' : ''}>{label}{isRequired && <FormRequiredIndicator />}</FormLabel>
<FormControl>
<InputGroup>
{leftSlot && <InputGroupAddon>{leftSlot}</InputGroupAddon>}
<CurrencyField field={field} />
</InputGroup>
</FormControl>
{formDescription && <FormDescription>{formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}
interface LinkFormFieldProps extends FormElementProps, Omit<LinkFieldComboboxProps, 'value' | 'onChange'> {
}
export const LinkFormField = ({ name, rules, label, isRequired, formDescription, hideLabel, disabled, readOnly, ...inputProps }: LinkFormFieldProps) => {
const { control } = useFormContext()
return <FormField
control={control}
name={name}
disabled={disabled}
rules={rules}
render={({ field }) => (
<FormItem className='flex flex-col'>
<FormLabel className={hideLabel ? 'sr-only' : ''}>{label}{isRequired && <FormRequiredIndicator />}</FormLabel>
<LinkFieldCombobox {...inputProps} value={field.value} onChange={field.onChange} useInForm disabled={disabled} readOnly={readOnly} />
{formDescription && <FormDescription>{formDescription}</FormDescription>}
<FormMessage />
</FormItem>
)}
/>
}

View File

@@ -0,0 +1,174 @@
import * as React from "react"
import { Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui"
import {
Controller,
FormProvider,
useFormContext,
useFormState,
type ControllerProps,
type FieldPath,
type FieldValues,
} from "react-hook-form"
import { cn } from "@/lib/utils"
import { Label } from "@/components/ui/label"
const Form = FormProvider
type FormFieldContextValue<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
> = {
name: TName
}
const FormFieldContext = React.createContext<FormFieldContextValue>(
{} as FormFieldContextValue
)
const FormField = <
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
>({
...props
}: ControllerProps<TFieldValues, TName>) => {
return (
<FormFieldContext.Provider value={{ name: props.name }}>
<Controller {...props} />
</FormFieldContext.Provider>
)
}
const useFormField = () => {
const fieldContext = React.useContext(FormFieldContext)
const itemContext = React.useContext(FormItemContext)
const { getFieldState } = useFormContext()
const formState = useFormState({ name: fieldContext.name })
const fieldState = getFieldState(fieldContext.name, formState)
if (!fieldContext) {
throw new Error("useFormField should be used within <FormField>")
}
const { id } = itemContext
return {
id,
name: fieldContext.name,
formItemId: `${id}-form-item`,
formDescriptionId: `${id}-form-item-description`,
formMessageId: `${id}-form-item-message`,
...fieldState,
}
}
type FormItemContextValue = {
id: string
}
const FormItemContext = React.createContext<FormItemContextValue>(
{} as FormItemContextValue
)
function FormItem({ className, ...props }: React.ComponentProps<"div">) {
const id = React.useId()
return (
<FormItemContext.Provider value={{ id }}>
<div
data-slot="form-item"
className={cn("grid gap-1.5", className)}
{...props}
/>
</FormItemContext.Provider>
)
}
function FormLabel({
className,
...props
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
const { error, formItemId } = useFormField()
return (
<Label
data-slot="form-label"
data-error={!!error}
className={className}
htmlFor={formItemId}
{...props}
/>
)
}
function FormRequiredIndicator({ className, ...props }: React.ComponentProps<"span">) {
return (
<span className={cn("text-ink-red-2", className)} {...props}>
*
</span>
)
}
function FormControl({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) {
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
return (
<SlotPrimitive.Slot
data-slot="form-control"
id={formItemId}
aria-describedby={
!error
? `${formDescriptionId}`
: `${formDescriptionId} ${formMessageId}`
}
aria-invalid={!!error}
{...props}
/>
)
}
function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
const { formDescriptionId } = useFormField()
return (
<p
data-slot="form-description"
id={formDescriptionId}
className={cn("text-ink-gray-5 text-p-base", className)}
{...props}
/>
)
}
function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
const { error, formMessageId } = useFormField()
const body = error ? String(error?.message ?? "") : props.children
if (!body) {
return null
}
return (
<p
data-slot="form-message"
id={formMessageId}
className={cn("text-ink-red-4 text-p-base", className)}
{...props}
>
{body}
</p>
)
}
export {
useFormField,
Form,
FormItem,
FormLabel,
FormControl,
FormDescription,
FormMessage,
FormField,
FormRequiredIndicator,
}

View File

@@ -0,0 +1,42 @@
import * as React from "react"
import { HoverCard as HoverCardPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function HoverCard({
...props
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />
}
function HoverCardTrigger({
...props
}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
return (
<HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
)
}
function HoverCardContent({
className,
align = "center",
sideOffset = 4,
...props
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
return (
<HoverCardPrimitive.Portal data-slot="hover-card-portal">
<HoverCardPrimitive.Content
data-slot="hover-card-content"
align={align}
sideOffset={sideOffset}
className={cn(
"rounded-lg border bg-surface-modal shadow-xl text-ink-gray-8 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) p-4 outline-hidden",
className
)}
{...props}
/>
</HoverCardPrimitive.Portal>
)
}
export { HoverCard, HoverCardTrigger, HoverCardContent }

View File

@@ -0,0 +1,161 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
const inputGroupVariants = cva(cn("group/input-group relative flex w-full items-center outline-none min-w-0 border border-transparent transition-all",
// Variants based on alignment.
"has-[>[data-align=inline-start]]:[&>input]:ps-2",
"has-[>[data-align=inline-end]]:[&>input]:pe-2",
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
// Focus state.
"has-[[data-slot=input]:focus-visible]:bg-surface-white has-[[data-slot=input]:focus-visible]:border-outline-gray-4 has-[[data-slot=input]:focus-visible]:shadow-focus-gray",
// Disabled state
"has-[>[data-slot=input]:disabled]:bg-surface-gray-1 has-[>[data-slot=input]:disabled]:text-ink-gray-3 has-[>[data-slot=input]:disabled]:cursor-not-allowed has-[>[data-slot=input]:disabled]:pointer-events-none",
// Error state.
"has-[[data-slot][aria-invalid=true]]:shadow-focus-red has-[[data-slot][aria-invalid=true]]:border-outline-red-3",
// Read only state
"has-[[data-slot][aria-readonly=true]]:bg-surface-gray-1 has-[[data-slot][aria-readonly=true]]:text-ink-gray-6 has-[[data-slot][aria-readonly=true]]:pointer-events-none",
),
{
variants: {
variant: {
subtle: "bg-surface-gray-2",
outline: "bg-surface-white border-outline-gray-2"
},
size: {
sm: "h-7 has-[>textarea]:h-auto rounded text-base",
md: "h-8 has-[>textarea]:h-auto rounded text-base",
lg: "h-10 has-[>textarea]:h-auto rounded-md text-lg"
}
},
defaultVariants: {
variant: "subtle",
size: "md"
}
}
)
function InputGroup({ className, variant = "subtle", size = "md", ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupVariants>) {
return (
<div
data-slot="input-group"
data-variant={variant}
data-size={size}
role="group"
className={cn(
inputGroupVariants({ variant, size }),
className
)}
{...props}
/>
)
}
const inputGroupAddonVariants = cva(
"text-ink-gray-5 flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
{
variants: {
align: {
"inline-start":
"order-first ps-3 has-[>button]:ms-[-0.45rem] has-[>kbd]:ms-[-0.35rem]",
"inline-end":
"order-last pe-3 has-[>button]:me-[-0.45rem] has-[>kbd]:me-[-0.35rem]",
"block-start":
"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
"block-end":
"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5",
},
},
defaultVariants: {
align: "inline-start",
},
}
)
function InputGroupAddon({
className,
align = "inline-start",
...props
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
return (
<div
role="group"
data-slot="input-group-addon"
data-align={align}
className={cn(inputGroupAddonVariants({ align }), className)}
onClick={(e) => {
if ((e.target as HTMLElement).closest("button")) {
return
}
e.currentTarget.parentElement?.querySelector("input")?.focus()
}}
{...props}
/>
)
}
const inputGroupButtonVariants = cva(
"text-sm shadow-none flex gap-2 items-center",
{
variants: {
size: {
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
"icon-xs":
"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
},
},
defaultVariants: {
size: "xs",
},
}
)
function InputGroupButton({
className,
type = "button",
variant = "ghost",
size = "xs",
...props
}: Omit<React.ComponentProps<typeof Button>, "size"> &
VariantProps<typeof inputGroupButtonVariants>) {
return (
<Button
type={type}
data-size={size}
variant={variant}
className={cn(inputGroupButtonVariants({ size }), className)}
{...props}
/>
)
}
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
return (
<span
className={cn(
"text-ink-gray-5 flex items-center gap-2 text-sm whitespace-nowrap [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
/>
)
}
export {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupText,
}

View File

@@ -0,0 +1,49 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cva, VariantProps } from "class-variance-authority"
const inputVariants = cva(cn("flex w-full min-w-0 transition-all outline-none border border-transparent",
"focus-visible:bg-surface-white focus-visible:border-outline-gray-4 focus-visible:shadow-focus-gray",
"active:bg-surface-white active:shadow-sm active:border-outline-gray-4",
"placeholder:text-ink-gray-4 text-ink-gray-7",
"disabled:bg-surface-gray-1 disabled:placeholder:text-ink-gray-3 disabled:text-ink-gray-3 disabled:cursor-not-allowed disabled:pointer-events-none",
"aria-readonly:bg-surface-gray-1 aria-readonly:text-ink-gray-6 aria-readonly:pointer-events-none aria-invalid:shadow-focus-red aria-invalid:border-outline-red-3",
"in-data-[slot=input-group]:border-transparent! in-data-[slot=input-group]:focus-visible:shadow-none! in-data-[slot=input-group]:bg-transparent!"),
{
variants: {
inputSize: {
sm: "text-base rounded py-1.5 px-2 h-7",
md: "text-base rounded py-2 px-2.5 h-8",
lg: "text-lg rounded-md py-[11px] px-3 h-10",
},
variant: {
subtle: "bg-surface-gray-2 hover:bg-surface-gray-3 aria-invalid:bg-surface-red-1",
outline: "bg-surface-white border-outline-gray-2 hover:border-outline-gray-3 active:border-outline-gray-4 disabled:border-outline-gray-2",
}
},
defaultVariants: {
inputSize: "md",
variant: "subtle"
}
}
)
function Input({ className, type, inputSize = "md", variant = "subtle", ...props }: React.ComponentProps<"input"> & VariantProps<typeof inputVariants>) {
return (
<input
type={type}
data-slot="input"
data-input-size={inputSize}
data-variant={variant}
className={cn(
"file:text-ink-gray-8 file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium",
inputVariants({ inputSize, variant }),
className
)}
{...props}
/>
)
}
export { Input }

Some files were not shown because too many files have changed in this diff Show More