fix(purchase): require Act Kind only for Purchase Act
Gate the client-side act_kind validation on act_type == "Purchase Act", matching the field's mandatory_depends_on. Previously it required act_kind whenever purchase_type/agricultural_goods was set, blocking submission for EQF/Import documents where the field is hidden. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4adde142b4
commit
8e3cc32501
|
|
@ -623,8 +623,9 @@ frappe.ui.form.on('Purchase Invoice', {
|
||||||
validate: function(frm) {
|
validate: function(frm) {
|
||||||
// Client-side validation before save
|
// Client-side validation before save
|
||||||
if ((frm.doc.purchase_type || frm.doc.agricultural_goods) && frm.doc.items) {
|
if ((frm.doc.purchase_type || frm.doc.agricultural_goods) && frm.doc.items) {
|
||||||
// Validate act_kind is selected
|
// Validate act_kind is selected — only required for a Purchase Act
|
||||||
if (!frm.doc.act_kind) {
|
// (matches the field's mandatory_depends_on).
|
||||||
|
if (frm.doc.act_type === 'Purchase Act' && !frm.doc.act_kind) {
|
||||||
frappe.msgprint({
|
frappe.msgprint({
|
||||||
title: __('Missing Act Kind'),
|
title: __('Missing Act Kind'),
|
||||||
indicator: 'red',
|
indicator: 'red',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue