ocui_version: '1.0'
skill: erpclaw
skill_version: 2.0.0
display_name: ERPClaw
icon: briefcase
color: '#2563eb'
domains:
- key: company
  label: Company
  entities:
  - company
- key: currencies
  label: Currencies
  entities:
  - currency
  - exchange_rate
- key: defaults
  label: Defaults
  entities:
  - payment_terms
  - uom
  - uom_conversion
- key: users
  label: Users & Security
  entities:
  - erp_user
  - role
  - audit_log
- key: chart_of_accounts
  label: Chart of Accounts
  entities:
  - account
- key: general_ledger
  label: General Ledger
  entities:
  - gl_entry
- key: fiscal
  label: Fiscal Periods
  entities:
  - fiscal_year
  - period_closing_voucher
- key: budgeting
  label: Budgeting
  entities:
  - cost_center
  - budget
- key: system
  label: System
  entities:
  - naming_series
- key: entry
  label: Entry
  entities:
  - payment_entry
  - payment_allocation
  - payment_deduction
- key: terms
  label: Terms
  entities:
  - payment_terms
- key: ledger_entry
  label: Ledger Entry
  entities:
  - payment_ledger_entry
- key: template
  label: Template
  entities:
  - tax_template
  - tax_rule
  - item_tax_template
- key: category
  label: Category
  entities:
  - tax_template
  - tax_rule
  - tax_category
- key: withholding_category
  label: Withholding Category
  entities:
  - tax_withholding_category
  - tax_withholding_entry
  - tax_withholding_group
- key: item_master
  label: Item Master
  entities:
  - item
  - item_group
- key: warehousing
  label: Warehousing
  entities:
  - warehouse
- key: stock_transactions
  label: Stock Transactions
  entities:
  - stock_entry
  - stock_reconciliation
  - stock_revaluation
- key: tracking
  label: Tracking
  entities:
  - batch
  - serial_number
- key: pricing
  label: Pricing
  entities:
  - price_list
  - item_price
  - pricing_rule
- key: customers
  label: Customers
  entities:
  - customer
  - sales_partner
- key: sales
  label: Sales
  entities:
  - quotation
  - sales_order
- key: fulfillment
  label: Fulfillment
  entities:
  - delivery_note
- key: billing
  label: Billing
  entities:
  - sales_invoice
  - credit_note
  - recurring_invoice_template
- key: suppliers
  label: Suppliers
  entities:
  - supplier
- key: purchasing
  label: Purchasing
  entities:
  - material_request
  - request_for_quotation
  - supplier_quotation
  - purchase_order
- key: receiving
  label: Receiving
  entities:
  - purchase_receipt
  - landed_cost_voucher
- key: billing
  label: Billing
  entities:
  - purchase_invoice
- key: meter
  label: Meter
  entities:
  - meter
  - usage_event
  - billing_period
- key: rate_plan
  label: Rate Plan
  entities:
  - rate_plan
  - rate_tier
  - billing_period
  - prepaid_credit_balance
- key: billing_adjustment
  label: Billing Adjustment
  entities:
  - billing_adjustment
- key: recurring_invoice_template
  label: Recurring Invoice Template
  entities:
  - recurring_invoice_template
dashboard:
  kpis:
  - key: total_companies
    label: Companies
    type: count
    action: list-companies
    drill_action: list-companies
  - key: total_users
    label: Users
    type: count
    action: list-users
    drill_action: list-users
  - key: total_accounts
    label: Accounts
    type: count
    action: list-accounts
    drill_action: list-accounts
  - key: open_periods
    label: Open Periods
    type: count
    action: list-fiscal-years
    drill_action: list-fiscal-years
  - key: frozen_accounts
    label: Frozen Accounts
    type: count
    action: list-accounts
    filter:
      is-frozen: true
    severity: info
    drill_action: list-accounts
    drill_filter:
      is-frozen: true
  - key: total_journal_entry
    label: Journal Entries
    type: count
    action: list-journal-entries
    drill_action: list-journal-entries
  - key: draft_journal_entry
    label: Draft Journal Entries
    type: count
    action: list-journal-entries
    filter:
      status: draft
    severity: warning
    drill_action: list-journal-entries
    drill_filter:
      status: draft
  - key: total_payments
    label: Payments
    type: count
    action: list-payments
    drill_action: list-payments
  - key: draft_payments
    label: Draft Payments
    type: count
    action: list-payments
    filter:
      status: draft
    severity: warning
    drill_action: list-payments
    drill_filter:
      status: draft
  - key: submitted_payments
    label: Submitted Payments
    type: count
    action: list-payments
    filter:
      status: submitted
    drill_action: list-payments
    drill_filter:
      status: submitted
  - key: unreconciled_entries
    label: Unreconciled Entries
    type: count
    action: get-unallocated-payments
    severity: warning
    drill_action: get-unallocated-payments
  - key: total_tax_template
    label: Tax Templates
    type: count
    action: list-tax-templates
    drill_action: list-tax-templates
  - key: total_tax_rule
    label: Tax Rules
    type: count
    action: list-tax-rules
    drill_action: list-tax-rules
  - key: total_tax_category
    label: Tax Categories
    type: count
    action: list-tax-categories
    drill_action: list-tax-categories
  - key: total_items
    label: Items
    type: count
    action: list-items
    drill_action: list-items
  - key: total_warehouses
    label: Warehouses
    type: count
    action: list-warehouses
    drill_action: list-warehouses
  - key: draft_stock_entries
    label: Draft Stock Entries
    type: count
    action: list-stock-entries
    filter:
      status: draft
    severity: warning
    drill_action: list-stock-entries
    drill_filter:
      status: draft
  - key: total_customers
    label: Customers
    type: count
    action: list-customers
    drill_action: list-customers
  - key: draft_quotations
    label: Draft Quotations
    type: count
    action: list-quotations
    filter:
      status: draft
    severity: warning
    drill_action: list-quotations
    drill_filter:
      status: draft
  - key: open_sales_orders
    label: Open Sales Orders
    type: count
    action: list-sales-orders
    filter:
      status: draft
    severity: warning
    drill_action: list-sales-orders
    drill_filter:
      status: draft
  - key: unpaid_invoices
    label: Unpaid Invoices
    type: count
    action: list-sales-invoices
    filter:
      status: unpaid
    severity: warning
    drill_action: list-sales-invoices
    drill_filter:
      status: unpaid
  - key: total_suppliers
    label: Suppliers
    type: count
    action: list-suppliers
    drill_action: list-suppliers
  - key: draft_purchase_orders
    label: Draft Purchase Orders
    type: count
    action: list-purchase-orders
    filter:
      status: draft
    severity: warning
    drill_action: list-purchase-orders
    drill_filter:
      status: draft
  - key: pending_receipts
    label: Pending Receipts
    type: count
    action: list-purchase-receipts
    filter:
      status: draft
    severity: warning
    drill_action: list-purchase-receipts
    drill_filter:
      status: draft
  - key: unpaid_invoices
    label: Unpaid Invoices
    type: count
    action: list-purchase-invoices
    filter:
      status: unpaid
    severity: warning
    drill_action: list-purchase-invoices
    drill_filter:
      status: unpaid
  - key: total_meter
    label: Meters
    type: count
    action: list-meters
    drill_action: list-meters
  - key: draft_meter
    label: Draft Meters
    type: count
    action: list-meters
    filter:
      status: draft
    severity: warning
    drill_action: list-meters
    drill_filter:
      status: draft
  - key: total_rate_plan
    label: Rate Plans
    type: count
    action: list-rate-plans
    drill_action: list-rate-plans
  - key: total_billing_period
    label: Billing Periods
    type: count
    action: list-billing-periods
    drill_action: list-billing-periods
  quick_actions:
  - action: setup-company
    label: Setup Company
  - action: add-account
    label: New Account
  - action: add-fiscal-year
    label: New Fiscal Year
  - action: add-cost-center
    label: New Cost Center
  - action: check-gl-integrity
    label: Check GL Integrity
  - action: add-journal-entry
    label: New Journal Entry
  - action: add-payment
    label: New Payment Entry
  - action: reconcile-payments
    label: Reconcile Payments
  - action: bank-reconciliation
    label: Bank Reconciliation
  - action: add-tax-template
    label: New Tax Template
  - action: add-tax-rule
    label: New Tax Rule
  - action: add-tax-category
    label: New Tax Category
  - action: add-tax-withholding-category
    label: New Tax Withholding Category
  - action: add-item
    label: New Item
  - action: add-warehouse
    label: New Warehouse
  - action: add-stock-entry
    label: New Stock Entry
  - action: add-customer
    label: New Customer
  - action: add-quotation
    label: New Quotation
  - action: add-sales-order
    label: New Sales Order
  - action: add-supplier
    label: New Supplier
  - action: add-purchase-order
    label: New Purchase Order
  - action: add-meter
    label: New Meter
  - action: add-usage-event
    label: New Usage Event
  - action: add-rate-plan
    label: New Rate Plan
