mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 13:49:13 +00:00
Merge branch 'version-14-hotfix' into mergify/bp/version-14-hotfix/pr-32226
This commit is contained in:
@@ -239,14 +239,14 @@ class POSInvoice(SalesInvoice):
|
|||||||
frappe.bold(d.warehouse),
|
frappe.bold(d.warehouse),
|
||||||
frappe.bold(d.qty),
|
frappe.bold(d.qty),
|
||||||
)
|
)
|
||||||
if flt(available_stock) <= 0:
|
if is_stock_item and flt(available_stock) <= 0:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Row #{}: Item Code: {} is not available under warehouse {}.").format(
|
_("Row #{}: Item Code: {} is not available under warehouse {}.").format(
|
||||||
d.idx, item_code, warehouse
|
d.idx, item_code, warehouse
|
||||||
),
|
),
|
||||||
title=_("Item Unavailable"),
|
title=_("Item Unavailable"),
|
||||||
)
|
)
|
||||||
elif flt(available_stock) < flt(d.qty):
|
elif is_stock_item and flt(available_stock) < flt(d.qty):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}."
|
"Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}."
|
||||||
@@ -632,11 +632,12 @@ def get_stock_availability(item_code, warehouse):
|
|||||||
pos_sales_qty = get_pos_reserved_qty(item_code, warehouse)
|
pos_sales_qty = get_pos_reserved_qty(item_code, warehouse)
|
||||||
return bin_qty - pos_sales_qty, is_stock_item
|
return bin_qty - pos_sales_qty, is_stock_item
|
||||||
else:
|
else:
|
||||||
is_stock_item = False
|
is_stock_item = True
|
||||||
if frappe.db.exists("Product Bundle", item_code):
|
if frappe.db.exists("Product Bundle", item_code):
|
||||||
return get_bundle_availability(item_code, warehouse), is_stock_item
|
return get_bundle_availability(item_code, warehouse), is_stock_item
|
||||||
else:
|
else:
|
||||||
# Is a service item
|
is_stock_item = False
|
||||||
|
# Is a service item or non_stock item
|
||||||
return 0, is_stock_item
|
return 0, is_stock_item
|
||||||
|
|
||||||
|
|
||||||
@@ -650,7 +651,9 @@ def get_bundle_availability(bundle_item_code, warehouse):
|
|||||||
available_qty = item_bin_qty - item_pos_reserved_qty
|
available_qty = item_bin_qty - item_pos_reserved_qty
|
||||||
|
|
||||||
max_available_bundles = available_qty / item.qty
|
max_available_bundles = available_qty / item.qty
|
||||||
if bundle_bin_qty > max_available_bundles:
|
if bundle_bin_qty > max_available_bundles and frappe.get_value(
|
||||||
|
"Item", item.item_code, "is_stock_item"
|
||||||
|
):
|
||||||
bundle_bin_qty = max_available_bundles
|
bundle_bin_qty = max_available_bundles
|
||||||
|
|
||||||
pos_sales_qty = get_pos_reserved_qty(bundle_item_code, warehouse)
|
pos_sales_qty = get_pos_reserved_qty(bundle_item_code, warehouse)
|
||||||
|
|||||||
@@ -841,7 +841,7 @@ def make_rm_stock_entry(
|
|||||||
for fg_item_code in fg_item_code_list:
|
for fg_item_code in fg_item_code_list:
|
||||||
for rm_item in rm_items:
|
for rm_item in rm_items:
|
||||||
|
|
||||||
if rm_item.get("main_item_code") or rm_item.get("item_code") == fg_item_code:
|
if rm_item.get("main_item_code") == fg_item_code or rm_item.get("item_code") == fg_item_code:
|
||||||
rm_item_code = rm_item.get("rm_item_code")
|
rm_item_code = rm_item.get("rm_item_code")
|
||||||
|
|
||||||
items_dict = {
|
items_dict = {
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ def execute():
|
|||||||
"mode_of_payment": loan.mode_of_payment,
|
"mode_of_payment": loan.mode_of_payment,
|
||||||
"loan_account": loan.loan_account,
|
"loan_account": loan.loan_account,
|
||||||
"payment_account": loan.payment_account,
|
"payment_account": loan.payment_account,
|
||||||
|
"disbursement_account": loan.payment_account,
|
||||||
"interest_income_account": loan.interest_income_account,
|
"interest_income_account": loan.interest_income_account,
|
||||||
"penalty_income_account": loan.penalty_income_account,
|
"penalty_income_account": loan.penalty_income_account,
|
||||||
},
|
},
|
||||||
@@ -190,6 +191,7 @@ def create_loan_type(loan, loan_type_name, penalty_account):
|
|||||||
loan_type_doc.company = loan.company
|
loan_type_doc.company = loan.company
|
||||||
loan_type_doc.mode_of_payment = loan.mode_of_payment
|
loan_type_doc.mode_of_payment = loan.mode_of_payment
|
||||||
loan_type_doc.payment_account = loan.payment_account
|
loan_type_doc.payment_account = loan.payment_account
|
||||||
|
loan_type_doc.disbursement_account = loan.payment_account
|
||||||
loan_type_doc.loan_account = loan.loan_account
|
loan_type_doc.loan_account = loan.loan_account
|
||||||
loan_type_doc.interest_income_account = loan.interest_income_account
|
loan_type_doc.interest_income_account = loan.interest_income_account
|
||||||
loan_type_doc.penalty_income_account = penalty_account
|
loan_type_doc.penalty_income_account = penalty_account
|
||||||
|
|||||||
@@ -660,7 +660,7 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (available_qty < qty_needed) {
|
} else if (is_stock_item && available_qty < qty_needed) {
|
||||||
frappe.throw({
|
frappe.throw({
|
||||||
message: __('Stock quantity not enough for Item Code: {0} under warehouse {1}. Available quantity {2}.', [bold_item_code, bold_warehouse, bold_available_qty]),
|
message: __('Stock quantity not enough for Item Code: {0} under warehouse {1}. Available quantity {2}.', [bold_item_code, bold_warehouse, bold_available_qty]),
|
||||||
indicator: 'orange'
|
indicator: 'orange'
|
||||||
@@ -694,7 +694,7 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
callback(res) {
|
callback(res) {
|
||||||
if (!me.item_stock_map[item_code])
|
if (!me.item_stock_map[item_code])
|
||||||
me.item_stock_map[item_code] = {};
|
me.item_stock_map[item_code] = {};
|
||||||
me.item_stock_map[item_code][warehouse] = res.message[0];
|
me.item_stock_map[item_code][warehouse] = res.message;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,13 +242,14 @@ erpnext.PointOfSale.ItemDetails = class {
|
|||||||
if (this.value) {
|
if (this.value) {
|
||||||
me.events.form_updated(me.current_item, 'warehouse', this.value).then(() => {
|
me.events.form_updated(me.current_item, 'warehouse', this.value).then(() => {
|
||||||
me.item_stock_map = me.events.get_item_stock_map();
|
me.item_stock_map = me.events.get_item_stock_map();
|
||||||
const available_qty = me.item_stock_map[me.item_row.item_code] && me.item_stock_map[me.item_row.item_code][this.value];
|
const available_qty = me.item_stock_map[me.item_row.item_code][this.value][0];
|
||||||
|
const is_stock_item = Boolean(me.item_stock_map[me.item_row.item_code][this.value][1]);
|
||||||
if (available_qty === undefined) {
|
if (available_qty === undefined) {
|
||||||
me.events.get_available_stock(me.item_row.item_code, this.value).then(() => {
|
me.events.get_available_stock(me.item_row.item_code, this.value).then(() => {
|
||||||
// item stock map is updated now reset warehouse
|
// item stock map is updated now reset warehouse
|
||||||
me.warehouse_control.set_value(this.value);
|
me.warehouse_control.set_value(this.value);
|
||||||
})
|
})
|
||||||
} else if (available_qty === 0) {
|
} else if (available_qty === 0 && is_stock_item) {
|
||||||
me.warehouse_control.set_value('');
|
me.warehouse_control.set_value('');
|
||||||
const bold_item_code = me.item_row.item_code.bold();
|
const bold_item_code = me.item_row.item_code.bold();
|
||||||
const bold_warehouse = this.value.bold();
|
const bold_warehouse = this.value.bold();
|
||||||
|
|||||||
Reference in New Issue
Block a user