Merge branch 'version-15-hotfix' into mergify/bp/version-15-hotfix/pr-41384

This commit is contained in:
mergify[bot]
2024-06-17 17:46:28 +00:00
committed by GitHub
163 changed files with 4016 additions and 1208 deletions

View File

@@ -2,6 +2,8 @@
# License: GNU General Public License v3. See license.txt
import json
import frappe
from frappe.test_runner import make_test_records
from frappe.tests.utils import FrappeTestCase
@@ -321,7 +323,7 @@ class TestCustomer(FrappeTestCase):
frappe.ValidationError,
update_child_qty_rate,
so.doctype,
frappe.json.dumps([modified_item]),
json.dumps([modified_item]),
so.name,
)

View File

@@ -9,5 +9,13 @@ frappe.ui.form.on("Product Bundle", {
query: "erpnext.selling.doctype.product_bundle.product_bundle.get_new_item_code",
};
});
frm.set_query("item_code", "items", () => {
return {
filters: {
has_variants: 0,
},
};
});
},
});

View File

@@ -903,6 +903,9 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
fields: fields,
primary_action: function () {
var data = { items: d.fields_dict.items.grid.get_selected_children() };
if (!data) {
frappe.throw(__("Please select items"));
}
me.frm.call({
method: "make_work_orders",
args: {

View File

@@ -1139,7 +1139,8 @@
"hide_seconds": 1,
"label": "Inter Company Order Reference",
"options": "Purchase Order",
"read_only": 1
"read_only": 1,
"search_index": 1
},
{
"fieldname": "project",
@@ -1645,7 +1646,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2024-03-29 16:27:41.539613",
"modified": "2024-05-23 16:35:54.905804",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",

View File

@@ -794,6 +794,11 @@ def get_requested_item_qty(sales_order):
def make_material_request(source_name, target_doc=None):
requested_item_qty = get_requested_item_qty(source_name)
def postprocess(source, target):
if source.tc_name and frappe.db.get_value("Terms and Conditions", source.tc_name, "buying") != 1:
target.tc_name = None
target.terms = None
def get_remaining_qty(so_item):
return flt(
flt(so_item.qty)
@@ -849,6 +854,7 @@ def make_material_request(source_name, target_doc=None):
},
},
target_doc,
postprocess,
)
return doc
@@ -1224,11 +1230,19 @@ def make_purchase_order_for_default_supplier(source_name, selected_items=None, t
target.discount_amount = 0.0
target.inter_company_order_reference = ""
target.shipping_rule = ""
target.tc_name = ""
target.terms = ""
target.payment_terms_template = ""
target.payment_schedule = []
default_price_list = frappe.get_value("Supplier", supplier, "default_price_list")
if default_price_list:
target.buying_price_list = default_price_list
default_payment_terms = frappe.get_value("Supplier", supplier, "payment_terms")
if default_payment_terms:
target.payment_terms_template = default_payment_terms
if any(item.delivered_by_supplier == 1 for item in source.items):
if source.shipping_address_name:
target.shipping_address = source.shipping_address_name
@@ -1280,7 +1294,6 @@ def make_purchase_order_for_default_supplier(source_name, selected_items=None, t
"contact_person",
"taxes_and_charges",
"shipping_address",
"terms",
],
"validation": {"docstatus": ["=", 1]},
},
@@ -1348,6 +1361,10 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
target.discount_amount = 0.0
target.inter_company_order_reference = ""
target.shipping_rule = ""
target.tc_name = ""
target.terms = ""
target.payment_terms_template = ""
target.payment_schedule = []
if is_drop_ship_order(target):
target.customer = source.customer
@@ -1383,7 +1400,6 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
"contact_person",
"taxes_and_charges",
"shipping_address",
"terms",
],
"validation": {"docstatus": ["=", 1]},
},

View File

@@ -684,7 +684,7 @@ erpnext.PointOfSale.Controller = class {
const is_stock_item = resp[1];
frappe.dom.unfreeze();
const bold_uom = item_row.stock_uom.bold();
const bold_uom = item_row.uom.bold();
const bold_item_code = item_row.item_code.bold();
const bold_warehouse = warehouse.bold();
const bold_available_qty = available_qty.toString().bold();

View File

@@ -857,7 +857,7 @@ erpnext.PointOfSale.ItemCart = class {
});
this.$customer_section.find(".customer-details").html(
`<div class="header">
<div class="label">Contact Details</div>
<div class="label">${__("Contact Details")}</div>
<div class="close-details-btn">
<svg width="32" height="32" viewBox="0 0 14 14" fill="none">
<path d="M4.93764 4.93759L7.00003 6.99998M9.06243 9.06238L7.00003 6.99998M7.00003 6.99998L4.93764 9.06238L9.06243 4.93759" stroke="#8D99A6"/>
@@ -877,7 +877,7 @@ erpnext.PointOfSale.ItemCart = class {
<div class="loyalty_program-field"></div>
<div class="loyalty_points-field"></div>
</div>
<div class="transactions-label">Recent Transactions</div>`
<div class="transactions-label">${__("Recent Transactions")}</div>`
);
// transactions need to be in diff div from sticky elem for scrolling
this.$customer_section.append(`<div class="customer-transactions"></div>`);

View File

@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
frappe.query_reports["Quotation Trends"] = {
filters: erpnext.get_sales_trends_filters(),
};
});
frappe.query_reports["Quotation Trends"] = $.extend({}, erpnext.sales_trends_filters);

View File

@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
frappe.query_reports["Sales Order Trends"] = {
filters: erpnext.get_sales_trends_filters(),
};
});
frappe.query_reports["Sales Order Trends"] = $.extend({}, erpnext.sales_trends_filters);

View File

@@ -164,9 +164,10 @@ def prepare_data(
rows = {}
target_qty_amt_field = "target_qty" if filters.get("target_on") == "Quantity" else "target_amount"
qty_or_amount_field = "stock_qty" if filters.get("target_on") == "Quantity" else "base_net_amount"
item_group_parent_child_map = get_item_group_parent_child_map()
for d in sales_users_data:
key = (d.parent, d.item_group)
dist_data = get_periodwise_distribution_data(d.distribution_id, period_list, filters.get("period"))
@@ -191,7 +192,11 @@ def prepare_data(
r.get(sales_field) == d.parent
and period.from_date <= r.get(date_field)
and r.get(date_field) <= period.to_date
and (not sales_user_wise_item_groups.get(d.parent) or r.item_group == d.item_group)
and (
not sales_user_wise_item_groups.get(d.parent)
or r.item_group == d.item_group
or r.item_group in item_group_parent_child_map.get(d.item_group, [])
)
):
details[p_key] += r.get(qty_or_amount_field, 0)
details[variance_key] = details.get(p_key) - details.get(target_key)
@@ -204,6 +209,25 @@ def prepare_data(
return rows
def get_item_group_parent_child_map():
"""
Returns a dict of all item group parents and leaf children associated with them.
"""
item_groups = frappe.get_all(
"Item Group", fields=["name", "parent_item_group"], order_by="lft desc, rgt desc"
)
item_group_parent_child_map = {}
for item_group in item_groups:
children = item_group_parent_child_map.get(item_group.name, [])
if not children:
children = [item_group.name]
item_group_parent_child_map.setdefault(item_group.parent_item_group, []).extend(children)
return item_group_parent_child_map
def get_actual_data(filters, sales_users_or_territory_data, date_field, sales_field):
fiscal_year = get_fiscal_year(fiscal_year=filters.get("fiscal_year"), as_dict=1)