{% extends "ui/templates/base/layout.html" %} {% block content %}

Accounting · Phase 21

Stock Item Intelligence

Mirror Tally Stock Groups, Stock Items and Units into ERP, learn client-specific source-description mappings, and convert source UQC/units safely before item-wise Purchase or Sales vouchers reach Tally.

{% if message %}
{{ message }}
{% endif %} {% if error %}
{{ error }}
{% endif %}
{% if selected_client and selected_tally_guid %}
{% if last_sync %}Last sync {{ last_sync.created_at_utc }} · {{ last_sync.stock_item_count }} items · {{ last_sync.stock_group_count }} groups · {{ last_sync.unit_count }} units{% else %}No ERP Stock Master snapshot yet.{% endif %}
{% endif %}
{% if selected_client and selected_tally_guid %}
Stock Items
{{ summary.items }}
Stock Groups
{{ summary.groups }}
Units
{{ summary.units }}
Learned Item Mappings
{{ summary.mappings }}
Unit Mappings
{{ summary.unit_mappings }}
{% if view=='items' %}

Tally Stock Item Master

Read-only ERP mirror of the selected Tally company's current Stock Items.

{% for item in items %} {% else %} {% endfor %}
Stock ItemGroupUnitHSNGSTOpening QtyOpening Value
{{ item.name }}
{% if item.category_name %}
Category: {{ item.category_name }}
{% endif %}
{{ item.parent_group_name or '-' }} {{ item.base_units or '-' }}{% if item.additional_units %}
Alt: {{ item.additional_units }}
{% endif %}
{{ item.hsn_code or '-' }} {{ item.gst_applicable or '-' }}{% if item.gst_type_of_supply %}
{{ item.gst_type_of_supply }}
{% endif %}
{{ item.opening_balance }} ₹{{ '%.2f'|format(item.opening_value) }}
No Stock Items synchronized yet.
{% if pages > 1 %}
{{ total }} item(s) · Page {{ page }} of {{ pages }}
{% if page>1 %}Previous{% endif %} {% if pageNext{% endif %}
{% endif %}
{% elif view=='review' %}

Needs Stock Item Mapping

Unresolved item descriptions already present in source-backed voucher evidence. Loose fuzzy matches are never auto-confirmed.

{% for row in review_rows %}
{{ row.source_type|upper }}{% if row.hsn %}HSN {{ row.hsn }}{% endif %}

{{ row.description }}

{{ row.party or 'No party-specific mapping' }}{% if row.source_unit %} · Source unit {{ row.source_unit }}{% endif %}

{{ row.reason }}{% if row.confidence %} · best candidate {{ row.confidence }}%{% endif %}

{% if row.candidates %}
Suggested candidates
{% for candidate in row.candidates[:5] %}
{{ candidate.confidence }}% · {{ candidate.name }} · {{ candidate.group or '-' }} · HSN {{ candidate.hsn or '-' }} · {{ candidate.unit or '-' }}
{% endfor %}
{% endif %}
{% else %}
No unresolved stock-item descriptions found in current voucher source evidence.
{% endfor %}
{% elif view=='mappings' %}

Add / Update Mapping Manually

Use this when a source item has not yet generated a review row, or when preparing mappings before E-Way Bill/E-Invoice migration.

Learned Stock Item Mappings

Confirmed mappings are client/company/source scoped and take precedence over name similarity.

{% for mapping,item in mappings %} {% else %}{% endfor %}
SourcePartySource DescriptionHSNMapped Tally ItemOrigin
{{ mapping.source_type|upper }}{{ mapping.party_key or 'Generic' }}{{ mapping.source_description }}{{ mapping.hsn_sac or '-' }}{{ item.name }}
{{ item.parent_group_name }} · {{ item.base_units }}
{{ mapping.mapping_origin|title }} · {{ mapping.confidence }}%
No learned stock-item mappings yet.
{% elif view=='units' %}

Tally Units

{% for unit in units %}{% else %}{% endfor %}
UnitOriginalConversion
{{ unit.name }}{{ unit.original_name or '-' }}{{ unit.conversion or '-' }}{% if unit.base_units or unit.additional_units %}
{{ unit.base_units }} → {{ unit.additional_units }}
{% endif %}
No units synchronized.

Add / Update Source Unit Mapping

Quantity factor means: source quantity × factor = Tally quantity. Example: 1 MT → 1000 Kg uses factor 1000.

Saved Unit Mappings

{% for mapping,unit in unit_mappings %}
{{ mapping.source_unit }} × {{ mapping.quantity_factor }} → {{ unit.name }}{% if mapping.note %}
{{ mapping.note }}
{% endif %}
{% else %}
No explicit unit mappings yet. Exact normalized units still resolve automatically.
{% endfor %}
{% endif %} {% endif %}
{% endblock %}