Commit Graph

3133 Commits

Author SHA1 Message Date
Pandiyan P
dd033cbc10 fix(stock): guard serial batch editor grid lookup (#58464) 2026-08-27 11:28:02 +05:30
Raffael Meyer
e71e08959f refactor: use Meta.get_translated_label (#58335) 2026-08-22 00:28:55 +02:00
Raffael Meyer
eae36c2d67 fix(i18n): translate get_label results at presentation with DocType context (#57217) 2026-08-21 23:19:36 +02:00
Mihir Kandoi
2328e6da94 fix: changing product bundle warehouse should change packed items war… (#58316) 2026-08-20 12:35:04 +05:30
diptanilsaha
449c90f05f fix: escape event subject in crm activities template 2026-08-19 02:06:24 +05:30
diptanilsaha
57c2887ab4 fix: escape attribute values in shared client side templates 2026-08-18 22:49:43 +05:30
Sudharsanan Ashok
fb7c2caf29 fix(stock): honour pick serial / batch based on in the batch selector (#58176) 2026-08-14 19:25:35 +05:30
Pandiyan P
10109674a4 feat(selling): add shipping contact person to sales order, delivery note and sales invoice (#58159) 2026-08-14 15:04:31 +05:30
Mihir Kandoi
8632119f11 fix(accounts): filter parties by transaction company (#58147) 2026-08-14 11:02:13 +05:30
Sudharsanan Ashok
a2976dd29e fix(stock): confirm before changing item qty from the batch selector (#58123)
the batch selector silently overwrote the item qty with the bundle total,
so editing a row qty in the dialog changed the delivered qty without any
warning. prompt for confirmation when the rows do not add up to the qty
to fetch, and only proceed if the user agrees.
2026-08-13 16:27:45 +05:30
Mihir Kandoi
e8c890a844 fix(selling): preserve explicit UOM during item selection 2026-08-11 20:54:04 +05:30
Mihir Kandoi
6c5aca0b37 Merge pull request #57983 from Jatin3128/fix/disabled-party-validation-opportunity-rfq
fix: block disabled/frozen party on Opportunity and Request for Quotation
2026-08-11 16:31:52 +05:30
Jatin3128
90937ce6d9 fix: block disabled/frozen customers on Opportunity
Opportunity inherits TransactionBase instead of AccountsController, so
it never ran validate_party_frozen_disabled like Quotation, Sales Order
and Sales Invoice do. A disabled Customer could be saved as an
Opportunity's party and only get caught later at Quotation stage.

Also fixes the party_name Link query on the client: it referenced
erpnext.queries.customer, which was never defined, so disabled
customers showed up in the picker.
2026-08-10 18:02:16 +05:30
Pandiyan P
55fe269046 fix: allow selecting a warehouse for new items in the update items dialog (#57876) 2026-08-07 17:32:29 +00:00
Mihir Kandoi
ca5a673409 fix: round computed conversion factors to field precision
The inverse (1 / value) and intermediate-UOM branches of
get_uom_conv_factor returned raw float quotients like
0.4535922921968971, bypassing the precision the docfields now declare.
Same for the client-side back-calculation from an edited stock qty.
Round both to the UOM Conversion Factor value precision.
2026-08-07 17:47:50 +05:30
rohitwaghchaure
742e0e16cf fix: XSS through unescaped work order name in shop floor view (#57826) 2026-08-06 08:53:46 +05:30
Mihir Kandoi
097ce0f348 fix(manufacturing): reach the whole configurator from tree toolbar actions
The toolbar handlers were copied onto view.events as unbound functions, so
`this` inside them was that object literal rather than the BOMConfigurator.
They worked only because the literal also carried `frm`, and broke as soon as
a handler called a method the literal did not list: get_item_code, added when
the tree started keying nodes on the row name, threw
"this.get_item_code is not a function" and killed Add Raw Material, Add Sub
Assembly and Convert to Sub Assembly.

Assign the instance instead of a hand-maintained whitelist. Every method is
reachable, `this.frm` keeps working, and no future method can be forgotten.

Fixes #57773
2026-08-04 15:34:59 +05:30
Diptanil Saha
4255df05cd Merge pull request #57742 from diptanilsaha/fix/escape_data_in_templates
fix: escape data in multiple templates
2026-08-04 12:11:43 +05:30
diptanilsaha
10c439ff01 fix: escape item name and item title on item_selector 2026-08-03 16:16:07 +05:30
diptanilsaha
2d387002d9 fix(workstation): escape data on get_workstations 2026-08-03 16:15:59 +05:30
Mihir Kandoi
dfec7bd5c7 fix(stock): stop a secondary item type from waiving quality inspection
The inspection skip for secondary rows applied to every purpose, and in
validate_inspection it skipped the row even when the item itself mandated
inspection. Secondary Item Type is only meaningful on the purposes that
produce secondary items, but nothing clears it elsewhere, since
mark_finished_and_secondary_items runs for Manufacture and Repack alone.

A Material Receipt of an item marked Inspection Required Before Purchase
is blocked without an inspection. Setting Secondary Item Type on the row
submitted it clean.

Limit the exemption to the purposes that produce secondary items, and to
other doctypes such as Subcontracting Receipt, which carry the field with
its intended meaning. The client-side mirror is kept in sync.
2026-08-03 13:55:26 +05:30
Mihir Kandoi
6477709f7c Merge pull request #57674 from mihir-kandoi/fix/uom-conversion-factor-precision
fix: preserve UOM conversion factor precision in transactions
2026-08-02 11:55:13 +05:30
Mihir Kandoi
07ac4d83ef feat(job_card): print quantities with their stock uom (#57689)
* feat(job_card): carry the stock uom on the job card

Every quantity the job card reports belongs to the item it produces, but the
document had no unit of its own, so messages could only print bare numbers.

Add the Stock UOM field, set from the finished good or the final product, and
backfill the job cards that already exist.

* fix(job_card): print quantities with their unit

A bare 5 in an error says nothing about what was counted. Every message that
reports a quantity now names its unit, taking it from the job card's stock uom,
from the previous operation's finished good when the message compares two
operations, and from the item itself for a raw material transfer.

The completion dialogs read the same unit off the job card.

* refactor(job_card): move the stock uom next to the qty it measures

* fix(job_card): keep the stock uom backfill atomic

Drop the auto commit toggle so the backfill is a single transaction with no
connection flag left behind when it raises, and select the job cards to fill
with an explicit unset filter instead of a value list.
2026-08-01 18:34:31 +05:30
Mihir Kandoi
0ddf72dae9 refactor(job_card): make the completion dialog say what it asks for (#57688)
* refactor(job_card): drop the unused make_finished_good handler

Nothing triggered it and Job Card has no make_finished_good method to call.

* refactor(job_card): make the completion dialog say what it asks for

The dialog qty shares the Qty to Manufacture label with the field on the form
while it means the current cycle only, its title fell back to the generic Enter
Value because frappe.prompt takes four arguments and it was passed five, and
nothing on it stated that the three quantities have to add up.

Name the cycle in the label, title the dialog after the button that opens it,
and describe the split on the fields. Same wording in the shop floor dialog.
2026-08-01 18:34:31 +05:30
Mihir Kandoi
7bffd84482 fix(job_card): reject a completion split that cannot add up (#57687)
* fix(job_card): reject a completion split that cannot add up

The completion dialogs silently dropped a recalculation whose result went
negative, so entering a pending qty larger than what is left of the qty to
manufacture kept the contradiction (3 to manufacture, 3 completed, 2 pending)
and the job card only failed much later, on submission.

Keep the split consistent while it is entered: reset the pending qty when the
qty to manufacture changes, and refuse a completed, pending or process loss qty
that leaves the others negative. complete_job_card validates the same rule, so
the shop floor and the API cannot store a split that will never submit.

Also name the three parts in the submission error instead of calling their sum
the Total Completed Qty, which read as a contradiction of the field itself.

* test(job_card): cover the completion qty split guard
2026-08-01 18:34:30 +05:30
Mihir Kandoi
269cc6ee3b fix: preserve UOM conversion factor precision in transactions
calculate_item_values rounds every Float field on an item row to the
site's Float Precision (3 by default), and conversion_factor was one of
them. The factor is a ratio, not a rate: UOM Conversion Factor.value is
stored at precision 9, and Material Request keeps the full value because
it has no currency field and so never runs the calculation.

Mapping a Material Request to a Purchase Order therefore truncated the
factor - 0.453592292 for Pound -> Kg became 0.454 - and stock_qty, which
is recomputed as qty * conversion_factor, drifted from the quantity that
was requested, leaving the Material Request unable to close.

Exclude conversion_factor from the rounded fields on the server and on
the client. Factors below the site precision would otherwise round to
zero outright.
2026-07-31 21:53:59 +05:30
Smit Vora
986cea2331 feat: taxable-base resolver hook for custom charge types (#56175) 2026-07-28 17:21:55 +05:30
Mihir Kandoi
b37152752f fix(manufacturing): scope BOM Creator tree children to the parent row
The BOM Creator tree identified a node by the parent's item code
(fg_item) instead of the specific BOM Creator Item row, so every
occurrence of a repeated sub-assembly shared one child set: expanding
any one of them listed the raw materials of all of them, and deleting
one wiped the raw materials of its siblings.

Key the tree on fg_reference_id and make the node value the row name,
matching the framework convention that a tree node's value is its
docname. Item code now travels as its own field for the label and for
the fg_item argument sent back on add/convert.

Fixes #57311
2026-07-28 11:25:29 +05:30
Nabin Hait
50e361e10d Merge pull request #57263 from nabinhait/proforma-invoice
feat(selling): Proforma Invoice against Sales Order
2026-07-23 19:48:44 +05:30
Nabin Hait
0b71c943c1 fix(selling): don't email cancelled proformas or copy their PDF
Address review findings:
- send_proforma_email rejects non-issued proformas, and the tab suppresses the
  action for cancelled rows, so a voided document can't be sent to a customer
- mark proforma_pdf as no_copy and disable amendment (a proforma is created
  only from a Sales Order), so a copied proforma can't carry the original's PDF
  and number
2026-07-23 19:17:21 +05:30
Nabin Hait
7b93252621 Merge pull request #57299 from nabinhait/feat/warn-existing-draft-links
feat: warn when a draft linked document already exists
2026-07-23 10:38:45 +05:30
Mihir Kandoi
551559e804 refactor: move new-doc route options to StockController
set_route_options_for_new_doc lived in TransactionController, so doctypes
extending StockController directly (Stock Reconciliation, Stock Entry) missed
the Batch/SABB prefill or duplicated it locally. Move it to StockController
and call it from onload_post_render so all descendants inherit it.

- Batch quick entry from Stock Reconciliation items now prefills Item
- SABB route options unified: warehouse || s_warehouse || t_warehouse,
  so transaction doctypes now also prefill warehouse
- Stock Entry's duplicate handler removed; its onload_post_render now
  calls super
2026-07-22 17:58:38 +05:30
Nabin Hait
01f7e45058 Merge branch 'develop' into feat/warn-existing-draft-links 2026-07-22 15:18:39 +05:30
Mihir Kandoi
88b8ce3888 fix: enforce company restrictions at transaction level
Restrict to Companies only filtered list views and document reads, and
only for users with Company user permissions. Any user could still use
a master restricted to Company A in a Company B transaction, and users
without Company user permissions bypassed the feature entirely.

Validate on save of transactions that every linked Item, Customer and
Supplier allows the transaction company, and filter item link queries
by the transaction company so restricted items don't show up in the
item selector.
2026-07-22 14:13:22 +05:30
Henil Maru
83e04dd773 fix: show transaction currency symbol in Payment Request schedule dialog and reference table (#57050)
* fix: show transaction currency symbol in Payment Request schedule dialog and reference table

When company currency (INR) differs from customer currency (USD), the Amount
column in the Select Payment Schedule dialog and the Payment Reference table on
the Payment Request form incorrectly displayed the company currency symbol (₹)
instead of the transaction currency symbol ($).

- Pass `currency` from the parent document on each schedule row returned by
  `get_available_payment_schedules` so the dialog can resolve the symbol.
- Add a hidden `currency` field to the dialog table and set `options: "currency"`
  on `payment_amount` so Frappe renders the correct symbol.
- Propagate `currency` into Payment Reference rows in `set_payment_references`.
- Add a hidden `currency` Link field to the Payment Reference child DocType and
  set `options: "currency"` on its `amount` field so the table renders correctly.

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

* fix: preserve currency when serializing payment schedule rows

get_available_payment_schedules set `schedule.currency` directly on
the Payment Schedule Document row, but `currency` isn't a field on
that DocType, so the API response serializer stripped it before it
reached the client. The Select Payment Schedule dialog and the
Payment Reference table therefore always fell back to the company
currency symbol, even with the earlier options="currency" changes in
place.

Convert each row to a plain dict via as_dict() first, then set the
currency key on the dict so it survives serialization.

* refactor: source schedule currency in dialog instead of API serializer

get_available_payment_schedules had to convert each child row with
as_dict() and re-attach currency, because currency is not a field on
Payment Schedule and the response serializer drops attributes set on the
Document itself.

The schedule dialog already has the transaction currency on frm.doc, so
set it there and let the API keep returning the schedule rows unchanged.
Payment Reference still stores currency per row.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jatin3128 <jatinsarna8@gmail.com>
Co-authored-by: Jatin3128 <140256508+Jatin3128@users.noreply.github.com>
2026-07-21 11:58:38 +05:30
Nabin Hait
7d351153bb feat: warn when a draft linked document already exists
When creating a follow-up document (SO->DN, PO->PR, PI->Payment Entry,
etc.), warn the user if a draft of the target doctype already linked to
the source document exists, with links to the drafts and the option to
proceed anyway.

The target doctype comes from the make_mapped_doc response via the new
frappe.model.add_mapped_doc_guard hook, so every open_mapped_doc flow is
covered without per-doctype code or method-name inference. The server
lookup walks parent-level and child-table Link / Dynamic Link fields of
the target doctype and queries through frappe.get_list, so role and user
permissions apply and docstatus filtering happens in the query itself.
Payment Entry creation bypasses open_mapped_doc, so its controller runs
the same guard explicitly.
2026-07-20 18:37:24 +05:30
rohitwaghchaure
2eecdc48bf feat: inline serial and batch entries editor (#57216)
* feat: inline serial and batch entries editor in Purchase Receipt

* feat: grid-style UX, deferred saves, scan and range options for inline serial batch editor

* feat: extend inline serial batch editor to all bundle doctypes with auto fetch

* fix: address review comments on inline serial batch editor

* fix: escape untrusted values in inline editor alerts

* fix: clear child bundle reference only when the row owns the bundle

* fix: keep inline serial batch editor disabled on existing sites via patch
2026-07-19 19:21:09 +05:30
Nabin Hait
e932105ee3 fix(selling): recompute proforma amount for all rows on qty change
Refreshing a single grid row only updates the active row, so the derived amount
for rows after the edited one went stale. Recompute every row's amount from
qty x rate and re-render the grid.
2026-07-19 12:26:34 +05:30
Nabin Hait
654c9e6ad8 style(selling): form-builder layout tweaks and label rename
- Proforma Invoice form: place Grand Total beside Total Quantity (column break)
  and minor field reorder
- Rename the tab button to "New Proforma Invoice"
- Add the Proforma Invoice client-script scaffold
2026-07-19 11:25:40 +05:30
Nabin Hait
63607e91fd feat(selling): open the Proforma tab after creating a proforma
Flag the form on create and activate the Proforma tab once the reloaded form
has rendered the list, so the new proforma is shown immediately.
2026-07-17 20:04:18 +05:30
Nabin Hait
853c1d8986 feat(selling): add a New button below the proforma listing
Place a "+ New" button under the Proforma tab list to create another proforma
without leaving the tab.
2026-07-17 19:16:28 +05:30
Nabin Hait
1da4657530 feat(selling): option to hide item qty on amount-based proforma print
Add a "Hide Item Quantity in Print" option (Amount basis only) that omits the
qty and rate columns from the printed proforma, for a clean value-based
document that shows only item and amount.
2026-07-17 17:44:04 +05:30
Nabin Hait
2242f1b230 feat(selling): make qty editable in amount-based proforma
In Amount basis, both qty and amount are now user-entered and the rate is
derived from them (rate = amount / qty). Previously qty was forced to the
ordered qty, which ignored an edited qty when switching basis.
2026-07-17 17:37:01 +05:30
Nabin Hait
77540403ab feat(selling): prefill remaining proforma qty/amount and reorder Create button
- Pre-fill each line with the remaining (ordered minus already proformed) qty
  and amount, so the default no longer trips the excess warning
- Place the Proforma Invoice action after the standard Create options
2026-07-17 14:11:26 +05:30
Nabin Hait
4177101ac0 feat(selling): warn when total proforma exceeds the ordered qty/amount
Show a non-blocking notice below the item table when a line's total proforma
quantity (or amount) — this proforma plus already-issued ones — exceeds the
Sales Order line's ordered value. It updates live as the qty/amount or the
basis changes, and the user can still create the proforma.

Issued-proforma qty/amount are aggregated per line on demand (cancelled
proformas excluded); nothing is stored on the Sales Order.
2026-07-17 13:42:11 +05:30
Nabin Hait
f711375885 feat(selling): keep cancelled proformas visible with their PDF
Cancelling a proforma should void it, not erase history.

- Persist the Cancelled status on cancel (db_set) and keep the PDF attached
- Proforma tab now lists cancelled proformas with a red status badge, so the
  voided document and its PDF stay reachable for audit
2026-07-17 12:50:44 +05:30
Nabin Hait
473c655cb2 feat(selling): add amount-based proforma option
Let a proforma be created by editing item amount instead of quantity, for
value/advance-style proformas.

- "Based On" (Quantity | Amount) on the proforma and the create dialog
- Amount basis keeps the ordered qty and derives a rate so the line totals
  the entered amount; the PDF renders the same in-memory Sales Order copy
- Proforma Invoice Item now stores rate and amount
2026-07-17 12:50:44 +05:30
Nabin Hait
f9a09e1b3d refactor(selling): drop proforma quantity tracking
Remove the pending/proforma-qty machinery: it only fit staged, incremental
proformas and misrepresented the common whole-order / re-issued cases.

- Drop proforma_qty from Sales Order Item and its submit/cancel write-back
- Drop pending-qty aggregation and the over-qty soft warning
- The create dialog now pre-fills the ordered qty (editable down)
2026-07-17 11:51:03 +05:30
Nabin Hait
fdc8879ce1 feat(selling): wire Proforma Invoice into Sales Order form
- Create > Proforma Invoice dialog with naming series, print format and
  letter head selectors, and an item-wise pending-qty grid
- Proforma tab listing issued proformas with inline view/email actions,
  shown only once at least one proforma exists
- Register the client script and add the connections dashboard link
2026-07-17 11:45:49 +05:30
Mihir Kandoi
b23224b3d6 Merge pull request #57091 from aerele/fix/so-qty-company-warehouse
fix(stock): show qty (company) and qty (warehouse) in sales transactions
2026-07-13 21:03:07 +05:30