entities:
  company:
    label: Company
    label_plural: Companies
    icon: building
    primary_field: name
    secondary_field: abbr
    identifier_field: id
    fields:
      name:
        type: text
        label: Company Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      abbr:
        type: text
        label: Abbreviation
        max_length: 10
        help_text: Auto-generated from initials if left blank
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      default_currency:
        type: currency_code
        label: Base Currency
        required: true
        default: USD
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      country:
        type: text
        label: Country
        default: United States
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      fiscal_year_start_month:
        type: integer
        label: Fiscal Year Start Month
        default: 1
        min: 1
        max: 12
        help_text: 1 = January, 4 = April, 7 = July, etc.
        in_form_view: true
        form_group: basic
        form_order: 5
      tax_id:
        type: text
        label: Tax ID / EIN
        max_length: 20
        in_form_view: true
        form_group: basic
        form_order: 6
      default_receivable_account_id:
        type: link
        label: Default Receivable Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: default_accounts
        form_order: 1
      default_payable_account_id:
        type: link
        label: Default Payable Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: default_accounts
        form_order: 2
      default_income_account_id:
        type: link
        label: Default Income Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: default_accounts
        form_order: 3
      default_expense_account_id:
        type: link
        label: Default Expense Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: default_accounts
        form_order: 4
      default_bank_account_id:
        type: link
        label: Default Bank Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: default_accounts
        form_order: 5
      default_cash_account_id:
        type: link
        label: Default Cash Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: default_accounts
        form_order: 6
      default_cost_center_id:
        type: link
        label: Default Cost Center
        link_entity: cost_center
        link_display_field: name
        link_search_action: list-cost-centers
        in_form_view: true
        form_group: default_accounts
        form_order: 7
      default_warehouse_id:
        type: link
        label: Default Warehouse
        link_entity: warehouse
        link_display_field: name
        link_search_action: list-warehouses
        in_form_view: true
        form_group: default_accounts
        form_order: 8
      round_off_account_id:
        type: link
        label: Round-Off Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: advanced
        form_order: 1
      exchange_gain_loss_account_id:
        type: link
        label: Exchange Gain/Loss Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: advanced
        form_order: 2
      perpetual_inventory:
        type: boolean
        label: Perpetual Inventory
        default: false
        help_text: Auto-post stock value changes to GL
        in_form_view: true
        form_group: advanced
        form_order: 3
      enable_negative_stock:
        type: boolean
        label: Allow Negative Stock
        default: false
        in_form_view: true
        form_group: advanced
        form_order: 4
      accounts_frozen_till_date:
        type: date
        label: Accounts Frozen Till
        help_text: No GL entries allowed before this date
        in_form_view: true
        form_group: advanced
        form_order: 5
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Company Information
        order: 1
        columns: 2
      default_accounts:
        label: Default Accounts
        order: 2
        columns: 2
        collapsible: true
      advanced:
        label: Advanced Settings
        order: 3
        columns: 2
        collapsible: true
    views:
      list:
        columns:
        - field: name
          width: 220
          link: true
        - field: abbr
          width: 80
        - field: default_currency
          width: 100
        - field: country
          width: 160
        row_click: get-company
      detail:
        header:
          title_field: name
          subtitle_field: country
        sections:
        - label: Company Information
          fields:
          - name
          - abbr
          - default_currency
          - country
          - fiscal_year_start_month
          - tax_id
          columns: 3
        - label: Default Accounts
          fields:
          - default_receivable_account_id
          - default_payable_account_id
          - default_income_account_id
          - default_expense_account_id
          - default_bank_account_id
          - default_cash_account_id
          - default_cost_center_id
          - default_warehouse_id
          columns: 2
          collapsible: true
        - label: Advanced
          fields:
          - round_off_account_id
          - exchange_gain_loss_account_id
          - perpetual_inventory
          - enable_negative_stock
          - accounts_frozen_till_date
          columns: 2
          collapsible: true
        actions:
        - action: update-company
          label: Edit
        - action: seed-defaults
          label: Seed Defaults
  currency:
    label: Currency
    label_plural: Currencies
    icon: dollar-sign
    primary_field: name
    secondary_field: code
    identifier_field: code
    fields:
      code:
        type: currency_code
        label: Currency Code
        required: true
        max_length: 3
        help_text: ISO 4217 code (e.g., USD, EUR, GBP)
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      name:
        type: text
        label: Currency Name
        required: true
        max_length: 80
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      symbol:
        type: text
        label: Symbol
        max_length: 5
        placeholder: $
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      decimal_places:
        type: integer
        label: Decimal Places
        default: 2
        min: 0
        max: 6
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      enabled:
        type: boolean
        label: Enabled
        default: false
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 5
    form_groups:
      basic:
        label: Currency Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: code
          width: 80
          link: true
        - field: name
          width: 200
        - field: symbol
          width: 60
        - field: decimal_places
          width: 80
          align: right
        - field: enabled
          width: 80
        filters:
        - field: enabled
          type: select
  exchange_rate:
    label: Exchange Rate
    label_plural: Exchange Rates
    icon: trending-up
    primary_field: from_currency
    secondary_field: to_currency
    identifier_field: id
    fields:
      from_currency:
        type: currency_code
        label: From Currency
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      to_currency:
        type: currency_code
        label: To Currency
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      rate:
        type: decimal
        label: Exchange Rate
        required: true
        precision: 6
        min: '0.000001'
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      effective_date:
        type: date
        label: Effective Date
        required: true
        default: today
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      source:
        type: select
        label: Source
        options:
        - value: manual
          label: Manual
        - value: api
          label: API
        - value: bank_feed
          label: Bank Feed
        default: manual
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 5
    form_groups:
      basic:
        label: Rate Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: from_currency
          width: 100
        - field: to_currency
          width: 100
        - field: rate
          width: 130
          align: right
        - field: effective_date
          width: 120
        - field: source
          width: 100
        filters:
        - field: from_currency
          type: text
        - field: to_currency
          type: text
        - field: effective_date
          type: date_range
  payment_terms:
    label: Payment Terms
    label_plural: Payment Terms
    table: payment_terms
    id_col: id
    name_col: name
    primary_field: name
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Name
        required: true
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      due_days:
        type: integer
        label: Due Days
        in_form_view: true
        form_group: details
        form_order: 2
      discount_percentage:
        type: currency
        label: Discount Percentage
        precision: 2
        in_form_view: true
        form_group: details
        form_order: 3
      discount_days:
        type: integer
        label: Discount Days
        in_form_view: true
        form_group: details
        form_order: 4
      description:
        type: textarea
        label: Description
        in_form_view: true
        form_group: notes
        form_order: 5
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      notes:
        label: Notes
        order: 3
        columns: 1
  uom:
    label: Unit of Measure
    label_plural: Units of Measure
    icon: ruler
    primary_field: name
    identifier_field: id
    fields:
      name:
        type: text
        label: UoM Name
        required: true
        max_length: 80
        placeholder: e.g., Kilogram, Piece, Dozen
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      must_be_whole_number:
        type: boolean
        label: Must Be Whole Number
        default: false
        help_text: Check for discrete units like Pieces, Boxes
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
    form_groups:
      basic:
        label: Unit of Measure
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: name
          width: 200
          link: true
        - field: must_be_whole_number
          width: 160
  uom_conversion:
    label: UoM Conversion
    label_plural: UoM Conversions
    icon: repeat
    primary_field: from_uom
    secondary_field: to_uom
    identifier_field: id
    fields:
      from_uom:
        type: text
        label: From UoM
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      to_uom:
        type: text
        label: To UoM
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      conversion_factor:
        type: decimal
        label: Conversion Factor
        required: true
        precision: 6
        min: '0.000001'
        help_text: 1 From UoM = X To UoM
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      item_id:
        type: link
        label: Item (optional)
        link_entity: item
        link_display_field: item_name
        link_search_action: list-items
        help_text: Leave blank for universal conversion, or select an item for item-specific conversion
        in_form_view: true
        form_group: basic
        form_order: 4
    form_groups:
      basic:
        label: Conversion Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: from_uom
          width: 140
        - field: to_uom
          width: 140
        - field: conversion_factor
          width: 140
          align: right
  erp_user:
    label: User
    label_plural: Users
    icon: user
    primary_field: username
    secondary_field: email
    identifier_field: id
    status_field: status
    status_colors:
      active: green
      disabled: gray
      locked: red
    fields:
      username:
        type: text
        label: Username
        required: true
        max_length: 80
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      email:
        type: email
        label: Email
        max_length: 254
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      full_name:
        type: text
        label: Full Name
        max_length: 140
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_ids:
        type: json
        label: Company Access
        help_text: JSON array of company IDs this user can access
        in_form_view: true
        form_group: access
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: User Information
        order: 1
        columns: 2
      access:
        label: Access Control
        order: 2
        columns: 1
        collapsible: true
    views:
      list:
        columns:
        - field: username
          width: 160
          link: true
        - field: full_name
          width: 180
        - field: email
          width: 200
        - field: status
          width: 100
        filters:
        - field: status
          type: select
        row_click: get-user
      detail:
        header:
          title_field: username
          subtitle_field: full_name
          status_field: status
        sections:
        - label: User Details
          fields:
          - username
          - email
          - full_name
          - status
          columns: 2
        - label: Access
          fields:
          - company_ids
          columns: 1
        actions:
        - action: update-user
          label: Edit
        - action: assign-role
          label: Assign Role
        - action: set-password
          label: Set Password
  role:
    label: Role
    label_plural: Roles
    icon: shield
    primary_field: name
    identifier_field: id
    fields:
      name:
        type: text
        label: Role Name
        required: true
        max_length: 80
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      description:
        type: textarea
        label: Description
        max_length: 500
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      is_system:
        type: boolean
        label: System Role
        read_only: true
        in_list_view: true
        in_detail_view: true
      user_count:
        type: integer
        label: Users
        read_only: true
        in_list_view: true
        in_detail_view: true
    form_groups:
      basic:
        label: Role Details
        order: 1
        columns: 1
    views:
      list:
        columns:
        - field: name
          width: 180
          link: true
        - field: description
          width: 260
        - field: is_system
          width: 100
        - field: user_count
          width: 80
          align: right
  audit_log:
    label: Audit Log
    label_plural: Audit Log
    icon: file-text
    primary_field: action
    secondary_field: entity_type
    identifier_field: id
    fields:
      timestamp:
        type: datetime
        label: Timestamp
        read_only: true
        in_list_view: true
      action:
        type: text
        label: Action
        read_only: true
        in_list_view: true
      entity_type:
        type: text
        label: Entity Type
        read_only: true
        in_list_view: true
      entity_id:
        type: text
        label: Entity ID
        read_only: true
      user_id:
        type: text
        label: User
        read_only: true
        in_list_view: true
      description:
        type: text
        label: Description
        read_only: true
        in_list_view: true
      old_values:
        type: json
        label: Previous Values
        read_only: true
        in_detail_view: true
      new_values:
        type: json
        label: New Values
        read_only: true
        in_detail_view: true
    views:
      list:
        columns:
        - field: timestamp
          width: 160
        - field: action
          width: 120
        - field: entity_type
          width: 120
        - field: description
          width: 260
        - field: user_id
          width: 140
        filters:
        - field: entity_type
          type: text
        - field: action
          type: text
        - field: timestamp
          type: date_range
  account:
    label: Account
    label_plural: Accounts
    icon: file-text
    primary_field: name
    secondary_field: account_number
    identifier_field: id
    status_field: is_frozen
    status_colors:
      false: green
      true: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        in_detail_view: true
      name:
        type: text
        label: Account Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      account_number:
        type: text
        label: Account Number
        max_length: 20
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      root_type:
        type: select
        label: Root Type
        required: true
        options:
        - value: asset
          label: Asset
        - value: liability
          label: Liability
        - value: equity
          label: Equity
        - value: income
          label: Income
        - value: expense
          label: Expense
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      account_type:
        type: select
        label: Account Type
        options:
        - value: receivable
          label: Receivable
        - value: payable
          label: Payable
        - value: bank
          label: Bank
        - value: cash
          label: Cash
        - value: stock
          label: Stock
        - value: tax
          label: Tax
        - value: fixed_asset
          label: Fixed Asset
        - value: depreciation
          label: Depreciation
        - value: accumulated_depreciation
          label: Accumulated Depreciation
        - value: cost_of_goods_sold
          label: Cost of Goods Sold
        - value: income_account
          label: Income Account
        - value: expense_account
          label: Expense Account
        - value: equity
          label: Equity
        - value: retained_earnings
          label: Retained Earnings
        - value: round_off
          label: Round Off
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      parent_id:
        type: link
        label: Parent Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: hierarchy
        form_order: 1
      is_group:
        type: boolean
        label: Is Group
        default: false
        help_text: Group accounts cannot receive GL postings directly
        in_list_view: true
        in_form_view: true
        form_group: hierarchy
        form_order: 2
      depth:
        type: integer
        label: Tree Depth
        read_only: true
        in_detail_view: true
      currency:
        type: currency_code
        label: Currency
        default: USD
        max_length: 3
        in_form_view: true
        form_group: basic
        form_order: 5
      balance_direction:
        type: select
        label: Balance Direction
        read_only: true
        options:
        - value: debit_normal
          label: Debit Normal
        - value: credit_normal
          label: Credit Normal
        in_detail_view: true
      is_frozen:
        type: boolean
        label: Frozen
        default: false
        read_only: true
        in_list_view: true
        in_detail_view: true
      disabled:
        type: boolean
        label: Disabled
        default: false
        read_only: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: basic
        form_order: 6
      balance:
        type: currency
        label: Balance
        precision: 2
        read_only: true
        in_detail_view: true
      debit_total:
        type: currency
        label: Total Debits
        precision: 2
        read_only: true
        in_detail_view: true
      credit_total:
        type: currency
        label: Total Credits
        precision: 2
        read_only: true
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Account Information
        order: 1
        columns: 2
      hierarchy:
        label: Hierarchy
        order: 2
        columns: 2
        collapsible: true
    views:
      list:
        columns:
        - field: account_number
          width: 100
          link: true
        - field: name
          width: 220
          link: true
        - field: root_type
          width: 100
        - field: account_type
          width: 140
        - field: is_group
          width: 80
        - field: is_frozen
          width: 80
        filters:
        - field: root_type
          type: select
        - field: account_type
          type: select
        - field: is_group
          type: select
        row_click: get-account
      detail:
        header:
          title_field: name
          subtitle_field: account_number
          status_field: is_frozen
        sections:
        - label: Account Information
          fields:
          - name
          - account_number
          - root_type
          - account_type
          - currency
          - balance_direction
          - company_id
          columns: 3
        - label: Hierarchy
          fields:
          - parent_id
          - is_group
          - depth
          columns: 3
        - label: Balance
          fields:
          - balance
          - debit_total
          - credit_total
          columns: 3
        - label: Status
          fields:
          - is_frozen
          - disabled
          - created_at
          - updated_at
          columns: 2
          collapsible: true
        actions:
        - action: update-account
          label: Edit
        - action: freeze-account
          label: Freeze
          destructive: true
        - action: unfreeze-account
          label: Unfreeze
        - action: get-account-balance
          label: Check Balance
  gl_entry:
    label: GL Entry
    label_plural: GL Entries
    icon: list
    primary_field: voucher_type
    secondary_field: posting_date
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        in_detail_view: true
      posting_date:
        type: date
        label: Posting Date
        required: true
        in_list_view: true
        in_detail_view: true
      account_id:
        type: link
        label: Account
        required: true
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_list_view: true
        in_detail_view: true
      account_name:
        type: text
        label: Account Name
        read_only: true
        in_list_view: true
      debit:
        type: currency
        label: Debit
        precision: 2
        required: true
        default: '0'
        in_list_view: true
        in_detail_view: true
      credit:
        type: currency
        label: Credit
        precision: 2
        required: true
        default: '0'
        in_list_view: true
        in_detail_view: true
      debit_base:
        type: currency
        label: Debit (Base)
        precision: 2
        read_only: true
        in_detail_view: true
      credit_base:
        type: currency
        label: Credit (Base)
        precision: 2
        read_only: true
        in_detail_view: true
      currency:
        type: currency_code
        label: Currency
        read_only: true
        in_detail_view: true
      exchange_rate:
        type: decimal
        label: Exchange Rate
        precision: 6
        read_only: true
        in_detail_view: true
      voucher_type:
        type: text
        label: Voucher Type
        required: true
        in_list_view: true
        in_detail_view: true
      voucher_id:
        type: text
        label: Voucher ID
        required: true
        in_list_view: true
        in_detail_view: true
      party_type:
        type: select
        label: Party Type
        options:
        - value: customer
          label: Customer
        - value: supplier
          label: Supplier
        - value: employee
          label: Employee
        in_detail_view: true
      party_id:
        type: text
        label: Party ID
        in_detail_view: true
      cost_center_id:
        type: link
        label: Cost Center
        link_entity: cost_center
        link_display_field: name
        link_search_action: list-cost-centers
        in_detail_view: true
      fiscal_year:
        type: text
        label: Fiscal Year
        read_only: true
        in_detail_view: true
      remarks:
        type: text
        label: Remarks
        read_only: true
        in_list_view: true
        in_detail_view: true
      is_cancelled:
        type: boolean
        label: Cancelled
        default: false
        read_only: true
        in_list_view: true
        in_detail_view: true
      is_opening:
        type: boolean
        label: Opening Entry
        default: false
        read_only: true
        in_detail_view: true
      gl_checksum:
        type: text
        label: GL Checksum
        read_only: true
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups: {}
    views:
      list:
        columns:
        - field: posting_date
          width: 110
        - field: account_name
          width: 200
        - field: debit
          width: 120
          align: right
        - field: credit
          width: 120
          align: right
        - field: voucher_type
          width: 130
        - field: voucher_id
          width: 140
        - field: remarks
          width: 180
        - field: is_cancelled
          width: 80
        filters:
        - field: voucher_type
          type: text
        - field: posting_date
          type: date_range
        - field: is_cancelled
          type: select
        - field: account_id
          type: link
          link_entity: account
          link_search_action: list-accounts
      detail:
        header:
          title_field: voucher_type
          subtitle_field: posting_date
        sections:
        - label: Entry Details
          fields:
          - posting_date
          - account_id
          - account_name
          - voucher_type
          - voucher_id
          - fiscal_year
          columns: 3
        - label: Amounts
          fields:
          - debit
          - credit
          - debit_base
          - credit_base
          - currency
          - exchange_rate
          columns: 3
        - label: Party
          fields:
          - party_type
          - party_id
          - cost_center_id
          columns: 3
          collapsible: true
        - label: Metadata
          fields:
          - is_cancelled
          - is_opening
          - remarks
          - gl_checksum
          - created_at
          columns: 2
          collapsible: true
  fiscal_year:
    label: Fiscal Year
    label_plural: Fiscal Years
    icon: calendar
    primary_field: name
    secondary_field: start_date
    identifier_field: id
    status_field: is_closed
    status_colors:
      false: green
      true: gray
    fields:
      id:
        type: text
        label: ID
        read_only: true
        in_detail_view: true
      name:
        type: text
        label: Name
        required: true
        max_length: 140
        placeholder: e.g., FY 2026
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      start_date:
        type: date
        label: Start Date
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      end_date:
        type: date
        label: End Date
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      is_closed:
        type: boolean
        label: Closed
        default: false
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Fiscal Year Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: name
          width: 180
          link: true
        - field: start_date
          width: 120
        - field: end_date
          width: 120
        - field: is_closed
          width: 80
        - field: company_id
          width: 160
        filters:
        - field: is_closed
          type: select
        row_click: get-fiscal-year
      detail:
        header:
          title_field: name
          subtitle_field: company_id
          status_field: is_closed
        sections:
        - label: Fiscal Year Details
          fields:
          - name
          - start_date
          - end_date
          - is_closed
          - company_id
          columns: 3
        - label: Metadata
          fields:
          - created_at
          - updated_at
          columns: 2
          collapsible: true
        actions:
        - action: validate-period-close
          label: Validate for Closing
        - action: close-fiscal-year
          label: Close Year
          destructive: true
        - action: reopen-fiscal-year
          label: Reopen Year
          destructive: true
  cost_center:
    label: Cost Center
    label_plural: Cost Centers
    icon: target
    primary_field: name
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        in_detail_view: true
      name:
        type: text
        label: Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      parent_id:
        type: link
        label: Parent Cost Center
        link_entity: cost_center
        link_display_field: name
        link_search_action: list-cost-centers
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      is_group:
        type: boolean
        label: Is Group
        default: false
        help_text: Group cost centers contain sub-cost-centers
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: basic
        form_order: 4
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Cost Center Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: name
          width: 220
          link: true
        - field: parent_id
          width: 180
        - field: is_group
          width: 80
        filters:
        - field: is_group
          type: select
        - field: parent_id
          type: link
          link_entity: cost_center
          link_search_action: list-cost-centers
      detail:
        header:
          title_field: name
        sections:
        - label: Cost Center Details
          fields:
          - name
          - parent_id
          - is_group
          - company_id
          columns: 2
        - label: Metadata
          fields:
          - created_at
          - updated_at
          columns: 2
          collapsible: true
  budget:
    label: Budget
    label_plural: Budgets
    icon: pie-chart
    primary_field: budget_amount
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        in_detail_view: true
      fiscal_year_id:
        type: link
        label: Fiscal Year
        required: true
        link_entity: fiscal_year
        link_display_field: name
        link_search_action: list-fiscal-years
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      account_id:
        type: link
        label: Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        help_text: At least one of Account or Cost Center is required
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      cost_center_id:
        type: link
        label: Cost Center
        link_entity: cost_center
        link_display_field: name
        link_search_action: list-cost-centers
        help_text: At least one of Account or Cost Center is required
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      budget_amount:
        type: currency
        label: Budget Amount
        precision: 2
        required: true
        min: '0'
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      actual_amount:
        type: currency
        label: Actual Amount
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      variance:
        type: currency
        label: Variance
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      action_if_exceeded:
        type: select
        label: Action If Exceeded
        options:
        - value: warn
          label: Warn
        - value: stop
          label: Stop
        default: warn
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 5
      company_id:
        type: link
        label: Company
        read_only: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Budget Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: fiscal_year_id
          width: 140
        - field: account_id
          width: 180
        - field: cost_center_id
          width: 160
        - field: budget_amount
          width: 130
          align: right
        - field: actual_amount
          width: 130
          align: right
        - field: variance
          width: 130
          align: right
        - field: action_if_exceeded
          width: 100
        filters:
        - field: fiscal_year_id
          type: link
          link_entity: fiscal_year
          link_search_action: list-fiscal-years
        - field: action_if_exceeded
          type: select
      detail:
        header:
          title_field: budget_amount
          subtitle_field: fiscal_year_id
        sections:
        - label: Budget Details
          fields:
          - fiscal_year_id
          - account_id
          - cost_center_id
          - budget_amount
          - action_if_exceeded
          - company_id
          columns: 2
        - label: Actuals
          fields:
          - actual_amount
          - variance
          columns: 2
        - label: Metadata
          fields:
          - created_at
          - updated_at
          columns: 2
          collapsible: true
  naming_series:
    label: Naming Series
    label_plural: Naming Series
    icon: hash
    primary_field: entity_type
    secondary_field: prefix
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        in_detail_view: true
      entity_type:
        type: text
        label: Entity Type
        required: true
        in_list_view: true
        in_detail_view: true
      prefix:
        type: text
        label: Prefix
        required: true
        help_text: e.g., INV-2026-, JV-2026-
        in_list_view: true
        in_detail_view: true
      current_value:
        type: integer
        label: Current Value
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups: {}
    views:
      list:
        columns:
        - field: entity_type
          width: 160
        - field: prefix
          width: 160
        - field: current_value
          width: 120
          align: right
        filters:
        - field: entity_type
          type: text
  period_closing_voucher:
    label: Period Closing Voucher
    label_plural: Period Closing Vouchers
    icon: lock
    primary_field: fiscal_year_id
    secondary_field: posting_date
    identifier_field: id
    status_field: status
    status_colors:
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        in_detail_view: true
      fiscal_year_id:
        type: link
        label: Fiscal Year
        required: true
        link_entity: fiscal_year
        link_display_field: name
        link_search_action: list-fiscal-years
        in_list_view: true
        in_detail_view: true
      posting_date:
        type: date
        label: Posting Date
        required: true
        in_list_view: true
        in_detail_view: true
      closing_account_id:
        type: link
        label: Closing Account (Retained Earnings)
        required: true
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_list_view: true
        in_detail_view: true
      net_pl_amount:
        type: currency
        label: Net P&L Amount
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        read_only: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups: {}
    views:
      list:
        columns:
        - field: fiscal_year_id
          width: 160
        - field: posting_date
          width: 120
        - field: closing_account_id
          width: 200
        - field: net_pl_amount
          width: 140
          align: right
        - field: status
          width: 100
      detail:
        header:
          title_field: fiscal_year_id
          subtitle_field: posting_date
          status_field: status
        sections:
        - label: Voucher Details
          fields:
          - fiscal_year_id
          - posting_date
          - closing_account_id
          - net_pl_amount
          - status
          - company_id
          columns: 2
        - label: Metadata
          fields:
          - created_at
          - updated_at
          columns: 2
          collapsible: true
  journal_entry:
    label: Journal Entry
    label_plural: Journal Entries
    table: journal_entry
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: Naming Series
        read_only: true
      posting_date:
        type: date
        label: Posting Date
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      entry_type:
        type: select
        label: Entry Type
        required: true
        options:
        - value: journal
          label: Journal
        - value: opening
          label: Opening
        - value: closing
          label: Closing
        - value: depreciation
          label: Depreciation
        - value: write_off
          label: Write Off
        - value: exchange_rate_revaluation
          label: Exchange Rate Revaluation
        - value: inter_company
          label: Inter Company
        - value: credit_note
          label: Credit Note
        - value: debit_note
          label: Debit Note
        in_form_view: true
        form_group: details
        form_order: 2
      total_debit:
        type: currency
        label: Total Debit
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 3
      total_credit:
        type: currency
        label: Total Credit
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 4
      currency:
        type: text
        label: Currency
        required: true
        in_form_view: true
        form_group: details
        form_order: 5
      exchange_rate:
        type: currency
        label: Exchange Rate
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 6
      remark:
        type: text
        label: Remark
        in_form_view: true
        form_group: details
        form_order: 7
      status:
        type: select
        label: Status
        options:
        - value: draft
          label: Draft
        - value: submitted
          label: Submitted
        - value: cancelled
          label: Cancelled
        - value: amended
          label: Amended
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 8
      amended_from:
        type: text
        label: Amended From
        in_form_view: true
        form_group: details
        form_order: 9
      company_id:
        type: link
        label: Company ID
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: references
        form_order: 10
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      amounts:
        label: Amounts
        order: 4
        columns: 2
      items:
        label: Line Items
        order: 5
        type: child_table
  payment_entry:
    label: Payment Entry
    label_plural: Payment Entries
    table: payment_entry
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: Naming Series
        read_only: true
      payment_type:
        type: select
        label: Payment Type
        required: true
        options:
        - value: receive
          label: Receive
        - value: pay
          label: Pay
        - value: internal_transfer
          label: Internal Transfer
        in_form_view: true
        form_group: details
        form_order: 1
      posting_date:
        type: date
        label: Posting Date
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 2
      party_type:
        type: select
        label: Party Type
        options:
        - value: customer
          label: Customer
        - value: supplier
          label: Supplier
        - value: employee
          label: Employee
        in_form_view: true
        form_group: details
        form_order: 3
      party_id:
        type: link
        label: Party ID
        link_entity: party
        link_display_field: name
        link_search_action: list-parties
        in_form_view: true
        form_group: references
        form_order: 4
      paid_from_account:
        type: currency
        label: Paid From Account
        precision: 2
        in_form_view: true
        form_group: details
        form_order: 5
      paid_to_account:
        type: currency
        label: Paid To Account
        precision: 2
        in_form_view: true
        form_group: details
        form_order: 6
      paid_amount:
        type: currency
        label: Paid Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 7
      received_amount:
        type: currency
        label: Received Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 8
      payment_currency:
        type: text
        label: Payment Currency
        required: true
        in_form_view: true
        form_group: details
        form_order: 9
      exchange_rate:
        type: currency
        label: Exchange Rate
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 10
      reference_number:
        type: text
        label: Reference Number
        in_form_view: true
        form_group: details
        form_order: 11
      reference_date:
        type: date
        label: Reference Date
        in_form_view: true
        form_group: header
        form_order: 12
      status:
        type: select
        label: Status
        options:
        - value: draft
          label: Draft
        - value: submitted
          label: Submitted
        - value: cancelled
          label: Cancelled
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 13
      unallocated_amount:
        type: currency
        label: Unallocated Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 14
      company_id:
        type: link
        label: Company ID
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: references
        form_order: 15
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      amounts:
        label: Amounts
        order: 4
        columns: 2
  payment_allocation:
    label: Payment Allocation
    label_plural: Payment Allocations
    table: payment_allocation
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      payment_entry_id:
        type: link
        label: Payment Entry ID
        link_entity: payment_entry
        link_display_field: name
        link_search_action: list-payment-entries
        in_form_view: true
        form_group: references
        form_order: 1
      voucher_type:
        type: select
        label: Voucher Type
        required: true
        options:
        - value: sales_invoice
          label: Sales Invoice
        - value: purchase_invoice
          label: Purchase Invoice
        - value: credit_note
          label: Credit Note
        - value: debit_note
          label: Debit Note
        in_form_view: true
        form_group: details
        form_order: 2
      voucher_id:
        type: link
        label: Voucher ID
        link_entity: voucher
        link_display_field: name
        link_search_action: list-vouchers
        in_form_view: true
        form_group: references
        form_order: 3
      allocated_amount:
        type: currency
        label: Allocated Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 4
      exchange_gain_loss:
        type: text
        label: Exchange Gain Loss
        required: true
        in_form_view: true
        form_group: details
        form_order: 5
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
      amounts:
        label: Amounts
        order: 3
        columns: 2
  payment_deduction:
    label: Payment Deduction
    label_plural: Payment Deductions
    table: payment_deduction
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      payment_entry_id:
        type: link
        label: Payment Entry ID
        link_entity: payment_entry
        link_display_field: name
        link_search_action: list-payment-entries
        in_form_view: true
        form_group: references
        form_order: 1
      account_id:
        type: link
        label: Account ID
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: references
        form_order: 2
      amount:
        type: currency
        label: Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 3
      type:
        type: select
        label: Type
        required: true
        options:
        - value: tds
          label: Tds
        - value: commission
          label: Commission
        - value: early_payment_discount
          label: Early Payment Discount
        - value: other
          label: Other
        in_form_view: true
        form_group: details
        form_order: 4
      description:
        type: textarea
        label: Description
        in_form_view: true
        form_group: notes
        form_order: 5
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
      amounts:
        label: Amounts
        order: 3
        columns: 2
      notes:
        label: Notes
        order: 4
        columns: 1
  payment_ledger_entry:
    label: Payment Ledger Entry
    label_plural: Payment Ledger Entries
    table: payment_ledger_entry
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      posting_date:
        type: date
        label: Posting Date
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      account_id:
        type: link
        label: Account ID
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: references
        form_order: 2
      party_type:
        type: select
        label: Party Type
        required: true
        options:
        - value: customer
          label: Customer
        - value: supplier
          label: Supplier
        - value: employee
          label: Employee
        in_form_view: true
        form_group: details
        form_order: 3
      party_id:
        type: link
        label: Party ID
        link_entity: party
        link_display_field: name
        link_search_action: list-parties
        in_form_view: true
        form_group: references
        form_order: 4
      voucher_type:
        type: text
        label: Voucher Type
        required: true
        in_form_view: true
        form_group: details
        form_order: 5
      voucher_id:
        type: link
        label: Voucher ID
        link_entity: voucher
        link_display_field: name
        link_search_action: list-vouchers
        in_form_view: true
        form_group: references
        form_order: 6
      against_voucher_type:
        type: text
        label: Against Voucher Type
        in_form_view: true
        form_group: details
        form_order: 7
      against_voucher_id:
        type: link
        label: Against Voucher ID
        link_entity: against_voucher
        link_display_field: name
        link_search_action: list-against-vouchers
        in_form_view: true
        form_group: references
        form_order: 8
      amount:
        type: currency
        label: Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 9
      amount_in_account_currency:
        type: currency
        label: Amount In Account Currency
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 10
      currency:
        type: text
        label: Currency
        required: true
        in_form_view: true
        form_group: details
        form_order: 11
      delinked:
        type: integer
        label: Delinked
        in_form_view: true
        form_group: details
        form_order: 12
      remarks:
        type: textarea
        label: Remarks
        in_form_view: true
        form_group: notes
        form_order: 13
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      amounts:
        label: Amounts
        order: 4
        columns: 2
      notes:
        label: Notes
        order: 5
        columns: 1
  tax_template:
    label: Tax Template
    label_plural: Tax Templates
    table: tax_template
    id_col: id
    name_col: name
    primary_field: name
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Name
        required: true
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      tax_type:
        type: select
        label: Tax Type
        required: true
        options:
        - value: sales
          label: Sales
        - value: purchase
          label: Purchase
        - value: both
          label: Both
        in_form_view: true
        form_group: details
        form_order: 2
      is_default:
        type: integer
        label: Is Default
        in_form_view: true
        form_group: details
        form_order: 3
      tax_category_id:
        type: link
        label: Tax Category ID
        link_entity: tax_category
        link_display_field: name
        link_search_action: list-tax-categories
        in_form_view: true
        form_group: references
        form_order: 4
      company_id:
        type: link
        label: Company ID
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: references
        form_order: 5
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      items:
        label: Line Items
        order: 4
        type: child_table
  tax_rule:
    label: Tax Rule
    label_plural: Tax Rules
    table: tax_rule
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      tax_template_id:
        type: link
        label: Tax Template ID
        link_entity: tax_template
        link_display_field: name
        link_search_action: list-tax-templates
        in_form_view: true
        form_group: references
        form_order: 1
      tax_type:
        type: select
        label: Tax Type
        required: true
        options:
        - value: sales
          label: Sales
        - value: purchase
          label: Purchase
        in_form_view: true
        form_group: details
        form_order: 2
      customer_id:
        type: link
        label: Customer ID
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_form_view: true
        form_group: references
        form_order: 3
      supplier_id:
        type: link
        label: Supplier ID
        link_entity: supplier
        link_display_field: name
        link_search_action: list-suppliers
        in_form_view: true
        form_group: references
        form_order: 4
      customer_group:
        type: text
        label: Customer Group
        in_form_view: true
        form_group: details
        form_order: 5
      supplier_group:
        type: text
        label: Supplier Group
        in_form_view: true
        form_group: details
        form_order: 6
      item_id:
        type: link
        label: Item ID
        link_entity: item
        link_display_field: name
        link_search_action: list-items
        in_form_view: true
        form_group: references
        form_order: 7
      item_group:
        type: text
        label: Item Group
        in_form_view: true
        form_group: details
        form_order: 8
      billing_state:
        type: text
        label: Billing State
        in_form_view: true
        form_group: details
        form_order: 9
      shipping_state:
        type: text
        label: Shipping State
        in_form_view: true
        form_group: details
        form_order: 10
      tax_category_id:
        type: link
        label: Tax Category ID
        link_entity: tax_category
        link_display_field: name
        link_search_action: list-tax-categories
        in_form_view: true
        form_group: references
        form_order: 11
      priority:
        type: integer
        label: Priority
        in_form_view: true
        form_group: details
        form_order: 12
      company_id:
        type: link
        label: Company ID
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: references
        form_order: 13
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
  tax_category:
    label: Tax Category
    label_plural: Tax Categories
    table: tax_category
    id_col: id
    name_col: name
    primary_field: name
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Name
        required: true
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      description:
        type: textarea
        label: Description
        in_form_view: true
        form_group: notes
        form_order: 2
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      notes:
        label: Notes
        order: 2
        columns: 1
  tax_withholding_category:
    label: Tax Withholding Category
    label_plural: Tax Withholding Categories
    table: tax_withholding_category
    id_col: id
    name_col: name
    primary_field: name
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Name
        required: true
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      category_code:
        type: text
        label: Category Code
        in_form_view: true
        form_group: details
        form_order: 2
      single_threshold:
        type: text
        label: Single Threshold
        in_form_view: true
        form_group: details
        form_order: 3
      cumulative_threshold:
        type: text
        label: Cumulative Threshold
        in_form_view: true
        form_group: details
        form_order: 4
      tax_on_excess_amount:
        type: integer
        label: Tax On Excess Amount
        in_form_view: true
        form_group: amounts
        form_order: 5
      company_id:
        type: link
        label: Company ID
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: references
        form_order: 6
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      amounts:
        label: Amounts
        order: 4
        columns: 2
  tax_withholding_entry:
    label: Tax Withholding Entry
    label_plural: Tax Withholding Entries
    table: tax_withholding_entry
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      party_type:
        type: select
        label: Party Type
        required: true
        options:
        - value: customer
          label: Customer
        - value: supplier
          label: Supplier
        in_form_view: true
        form_group: details
        form_order: 1
      party_id:
        type: link
        label: Party ID
        link_entity: party
        link_display_field: name
        link_search_action: list-parties
        in_form_view: true
        form_group: references
        form_order: 2
      category_id:
        type: link
        label: Category ID
        link_entity: tax_withholding_category
        link_display_field: name
        link_search_action: list-tax-withholding-categories
        in_form_view: true
        form_group: references
        form_order: 3
      fiscal_year:
        type: text
        label: Fiscal Year
        required: true
        in_form_view: true
        form_group: details
        form_order: 4
      taxable_amount:
        type: currency
        label: Taxable Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 5
      withheld_amount:
        type: currency
        label: Withheld Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 6
      taxable_voucher_type:
        type: text
        label: Taxable Voucher Type
        in_form_view: true
        form_group: details
        form_order: 7
      taxable_voucher_id:
        type: link
        label: Taxable Voucher ID
        link_entity: taxable_voucher
        link_display_field: name
        link_search_action: list-taxable-vouchers
        in_form_view: true
        form_group: references
        form_order: 8
      withholding_voucher_type:
        type: text
        label: Withholding Voucher Type
        in_form_view: true
        form_group: details
        form_order: 9
      withholding_voucher_id:
        type: link
        label: Withholding Voucher ID
        link_entity: withholding_voucher
        link_display_field: name
        link_search_action: list-withholding-vouchers
        in_form_view: true
        form_group: references
        form_order: 10
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
      amounts:
        label: Amounts
        order: 3
        columns: 2
  tax_withholding_group:
    label: Tax Withholding Group
    label_plural: Tax Withholding Groups
    table: tax_withholding_group
    id_col: id
    name_col: group_name
    primary_field: group_name
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      category_id:
        type: link
        label: Category ID
        link_entity: tax_withholding_category
        link_display_field: name
        link_search_action: list-tax-withholding-categories
        in_form_view: true
        form_group: references
        form_order: 1
      group_name:
        type: text
        label: Group Name
        required: true
        in_list_view: true
        in_form_view: true
        form_group: details
        form_order: 2
      rate:
        type: currency
        label: Rate
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 3
      effective_from:
        type: date
        label: Effective From
        in_form_view: true
        form_group: details
        form_order: 4
      effective_to:
        type: date
        label: Effective To
        in_form_view: true
        form_group: details
        form_order: 5
      account_id:
        type: link
        label: Account ID
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        in_form_view: true
        form_group: references
        form_order: 6
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
      amounts:
        label: Amounts
        order: 3
        columns: 2
  item_tax_template:
    label: Item Tax Template
    label_plural: Item Tax Templates
    table: item_tax_template
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      item_id:
        type: link
        label: Item ID
        link_entity: item
        link_display_field: name
        link_search_action: list-items
        in_form_view: true
        form_group: references
        form_order: 1
      tax_template_id:
        type: link
        label: Tax Template ID
        link_entity: tax_template
        link_display_field: name
        link_search_action: list-tax-templates
        in_form_view: true
        form_group: references
        form_order: 2
      tax_rate:
        type: currency
        label: Tax Rate
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 3
    form_groups:
      references:
        label: References
        order: 1
        columns: 2
      amounts:
        label: Amounts
        order: 2
        columns: 2
  item:
    label: Item
    label_plural: Items
    icon: box
    primary_field: item_name
    secondary_field: item_code
    identifier_field: id
    status_field: status
    status_colors:
      active: green
      disabled: gray
    fields:
      item_code:
        type: text
        label: Item Code
        required: true
        max_length: 140
        placeholder: e.g., SKU-001
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      item_name:
        type: text
        label: Item Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      item_type:
        type: select
        label: Item Type
        required: true
        options:
        - value: stock
          label: Stock
        - value: non_stock
          label: Non-Stock
        - value: service
          label: Service
        default: stock
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      item_group_id:
        type: link
        label: Item Group
        link_entity: item_group
        link_display_field: name
        link_search_action: list-item-groups
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      stock_uom:
        type: text
        label: Stock UoM
        required: true
        default: Nos
        max_length: 80
        help_text: Default unit of measure (e.g., Nos, Kg, Ltr)
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 5
      valuation_method:
        type: select
        label: Valuation Method
        options:
        - value: moving_average
          label: Moving Average
        - value: fifo
          label: FIFO
        default: moving_average
        in_form_view: true
        form_group: basic
        form_order: 6
      standard_rate:
        type: currency
        label: Standard Rate
        precision: 2
        default: '0.00'
        help_text: Default rate used when no price list rate is available
        in_list_view: true
        in_form_view: true
        form_group: pricing
        form_order: 1
      is_stock_item:
        type: boolean
        label: Is Stock Item
        read_only: true
        help_text: Automatically set based on item type
        in_detail_view: true
      has_batch:
        type: boolean
        label: Has Batch No
        default: false
        help_text: Track this item by batch number
        in_form_view: true
        form_group: tracking
        form_order: 1
      has_serial:
        type: boolean
        label: Has Serial No
        default: false
        help_text: Track each unit by serial number
        in_form_view: true
        form_group: tracking
        form_order: 2
      reorder_level:
        type: quantity
        label: Reorder Level
        precision: 2
        help_text: Alert when stock falls to or below this quantity
        in_form_view: true
        form_group: reorder
        form_order: 1
      reorder_qty:
        type: quantity
        label: Reorder Qty
        precision: 2
        help_text: Suggested quantity to reorder
        in_form_view: true
        form_group: reorder
        form_order: 2
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      description:
        type: textarea
        label: Description
        max_length: 1000
        in_form_view: true
        form_group: basic
        form_order: 7
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Item Details
        order: 1
        columns: 2
      pricing:
        label: Pricing
        order: 2
        columns: 2
      tracking:
        label: Batch & Serial Tracking
        order: 3
        columns: 2
        collapsible: true
      reorder:
        label: Reorder Settings
        order: 4
        columns: 2
        collapsible: true
    views:
      list:
        columns:
        - field: item_code
          width: 120
          link: true
        - field: item_name
          width: 200
        - field: item_type
          width: 100
        - field: stock_uom
          width: 80
        - field: standard_rate
          width: 120
          align: right
        - field: status
          width: 90
        filters:
        - field: item_type
          type: select
        - field: item_group_id
          type: link
        - field: status
          type: select
        row_click: get-item
      detail:
        header:
          title_field: item_name
          subtitle_field: item_code
          status_field: status
        sections:
        - label: Item Details
          fields:
          - item_code
          - item_name
          - item_type
          - item_group_id
          - stock_uom
          - valuation_method
          - description
          columns: 2
        - label: Pricing
          fields:
          - standard_rate
          columns: 2
        - label: Tracking
          fields:
          - has_batch
          - has_serial
          columns: 2
          collapsible: true
        - label: Reorder Settings
          fields:
          - reorder_level
          - reorder_qty
          columns: 2
          collapsible: true
        - label: Stock Balances
          child_entity: item_stock_balance
          child_action: get-item
          child_key: stock_balances
          columns: 1
        actions:
        - action: update-item
          label: Edit
        - action: add-item-price
          label: Set Price
        - action: add-batch
          label: Add Batch
          condition: has_batch == true
        - action: add-serial-number
          label: Add Serial No
          condition: has_serial == true
  item_group:
    label: Item Group
    label_plural: Item Groups
    icon: folder
    primary_field: name
    identifier_field: id
    fields:
      name:
        type: text
        label: Group Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      parent_id:
        type: link
        label: Parent Group
        link_entity: item_group
        link_display_field: name
        link_search_action: list-item-groups
        help_text: Leave blank for a top-level group
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Item Group Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: name
          width: 240
          link: true
        - field: parent_id
          width: 200
        filters:
        - field: parent_id
          type: link
  warehouse:
    label: Warehouse
    label_plural: Warehouses
    icon: home
    primary_field: name
    secondary_field: warehouse_type
    identifier_field: id
    fields:
      name:
        type: text
        label: Warehouse Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      warehouse_type:
        type: select
        label: Warehouse Type
        options:
        - value: stores
          label: Stores
        - value: production
          label: Production
        - value: transit
          label: Transit
        - value: rejected
          label: Rejected
        default: stores
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      parent_id:
        type: link
        label: Parent Warehouse
        link_entity: warehouse
        link_display_field: name
        link_search_action: list-warehouses
        help_text: Leave blank for a top-level warehouse
        in_form_view: true
        form_group: basic
        form_order: 4
      account_id:
        type: link
        label: Stock Account
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        help_text: GL account for perpetual inventory posting
        in_form_view: true
        form_group: accounting
        form_order: 1
      is_group:
        type: boolean
        label: Is Group
        default: false
        help_text: Group warehouses cannot hold stock directly
        in_form_view: true
        form_group: basic
        form_order: 5
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Warehouse Details
        order: 1
        columns: 2
      accounting:
        label: Accounting
        order: 2
        columns: 2
        collapsible: true
    views:
      list:
        columns:
        - field: name
          width: 220
          link: true
        - field: warehouse_type
          width: 120
        - field: company_id
          width: 180
        - field: is_group
          width: 80
        filters:
        - field: company_id
          type: link
        - field: warehouse_type
          type: select
  stock_entry:
    label: Stock Entry
    label_plural: Stock Entries
    icon: truck
    primary_field: naming_series
    secondary_field: stock_entry_type
    identifier_field: id
    status_field: status
    lifecycle: draft-submit-cancel
    status_colors:
      draft: blue
      submitted: green
      cancelled: red
    fields:
      naming_series:
        type: text
        label: Entry No
        read_only: true
        in_list_view: true
        in_detail_view: true
      stock_entry_type:
        type: select
        label: Entry Type
        required: true
        options:
        - value: material_receipt
          label: Material Receipt
        - value: material_issue
          label: Material Issue
        - value: material_transfer
          label: Material Transfer
        - value: manufacture
          label: Manufacture
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      posting_date:
        type: date
        label: Posting Date
        required: true
        default: today
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      total_incoming_value:
        type: currency
        label: Total Incoming Value
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      total_outgoing_value:
        type: currency
        label: Total Outgoing Value
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      value_difference:
        type: currency
        label: Value Difference
        precision: 2
        read_only: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Stock Entry Details
        order: 1
        columns: 3
      items:
        label: Items
        order: 2
        columns: 1
        child_entity: stock_entry_item
      totals:
        label: Totals
        order: 3
        columns: 3
        read_only: true
    views:
      list:
        columns:
        - field: naming_series
          width: 140
          link: true
        - field: stock_entry_type
          width: 140
        - field: posting_date
          width: 110
        - field: total_incoming_value
          width: 140
          align: right
        - field: total_outgoing_value
          width: 140
          align: right
        - field: status
          width: 100
        filters:
        - field: company_id
          type: link
        - field: stock_entry_type
          type: select
        - field: status
          type: select
        - field: posting_date
          type: date_range
        row_click: get-stock-entry
      detail:
        header:
          title_field: naming_series
          subtitle_field: stock_entry_type
          status_field: status
        sections:
        - label: Entry Details
          fields:
          - naming_series
          - stock_entry_type
          - company_id
          - posting_date
          columns: 2
        - label: Items
          child_entity: stock_entry_item
          child_action: get-stock-entry
          child_key: items
          columns: 1
        - label: Totals
          fields:
          - total_incoming_value
          - total_outgoing_value
          - value_difference
          columns: 3
        actions:
        - action: submit-stock-entry
          label: Submit
          condition: status == 'draft'
          style: primary
          confirm: true
        - action: cancel-stock-entry
          label: Cancel
          condition: status == 'submitted'
          style: danger
          confirm: true
  batch:
    label: Batch
    label_plural: Batches
    icon: layers
    primary_field: batch_name
    identifier_field: id
    fields:
      batch_name:
        type: text
        label: Batch Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      item_id:
        type: link
        label: Item
        required: true
        link_entity: item
        link_display_field: item_name
        link_search_action: list-items
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      manufacturing_date:
        type: date
        label: Manufacturing Date
        in_form_view: true
        form_group: dates
        form_order: 1
      expiry_date:
        type: date
        label: Expiry Date
        in_list_view: true
        in_form_view: true
        form_group: dates
        form_order: 2
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Batch Details
        order: 1
        columns: 2
      dates:
        label: Dates
        order: 2
        columns: 2
    views:
      list:
        columns:
        - field: batch_name
          width: 180
          link: true
        - field: item_id
          width: 200
        - field: expiry_date
          width: 120
        filters:
        - field: item_id
          type: link
  serial_number:
    label: Serial Number
    label_plural: Serial Numbers
    icon: hash
    primary_field: serial_no
    secondary_field: status
    identifier_field: id
    status_field: status
    status_colors:
      active: green
      delivered: blue
      returned: orange
      scrapped: red
    fields:
      serial_no:
        type: text
        label: Serial No
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      item_id:
        type: link
        label: Item
        required: true
        link_entity: item
        link_display_field: item_name
        link_search_action: list-items
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      warehouse_id:
        type: link
        label: Warehouse
        link_entity: warehouse
        link_display_field: name
        link_search_action: list-warehouses
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      batch_id:
        type: link
        label: Batch
        link_entity: batch
        link_display_field: batch_name
        link_search_action: list-batches
        in_form_view: true
        form_group: basic
        form_order: 4
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Serial Number Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: serial_no
          width: 160
          link: true
        - field: item_id
          width: 200
        - field: warehouse_id
          width: 180
        - field: status
          width: 100
        filters:
        - field: item_id
          type: link
        - field: warehouse_id
          type: link
        - field: status
          type: select
  price_list:
    label: Price List
    label_plural: Price Lists
    icon: tag
    primary_field: name
    secondary_field: currency
    identifier_field: id
    fields:
      name:
        type: text
        label: Price List Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      currency:
        type: currency_code
        label: Currency
        default: USD
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      buying:
        type: boolean
        label: Buying
        default: false
        help_text: Use this price list for purchase transactions
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      selling:
        type: boolean
        label: Selling
        default: false
        help_text: Use this price list for sales transactions
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 4
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Price List Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: name
          width: 220
          link: true
        - field: currency
          width: 100
        - field: buying
          width: 80
        - field: selling
          width: 80
  item_price:
    label: Item Price
    label_plural: Item Prices
    icon: dollar-sign
    primary_field: item_id
    secondary_field: price_list_id
    identifier_field: id
    fields:
      item_id:
        type: link
        label: Item
        required: true
        link_entity: item
        link_display_field: item_name
        link_search_action: list-items
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      price_list_id:
        type: link
        label: Price List
        required: true
        link_entity: price_list
        link_display_field: name
        link_search_action: list-price-lists
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      rate:
        type: currency
        label: Rate
        required: true
        precision: 2
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      min_qty:
        type: quantity
        label: Minimum Qty
        precision: 2
        default: '0'
        help_text: Price applies when ordered qty >= this value
        in_list_view: true
        in_form_view: true
        form_group: validity
        form_order: 1
      valid_from:
        type: date
        label: Valid From
        in_form_view: true
        form_group: validity
        form_order: 2
      valid_to:
        type: date
        label: Valid To
        in_form_view: true
        form_group: validity
        form_order: 3
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Price Details
        order: 1
        columns: 3
      validity:
        label: Validity & Tiers
        order: 2
        columns: 3
        collapsible: true
    views:
      list:
        columns:
        - field: item_id
          width: 200
        - field: price_list_id
          width: 180
        - field: rate
          width: 120
          align: right
        - field: min_qty
          width: 100
          align: right
        - field: valid_from
          width: 110
        - field: valid_to
          width: 110
  pricing_rule:
    label: Pricing Rule
    label_plural: Pricing Rules
    icon: percent
    primary_field: name
    secondary_field: applies_to
    identifier_field: id
    fields:
      name:
        type: text
        label: Rule Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      applies_to:
        type: select
        label: Applies To
        required: true
        options:
        - value: item
          label: Item
        - value: item_group
          label: Item Group
        - value: customer
          label: Customer
        - value: customer_group
          label: Customer Group
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      entity_id:
        type: text
        label: Entity ID
        help_text: ID of the item, item group, customer, or customer group
        in_form_view: true
        form_group: basic
        form_order: 3
      discount_percentage:
        type: percent
        label: Discount %
        precision: 2
        min: '0'
        max: '100'
        in_list_view: true
        in_form_view: true
        form_group: pricing
        form_order: 1
      rate:
        type: currency
        label: Fixed Rate
        precision: 2
        help_text: Override rate (alternative to discount %)
        in_form_view: true
        form_group: pricing
        form_order: 2
      min_qty:
        type: quantity
        label: Minimum Qty
        precision: 2
        in_form_view: true
        form_group: conditions
        form_order: 1
      max_qty:
        type: quantity
        label: Maximum Qty
        precision: 2
        in_form_view: true
        form_group: conditions
        form_order: 2
      valid_from:
        type: date
        label: Valid From
        in_list_view: true
        in_form_view: true
        form_group: conditions
        form_order: 3
      valid_to:
        type: date
        label: Valid To
        in_list_view: true
        in_form_view: true
        form_group: conditions
        form_order: 4
      priority:
        type: integer
        label: Priority
        default: 0
        help_text: Higher priority rules are applied first
        in_form_view: true
        form_group: conditions
        form_order: 5
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: basic
        form_order: 4
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Rule Details
        order: 1
        columns: 2
      pricing:
        label: Pricing
        order: 2
        columns: 2
      conditions:
        label: Conditions & Validity
        order: 3
        columns: 2
        collapsible: true
    views:
      list:
        columns:
        - field: name
          width: 200
          link: true
        - field: applies_to
          width: 120
        - field: discount_percentage
          width: 100
          align: right
        - field: valid_from
          width: 110
        - field: valid_to
          width: 110
        filters:
        - field: applies_to
          type: select
        - field: company_id
          type: link
  stock_reconciliation:
    label: Stock Reconciliation
    label_plural: Stock Reconciliations
    icon: clipboard-check
    primary_field: naming_series
    secondary_field: posting_date
    identifier_field: id
    status_field: status
    lifecycle: draft-submit-cancel
    status_colors:
      draft: blue
      submitted: green
      cancelled: red
    fields:
      naming_series:
        type: text
        label: Reconciliation No
        read_only: true
        in_list_view: true
        in_detail_view: true
      posting_date:
        type: date
        label: Posting Date
        required: true
        default: today
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      difference_amount:
        type: currency
        label: Difference Amount
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Reconciliation Details
        order: 1
        columns: 2
      items:
        label: Items
        order: 2
        columns: 1
        child_entity: stock_reconciliation_item
    views:
      list:
        columns:
        - field: naming_series
          width: 160
          link: true
        - field: posting_date
          width: 120
        - field: company_id
          width: 180
        - field: difference_amount
          width: 140
          align: right
        - field: status
          width: 100
        filters:
        - field: company_id
          type: link
        - field: status
          type: select
        - field: posting_date
          type: date_range
      detail:
        header:
          title_field: naming_series
          subtitle_field: posting_date
          status_field: status
        sections:
        - label: Reconciliation Details
          fields:
          - naming_series
          - posting_date
          - company_id
          - difference_amount
          columns: 2
        - label: Items
          child_entity: stock_reconciliation_item
          child_action: get-stock-reconciliation
          child_key: items
          columns: 1
        actions:
        - action: submit-stock-reconciliation
          label: Submit
          condition: status == 'draft'
          style: primary
          confirm: true
  stock_revaluation:
    label: Stock Revaluation
    label_plural: Stock Revaluations
    icon: trending-up
    primary_field: naming_series
    secondary_field: posting_date
    identifier_field: id
    status_field: status
    lifecycle: submit-cancel
    status_colors:
      submitted: green
      cancelled: red
    fields:
      naming_series:
        type: text
        label: Revaluation No
        read_only: true
        in_list_view: true
        in_detail_view: true
      item_id:
        type: link
        label: Item
        required: true
        link_entity: item
        link_display_field: item_name
        link_search_action: list-items
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      warehouse_id:
        type: link
        label: Warehouse
        required: true
        link_entity: warehouse
        link_display_field: name
        link_search_action: list-warehouses
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      posting_date:
        type: date
        label: Posting Date
        required: true
        default: today
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      new_rate:
        type: currency
        label: New Rate
        precision: 2
        required: true
        in_form_view: true
        form_group: basic
        form_order: 4
      reason:
        type: text
        label: Reason
        in_form_view: true
        form_group: basic
        form_order: 5
      current_qty:
        type: quantity
        label: Current Qty
        precision: 2
        read_only: true
        in_detail_view: true
      old_rate:
        type: currency
        label: Old Rate
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      adjustment_amount:
        type: currency
        label: Adjustment Amount
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
    form_groups:
      basic:
        label: Revaluation Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: naming_series
          width: 160
          link: true
        - field: posting_date
          width: 120
        - field: item_id
          width: 180
        - field: old_rate
          width: 120
          align: right
        - field: new_rate
          width: 120
          align: right
        - field: adjustment_amount
          width: 140
          align: right
        - field: status
          width: 100
        filters:
        - field: status
          type: select
        - field: posting_date
          type: date_range
      detail:
        header:
          title_field: naming_series
          subtitle_field: posting_date
          status_field: status
        sections:
        - label: Revaluation Details
          fields:
          - naming_series
          - item_id
          - warehouse_id
          - posting_date
          - current_qty
          - old_rate
          - new_rate
          - adjustment_amount
          - reason
          columns: 2
        actions:
        - action: cancel-stock-revaluation
          label: Cancel
          condition: status == 'submitted'
          style: destructive
          confirm: true
  customer:
    label: Customer
    label_plural: Customers
    icon: users
    table: customer
    id_col: id
    name_col: name
    primary_field: name
    secondary_field: customer_type
    identifier_field: id
    status_field: status
    status_colors:
      active: green
      suspended: yellow
      closed: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Customer Name
        required: true
        max_length: 140
        placeholder: Enter company or individual name
        help_text: The legal name of the customer
        searchable: true
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      customer_type:
        type: select
        label: Type
        required: true
        options:
        - value: company
          label: Company
        - value: individual
          label: Individual
        default: company
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      customer_group:
        type: text
        label: Customer Group
        required: false
        max_length: 140
        in_form_view: true
        in_detail_view: true
        form_group: classification
        form_order: 1
      payment_terms_id:
        type: link
        label: Payment Terms
        required: false
        link_entity: payment_terms
        link_display_field: name
        in_form_view: true
        form_group: accounting
        form_order: 3
      credit_limit:
        type: currency
        label: Credit Limit
        required: false
        default: '0.00'
        min: '0.00'
        precision: 2
        in_form_view: true
        in_detail_view: true
        form_group: accounting
        form_order: 1
      tax_id:
        type: text
        label: Tax ID / EIN
        required: false
        max_length: 20
        pattern: ^[0-9]{2}-[0-9]{7}$
        pattern_message: 'Format: XX-XXXXXXX'
        in_form_view: true
        in_detail_view: true
        form_group: accounting
        form_order: 2
      exempt_from_sales_tax:
        type: boolean
        label: Exempt from Sales Tax
        default: false
        in_form_view: true
        form_group: accounting
        form_order: 4
      primary_address:
        type: textarea
        label: Primary Address
        required: false
        in_form_view: true
        in_detail_view: true
        form_group: contact
        form_order: 1
      primary_contact:
        type: textarea
        label: Primary Contact
        required: false
        in_form_view: true
        in_detail_view: true
        form_group: contact
        form_order: 2
      total_outstanding:
        type: currency
        label: Outstanding
        read_only: true
        precision: 2
        in_list_view: true
        in_detail_view: true
      outstanding_invoice_count:
        type: integer
        label: Open Invoices
        read_only: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        in_form_view: true
        form_group: basic
        form_order: 3
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Updated
        read_only: true
    form_groups:
      basic:
        label: Basic Information
        order: 1
        columns: 2
      contact:
        label: Contact Details
        order: 2
        columns: 2
        collapsible: true
      accounting:
        label: Accounting
        order: 3
        columns: 2
      classification:
        label: Classification
        order: 4
        columns: 2
        collapsible: true
    views:
      list:
        columns:
        - field: name
          width: 200
          link: true
        - field: customer_type
          width: 120
        - field: customer_group
          width: 140
        - field: credit_limit
          width: 130
          align: right
        - field: total_outstanding
          width: 130
          align: right
        - field: status
          width: 100
        filters:
        - field: customer_type
          type: select
        - field: customer_group
          type: text
        - field: status
          type: select
        - field: company_id
          type: link
          label: Company
        row_click: get-customer
      detail:
        header:
          title_field: name
          subtitle_field: customer_type
          status_field: status
        sections:
        - label: Details
          fields:
          - name
          - customer_type
          - customer_group
          - company_id
          columns: 2
        - label: Contact
          fields:
          - primary_address
          - primary_contact
          columns: 2
        - label: Accounting
          fields:
          - credit_limit
          - tax_id
          - exempt_from_sales_tax
          - payment_terms_id
          - total_outstanding
          - outstanding_invoice_count
          columns: 3
        actions:
        - action: update-customer
          label: Edit
        - action: add-quotation
          label: New Quotation
          primary: true
        - action: add-sales-order
          label: New Sales Order
        - action: create-sales-invoice
          label: New Invoice
  quotation:
    label: Quotation
    label_plural: Quotations
    icon: file-text
    table: quotation
    id_col: id
    name_col: naming_series
    primary_field: naming_series
    secondary_field: customer_id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      open: blue
      ordered: green
      expired: orange
      cancelled: red
    lifecycle: draft-submit-cancel
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: Quotation No.
        read_only: true
        in_list_view: true
        in_detail_view: true
      customer_id:
        type: link
        label: Customer
        required: true
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      quotation_date:
        type: date
        label: Quotation Date
        required: true
        default: today
        param_name: posting_date
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 2
      valid_until:
        type: date
        label: Valid Until
        in_form_view: true
        in_detail_view: true
        form_group: header
        form_order: 3
      tax_template_id:
        type: link
        label: Tax Template
        link_entity: tax_template
        link_display_field: name
        in_form_view: true
        form_group: header
        form_order: 4
      total_amount:
        type: currency
        label: Net Total
        read_only: true
        precision: 2
        in_detail_view: true
      tax_amount:
        type: currency
        label: Tax
        read_only: true
        precision: 2
        in_detail_view: true
      grand_total:
        type: currency
        label: Grand Total
        read_only: true
        precision: 2
        emphasis: true
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      converted_to:
        type: text
        label: Converted To SO
        read_only: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        in_form_view: true
        form_group: header
        form_order: 5
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      header:
        label: Quotation Details
        order: 1
        columns: 2
      items:
        label: Items
        order: 2
        type: child_table
      totals:
        label: Totals
        order: 3
        columns: 3
    views:
      list:
        columns:
        - field: naming_series
          width: 160
          link: true
        - field: customer_id
          width: 200
        - field: quotation_date
          width: 120
        - field: grand_total
          width: 130
          align: right
        - field: status
          width: 100
        filters:
        - field: status
          type: select
        - field: quotation_date
          type: date_range
        - field: customer_id
          type: link
          label: Customer
        - field: company_id
          type: link
          label: Company
        row_click: get-quotation
      detail:
        header:
          title_field: naming_series
          subtitle_field: customer_id
          status_field: status
          amount_field: grand_total
        sections:
        - label: Quotation Details
          fields:
          - customer_id
          - quotation_date
          - valid_until
          - company_id
          columns: 2
        - label: Items
          type: child_table
          child_entity: quotation_item
          child_fields:
          - item_id
          - item_name
          - quantity
          - uom
          - rate
          - discount_percentage
          - net_amount
          summary_fields:
          - field: net_amount
            aggregate: sum
        - label: Totals
          fields:
          - total_amount
          - tax_amount
          - grand_total
          columns: 3
        actions:
        - action: submit-quotation
          label: Submit
          requires_status: draft
          primary: true
        - action: convert-quotation-to-so
          label: Convert to Sales Order
          requires_status: open
        - action: update-quotation
          label: Edit
          requires_status: draft
  sales_order:
    label: Sales Order
    label_plural: Sales Orders
    icon: clipboard
    table: sales_order
    id_col: id
    name_col: naming_series
    primary_field: naming_series
    secondary_field: customer_id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      confirmed: blue
      partially_delivered: cyan
      fully_delivered: teal
      partially_invoiced: indigo
      fully_invoiced: green
      cancelled: red
    lifecycle: draft-submit-cancel
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: SO No.
        read_only: true
        in_list_view: true
        in_detail_view: true
      customer_id:
        type: link
        label: Customer
        required: true
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      order_date:
        type: date
        label: Order Date
        required: true
        default: today
        param_name: posting_date
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 2
      delivery_date:
        type: date
        label: Delivery Date
        required: true
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 3
      tax_template_id:
        type: link
        label: Tax Template
        link_entity: tax_template
        link_display_field: name
        in_form_view: true
        form_group: header
        form_order: 4
      total_amount:
        type: currency
        label: Net Total
        read_only: true
        precision: 2
        in_detail_view: true
      tax_amount:
        type: currency
        label: Tax
        read_only: true
        precision: 2
        in_detail_view: true
      grand_total:
        type: currency
        label: Grand Total
        read_only: true
        precision: 2
        emphasis: true
        in_list_view: true
        in_detail_view: true
      per_delivered:
        type: percent
        label: '% Delivered'
        read_only: true
        precision: 1
        in_list_view: true
        in_detail_view: true
      per_invoiced:
        type: percent
        label: '% Invoiced'
        read_only: true
        precision: 1
        in_list_view: true
        in_detail_view: true
      quotation_id:
        type: link
        label: Source Quotation
        link_entity: quotation
        link_display_field: naming_series
        read_only: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        in_form_view: true
        form_group: header
        form_order: 5
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      header:
        label: Order Details
        order: 1
        columns: 2
      items:
        label: Items
        order: 2
        type: child_table
      totals:
        label: Totals
        order: 3
        columns: 3
    views:
      list:
        columns:
        - field: naming_series
          width: 150
          link: true
        - field: customer_id
          width: 200
        - field: order_date
          width: 120
        - field: delivery_date
          width: 120
        - field: grand_total
          width: 130
          align: right
        - field: per_delivered
          width: 100
          align: right
        - field: per_invoiced
          width: 100
          align: right
        - field: status
          width: 120
        filters:
        - field: status
          type: select
        - field: order_date
          type: date_range
        - field: customer_id
          type: link
          label: Customer
        - field: company_id
          type: link
          label: Company
        bulk_actions:
        - action: submit-sales-order
          label: Submit
          requires_status: draft
        - action: cancel-sales-order
          label: Cancel
          requires_status: confirmed
          destructive: true
        row_click: get-sales-order
      detail:
        header:
          title_field: naming_series
          subtitle_field: customer_id
          status_field: status
          amount_field: grand_total
        sections:
        - label: Order Details
          fields:
          - customer_id
          - order_date
          - delivery_date
          - quotation_id
          - company_id
          columns: 3
        - label: Items
          type: child_table
          child_entity: sales_order_item
          child_fields:
          - item_id
          - item_name
          - item_code
          - quantity
          - uom
          - rate
          - discount_percentage
          - net_amount
          - delivered_qty
          - invoiced_qty
          summary_fields:
          - field: net_amount
            aggregate: sum
        - label: Totals
          fields:
          - total_amount
          - tax_amount
          - grand_total
          columns: 3
        - label: Fulfillment
          fields:
          - per_delivered
          - per_invoiced
          columns: 2
        - label: Linked Delivery Notes
          type: related_list
          related_entity: delivery_note
          related_action: list-delivery-notes
          filter_field: sales_order_id
        - label: Linked Sales Invoices
          type: related_list
          related_entity: sales_invoice
          related_action: list-sales-invoices
          filter_field: sales_order_id
        actions:
        - action: submit-sales-order
          label: Submit
          requires_status: draft
          primary: true
        - action: cancel-sales-order
          label: Cancel
          requires_status: confirmed
          destructive: true
        - action: create-delivery-note
          label: Create Delivery Note
          requires_status:
          - confirmed
          - partially_delivered
        - action: create-sales-invoice
          label: Create Invoice
          requires_status:
          - confirmed
          - partially_delivered
          - fully_delivered
          - partially_invoiced
        - action: update-sales-order
          label: Edit
          requires_status: draft
  delivery_note:
    label: Delivery Note
    label_plural: Delivery Notes
    icon: truck
    table: delivery_note
    id_col: id
    name_col: naming_series
    primary_field: naming_series
    secondary_field: customer_id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: blue
      cancelled: red
    lifecycle: draft-submit-cancel
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: DN No.
        read_only: true
        in_list_view: true
        in_detail_view: true
      customer_id:
        type: link
        label: Customer
        required: true
        link_entity: customer
        link_display_field: name
        read_only: true
        in_list_view: true
        in_detail_view: true
      posting_date:
        type: date
        label: Posting Date
        required: true
        default: today
        in_list_view: true
        in_detail_view: true
      sales_order_id:
        type: link
        label: Sales Order
        required: true
        link_entity: sales_order
        link_display_field: naming_series
        link_search_action: list-sales-orders
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      total_qty:
        type: quantity
        label: Total Qty
        read_only: true
        precision: 2
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        read_only: true
        link_entity: company
        link_display_field: name
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      header:
        label: Delivery Details
        order: 1
        columns: 2
      items:
        label: Items
        order: 2
        type: child_table
    views:
      list:
        columns:
        - field: naming_series
          width: 150
          link: true
        - field: customer_id
          width: 200
        - field: posting_date
          width: 120
        - field: sales_order_id
          width: 150
        - field: total_qty
          width: 100
          align: right
        - field: status
          width: 100
        filters:
        - field: status
          type: select
        - field: posting_date
          type: date_range
        - field: customer_id
          type: link
          label: Customer
        - field: company_id
          type: link
          label: Company
        row_click: get-delivery-note
      detail:
        header:
          title_field: naming_series
          subtitle_field: customer_id
          status_field: status
        sections:
        - label: Delivery Details
          fields:
          - customer_id
          - posting_date
          - sales_order_id
          - company_id
          - total_qty
          columns: 3
        - label: Items
          type: child_table
          child_entity: delivery_note_item
          child_fields:
          - item_id
          - item_name
          - item_code
          - quantity
          - uom
          - warehouse_id
          - rate
          - amount
          summary_fields:
          - field: quantity
            aggregate: sum
        actions:
        - action: submit-delivery-note
          label: Submit
          requires_status: draft
          primary: true
        - action: cancel-delivery-note
          label: Cancel
          requires_status: submitted
          destructive: true
        - action: create-sales-invoice
          label: Create Invoice
          requires_status: submitted
  sales_invoice:
    label: Sales Invoice
    label_plural: Sales Invoices
    icon: file-text
    table: sales_invoice
    id_col: id
    name_col: naming_series
    primary_field: naming_series
    secondary_field: customer_id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: blue
      overdue: orange
      partially_paid: yellow
      paid: green
      cancelled: red
    lifecycle: draft-submit-cancel
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: Invoice No.
        read_only: true
        in_list_view: true
        in_detail_view: true
      customer_id:
        type: link
        label: Customer
        required: true
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        link_create_action: add-customer
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      posting_date:
        type: date
        label: Invoice Date
        required: true
        default: today
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 2
      due_date:
        type: date
        label: Due Date
        required: false
        help_text: 'Auto-calculated from payment terms if blank (default: +30 days)'
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 3
      tax_template_id:
        type: link
        label: Tax Template
        link_entity: tax_template
        link_display_field: name
        in_form_view: true
        in_detail_view: true
        form_group: header
        form_order: 4
      sales_order_id:
        type: link
        label: Sales Order
        link_entity: sales_order
        link_display_field: naming_series
        link_search_action: list-sales-orders
        help_text: Create invoice from a sales order
        in_form_view: true
        in_detail_view: true
        form_group: source
        form_order: 1
      delivery_note_id:
        type: link
        label: Delivery Note
        link_entity: delivery_note
        link_display_field: naming_series
        link_search_action: list-delivery-notes
        help_text: Create invoice from a delivery note
        in_form_view: true
        in_detail_view: true
        form_group: source
        form_order: 2
      payment_terms_id:
        type: link
        label: Payment Terms
        link_entity: payment_terms
        link_display_field: name
        in_detail_view: true
      total_amount:
        type: currency
        label: Net Total
        read_only: true
        precision: 2
        in_detail_view: true
      tax_amount:
        type: currency
        label: Total Tax
        read_only: true
        precision: 2
        in_detail_view: true
      grand_total:
        type: currency
        label: Grand Total
        read_only: true
        precision: 2
        emphasis: true
        in_list_view: true
        in_detail_view: true
      outstanding_amount:
        type: currency
        label: Outstanding
        read_only: true
        precision: 2
        in_list_view: true
        in_detail_view: true
      is_return:
        type: boolean
        label: Is Return (Credit Note)
        read_only: true
        in_detail_view: true
      return_against:
        type: link
        label: Return Against
        link_entity: sales_invoice
        link_display_field: naming_series
        read_only: true
        in_detail_view: true
      update_stock:
        type: boolean
        label: Update Stock
        read_only: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        in_form_view: true
        form_group: header
        form_order: 5
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      header:
        label: Invoice Details
        order: 1
        columns: 2
      source:
        label: Source Document
        order: 2
        columns: 2
        collapsible: true
        help_text: Create from SO or DN, or leave blank for standalone invoice
      items:
        label: Items
        order: 3
        type: child_table
      totals:
        label: Totals
        order: 4
        columns: 3
    views:
      list:
        columns:
        - field: naming_series
          width: 160
          link: true
        - field: customer_id
          width: 200
        - field: posting_date
          width: 120
        - field: due_date
          width: 120
        - field: grand_total
          width: 130
          align: right
        - field: outstanding_amount
          width: 130
          align: right
        - field: status
          width: 110
        filters:
        - field: status
          type: select
        - field: posting_date
          type: date_range
        - field: customer_id
          type: link
          label: Customer
        - field: company_id
          type: link
          label: Company
        bulk_actions:
        - action: submit-sales-invoice
          label: Submit
          requires_status: draft
        - action: cancel-sales-invoice
          label: Cancel
          requires_status: submitted
          destructive: true
        row_click: get-sales-invoice
      detail:
        header:
          title_field: naming_series
          subtitle_field: customer_id
          status_field: status
          amount_field: grand_total
        sections:
        - label: Invoice Details
          fields:
          - customer_id
          - posting_date
          - due_date
          - company_id
          columns: 2
        - label: Source
          fields:
          - sales_order_id
          - delivery_note_id
          - payment_terms_id
          columns: 3
          collapsible: true
        - label: Items
          type: child_table
          child_entity: sales_invoice_item
          child_fields:
          - item_id
          - item_name
          - item_code
          - quantity
          - uom
          - rate
          - discount_percentage
          - net_amount
          summary_fields:
          - field: net_amount
            aggregate: sum
        - label: Totals
          fields:
          - total_amount
          - tax_amount
          - grand_total
          - outstanding_amount
          columns: 4
        - label: Returns
          fields:
          - is_return
          - return_against
          - update_stock
          columns: 3
          collapsible: true
        - label: Payments
          type: related_list
          related_entity: payment_ledger_entry
          related_fields:
          - posting_date
          - voucher_type
          - amount
          - currency
          - remarks
        actions:
        - action: submit-sales-invoice
          label: Submit
          requires_status: draft
          primary: true
        - action: cancel-sales-invoice
          label: Cancel
          requires_status:
          - submitted
          - overdue
          - partially_paid
          destructive: true
        - action: create-credit-note
          label: Create Credit Note
          requires_status:
          - submitted
          - overdue
          - partially_paid
          - paid
        - action: update-sales-invoice
          label: Edit
          requires_status: draft
      form:
        groups:
        - label: Invoice Details
          fields:
          - customer_id
          - posting_date
          - due_date
          - company_id
          columns: 2
        - label: Source Document
          fields:
          - sales_order_id
          - delivery_note_id
          columns: 2
          collapsible: true
        - label: Items
          type: child_table
          child_entity: sales_invoice_item
          add_label: Add Item
          fields:
          - item_id
          - quantity
          - rate
          - discount_percentage
          computed_fields:
          - net_amount
        - label: Tax
          fields:
          - tax_template_id
  credit_note:
    label: Credit Note
    label_plural: Credit Notes
    icon: file-minus
    table: sales_invoice
    id_col: id
    name_col: naming_series
    primary_field: naming_series
    secondary_field: customer_id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: blue
      cancelled: red
    lifecycle: draft-submit-cancel
    filter_condition: is_return = 1
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: Credit Note No.
        read_only: true
        in_list_view: true
        in_detail_view: true
      customer_id:
        type: link
        label: Customer
        read_only: true
        link_entity: customer
        link_display_field: name
        in_list_view: true
        in_detail_view: true
      posting_date:
        type: date
        label: Date
        read_only: true
        in_list_view: true
        in_detail_view: true
      return_against:
        type: link
        label: Against Invoice
        required: true
        link_entity: sales_invoice
        link_display_field: naming_series
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      grand_total:
        type: currency
        label: Credit Amount
        read_only: true
        precision: 2
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
    form_groups:
      header:
        label: Credit Note Details
        order: 1
        columns: 2
      items:
        label: Return Items
        order: 2
        type: child_table
    views:
      list:
        columns:
        - field: naming_series
          width: 160
          link: true
        - field: customer_id
          width: 200
        - field: posting_date
          width: 120
        - field: return_against
          width: 160
        - field: grand_total
          width: 130
          align: right
        - field: status
          width: 100
        filters:
        - field: status
          type: select
        - field: posting_date
          type: date_range
        - field: customer_id
          type: link
          label: Customer
        row_click: get-sales-invoice
      detail:
        header:
          title_field: naming_series
          subtitle_field: customer_id
          status_field: status
          amount_field: grand_total
        sections:
        - label: Details
          fields:
          - customer_id
          - posting_date
          - return_against
          columns: 3
        - label: Items
          type: child_table
          child_entity: sales_invoice_item
          child_fields:
          - item_id
          - item_name
          - quantity
          - rate
          - net_amount
        - label: Totals
          fields:
          - grand_total
          columns: 1
        actions:
        - action: submit-sales-invoice
          label: Submit
          requires_status: draft
          primary: true
        - action: cancel-sales-invoice
          label: Cancel
          requires_status: submitted
          destructive: true
  sales_partner:
    label: Sales Partner
    label_plural: Sales Partners
    icon: handshake
    table: sales_partner
    id_col: id
    name_col: name
    primary_field: name
    secondary_field: commission_rate
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Partner Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      commission_rate:
        type: percent
        label: Commission Rate
        required: true
        min: '0'
        max: '100'
        precision: 2
        in_list_view: true
        in_detail_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Partner Details
        order: 1
        columns: 2
    views:
      list:
        columns:
        - field: name
          width: 250
          link: true
        - field: commission_rate
          width: 150
          align: right
        filters: []
        row_click: null
  recurring_invoice_template:
    label: Recurring Invoice Template
    label_plural: Recurring Invoice Templates
    table: recurring_invoice_template
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: Naming Series
        read_only: true
      customer_id:
        type: link
        label: Customer ID
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_form_view: true
        form_group: references
        form_order: 1
      frequency:
        type: select
        label: Frequency
        required: true
        options:
        - value: weekly
          label: Weekly
        - value: monthly
          label: Monthly
        - value: quarterly
          label: Quarterly
        - value: semi_annually
          label: Semi Annually
        - value: annually
          label: Annually
        in_form_view: true
        form_group: details
        form_order: 2
      start_date:
        type: date
        label: Start Date
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 3
      end_date:
        type: date
        label: End Date
        in_form_view: true
        form_group: header
        form_order: 4
      next_invoice_date:
        type: date
        label: Next Invoice Date
        in_form_view: true
        form_group: header
        form_order: 5
      last_invoice_date:
        type: date
        label: Last Invoice Date
        in_form_view: true
        form_group: header
        form_order: 6
      tax_template_id:
        type: link
        label: Tax Template ID
        link_entity: tax_template
        link_display_field: name
        link_search_action: list-tax-templates
        in_form_view: true
        form_group: references
        form_order: 7
      payment_terms_id:
        type: link
        label: Payment Terms ID
        link_entity: payment_terms
        link_display_field: name
        link_search_action: list-payment-termses
        in_form_view: true
        form_group: references
        form_order: 8
      status:
        type: select
        label: Status
        options:
        - value: draft
          label: Draft
        - value: active
          label: Active
        - value: paused
          label: Paused
        - value: completed
          label: Completed
        - value: cancelled
          label: Cancelled
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 9
      company_id:
        type: link
        label: Company ID
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        in_form_view: true
        form_group: references
        form_order: 10
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      items:
        label: Line Items
        order: 4
        type: child_table
  supplier:
    label: Supplier
    label_plural: Suppliers
    icon: truck
    primary_field: name
    secondary_field: supplier_group
    identifier_field: id
    status_field: status
    status_colors:
      active: green
      disabled: gray
      blocked: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Supplier Name
        required: true
        max_length: 140
        searchable: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      supplier_group:
        type: select
        label: Supplier Group
        options:
        - value: Raw-Material
          label: Raw Material
        - value: Services
          label: Services
        - value: Consumables
          label: Consumables
        - value: Sub-Contracting
          label: Sub-Contracting
        - value: Hardware
          label: Hardware
        - value: Software
          label: Software
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      supplier_type:
        type: select
        label: Supplier Type
        options:
        - value: company
          label: Company
        - value: individual
          label: Individual
        default: company
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      payment_terms_id:
        type: link
        label: Payment Terms
        link_entity: payment_terms
        link_display_field: name
        link_search_action: list-payment-terms
        in_form_view: true
        form_group: basic
        form_order: 4
      tax_id:
        type: text
        label: Tax ID / EIN
        max_length: 20
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 5
      is_1099_vendor:
        type: boolean
        label: 1099 Vendor
        default: false
        help_text: Mark for US 1099 tax reporting
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 6
      primary_address:
        type: json
        label: Primary Address
        help_text: JSON object with address_line1, city, state, zip, country
        in_form_view: true
        form_group: address
        form_order: 1
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        required: true
        in_form_view: true
        form_group: basic
        form_order: 7
      total_outstanding:
        type: currency
        label: Total Outstanding
        precision: 2
        read_only: true
        in_detail_view: true
      outstanding_invoice_count:
        type: integer
        label: Outstanding Invoices
        read_only: true
        in_detail_view: true
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Supplier Information
        order: 1
        columns: 2
      address:
        label: Address
        order: 2
        columns: 1
        collapsible: true
    views:
      list:
        columns:
        - field: name
          width: 200
          link: true
        - field: supplier_group
          width: 130
        - field: supplier_type
          width: 100
        - field: tax_id
          width: 120
        - field: is_1099_vendor
          width: 80
        - field: status
          width: 90
        filters:
        - field: supplier_group
          type: select
        - field: supplier_type
          type: select
        - field: status
          type: select
        - field: company_id
          type: link
        row_click: get-supplier
      detail:
        header:
          title_field: name
          subtitle_field: supplier_group
          status_field: status
        sections:
        - label: Supplier Details
          fields:
          - name
          - supplier_group
          - supplier_type
          - tax_id
          - is_1099_vendor
          - company_id
          columns: 3
        - label: Payment & Terms
          fields:
          - payment_terms_id
          - total_outstanding
          - outstanding_invoice_count
          columns: 3
        - label: Address
          fields:
          - primary_address
          columns: 1
          collapsible: true
        actions:
        - action: update-supplier
          label: Edit
        - action: add-purchase-order
          label: New Purchase Order
          prefill:
            supplier_id: id
  material_request:
    label: Material Request
    label_plural: Material Requests
    icon: clipboard-list
    primary_field: naming_series
    secondary_field: request_type
    identifier_field: id
    status_field: status
    lifecycle: draft-submit-cancel
    status_colors:
      draft: gray
      submitted: blue
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: MR Number
        read_only: true
        in_list_view: true
        in_detail_view: true
      request_type:
        type: select
        label: Request Type
        required: true
        options:
        - value: purchase
          label: Purchase
        - value: transfer
          label: Transfer
        - value: manufacture
          label: Manufacture
        - value: material_transfer
          label: Material Transfer
        - value: material_issue
          label: Material Issue
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        required: true
        in_form_view: true
        form_group: basic
        form_order: 2
      items:
        type: json
        label: Items
        required: true
        help_text: 'JSON array: [{item_id, qty, warehouse_id}]'
        in_form_view: true
        form_group: items
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_list_view: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Request Details
        order: 1
        columns: 2
      items:
        label: Items
        order: 2
        columns: 1
    views:
      list:
        columns:
        - field: naming_series
          width: 140
          link: true
        - field: request_type
          width: 140
        - field: status
          width: 100
        - field: created_at
          width: 160
        filters:
        - field: request_type
          type: select
        - field: status
          type: select
        - field: company_id
          type: link
  request_for_quotation:
    label: Request for Quotation
    label_plural: RFQs
    icon: file-question
    primary_field: naming_series
    secondary_field: rfq_date
    identifier_field: id
    status_field: status
    lifecycle: draft-submit-cancel
    status_colors:
      draft: gray
      submitted: blue
      quotation_received: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: RFQ Number
        read_only: true
        in_list_view: true
        in_detail_view: true
      rfq_date:
        type: date
        label: RFQ Date
        read_only: true
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        required: true
        in_form_view: true
        form_group: basic
        form_order: 1
      items:
        type: json
        label: Items
        required: true
        help_text: 'JSON array: [{item_id, qty, uom, required_date}]'
        in_form_view: true
        form_group: items
        form_order: 1
      suppliers:
        type: json
        label: Suppliers
        required: true
        help_text: JSON array of supplier IDs
        in_form_view: true
        form_group: suppliers
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: RFQ Details
        order: 1
        columns: 2
      items:
        label: Items
        order: 2
        columns: 1
      suppliers:
        label: Suppliers
        order: 3
        columns: 1
    views:
      list:
        columns:
        - field: naming_series
          width: 140
          link: true
        - field: rfq_date
          width: 120
        - field: status
          width: 130
        - field: created_at
          width: 160
        filters:
        - field: status
          type: select
        - field: company_id
          type: link
  supplier_quotation:
    label: Supplier Quotation
    label_plural: Supplier Quotations
    icon: file-text
    primary_field: supplier_name
    secondary_field: total_amount
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: blue
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      supplier_id:
        type: link
        label: Supplier
        link_entity: supplier
        link_display_field: name
        link_search_action: list-suppliers
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      supplier_name:
        type: text
        label: Supplier Name
        read_only: true
        in_list_view: true
        in_detail_view: true
      rfq_id:
        type: link
        label: RFQ
        link_entity: request_for_quotation
        link_display_field: naming_series
        link_search_action: list-rfqs
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      quotation_date:
        type: date
        label: Quotation Date
        read_only: true
        in_list_view: true
        in_detail_view: true
      total_amount:
        type: currency
        label: Total Amount
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      grand_total:
        type: currency
        label: Grand Total
        precision: 2
        read_only: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        read_only: true
        in_detail_view: true
      items:
        type: json
        label: Items
        required: true
        help_text: 'JSON array: [{rfq_item_id, rate, lead_time_days}]'
        in_form_view: true
        form_group: items
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Quotation Details
        order: 1
        columns: 2
      items:
        label: Quoted Items
        order: 2
        columns: 1
    views:
      list:
        columns:
        - field: supplier_name
          width: 180
          link: true
        - field: quotation_date
          width: 120
        - field: total_amount
          width: 130
          align: right
        - field: status
          width: 100
        filters:
        - field: rfq_id
          type: link
        - field: supplier_id
          type: link
  purchase_order:
    label: Purchase Order
    label_plural: Purchase Orders
    icon: file-plus
    primary_field: naming_series
    secondary_field: supplier_name
    identifier_field: id
    status_field: status
    lifecycle: draft-submit-cancel
    status_colors:
      draft: gray
      confirmed: blue
      partially_received: yellow
      fully_received: green
      partially_invoiced: orange
      fully_invoiced: teal
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: PO Number
        read_only: true
        in_list_view: true
        in_detail_view: true
      supplier_id:
        type: link
        label: Supplier
        link_entity: supplier
        link_display_field: name
        link_search_action: list-suppliers
        required: true
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      supplier_name:
        type: text
        label: Supplier Name
        read_only: true
        in_list_view: true
      order_date:
        type: date
        label: Order Date
        default: today
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      tax_template_id:
        type: link
        label: Tax Template
        link_entity: tax_template
        link_display_field: name
        link_search_action: list-tax-templates
        in_form_view: true
        form_group: basic
        form_order: 3
      total_amount:
        type: currency
        label: Net Total
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      tax_amount:
        type: currency
        label: Tax Amount
        precision: 2
        read_only: true
        in_detail_view: true
      grand_total:
        type: currency
        label: Grand Total
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      per_received:
        type: percent
        label: '% Received'
        precision: 2
        read_only: true
        in_detail_view: true
      per_invoiced:
        type: percent
        label: '% Invoiced'
        precision: 2
        read_only: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        required: true
        in_form_view: true
        form_group: basic
        form_order: 4
      items:
        type: json
        label: Items
        required: true
        help_text: 'JSON array: [{item_id, qty, rate, uom, warehouse_id, discount_percentage, required_date}]'
        in_form_view: true
        form_group: items
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Order Details
        order: 1
        columns: 2
      items:
        label: Items
        order: 2
        columns: 1
    views:
      list:
        columns:
        - field: naming_series
          width: 140
          link: true
        - field: supplier_name
          width: 180
        - field: order_date
          width: 110
        - field: grand_total
          width: 130
          align: right
        - field: status
          width: 130
        filters:
        - field: status
          type: select
        - field: supplier_id
          type: link
        - field: company_id
          type: link
        - field: order_date
          type: date_range
        row_click: get-purchase-order
      detail:
        header:
          title_field: naming_series
          subtitle_field: supplier_name
          status_field: status
        sections:
        - label: Order Details
          fields:
          - supplier_id
          - order_date
          - tax_template_id
          - company_id
          columns: 2
        - label: Amounts
          fields:
          - total_amount
          - tax_amount
          - grand_total
          columns: 3
        - label: Fulfillment
          fields:
          - per_received
          - per_invoiced
          columns: 2
        - label: Items
          child_entity: purchase_order_item
          columns: 1
        - label: Linked Receipts
          related_entity: purchase_receipt
          related_filter: purchase_order_id
          columns: 1
          collapsible: true
        - label: Linked Invoices
          related_entity: purchase_invoice
          related_filter: purchase_order_id
          columns: 1
          collapsible: true
        actions:
        - action: update-purchase-order
          label: Edit
          condition: status == 'draft'
        - action: submit-purchase-order
          label: Submit
          condition: status == 'draft'
          confirm: true
        - action: cancel-purchase-order
          label: Cancel
          condition: status != 'draft' && status != 'cancelled'
          confirm: true
          variant: danger
        - action: create-purchase-receipt
          label: Receive Goods
          condition: status == 'confirmed' || status == 'partially_received'
        - action: create-purchase-invoice
          label: Create Invoice
          condition: status != 'draft' && status != 'cancelled'
  purchase_receipt:
    label: Purchase Receipt
    label_plural: Purchase Receipts
    icon: package-check
    primary_field: naming_series
    secondary_field: supplier_name
    identifier_field: id
    status_field: status
    lifecycle: draft-submit-cancel
    status_colors:
      draft: gray
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: GRN Number
        read_only: true
        in_list_view: true
        in_detail_view: true
      supplier_id:
        type: link
        label: Supplier
        link_entity: supplier
        link_display_field: name
        link_search_action: list-suppliers
        read_only: true
        in_list_view: true
        in_detail_view: true
      supplier_name:
        type: text
        label: Supplier Name
        read_only: true
        in_list_view: true
      posting_date:
        type: date
        label: Posting Date
        default: today
        in_list_view: true
        in_detail_view: true
      purchase_order_id:
        type: link
        label: Purchase Order
        link_entity: purchase_order
        link_display_field: naming_series
        link_search_action: list-purchase-orders
        required: true
        in_form_view: true
        form_group: basic
        form_order: 1
      total_qty:
        type: quantity
        label: Total Qty
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        read_only: true
        in_detail_view: true
      items:
        type: json
        label: Items (partial receipt)
        help_text: 'Optional JSON array for partial receipt: [{purchase_order_item_id, qty, warehouse_id, batch_id, serial_numbers}]'
        in_form_view: true
        form_group: items
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Receipt Details
        order: 1
        columns: 2
      items:
        label: Items (Partial Receipt Override)
        order: 2
        columns: 1
        collapsible: true
    views:
      list:
        columns:
        - field: naming_series
          width: 140
          link: true
        - field: supplier_name
          width: 180
        - field: posting_date
          width: 110
        - field: total_qty
          width: 100
          align: right
        - field: status
          width: 100
        filters:
        - field: status
          type: select
        - field: supplier_id
          type: link
        - field: company_id
          type: link
        row_click: get-purchase-receipt
      detail:
        header:
          title_field: naming_series
          subtitle_field: supplier_name
          status_field: status
        sections:
        - label: Receipt Details
          fields:
          - supplier_id
          - posting_date
          - purchase_order_id
          - total_qty
          - company_id
          columns: 3
        - label: Items
          child_entity: purchase_receipt_item
          columns: 1
        actions:
        - action: submit-purchase-receipt
          label: Submit
          condition: status == 'draft'
          confirm: true
        - action: cancel-purchase-receipt
          label: Cancel
          condition: status == 'submitted'
          confirm: true
          variant: danger
        - action: create-purchase-invoice
          label: Create Invoice
          condition: status == 'submitted'
  purchase_invoice:
    label: Purchase Invoice
    label_plural: Purchase Invoices
    icon: file-invoice
    primary_field: naming_series
    secondary_field: supplier_name
    identifier_field: id
    status_field: status
    lifecycle: draft-submit-cancel
    status_colors:
      draft: gray
      submitted: blue
      overdue: red
      partially_paid: orange
      paid: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      naming_series:
        type: text
        label: Invoice Number
        read_only: true
        in_list_view: true
        in_detail_view: true
      supplier_id:
        type: link
        label: Supplier
        link_entity: supplier
        link_display_field: name
        link_search_action: list-suppliers
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 1
      supplier_name:
        type: text
        label: Supplier Name
        read_only: true
        in_list_view: true
      posting_date:
        type: date
        label: Posting Date
        default: today
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 2
      due_date:
        type: date
        label: Due Date
        in_list_view: true
        in_form_view: true
        form_group: basic
        form_order: 3
      purchase_order_id:
        type: link
        label: Purchase Order
        link_entity: purchase_order
        link_display_field: naming_series
        link_search_action: list-purchase-orders
        in_form_view: true
        form_group: source
        form_order: 1
      purchase_receipt_id:
        type: link
        label: Purchase Receipt
        link_entity: purchase_receipt
        link_display_field: naming_series
        link_search_action: list-purchase-receipts
        in_form_view: true
        form_group: source
        form_order: 2
      tax_template_id:
        type: link
        label: Tax Template
        link_entity: tax_template
        link_display_field: name
        link_search_action: list-tax-templates
        in_form_view: true
        form_group: basic
        form_order: 4
      total_amount:
        type: currency
        label: Net Total
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      tax_amount:
        type: currency
        label: Tax Amount
        precision: 2
        read_only: true
        in_detail_view: true
      grand_total:
        type: currency
        label: Grand Total
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      outstanding_amount:
        type: currency
        label: Outstanding
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      update_stock:
        type: boolean
        label: Update Stock
        read_only: true
        in_detail_view: true
        help_text: If true, SLE entries were posted on submit
      is_return:
        type: boolean
        label: Is Return (Debit Note)
        read_only: true
        in_detail_view: true
      return_against:
        type: link
        label: Return Against Invoice
        link_entity: purchase_invoice
        link_display_field: naming_series
        link_search_action: list-purchase-invoices
        read_only: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        required: true
        in_form_view: true
        form_group: basic
        form_order: 5
      items:
        type: json
        label: Items
        help_text: 'JSON array: [{item_id, qty, rate, uom, expense_account_id, cost_center_id}]'
        in_form_view: true
        form_group: items
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
      updated_at:
        type: datetime
        label: Last Updated
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Invoice Details
        order: 1
        columns: 2
      source:
        label: Source Documents
        order: 2
        columns: 2
        collapsible: true
        help_text: Link to PO or Purchase Receipt, or leave blank for standalone invoice
      items:
        label: Items
        order: 3
        columns: 1
    views:
      list:
        columns:
        - field: naming_series
          width: 140
          link: true
        - field: supplier_name
          width: 180
        - field: posting_date
          width: 110
        - field: grand_total
          width: 130
          align: right
        - field: outstanding_amount
          width: 130
          align: right
        - field: status
          width: 120
        filters:
        - field: status
          type: select
        - field: supplier_id
          type: link
        - field: company_id
          type: link
        - field: posting_date
          type: date_range
        row_click: get-purchase-invoice
      detail:
        header:
          title_field: naming_series
          subtitle_field: supplier_name
          status_field: status
        sections:
        - label: Invoice Details
          fields:
          - supplier_id
          - posting_date
          - due_date
          - tax_template_id
          - company_id
          columns: 3
        - label: Source Documents
          fields:
          - purchase_order_id
          - purchase_receipt_id
          columns: 2
          collapsible: true
        - label: Amounts
          fields:
          - total_amount
          - tax_amount
          - grand_total
          - outstanding_amount
          columns: 4
        - label: Flags
          fields:
          - update_stock
          - is_return
          - return_against
          columns: 3
          collapsible: true
        - label: Items
          child_entity: purchase_invoice_item
          columns: 1
        - label: Payments
          related_entity: payment_ledger_entry
          related_filter: against_voucher_id
          columns: 1
          collapsible: true
        actions:
        - action: update-purchase-invoice
          label: Edit
          condition: status == 'draft'
        - action: submit-purchase-invoice
          label: Submit
          condition: status == 'draft'
          confirm: true
        - action: cancel-purchase-invoice
          label: Cancel
          condition: status in ['submitted','overdue','partially_paid']
          confirm: true
          variant: danger
        - action: create-debit-note
          label: Create Debit Note
          condition: status in ['submitted','partially_paid','paid','overdue'] && !is_return
  landed_cost_voucher:
    label: Landed Cost Voucher
    label_plural: Landed Cost Vouchers
    icon: anchor
    primary_field: id
    secondary_field: total_landed_cost
    identifier_field: id
    status_field: status
    status_colors:
      submitted: green
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      posting_date:
        type: date
        label: Posting Date
        read_only: true
        in_list_view: true
        in_detail_view: true
      total_landed_cost:
        type: currency
        label: Total Landed Cost
        precision: 2
        read_only: true
        in_list_view: true
        in_detail_view: true
      status:
        type: status
        label: Status
        read_only: true
        in_list_view: true
        in_detail_view: true
      company_id:
        type: link
        label: Company
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
        required: true
        in_form_view: true
        form_group: basic
        form_order: 1
      purchase_receipt_ids:
        type: json
        label: Purchase Receipts
        required: true
        help_text: JSON array of purchase receipt IDs
        in_form_view: true
        form_group: basic
        form_order: 2
      charges:
        type: json
        label: Charges
        required: true
        help_text: 'JSON array: [{description, amount, expense_account_id, allocation_method}]'
        in_form_view: true
        form_group: charges
        form_order: 1
      created_at:
        type: datetime
        label: Created
        read_only: true
        in_detail_view: true
    form_groups:
      basic:
        label: Voucher Details
        order: 1
        columns: 2
      charges:
        label: Charges
        order: 2
        columns: 1
    views:
      list:
        columns:
        - field: posting_date
          width: 120
        - field: total_landed_cost
          width: 150
          align: right
        - field: status
          width: 100
        - field: created_at
          width: 160
      detail:
        header:
          title_field: id
          subtitle_field: posting_date
          status_field: status
        sections:
        - label: Voucher Details
          fields:
          - posting_date
          - total_landed_cost
          - company_id
          columns: 3
        - label: Charges
          child_entity: landed_cost_charge
          columns: 1
        - label: Allocated Items
          child_entity: landed_cost_item
          columns: 1
  meter:
    label: Meter
    label_plural: Meters
    table: meter
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      meter_number:
        type: text
        label: Meter Number
        required: true
        in_form_view: true
        form_group: details
        form_order: 1
      customer_id:
        type: link
        label: Customer ID
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_form_view: true
        form_group: references
        form_order: 2
      service_type:
        type: select
        label: Service Type
        required: true
        options:
        - value: electricity
          label: Electricity
        - value: water
          label: Water
        - value: gas
          label: Gas
        - value: telecom
          label: Telecom
        - value: saas
          label: Saas
        - value: parking
          label: Parking
        - value: rental
          label: Rental
        - value: waste
          label: Waste
        - value: custom
          label: Custom
        in_form_view: true
        form_group: details
        form_order: 3
      service_point_id:
        type: link
        label: Service Point ID
        link_entity: service_point
        link_display_field: name
        link_search_action: list-service-points
        in_form_view: true
        form_group: references
        form_order: 4
      service_point_address:
        type: text
        label: Service Point Address
        in_form_view: true
        form_group: details
        form_order: 5
      rate_plan_id:
        type: link
        label: Rate Plan ID
        link_entity: rate_plan
        link_display_field: name
        link_search_action: list-rate-plans
        in_form_view: true
        form_group: references
        form_order: 6
      install_date:
        type: date
        label: Install Date
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 7
      last_reading_date:
        type: date
        label: Last Reading Date
        in_form_view: true
        form_group: header
        form_order: 8
      last_reading_value:
        type: text
        label: Last Reading Value
        in_form_view: true
        form_group: details
        form_order: 9
      status:
        type: select
        label: Status
        options:
        - value: active
          label: Active
        - value: disconnected
          label: Disconnected
        - value: removed
          label: Removed
        - value: suspended
          label: Suspended
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 10
      metadata:
        type: text
        label: Metadata
        in_form_view: true
        form_group: details
        form_order: 11
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      items:
        label: Line Items
        order: 4
        type: child_table
  usage_event:
    label: Usage Event
    label_plural: Usage Events
    table: usage_event
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      customer_id:
        type: link
        label: Customer ID
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_form_view: true
        form_group: references
        form_order: 1
      meter_id:
        type: link
        label: Meter ID
        link_entity: meter
        link_display_field: name
        link_search_action: list-meters
        in_form_view: true
        form_group: references
        form_order: 2
      event_type:
        type: text
        label: Event Type
        required: true
        in_form_view: true
        form_group: details
        form_order: 3
      quantity:
        type: quantity
        label: Quantity
        in_form_view: true
        form_group: details
        form_order: 4
      timestamp:
        type: text
        label: Timestamp
        required: true
        in_form_view: true
        form_group: details
        form_order: 5
      metadata:
        type: text
        label: Metadata
        in_form_view: true
        form_group: details
        form_order: 6
      idempotency_key:
        type: text
        label: IDempotency Key
        in_form_view: true
        form_group: details
        form_order: 7
      billing_period_id:
        type: link
        label: Billing Period ID
        link_entity: billing_period
        link_display_field: name
        link_search_action: list-billing-periods
        in_form_view: true
        form_group: references
        form_order: 8
      processed:
        type: integer
        label: Processed
        in_form_view: true
        form_group: details
        form_order: 9
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
  rate_plan:
    label: Rate Plan
    label_plural: Rate Plans
    table: rate_plan
    id_col: id
    name_col: name
    primary_field: name
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      name:
        type: text
        label: Name
        required: true
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 1
      service_type:
        type: text
        label: Service Type
        in_form_view: true
        form_group: details
        form_order: 2
      plan_type:
        type: select
        label: Plan Type
        required: true
        options:
        - value: flat
          label: Flat
        - value: tiered
          label: Tiered
        - value: time_of_use
          label: Time Of Use
        - value: demand
          label: Demand
        - value: volume_discount
          label: Volume Discount
        - value: prepaid_credit
          label: Prepaid Credit
        - value: hybrid
          label: Hybrid
        in_form_view: true
        form_group: details
        form_order: 3
      base_charge:
        type: text
        label: Base Charge
        in_form_view: true
        form_group: details
        form_order: 4
      base_charge_period:
        type: select
        label: Base Charge Period
        options:
        - value: monthly
          label: Monthly
        - value: quarterly
          label: Quarterly
        - value: annually
          label: Annually
        in_form_view: true
        form_group: details
        form_order: 5
      currency:
        type: text
        label: Currency
        required: true
        in_form_view: true
        form_group: details
        form_order: 6
      effective_from:
        type: date
        label: Effective From
        in_form_view: true
        form_group: details
        form_order: 7
      effective_to:
        type: date
        label: Effective To
        in_form_view: true
        form_group: details
        form_order: 8
      minimum_charge:
        type: text
        label: Minimum Charge
        in_form_view: true
        form_group: details
        form_order: 9
      minimum_commitment:
        type: text
        label: Minimum Commitment
        in_form_view: true
        form_group: details
        form_order: 10
      overage_rate:
        type: currency
        label: Overage Rate
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 11
      metadata:
        type: text
        label: Metadata
        in_form_view: true
        form_group: details
        form_order: 12
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      amounts:
        label: Amounts
        order: 3
        columns: 2
  rate_tier:
    label: Rate Tier
    label_plural: Rate Tiers
    table: rate_tier
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      rate_plan_id:
        type: link
        label: Rate Plan ID
        link_entity: rate_plan
        link_display_field: name
        link_search_action: list-rate-plans
        in_form_view: true
        form_group: references
        form_order: 1
      tier_start:
        type: text
        label: Tier Start
        required: true
        in_form_view: true
        form_group: details
        form_order: 2
      tier_end:
        type: text
        label: Tier End
        in_form_view: true
        form_group: details
        form_order: 3
      rate:
        type: currency
        label: Rate
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 4
      fixed_charge:
        type: text
        label: Fixed Charge
        in_form_view: true
        form_group: details
        form_order: 5
      time_of_use_period:
        type: select
        label: Time Of Use Period
        options:
        - value: peak
          label: Peak
        - value: off_peak
          label: Off Peak
        - value: shoulder
          label: Shoulder
        in_form_view: true
        form_group: details
        form_order: 6
      time_of_use_hours:
        type: text
        label: Time Of Use Hours
        in_form_view: true
        form_group: details
        form_order: 7
      demand_type:
        type: select
        label: Demand Type
        options:
        - value: energy
          label: Energy
        - value: demand
          label: Demand
        - value: reactive_power
          label: Reactive Power
        in_form_view: true
        form_group: details
        form_order: 8
      sort_order:
        type: integer
        label: Sort Order
        in_form_view: true
        form_group: details
        form_order: 9
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
      amounts:
        label: Amounts
        order: 3
        columns: 2
  billing_period:
    label: Billing Period
    label_plural: Billing Periods
    table: billing_period
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      customer_id:
        type: link
        label: Customer ID
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_form_view: true
        form_group: references
        form_order: 1
      meter_id:
        type: link
        label: Meter ID
        link_entity: meter
        link_display_field: name
        link_search_action: list-meters
        in_form_view: true
        form_group: references
        form_order: 2
      rate_plan_id:
        type: link
        label: Rate Plan ID
        link_entity: rate_plan
        link_display_field: name
        link_search_action: list-rate-plans
        in_form_view: true
        form_group: references
        form_order: 3
      period_start:
        type: text
        label: Period Start
        required: true
        in_form_view: true
        form_group: details
        form_order: 4
      period_end:
        type: text
        label: Period End
        required: true
        in_form_view: true
        form_group: details
        form_order: 5
      total_consumption:
        type: currency
        label: Total Consumption
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 6
      consumption_uom:
        type: text
        label: Consumption UOM
        in_form_view: true
        form_group: details
        form_order: 7
      peak_demand:
        type: text
        label: Peak Demand
        in_form_view: true
        form_group: details
        form_order: 8
      base_charge:
        type: text
        label: Base Charge
        required: true
        in_form_view: true
        form_group: details
        form_order: 9
      usage_charge:
        type: text
        label: Usage Charge
        required: true
        in_form_view: true
        form_group: details
        form_order: 10
      demand_charge:
        type: text
        label: Demand Charge
        in_form_view: true
        form_group: details
        form_order: 11
      adjustments_total:
        type: currency
        label: Adjustments Total
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 12
      subtotal:
        type: currency
        label: Subtotal
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 13
      tax_amount:
        type: currency
        label: Tax Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 14
      grand_total:
        type: currency
        label: Grand Total
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 15
      invoice_id:
        type: link
        label: Invoice ID
        link_entity: invoice
        link_display_field: name
        link_search_action: list-invoices
        in_form_view: true
        form_group: references
        form_order: 16
      status:
        type: select
        label: Status
        options:
        - value: open
          label: Open
        - value: rated
          label: Rated
        - value: invoiced
          label: Invoiced
        - value: paid
          label: Paid
        - value: disputed
          label: Disputed
        - value: void
          label: Void
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 17
      rated_at:
        type: currency
        label: Rated At
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 18
      invoiced_at:
        type: text
        label: Invoiced At
        in_form_view: true
        form_group: details
        form_order: 19
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      amounts:
        label: Amounts
        order: 4
        columns: 2
  billing_adjustment:
    label: Billing Adjustment
    label_plural: Billing Adjustments
    table: billing_adjustment
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      billing_period_id:
        type: link
        label: Billing Period ID
        link_entity: billing_period
        link_display_field: name
        link_search_action: list-billing-periods
        in_form_view: true
        form_group: references
        form_order: 1
      adjustment_type:
        type: select
        label: Adjustment Type
        required: true
        options:
        - value: credit
          label: Credit
        - value: late_fee
          label: Late Fee
        - value: deposit
          label: Deposit
        - value: refund
          label: Refund
        - value: proration
          label: Proration
        - value: discount
          label: Discount
        - value: penalty
          label: Penalty
        - value: write_off
          label: Write Off
        in_form_view: true
        form_group: details
        form_order: 2
      amount:
        type: currency
        label: Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 3
      reason:
        type: textarea
        label: Reason
        in_form_view: true
        form_group: notes
        form_order: 4
      approved_by:
        type: text
        label: Approved By
        in_form_view: true
        form_group: details
        form_order: 5
    form_groups:
      details:
        label: Details
        order: 1
        columns: 2
      references:
        label: References
        order: 2
        columns: 2
      amounts:
        label: Amounts
        order: 3
        columns: 2
      notes:
        label: Notes
        order: 4
        columns: 1
  prepaid_credit_balance:
    label: Prepaid Credit Balance
    label_plural: Prepaid Credit Balances
    table: prepaid_credit_balance
    id_col: id
    name_col: id
    primary_field: id
    identifier_field: id
    status_field: status
    status_colors:
      draft: gray
      submitted: green
      cancelled: red
    fields:
      id:
        type: text
        label: ID
        read_only: true
        hidden: true
      customer_id:
        type: link
        label: Customer ID
        link_entity: customer
        link_display_field: name
        link_search_action: list-customers
        in_form_view: true
        form_group: references
        form_order: 1
      rate_plan_id:
        type: link
        label: Rate Plan ID
        link_entity: rate_plan
        link_display_field: name
        link_search_action: list-rate-plans
        in_form_view: true
        form_group: references
        form_order: 2
      original_amount:
        type: currency
        label: Original Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 3
      remaining_amount:
        type: currency
        label: Remaining Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 4
      period_start:
        type: text
        label: Period Start
        required: true
        in_form_view: true
        form_group: details
        form_order: 5
      period_end:
        type: text
        label: Period End
        required: true
        in_form_view: true
        form_group: details
        form_order: 6
      overage_amount:
        type: currency
        label: Overage Amount
        precision: 2
        in_form_view: true
        form_group: amounts
        form_order: 7
      status:
        type: select
        label: Status
        options:
        - value: active
          label: Active
        - value: exhausted
          label: Exhausted
        - value: expired
          label: Expired
        in_list_view: true
        in_form_view: true
        form_group: header
        form_order: 8
    form_groups:
      header:
        label: Basic Information
        order: 1
        columns: 2
      details:
        label: Details
        order: 2
        columns: 2
      references:
        label: References
        order: 3
        columns: 2
      amounts:
        label: Amounts
        order: 4
        columns: 2
action_map:
  setup-company:
    component: FormView
    entity: company
    mode: create
    success_redirect: get-company
    success_toast: Company '{name}' created successfully
  update-company:
    component: FormView
    entity: company
    mode: edit
    success_redirect: get-company
  get-company:
    component: DetailView
    entity: company
  list-companies:
    component: DataTable
    entity: company
    default_sort: name
    searchable: true
    add_action: setup-company
  add-currency:
    component: FormView
    entity: currency
    mode: create
    success_toast: Currency {code} added
  list-currencies:
    component: DataTable
    entity: currency
    default_sort: code
    searchable: true
    add_action: add-currency
  add-exchange-rate:
    component: FormView
    entity: exchange_rate
    mode: create
    success_toast: Exchange rate added for {effective_date}
  get-exchange-rate:
    component: DetailView
    entity: exchange_rate
  list-exchange-rates:
    component: DataTable
    entity: exchange_rate
    default_sort: effective_date
    default_sort_dir: desc
    add_action: add-exchange-rate
  add-payment-terms:
    component: FormView
    entity: payment_terms
    mode: create
    success_toast: Payment terms '{name}' created
  list-payment-terms:
    component: DataTable
    entity: payment_terms
    default_sort: due_days
    searchable: true
    add_action: add-payment-terms
  add-uom:
    component: FormView
    entity: uom
    mode: create
    success_toast: Unit of measure '{name}' added
  list-uoms:
    component: DataTable
    entity: uom
    default_sort: name
    searchable: true
    add_action: add-uom
  add-uom-conversion:
    component: FormView
    entity: uom_conversion
    mode: create
    success_toast: UoM conversion added
  add-user:
    component: FormView
    entity: erp_user
    mode: create
    success_redirect: get-user
    success_toast: User '{username}' created
  update-user:
    component: FormView
    entity: erp_user
    mode: edit
    success_redirect: get-user
  get-user:
    component: DetailView
    entity: erp_user
  list-users:
    component: DataTable
    entity: erp_user
    default_sort: username
    searchable: true
    add_action: add-user
  add-role:
    component: FormView
    entity: role
    mode: create
    success_toast: Role '{name}' created
  list-roles:
    component: DataTable
    entity: role
    default_sort: name
    add_action: add-role
  get-audit-log:
    component: DataTable
    entity: audit_log
    default_sort: timestamp
    default_sort_dir: desc
    searchable: false
  setup-chart-of-accounts:
    component: WizardFlow
    entity: account
    steps:
    - label: Select Template
      fields:
      - name: template
        type: select
        label: Chart of Accounts Template
        required: true
        default: us_gaap
        options:
        - value: us_gaap
          label: US GAAP (Full ~90 accounts)
        - value: us_gaap_simplified
          label: US GAAP Simplified (~40 accounts)
      - name: company_id
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
    - label: Confirm
      confirmation: true
      message: This will load the selected chart of accounts template. Existing accounts will not be duplicated.
    success_redirect: list-accounts
    success_toast: 'Chart of accounts loaded: {accounts_created} accounts created'
  add-account:
    component: FormView
    entity: account
    mode: create
    success_redirect: get-account
    success_toast: Account '{name}' created
  update-account:
    component: FormView
    entity: account
    mode: edit
    success_redirect: get-account
    success_toast: Account updated
  list-accounts:
    component: DataTable
    entity: account
    default_sort: account_number
    searchable: true
    add_action: add-account
    extra_actions:
    - action: setup-chart-of-accounts
      label: Load Template
      icon: upload
  get-account:
    component: DetailView
    entity: account
  freeze-account:
    component: WizardFlow
    entity: account
    steps:
    - label: Confirm Freeze
      confirmation: true
      message: Freezing this account will prevent any new GL postings. Are you sure?
      fields:
      - name: account_id
        type: link
        label: Account
        required: true
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
    success_redirect: get-account
    success_toast: Account frozen
  unfreeze-account:
    component: FormView
    entity: account
    mode: action
    fields:
    - name: account_id
      type: link
      label: Account
      required: true
      link_entity: account
      link_display_field: name
      link_search_action: list-accounts
    success_redirect: get-account
    success_toast: Account unfrozen
  post-gl-entries:
    component: WizardFlow
    entity: gl_entry
    steps:
    - label: Voucher Details
      fields:
      - name: voucher_type
        type: text
        label: Voucher Type
        required: true
      - name: voucher_id
        type: text
        label: Voucher ID
        required: true
      - name: posting_date
        type: date
        label: Posting Date
        required: true
        default: today
      - name: company_id
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
    - label: GL Entries
      fields:
      - name: entries
        type: json
        label: Entries (JSON array)
        required: true
        help_text: 'Each entry: {"account_id": "...", "debit": "0", "credit": "100.00"}'
    - label: Review
      confirmation: true
      message: 'GL entries must balance: SUM(debits) = SUM(credits). Confirm posting?'
    success_toast: 'GL entries posted: {entries_created} entries created'
  reverse-gl-entries:
    component: WizardFlow
    entity: gl_entry
    steps:
    - label: Select Voucher
      fields:
      - name: voucher_type
        type: text
        label: Voucher Type
        required: true
      - name: voucher_id
        type: text
        label: Voucher ID
        required: true
      - name: posting_date
        type: date
        label: Reversal Date
        default: today
    - label: Confirm Reversal
      confirmation: true
      message: This will create reversing GL entries for the selected voucher. This action cannot be undone.
    success_toast: 'GL entries reversed: {reversed_count} reversal entries created'
  list-gl-entries:
    component: DataTable
    entity: gl_entry
    default_sort: posting_date
    default_sort_dir: desc
    searchable: false
    paginated: true
    page_size: 50
  check-gl-integrity:
    component: DashboardView
    entity: gl_entry
    fields:
    - name: company_id
      type: link
      label: Company
      required: true
      link_entity: company
      link_display_field: name
      link_search_action: list-companies
    display:
    - key: balanced
      label: GL Balanced
      type: boolean_badge
      true_label: Balanced
      false_label: OUT OF BALANCE
    - key: total_debit
      label: Total Debits
      type: currency
    - key: total_credit
      label: Total Credits
      type: currency
    - key: difference
      label: Difference
      type: currency
    - key: chain_intact
      label: Hash Chain Intact
      type: boolean_badge
      true_label: Intact
      false_label: BROKEN
    - key: broken_links
      label: Broken Links
      type: integer
    - key: total_entries
      label: Total Entries
      type: integer
  add-fiscal-year:
    component: FormView
    entity: fiscal_year
    mode: create
    success_toast: Fiscal year '{name}' created
  list-fiscal-years:
    component: DataTable
    entity: fiscal_year
    default_sort: start_date
    default_sort_dir: desc
    searchable: true
    add_action: add-fiscal-year
  validate-period-close:
    component: DashboardView
    entity: fiscal_year
    fields:
    - name: fiscal_year_id
      type: link
      label: Fiscal Year
      required: true
      link_entity: fiscal_year
      link_display_field: name
      link_search_action: list-fiscal-years
    display:
    - key: fiscal_year
      label: Fiscal Year
      type: text
    - key: income_total
      label: Income Total
      type: currency
    - key: expense_total
      label: Expense Total
      type: currency
    - key: net_income
      label: Net Income
      type: currency
    - key: trial_balance_balanced
      label: Trial Balance Balanced
      type: boolean_badge
      true_label: Balanced
      false_label: NOT BALANCED
  close-fiscal-year:
    component: WizardFlow
    entity: fiscal_year
    steps:
    - label: Closing Parameters
      fields:
      - name: fiscal_year_id
        type: link
        label: Fiscal Year
        required: true
        link_entity: fiscal_year
        link_display_field: name
        link_search_action: list-fiscal-years
      - name: closing_account_id
        type: link
        label: Closing Account (Retained Earnings)
        required: true
        link_entity: account
        link_display_field: name
        link_search_action: list-accounts
        help_text: Must be an equity account (e.g., Retained Earnings)
      - name: posting_date
        type: date
        label: Closing Date
        required: true
    - label: Confirm Close
      confirmation: true
      message: Closing a fiscal year will transfer net P&L to Retained Earnings and mark the year as closed. This is a significant
        action.
    success_toast: Fiscal year closed. Net P&L of {net_pl_transferred} transferred.
  reopen-fiscal-year:
    component: WizardFlow
    entity: fiscal_year
    steps:
    - label: Select Fiscal Year
      fields:
      - name: fiscal_year_id
        type: link
        label: Fiscal Year
        required: true
        link_entity: fiscal_year
        link_display_field: name
        link_search_action: list-fiscal-years
    - label: Confirm Reopen
      confirmation: true
      message: Reopening a fiscal year will cancel the period closing voucher and reverse all closing GL entries. Are you
        sure?
    success_toast: Fiscal year reopened
  add-cost-center:
    component: FormView
    entity: cost_center
    mode: create
    success_toast: Cost center '{name}' created
  list-cost-centers:
    component: DataTable
    entity: cost_center
    default_sort: name
    searchable: true
    add_action: add-cost-center
  add-budget:
    component: FormView
    entity: budget
    mode: create
    success_toast: Budget created
  list-budgets:
    component: DataTable
    entity: budget
    default_sort: budget_amount
    default_sort_dir: desc
    paginated: true
  seed-naming-series:
    component: WizardFlow
    entity: naming_series
    steps:
    - label: Select Company
      fields:
      - name: company_id
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
    - label: Confirm
      confirmation: true
      message: This will seed naming series for all entity types for the current year. Existing series will not be duplicated.
    success_toast: 'Naming series seeded: {series_created} created'
  next-series:
    component: FormView
    entity: naming_series
    mode: action
    fields:
    - name: entity_type
      type: text
      label: Entity Type
      required: true
      help_text: e.g., journal_entry, payment_entry, sales_invoice
    - name: company_id
      type: link
      label: Company
      required: true
      link_entity: company
      link_display_field: name
      link_search_action: list-companies
    success_toast: 'Next series: {series}'
  get-account-balance:
    component: DashboardView
    entity: account
    fields:
    - name: account_id
      type: link
      label: Account
      required: true
      link_entity: account
      link_display_field: name
      link_search_action: list-accounts
    - name: as_of_date
      type: date
      label: As-of Date
      required: true
      default: today
    - name: party_type
      type: select
      label: Party Type
      options:
      - value: customer
        label: Customer
      - value: supplier
        label: Supplier
      - value: employee
        label: Employee
    - name: party_id
      type: text
      label: Party ID
    display:
    - key: balance
      label: Balance
      type: currency
    - key: debit_total
      label: Total Debits
      type: currency
    - key: credit_total
      label: Total Credits
      type: currency
    - key: currency
      label: Currency
      type: text
  status:
    component: DashboardView
  revalue-foreign-balances:
    component: WizardFlow
    entity: gl_entry
    steps:
    - label: Revaluation Parameters
      fields:
      - name: company_id
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
      - name: as_of_date
        type: date
        label: As-of Date
        required: true
        default: today
    - label: Confirm Revaluation
      confirmation: true
      message: This will post unrealized FX gain/loss entries for all foreign currency accounts. Review results carefully.
    success_toast: 'FX revaluation complete: {accounts_processed} accounts processed, total gain/loss {total_gain_loss}'
  import-chart-of-accounts:
    component: WizardFlow
    entity: account
    steps:
    - label: Import Settings
      fields:
      - name: csv_path
        type: text
        label: CSV File Path
        required: true
        help_text: Absolute path to the CSV file on the server
      - name: company_id
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
    - label: Confirm Import
      confirmation: true
      message: This will import accounts from the CSV file. Duplicate account names will be skipped.
    success_redirect: list-accounts
    success_toast: 'Import complete: {imported} accounts imported, {skipped} skipped'
  import-opening-balances:
    component: WizardFlow
    entity: gl_entry
    steps:
    - label: Import Settings
      fields:
      - name: csv_path
        type: text
        label: CSV File Path
        required: true
        help_text: Absolute path to the CSV file on the server
      - name: company_id
        type: link
        label: Company
        required: true
        link_entity: company
        link_display_field: name
        link_search_action: list-companies
      - name: posting_date
        type: date
        label: Opening Balance Date
        required: true
        help_text: Typically the day before the first day of the new fiscal year
    - label: Confirm Import
      confirmation: true
      message: This will post opening balance GL entries from the CSV file. Ensure debits equal credits.
    success_toast: 'Opening balances imported: {gl_entries_created} GL entries created'
  add-journal-entry:
    component: FormView
    entity: journal_entry
    mode: create
    child_tables:
    - entity: journal_entry_line
      form_group: items
      add_label: Add Row
  amend-journal-entry:
    component: FormView
    mode: create
  cancel-journal-entry:
    component: WizardFlow
    entity: journal_entry
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Cancel this journal entry? This cannot be undone.
      destructive: true
  delete-journal-entry:
    component: null
    entity: journal_entry
    hidden: true
  duplicate-journal-entry:
    component: FormView
    mode: create
  get-journal-entry:
    component: DetailView
    entity: journal_entry
  list-journal-entries:
    component: DataTable
    entity: journal_entry
    default_sort: created_at
    default_sort_dir: desc
    searchable: true
    add_action: add-journal-entry
  submit-journal-entry:
    component: WizardFlow
    entity: journal_entry
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Submit this journal entry?
  update-journal-entry:
    component: FormView
    entity: journal_entry
    mode: edit
  add-payment:
    component: FormView
    mode: create
  allocate-payment:
    component: FormView
    mode: create
  bank-reconciliation:
    component: FormView
    mode: create
  cancel-payment:
    component: FormView
    mode: create
  create-payment-ledger-entry:
    component: FormView
    entity: payment_ledger_entry
    mode: create
  delete-payment:
    component: FormView
    mode: create
  get-outstanding:
    component: FormView
    mode: create
  get-payment:
    component: FormView
    mode: create
  get-unallocated-payments:
    component: FormView
    mode: create
  list-payments:
    component: FormView
    mode: create
  reconcile-payments:
    component: FormView
    mode: create
  submit-payment:
    component: FormView
    mode: create
  update-payment:
    component: FormView
    mode: create
  add-item-tax-template:
    component: FormView
    entity: item_tax_template
    mode: create
  add-tax-category:
    component: FormView
    entity: tax_category
    mode: create
  add-tax-rule:
    component: FormView
    entity: tax_rule
    mode: create
  add-tax-template:
    component: FormView
    entity: tax_template
    mode: create
    child_tables:
    - entity: tax_template_line
      form_group: items
      add_label: Add Row
  add-tax-withholding-category:
    component: FormView
    entity: tax_withholding_category
    mode: create
  calculate-tax:
    component: FormView
    mode: create
  delete-tax-template:
    component: null
    entity: tax_template
    hidden: true
  generate-1099-data:
    component: FormView
    mode: create
  get-tax-template:
    component: DetailView
    entity: tax_template
  get-withholding-details:
    component: FormView
    mode: create
  list-tax-categories:
    component: DataTable
    entity: tax_category
    default_sort: created_at
    default_sort_dir: desc
    searchable: true
    add_action: add-tax-category
  list-tax-rules:
    component: DataTable
    entity: tax_rule
    default_sort: created_at
    default_sort_dir: desc
    searchable: true
    add_action: add-tax-rule
  list-tax-templates:
    component: DataTable
    entity: tax_template
    default_sort: created_at
    default_sort_dir: desc
    searchable: true
    add_action: add-tax-template
  record-1099-payment:
    component: FormView
    mode: create
  record-withholding-entry:
    component: FormView
    mode: create
  resolve-tax-template:
    component: FormView
    mode: create
  update-tax-template:
    component: FormView
    entity: tax_template
    mode: edit
  ap-aging:
    component: FormView
    mode: create
  ar-aging:
    component: FormView
    mode: create
  balance-sheet:
    component: FormView
    mode: create
  budget-vs-actual:
    component: FormView
    mode: create
  cash-flow:
    component: FormView
    mode: create
  comparative-pl:
    component: FormView
    mode: create
  general-ledger:
    component: FormView
    mode: create
  gl-summary:
    component: FormView
    mode: create
  party-ledger:
    component: FormView
    mode: create
  payment-summary:
    component: FormView
    mode: create
  profit-and-loss:
    component: FormView
    mode: create
  tax-summary:
    component: FormView
    mode: create
  trial-balance:
    component: FormView
    mode: create
  add-item:
    component: FormView
    entity: item
    mode: create
    success_redirect: get-item
    success_toast: Item '{item_name}' ({item_code}) created successfully
  update-item:
    component: FormView
    entity: item
    mode: edit
    success_redirect: get-item
    success_toast: Item updated
  get-item:
    component: DetailView
    entity: item
  list-items:
    component: DataTable
    entity: item
    default_sort: item_name
    searchable: true
    search_fields:
    - item_name
    - item_code
    add_action: add-item
  import-items:
    component: FileUpload
    entity: item
    mode: bulk_import
    accept: .csv
    success_toast: Imported {imported} items ({skipped} skipped)
  add-item-group:
    component: FormView
    entity: item_group
    mode: create
    success_toast: Item group '{name}' created
  list-item-groups:
    component: DataTable
    entity: item_group
    default_sort: name
    searchable: true
    add_action: add-item-group
  add-warehouse:
    component: FormView
    entity: warehouse
    mode: create
    success_toast: Warehouse '{name}' created
  update-warehouse:
    component: FormView
    entity: warehouse
    mode: edit
    success_toast: Warehouse updated
  list-warehouses:
    component: DataTable
    entity: warehouse
    default_sort: name
    searchable: true
    add_action: add-warehouse
  add-stock-entry:
    component: FormView
    entity: stock_entry
    mode: create
    child_tables:
    - entity: stock_entry_item
      min_rows: 1
    success_redirect: get-stock-entry
    success_toast: Stock entry {naming_series} created as draft
  get-stock-entry:
    component: DetailView
    entity: stock_entry
  list-stock-entries:
    component: DataTable
    entity: stock_entry
    default_sort: posting_date
    default_sort_dir: desc
    searchable: false
    add_action: add-stock-entry
  submit-stock-entry:
    component: WizardFlow
    entity: stock_entry
    steps:
    - type: confirmation
      title: Submit Stock Entry
      message: This will post Stock Ledger Entries (SLE) and perpetual inventory GL entries. Stock balances and valuations
        will be updated. This action cannot be undone (only cancelled with reversal entries).
      confirm_label: Submit
      cancel_label: Cancel
    - type: action
      action: submit-stock-entry
    success_redirect: get-stock-entry
    success_toast: 'Stock entry submitted: {sle_entries_created} SLE and {gl_entries_created} GL entries posted'
  cancel-stock-entry:
    component: WizardFlow
    entity: stock_entry
    steps:
    - type: confirmation
      title: Cancel Stock Entry
      message: This will mark existing SLE entries as cancelled and post reversal SLE + GL entries. Stock balances and valuations
        will be adjusted. The stock entry will become immutable.
      confirm_label: Cancel Entry
      cancel_label: Go Back
      style: danger
    - type: action
      action: cancel-stock-entry
    success_redirect: get-stock-entry
    success_toast: 'Stock entry cancelled: {sle_reversals} SLE and {gl_reversals} GL reversal entries posted'
  create-stock-ledger-entries:
    component: ApiAction
    hidden: true
    description: 'Cross-skill: create SLE entries (called by selling/buying skills)'
  reverse-stock-ledger-entries:
    component: ApiAction
    hidden: true
    description: 'Cross-skill: reverse SLE entries (called by selling/buying skills)'
  get-stock-balance:
    component: DetailView
    entity: item
    custom_layout:
      title: Stock Balance
      description: Current stock for a specific item in a specific warehouse
      fields:
      - key: item_id
        label: Item
        type: link
        link_entity: item
      - key: warehouse_id
        label: Warehouse
        type: link
        link_entity: warehouse
      - key: qty
        label: Balance Qty
        type: quantity
        precision: 2
      - key: valuation_rate
        label: Valuation Rate
        type: currency
        precision: 2
      - key: stock_value
        label: Stock Value
        type: currency
        precision: 2
  stock-balance-report:
    component: ReportView
    custom_layout:
      title: Stock Balance Report
      description: Stock balance summary across all items and warehouses for a company
      filters:
      - key: company_id
        label: Company
        type: link
        link_entity: company
        link_search_action: list-companies
        required: true
      - key: warehouse_id
        label: Warehouse
        type: link
        link_entity: warehouse
        link_search_action: list-warehouses
      columns:
      - key: item_code
        label: Item Code
        width: 120
      - key: item_name
        label: Item Name
        width: 200
      - key: warehouse_name
        label: Warehouse
        width: 180
      - key: qty
        label: Balance Qty
        width: 100
        align: right
        type: quantity
        precision: 2
      - key: valuation_rate
        label: Valuation Rate
        width: 120
        align: right
        type: currency
        precision: 2
      - key: stock_value
        label: Stock Value
        width: 140
        align: right
        type: currency
        precision: 2
      summary:
      - key: total_stock_value
        label: Total Stock Value
        type: currency
        precision: 2
      - key: row_count
        label: Total Rows
        type: integer
      data_key: report
  stock-ledger-report:
    component: ReportView
    custom_layout:
      title: Stock Ledger Report
      description: Detailed stock ledger entry log with all movements
      filters:
      - key: item_id
        label: Item
        type: link
        link_entity: item
        link_search_action: list-items
      - key: warehouse_id
        label: Warehouse
        type: link
        link_entity: warehouse
        link_search_action: list-warehouses
      - key: from_date
        label: From Date
        type: date
      - key: to_date
        label: To Date
        type: date
      columns:
      - key: posting_date
        label: Date
        width: 100
        type: date
      - key: item_code
        label: Item Code
        width: 110
      - key: item_name
        label: Item Name
        width: 160
      - key: warehouse_name
        label: Warehouse
        width: 160
      - key: voucher_type
        label: Voucher Type
        width: 130
      - key: actual_qty
        label: Qty Change
        width: 100
        align: right
        type: quantity
        precision: 2
      - key: incoming_rate
        label: Incoming Rate
        width: 110
        align: right
        type: currency
        precision: 2
      - key: valuation_rate
        label: Valuation Rate
        width: 120
        align: right
        type: currency
        precision: 2
      - key: stock_value
        label: Stock Value
        width: 130
        align: right
        type: currency
        precision: 2
      - key: stock_value_difference
        label: Value Diff
        width: 120
        align: right
        type: currency
        precision: 2
      data_key: entries
  check-reorder:
    component: ReportView
    custom_layout:
      title: Reorder Check
      description: Items whose current stock is at or below their reorder level
      filters:
      - key: company_id
        label: Company
        type: link
        link_entity: company
        link_search_action: list-companies
      columns:
      - key: item_code
        label: Item Code
        width: 120
      - key: item_name
        label: Item Name
        width: 200
      - key: current_stock
        label: Current Stock
        width: 120
        align: right
        type: quantity
        precision: 2
      - key: reorder_level
        label: Reorder Level
        width: 120
        align: right
        type: quantity
        precision: 2
      - key: reorder_qty
        label: Reorder Qty
        width: 120
        align: right
        type: quantity
        precision: 2
      - key: shortfall
        label: Shortfall
        width: 120
        align: right
        type: quantity
        precision: 2
      summary:
      - key: items_below_reorder
        label: Items Below Reorder
        type: integer
      data_key: items
      empty_state:
        icon: check-circle
        message: All items are above reorder level
  add-batch:
    component: FormView
    entity: batch
    mode: create
    success_toast: Batch '{batch_name}' created
  list-batches:
    component: DataTable
    entity: batch
    default_sort: batch_name
    searchable: true
    add_action: add-batch
  add-serial-number:
    component: FormView
    entity: serial_number
    mode: create
    success_toast: Serial number '{serial_no}' registered
  list-serial-numbers:
    component: DataTable
    entity: serial_number
    default_sort: serial_no
    searchable: true
    add_action: add-serial-number
  add-price-list:
    component: FormView
    entity: price_list
    mode: create
    success_toast: Price list '{name}' created
  add-item-price:
    component: FormView
    entity: item_price
    mode: create
    success_toast: Item price set at {rate}
  get-item-price:
    component: DetailView
    entity: item_price
    custom_layout:
      title: Item Price Lookup
      description: Finds the applicable price from a price list for the given item and quantity
      fields:
      - key: item_id
        label: Item
        type: link
        link_entity: item
      - key: price_list_id
        label: Price List
        type: link
        link_entity: price_list
      - key: rate
        label: Rate
        type: currency
        precision: 2
      - key: min_qty
        label: Min Qty
        type: quantity
        precision: 2
      - key: valid_from
        label: Valid From
        type: date
      - key: valid_to
        label: Valid To
        type: date
  add-pricing-rule:
    component: FormView
    entity: pricing_rule
    mode: create
    success_toast: Pricing rule '{name}' created
  add-stock-reconciliation:
    component: FormView
    entity: stock_reconciliation
    mode: create
    child_tables:
    - entity: stock_reconciliation_item
      min_rows: 1
    success_redirect: get-stock-reconciliation
    success_toast: 'Stock reconciliation {naming_series} created as draft (difference: {difference_amount})'
  submit-stock-reconciliation:
    component: WizardFlow
    entity: stock_reconciliation
    steps:
    - type: confirmation
      title: Submit Stock Reconciliation
      message: This will post Stock Ledger Entries (SLE) for quantity differences and perpetual inventory GL entries for value
        adjustments. Stock balances and valuations will be updated to match the physical count.
      confirm_label: Submit Reconciliation
      cancel_label: Cancel
    - type: action
      action: submit-stock-reconciliation
    success_redirect: get-stock-reconciliation
    success_toast: 'Reconciliation submitted: {sle_entries_created} SLE and {gl_entries_created} GL entries posted'
  revalue-stock:
    component: FormView
    entity: stock_revaluation
    mode: create
    success_redirect: get-stock-revaluation
    success_toast: 'Stock revalued: {item_name} rate {old_rate} → {new_rate} (adjustment: {adjustment_amount})'
  list-stock-revaluations:
    component: DataTable
    entity: stock_revaluation
    default_sort: created_at
    sort_direction: desc
    add_action: revalue-stock
  get-stock-revaluation:
    component: DetailView
    entity: stock_revaluation
  cancel-stock-revaluation:
    component: WizardFlow
    entity: stock_revaluation
    steps:
    - type: confirmation
      title: Cancel Stock Revaluation
      message: This will reverse the SLE and GL entries created by this revaluation, restoring the previous valuation rate.
      confirm_label: Cancel Revaluation
      cancel_label: Keep
    - type: action
      action: cancel-stock-revaluation
    success_redirect: get-stock-revaluation
    success_toast: Revaluation cancelled and reversed
  add-customer:
    component: FormView
    entity: customer
    mode: create
    success_redirect: get-customer
  update-customer:
    component: FormView
    entity: customer
    mode: edit
    success_redirect: get-customer
  get-customer:
    component: DetailView
    entity: customer
    related:
    - entity: sales_invoice
      action: list-sales-invoices
      filter_field: customer_id
      label: Invoices
    - entity: sales_order
      action: list-sales-orders
      filter_field: customer_id
      label: Orders
    - entity: quotation
      action: list-quotations
      filter_field: customer_id
      label: Quotations
  list-customers:
    component: DataTable
    entity: customer
    default_sort: name
    default_sort_dir: asc
    searchable: true
    add_action: add-customer
  add-quotation:
    component: FormView
    entity: quotation
    mode: create
    child_tables:
    - entity: quotation_item
      form_group: items
      add_label: Add Item
    success_redirect: get-quotation
  update-quotation:
    component: FormView
    entity: quotation
    mode: edit
    child_tables:
    - entity: quotation_item
      form_group: items
      add_label: Add Item
    success_redirect: get-quotation
  get-quotation:
    component: DetailView
    entity: quotation
  list-quotations:
    component: DataTable
    entity: quotation
    default_sort: quotation_date
    default_sort_dir: desc
    searchable: true
    add_action: add-quotation
  submit-quotation:
    component: WizardFlow
    entity: quotation
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Submit this quotation? It will be locked and can be converted to a sales order.
    success_toast: Quotation {naming_series} submitted.
  convert-quotation-to-so:
    component: WizardFlow
    entity: quotation
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Convert this quotation to a sales order?
    success_toast: Sales order created from quotation.
    success_redirect: get-sales-order
  add-sales-order:
    component: FormView
    entity: sales_order
    mode: create
    child_tables:
    - entity: sales_order_item
      form_group: items
      add_label: Add Item
    success_redirect: get-sales-order
  update-sales-order:
    component: FormView
    entity: sales_order
    mode: edit
    child_tables:
    - entity: sales_order_item
      form_group: items
      add_label: Add Item
    success_redirect: get-sales-order
  get-sales-order:
    component: DetailView
    entity: sales_order
    related:
    - entity: delivery_note
      action: list-delivery-notes
      filter_field: sales_order_id
      label: Delivery Notes
    - entity: sales_invoice
      action: list-sales-invoices
      filter_field: sales_order_id
      label: Invoices
  list-sales-orders:
    component: DataTable
    entity: sales_order
    default_sort: order_date
    default_sort_dir: desc
    searchable: true
    add_action: add-sales-order
  submit-sales-order:
    component: WizardFlow
    entity: sales_order
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Submit this sales order? A credit limit check will be performed.
    success_toast: Sales order {naming_series} confirmed.
  cancel-sales-order:
    component: WizardFlow
    entity: sales_order
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Cancel this sales order? This cannot be undone.
      destructive: true
    success_toast: Sales order cancelled.
  create-delivery-note:
    component: FormView
    entity: delivery_note
    mode: create
    child_tables:
    - entity: delivery_note_item
      form_group: items
      add_label: Add Item
    success_redirect: get-delivery-note
  get-delivery-note:
    component: DetailView
    entity: delivery_note
  list-delivery-notes:
    component: DataTable
    entity: delivery_note
    default_sort: posting_date
    default_sort_dir: desc
    searchable: true
  submit-delivery-note:
    component: WizardFlow
    entity: delivery_note
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Submit this delivery note? Stock ledger entries and COGS GL entries will be posted.
    success_toast: Delivery note {naming_series} submitted. {sle_entries_created} SLE + {gl_entries_created} GL entries posted.
  cancel-delivery-note:
    component: WizardFlow
    entity: delivery_note
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Cancel this delivery note? SLE and GL reversal entries will be posted.
      destructive: true
    success_toast: Delivery note cancelled. Reversal entries posted.
  create-sales-invoice:
    component: FormView
    entity: sales_invoice
    mode: create
    child_tables:
    - entity: sales_invoice_item
      form_group: items
      add_label: Add Item
    success_redirect: get-sales-invoice
  update-sales-invoice:
    component: FormView
    entity: sales_invoice
    mode: edit
    child_tables:
    - entity: sales_invoice_item
      form_group: items
      add_label: Add Item
    success_redirect: get-sales-invoice
  get-sales-invoice:
    component: DetailView
    entity: sales_invoice
  list-sales-invoices:
    component: DataTable
    entity: sales_invoice
    default_sort: posting_date
    default_sort_dir: desc
    searchable: true
    add_action: create-sales-invoice
  submit-sales-invoice:
    component: WizardFlow
    entity: sales_invoice
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Submit this invoice? GL entries will be posted and the invoice cannot be edited.
    success_toast: Invoice {naming_series} submitted. {gl_entries_created} GL entries posted.
  cancel-sales-invoice:
    component: WizardFlow
    entity: sales_invoice
    steps:
    - label: Review
      type: detail
    - label: Confirm
      type: confirmation
      message: Cancel this invoice? Reversal GL entries will be posted.
      destructive: true
    success_toast: Invoice {naming_series} cancelled. Reversal entries posted.
  create-credit-note:
    component: FormView
    entity: credit_note
    mode: create
    child_tables:
    - entity: sales_invoice_item
      form_group: items
      add_label: Add Return Item
    success_redirect: get-sales-invoice
  add-sales-partner:
    component: FormView
    entity: sales_partner
    mode: create
  list-sales-partners:
    component: DataTable
    entity: sales_partner
    default_sort: name
    default_sort_dir: asc
    searchable: true
    add_action: add-sales-partner
  add-recurring-template:
    component: FormView
    entity: recurring_invoice_template
    mode: create
    child_tables:
    - entity: recurring_invoice_template_item
      form_group: items
      add_label: Add Item
  update-recurring-template:
    component: FormView
    entity: recurring_invoice_template
    mode: edit
    child_tables:
    - entity: recurring_invoice_template_item
      form_group: items
      add_label: Add Item
  list-recurring-templates:
    component: DataTable
    entity: recurring_invoice_template
    default_sort: next_invoice_date
    default_sort_dir: asc
    searchable: true
    add_action: add-recurring-template
  generate-recurring-invoices:
    component: WizardFlow
    entity: recurring_invoice_template
    steps:
    - label: Confirm
      type: confirmation
      message: Generate all due recurring invoices? Draft invoices will be auto-submitted with GL entries.
    success_toast: '{invoices_generated} recurring invoices generated.'
  update-invoice-outstanding:
    component: InternalAction
    entity: purchase_invoice
    description: Called by erpclaw-payments to reduce outstanding amount after payment allocation
    params:
    - name: purchase_invoice_id
      type: text
      required: true
    - name: amount
      type: currency
      required: true
      precision: 2
  import-customers:
    component: null
    hidden: true
  add-intercompany-account-map:
    component: FormView
    entity: intercompany_account_map
    mode: create
    fields:
    - key: company_id
      label: Source Company
      type: entity_lookup
      entity: company
      required: true
    - key: target_company_id
      label: Target Company
      type: entity_lookup
      entity: company
      required: true
    - key: source_account_id
      label: Source Account
      type: entity_lookup
      entity: account
      required: true
    - key: target_account_id
      label: Target Account
      type: entity_lookup
      entity: account
      required: true
  list-intercompany-account-maps:
    component: DataTable
    entity: intercompany_account_map
    columns:
    - key: source_account_name
      label: Source Account
    - key: target_account_name
      label: Target Account
    filters:
    - key: company_id
      label: Source Company
      type: entity_lookup
      entity: company
      required: true
    - key: target_company_id
      label: Target Company
      type: entity_lookup
      entity: company
  create-intercompany-invoice:
    component: FormView
    entity: intercompany_invoice
    mode: create
    fields:
    - key: sales_invoice_id
      label: Sales Invoice
      type: entity_lookup
      entity: sales_invoice
      required: true
    - key: target_company_id
      label: Target Company
      type: entity_lookup
      entity: company
      required: true
    - key: supplier_id
      label: Supplier (in target)
      type: entity_lookup
      entity: supplier
      required: true
  list-intercompany-invoices:
    component: DataTable
    entity: intercompany_invoice
    columns:
    - key: naming_series
      label: 'Invoice #'
    - key: posting_date
      label: Date
      type: date
    - key: grand_total
      label: Amount
      type: currency
    - key: status
      label: Status
      type: status_badge
    - key: direction
      label: Direction
    filters:
    - key: company_id
      label: Company
      type: entity_lookup
      entity: company
      required: true
  cancel-intercompany-invoice:
    component: WizardFlow
    steps:
    - type: confirmation
      message: Cancel this intercompany invoice? Both the sales invoice and mirror purchase invoice will be cancelled.
    fields:
    - key: sales_invoice_id
      label: Sales Invoice
      type: entity_lookup
      entity: sales_invoice
      required: true
  add-supplier:
    component: FormView
    entity: supplier
    mode: create
    success_redirect: get-supplier
    success_toast: Supplier '{name}' created successfully
  update-supplier:
    component: FormView
    entity: supplier
    mode: edit
    success_redirect: get-supplier
    success_toast: Supplier updated
  get-supplier:
    component: DetailView
    entity: supplier
  list-suppliers:
    component: DataTable
    entity: supplier
    default_sort: name
    searchable: true
    add_action: add-supplier
  import-suppliers:
    component: WizardFlow
    entity: supplier
    steps:
    - label: Upload CSV
      fields:
      - csv_path
      - company_id
    success_toast: 'Suppliers imported: {imported} new, {skipped} skipped'
  add-material-request:
    component: FormView
    entity: material_request
    mode: create
    success_toast: Material request created ({item_count} items)
  submit-material-request:
    component: WizardFlow
    entity: material_request
    steps:
    - label: Confirm Submission
      confirmation_message: Submit this material request? It will be assigned a naming series and can no longer be edited.
      fields:
      - material_request_id
    success_toast: Material request {naming_series} submitted
  list-material-requests:
    component: DataTable
    entity: material_request
    default_sort: created_at
    default_sort_dir: desc
    add_action: add-material-request
  add-rfq:
    component: FormView
    entity: request_for_quotation
    mode: create
    success_toast: RFQ created with {item_count} items for {supplier_count} suppliers
  submit-rfq:
    component: WizardFlow
    entity: request_for_quotation
    steps:
    - label: Confirm Submission
      confirmation_message: Submit this RFQ? It will be sent to the selected suppliers.
      fields:
      - rfq_id
    success_toast: RFQ {naming_series} submitted to suppliers
  list-rfqs:
    component: DataTable
    entity: request_for_quotation
    default_sort: created_at
    default_sort_dir: desc
    add_action: add-rfq
  add-supplier-quotation:
    component: FormView
    entity: supplier_quotation
    mode: create
    success_toast: 'Supplier quotation recorded (total: ${total_amount})'
  list-supplier-quotations:
    component: DataTable
    entity: supplier_quotation
    default_sort: created_at
    default_sort_dir: desc
  compare-supplier-quotations:
    component: ComparisonView
    entity: supplier_quotation
    params:
    - name: rfq_id
      type: link
      link_entity: request_for_quotation
      required: true
    display:
      group_by: item
      columns_per_supplier:
      - rate
      - amount
      - lead_time_days
      highlight_lowest: true
      lowest_field: rate
  add-purchase-order:
    component: FormView
    entity: purchase_order
    mode: create
    success_redirect: get-purchase-order
    success_toast: 'Purchase order created (grand total: ${grand_total})'
  update-purchase-order:
    component: FormView
    entity: purchase_order
    mode: edit
    success_redirect: get-purchase-order
    success_toast: 'Purchase order updated (grand total: ${grand_total})'
  get-purchase-order:
    component: DetailView
    entity: purchase_order
  list-purchase-orders:
    component: DataTable
    entity: purchase_order
    default_sort: order_date
    default_sort_dir: desc
    searchable: true
    add_action: add-purchase-order
  submit-purchase-order:
    component: WizardFlow
    entity: purchase_order
    steps:
    - label: Confirm Submission
      confirmation_message: Submit this purchase order? It will be confirmed and locked for editing. A naming series will
        be assigned.
      fields:
      - purchase_order_id
    success_toast: Purchase order {naming_series} confirmed
  cancel-purchase-order:
    component: WizardFlow
    entity: purchase_order
    steps:
    - label: Confirm Cancellation
      confirmation_message: Cancel this purchase order? This cannot be undone. Ensure there are no linked receipts or invoices.
      fields:
      - purchase_order_id
      variant: danger
    success_toast: Purchase order cancelled
  create-purchase-receipt:
    component: FormView
    entity: purchase_receipt
    mode: create
    success_redirect: get-purchase-receipt
    success_toast: 'Purchase receipt created ({item_count} items, total qty: {total_qty})'
  get-purchase-receipt:
    component: DetailView
    entity: purchase_receipt
  list-purchase-receipts:
    component: DataTable
    entity: purchase_receipt
    default_sort: posting_date
    default_sort_dir: desc
    add_action: create-purchase-receipt
  submit-purchase-receipt:
    component: WizardFlow
    entity: purchase_receipt
    steps:
    - label: Confirm Submission
      confirmation_message: Submit this purchase receipt? This will post Stock Ledger Entries (SLE) to add inventory and GL
        entries (DR Stock In Hand / CR Stock Received Not Billed) for perpetual inventory. These ledger entries are immutable.
      fields:
      - purchase_receipt_id
    success_toast: Purchase receipt {naming_series} submitted ({sle_entries_created} SLE, {gl_entries_created} GL entries
      posted)
  cancel-purchase-receipt:
    component: WizardFlow
    entity: purchase_receipt
    steps:
    - label: Confirm Cancellation
      confirmation_message: Cancel this purchase receipt? This will reverse all SLE and GL entries. Inventory quantities and
        valuations will be rolled back. This cannot be undone.
      fields:
      - purchase_receipt_id
      variant: danger
    success_toast: Purchase receipt cancelled ({sle_reversals} SLE, {gl_reversals} GL reversals posted)
  create-purchase-invoice:
    component: FormView
    entity: purchase_invoice
    mode: create
    success_redirect: get-purchase-invoice
    success_toast: 'Purchase invoice created (grand total: ${grand_total})'
  update-purchase-invoice:
    component: FormView
    entity: purchase_invoice
    mode: edit
    success_redirect: get-purchase-invoice
    success_toast: Purchase invoice updated
  get-purchase-invoice:
    component: DetailView
    entity: purchase_invoice
  list-purchase-invoices:
    component: DataTable
    entity: purchase_invoice
    default_sort: posting_date
    default_sort_dir: desc
    searchable: true
    add_action: create-purchase-invoice
  submit-purchase-invoice:
    component: WizardFlow
    entity: purchase_invoice
    steps:
    - label: Confirm Submission
      confirmation_message: Submit this purchase invoice? This will post GL entries (DR Expense/SRNB / CR Accounts Payable),
        tax GL entries, and a Payment Ledger Entry (PLE). If update_stock is enabled, SLE entries will also be posted. These
        ledger entries are immutable.
      fields:
      - purchase_invoice_id
    success_toast: Purchase invoice {naming_series} submitted ({gl_entries_created} GL entries posted)
  cancel-purchase-invoice:
    component: WizardFlow
    entity: purchase_invoice
    steps:
    - label: Confirm Cancellation
      confirmation_message: Cancel this purchase invoice? This will reverse all GL entries, delink PLE entries, and (if update_stock
        was set) reverse SLE entries. This cannot be undone.
      fields:
      - purchase_invoice_id
      variant: danger
    success_toast: Purchase invoice cancelled ({gl_reversals} GL reversals posted)
  create-debit-note:
    component: WizardFlow
    entity: purchase_invoice
    steps:
    - label: Select Invoice & Items
      fields:
      - against_invoice_id
      - items
      - reason
      confirmation_message: Create a debit note (return) against this purchase invoice? The debit note will be created in
        draft status and must be submitted separately to post GL reversals.
    success_toast: 'Debit note created (total: ${total_amount})'
  add-landed-cost-voucher:
    component: WizardFlow
    entity: landed_cost_voucher
    steps:
    - label: Select Receipts
      fields:
      - purchase_receipt_ids
      - company_id
    - label: Define Charges
      fields:
      - charges
      confirmation_message: Submit this landed cost voucher? Charges will be allocated across receipt items proportionally,
        adjusting item valuation rates. GL entries (DR Stock In Hand / CR Expense) will be posted.
    success_toast: Landed cost voucher created (${total_landed_cost} allocated, {gl_entries_created} GL entries)
  add-billing-adjustment:
    component: FormView
    entity: billing_adjustment
    mode: create
  add-meter:
    component: FormView
    entity: meter
    mode: create
    child_tables:
    - entity: meter_reading
      form_group: items
      add_label: Add Row
  add-meter-reading:
    component: FormView
    mode: create
  add-prepaid-credit:
    component: FormView
    mode: create
  add-rate-plan:
    component: FormView
    entity: rate_plan
    mode: create
  add-usage-event:
    component: FormView
    entity: usage_event
    mode: create
  add-usage-events-batch:
    component: FormView
    mode: create
  create-billing-period:
    component: FormView
    entity: billing_period
    mode: create
  generate-invoices:
    component: FormView
    mode: create
  get-billing-period:
    component: DetailView
    entity: billing_period
  get-meter:
    component: DetailView
    entity: meter
  get-prepaid-balance:
    component: FormView
    mode: create
  get-rate-plan:
    component: DetailView
    entity: rate_plan
  list-billing-periods:
    component: DataTable
    entity: billing_period
    default_sort: created_at
    default_sort_dir: desc
    searchable: true
    add_action: create-billing-period
  list-meter-readings:
    component: FormView
    mode: create
  list-meters:
    component: DataTable
    entity: meter
    default_sort: created_at
    default_sort_dir: desc
    searchable: true
    add_action: add-meter
  list-rate-plans:
    component: DataTable
    entity: rate_plan
    default_sort: created_at
    default_sort_dir: desc
    searchable: true
    add_action: add-rate-plan
  rate-consumption:
    component: FormView
    mode: create
  run-billing:
    component: FormView
    mode: create
  update-meter:
    component: FormView
    entity: meter
    mode: edit
  update-rate-plan:
    component: FormView
    entity: rate_plan
    mode: edit
