mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-14 18:51:21 +00:00
* fix: incorrect validation thrown for drop shipped PI (#54751)
(cherry picked from commit 907a809f3f)
# Conflicts:
# erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
* chore: resolve conflicts
---------
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
@@ -110,6 +110,7 @@
|
|||||||
"sales_invoice_item",
|
"sales_invoice_item",
|
||||||
"material_request",
|
"material_request",
|
||||||
"material_request_item",
|
"material_request_item",
|
||||||
|
"delivered_by_supplier",
|
||||||
"item_weight_details",
|
"item_weight_details",
|
||||||
"weight_per_unit",
|
"weight_per_unit",
|
||||||
"total_weight",
|
"total_weight",
|
||||||
@@ -1001,13 +1002,22 @@
|
|||||||
"label": "Tax Withholding Category",
|
"label": "Tax Withholding Category",
|
||||||
"options": "Tax Withholding Category",
|
"options": "Tax Withholding Category",
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "delivered_by_supplier",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Delivered by Supplier",
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grid_page_length": 50,
|
"grid_page_length": 50,
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2026-04-07 15:40:45.687554",
|
"modified": "2026-05-06 08:08:40.782395",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice Item",
|
"name": "Purchase Invoice Item",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class PurchaseInvoiceItem(Document):
|
|||||||
conversion_factor: DF.Float
|
conversion_factor: DF.Float
|
||||||
cost_center: DF.Link | None
|
cost_center: DF.Link | None
|
||||||
deferred_expense_account: DF.Link | None
|
deferred_expense_account: DF.Link | None
|
||||||
|
delivered_by_supplier: DF.Check
|
||||||
description: DF.TextEditor | None
|
description: DF.TextEditor | None
|
||||||
discount_amount: DF.Currency
|
discount_amount: DF.Currency
|
||||||
discount_percentage: DF.Percent
|
discount_percentage: DF.Percent
|
||||||
|
|||||||
@@ -327,6 +327,7 @@ class AccountsController(TransactionBase):
|
|||||||
# Determine if drop ship applies
|
# Determine if drop ship applies
|
||||||
is_drop_ship = self.doctype in {
|
is_drop_ship = self.doctype in {
|
||||||
"Purchase Order",
|
"Purchase Order",
|
||||||
|
"Purchase Invoice",
|
||||||
"Sales Order",
|
"Sales Order",
|
||||||
"Sales Invoice",
|
"Sales Invoice",
|
||||||
} and self.is_drop_ship(self.items)
|
} and self.is_drop_ship(self.items)
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ erpnext.buying = {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const project_filters = {
|
const get_project_filters = () => ({
|
||||||
query: "erpnext.controllers.queries.get_project_name",
|
query: "erpnext.controllers.queries.get_project_name",
|
||||||
filters: {
|
filters: {
|
||||||
company: doc.company,
|
company: this.frm.doc.company,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
this.frm.set_query("project", (_) => project_filters);
|
this.frm.set_query("project", get_project_filters);
|
||||||
this.frm.set_query("project", "items", (_, __, ___) => project_filters);
|
this.frm.set_query("project", "items", get_project_filters);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.frm.doc.__islocal &&
|
this.frm.doc.__islocal &&
|
||||||
@@ -178,9 +178,14 @@ erpnext.buying = {
|
|||||||
callback: (r) => {
|
callback: (r) => {
|
||||||
if (!r.message) return;
|
if (!r.message) return;
|
||||||
|
|
||||||
this.frm.set_value("billing_address", r.message.primary_address || "");
|
if (!this.frm.doc.billing_address) {
|
||||||
|
this.frm.set_value("billing_address", r.message.primary_address || "");
|
||||||
|
}
|
||||||
|
|
||||||
if (frappe.meta.has_field(this.frm.doc.doctype, "shipping_address")) {
|
if (
|
||||||
|
frappe.meta.has_field(this.frm.doc.doctype, "shipping_address") &&
|
||||||
|
!this.frm.doc.shipping_address
|
||||||
|
) {
|
||||||
this.frm.set_value("shipping_address", r.message.shipping_address || "");
|
this.frm.set_value("shipping_address", r.message.shipping_address || "");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1292,7 +1292,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
["Purchase Order", "Purchase Receipt", "Purchase Invoice"].includes(this.frm.doctype) &&
|
["Purchase Order", "Purchase Receipt", "Purchase Invoice"].includes(this.frm.doctype) &&
|
||||||
!this.frm.doc.shipping_address
|
!this.frm.doc.shipping_address
|
||||||
) {
|
) {
|
||||||
let is_drop_ship = me.frm.doc.items.some((item) => item.delivered_by_supplier);
|
const is_drop_ship = me.frm.doc.items.some((item) => item.delivered_by_supplier);
|
||||||
|
|
||||||
if (!is_drop_ship) {
|
if (!is_drop_ship) {
|
||||||
erpnext.utils.get_shipping_address(this.frm, function () {
|
erpnext.utils.get_shipping_address(this.frm, function () {
|
||||||
|
|||||||
@@ -106,15 +106,19 @@ $.extend(erpnext.queries, {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let filters = { link_doctype: "Company", link_name: doc.company || "" };
|
||||||
|
const is_drop_ship = doc.items.some((item) => item.delivered_by_supplier);
|
||||||
|
if (is_drop_ship) filters = {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
query: "frappe.contacts.doctype.address.address.address_query",
|
query: "frappe.contacts.doctype.address.address.address_query",
|
||||||
filters: { link_doctype: "Company", link_name: doc.company },
|
filters: filters,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
dispatch_address_query: function (doc) {
|
dispatch_address_query: function (doc) {
|
||||||
var filters = { link_doctype: "Company", link_name: doc.company || "" };
|
let filters = { link_doctype: "Company", link_name: doc.company || "" };
|
||||||
var is_drop_ship = doc.items.some((item) => item.delivered_by_supplier);
|
const is_drop_ship = doc.items.some((item) => item.delivered_by_supplier);
|
||||||
if (is_drop_ship) filters = {};
|
if (is_drop_ship) filters = {};
|
||||||
return {
|
return {
|
||||||
query: "frappe.contacts.doctype.address.address.address_query",
|
query: "frappe.contacts.doctype.address.address.address_query",
|
||||||
|
|||||||
Reference in New Issue
Block a user