Skip to content

Commit

Permalink
Merge pull request #44639 from frappe/version-14-hotfix
Browse files Browse the repository at this point in the history
chore: release v14
  • Loading branch information
ruthra-kumar authored Dec 12, 2024
2 parents 7a2b07a + a460bf9 commit e092322
Show file tree
Hide file tree
Showing 23 changed files with 106 additions and 50 deletions.
19 changes: 12 additions & 7 deletions erpnext/accounts/doctype/bank_transaction/bank_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# For license information, please see license.txt

import frappe
from frappe import _
from frappe.model.docstatus import DocStatus
from frappe.utils import flt

Expand Down Expand Up @@ -156,13 +157,17 @@ def auto_set_party(self):
if self.party_type and self.party:
return

result = AutoMatchParty(
bank_party_account_number=self.bank_party_account_number,
bank_party_iban=self.bank_party_iban,
bank_party_name=self.bank_party_name,
description=self.description,
deposit=self.deposit,
).match()
result = None
try:
result = AutoMatchParty(
bank_party_account_number=self.bank_party_account_number,
bank_party_iban=self.bank_party_iban,
bank_party_name=self.bank_party_name,
description=self.description,
deposit=self.deposit,
).match()
except Exception:
frappe.log_error(title=_("Error in party matching for Bank Transaction {0}").format(self.name))

if result:
party_type, party = result
Expand Down
2 changes: 1 addition & 1 deletion erpnext/assets/doctype/asset/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ frappe.ui.form.on("Asset", {
}

frm.dashboard.render_graph({
title: "Asset Value",
title: __("Asset Value"),
data: {
labels: x_intervals,
datasets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def prepare_data(data, filters):


def prepare_chart_data(pending, completed):
labels = ["Amount to Bill", "Billed Amount"]
labels = [_("Amount to Bill"), _("Billed Amount")]

return {
"data": {"labels": labels, "datasets": [{"values": [pending, completed]}]},
Expand Down
2 changes: 1 addition & 1 deletion erpnext/manufacturing/doctype/bom/bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ frappe.ui.form.on("BOM", {
dialog.fields_dict.items.df.data.push({
item_code: d.item_code,
variant_item_code: "",
qty: d.qty,
qty: (d.qty / frm.doc.quantity) * (dialog.fields_dict.qty.value || 1),
source_warehouse: d.source_warehouse,
operation: d.operation,
});
Expand Down
18 changes: 18 additions & 0 deletions erpnext/manufacturing/doctype/bom/bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ def validate(self):
self.update_cost(update_parent=False, from_child_bom=True, update_hour_rate=False, save=False)
self.set_process_loss_qty()
self.validate_scrap_items()
self.set_default_uom()

def set_default_uom(self):
if not self.get("items"):
return

item_wise_uom = frappe._dict(
frappe.get_all(
"Item",
filters={"name": ("in", [item.item_code for item in self.items])},
fields=["name", "stock_uom"],
as_list=1,
)
)

for row in self.get("items"):
if row.stock_uom != item_wise_uom.get(row.item_code):
row.stock_uom = item_wise_uom.get(row.item_code)

def get_context(self, context):
context.parents = [{"name": "boms", "title": _("All BOMs")}]
Expand Down
20 changes: 20 additions & 0 deletions erpnext/manufacturing/doctype/bom/test_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,26 @@ def test_do_not_include_manufacturing_and_fixed_items(self):
self.assertTrue("_Test RM Item 2 Fixed Asset Item" not in items)
self.assertTrue("_Test RM Item 3 Manufacture Item" in items)

def test_bom_raw_materials_stock_uom(self):
rm_item = make_item(
properties={"is_stock_item": 1, "valuation_rate": 1000.0, "stock_uom": "Nos"}
).name
fg_item = make_item(properties={"is_stock_item": 1}).name

from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom

bom = make_bom(item=fg_item, raw_materials=[rm_item], do_not_submit=True)
for row in bom.items:
self.assertEqual(row.stock_uom, "Nos")

frappe.db.set_value("Item", rm_item, "stock_uom", "Kg")

bom.items[0].qty = 2
bom.save()

for row in bom.items:
self.assertEqual(row.stock_uom, "Kg")


def get_default_bom(item_code="_Test FG Item 2"):
return frappe.db.get_value("BOM", {"item": item_code, "is_active": 1, "is_default": 1})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ def get_chart_data(periodic_data, columns):
pending.append(periodic_data.get("Pending").get(d))
completed.append(periodic_data.get("Completed").get(d))

datasets.append({"name": "All Work Orders", "values": all_data})
datasets.append({"name": "Not Started", "values": not_start})
datasets.append({"name": "Overdue", "values": overdue})
datasets.append({"name": "Pending", "values": pending})
datasets.append({"name": "Completed", "values": completed})
datasets.append({"name": _("All Work Orders"), "values": all_data})
datasets.append({"name": _("Not Started"), "values": not_start})
datasets.append({"name": _("Overdue"), "values": overdue})
datasets.append({"name": _("Pending"), "values": pending})
datasets.append({"name": _("Completed"), "values": completed})

chart = {"data": {"labels": labels, "datasets": datasets}}
chart["type"] = "line"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_data(filters):


def get_chart_data(periodic_data, columns):
labels = ["Rejected", "Accepted"]
labels = [_("Rejected"), _("Accepted")]

status_wise_data = {"Accepted": 0, "Rejected": 0}

Expand All @@ -53,7 +53,7 @@ def get_chart_data(periodic_data, columns):

datasets.append(
{
"name": "Qty Wise Chart",
"name": _("Qty Wise Chart"),
"values": [status_wise_data.get("Rejected"), status_wise_data.get("Accepted")],
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def get_chart_data(data):
on_track = on_track + 1
charts = {
"data": {
"labels": ["On Track", "Delayed"],
"datasets": [{"name": "Delayed", "values": [on_track, delay]}],
"labels": [_("On Track"), _("Delayed")],
"datasets": [{"name": _("Delayed"), "values": [on_track, delay]}],
},
"type": "percentage",
"colors": ["#84D5BA", "#CB4B5F"],
Expand Down
8 changes: 4 additions & 4 deletions erpnext/selling/doctype/sales_order/sales_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ frappe.ui.form.on("Sales Order", {
target: frm,
setters: [
{
label: 'Supplier',
label: __('Supplier'),
fieldname: 'supplier',
fieldtype: 'Link',
options: 'Supplier'
Expand Down Expand Up @@ -376,7 +376,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
target: me.frm,
setters: [
{
label: "Customer",
label: __("Customer"),
fieldname: "party_name",
fieldtype: "Link",
options: "Customer",
Expand Down Expand Up @@ -430,7 +430,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
}
else {
const fields = [{
label: 'Items',
label: __('Items'),
fieldtype: 'Table',
fieldname: 'items',
description: __('Select BOM and Qty for Production'),
Expand Down Expand Up @@ -724,7 +724,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
"default": 0
},
{
fieldname: 'items_for_po', fieldtype: 'Table', label: 'Select Items',
fieldname: 'items_for_po', fieldtype: 'Table', label: __('Select Items'),
fields: [
{
fieldtype:'Data',
Expand Down
6 changes: 3 additions & 3 deletions erpnext/selling/page/point_of_sale/pos_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ erpnext.PointOfSale.Controller = class {
fieldname: "mode_of_payment",
fieldtype: "Link",
in_list_view: 1,
label: "Mode of Payment",
label: __("Mode of Payment"),
options: "Mode of Payment",
reqd: 1,
},
{
fieldname: "opening_amount",
fieldtype: "Currency",
in_list_view: 1,
label: "Opening Amount",
label: __("Opening Amount"),
options: "company:company_currency",
change: function () {
dialog.fields_dict.balance_details.df.data.some((d) => {
Expand Down Expand Up @@ -87,7 +87,7 @@ erpnext.PointOfSale.Controller = class {
{
fieldname: "balance_details",
fieldtype: "Table",
label: "Opening Balance Details",
label: __("Opening Balance Details"),
cannot_add_rows: false,
in_place_edit: true,
reqd: 1,
Expand Down
8 changes: 5 additions & 3 deletions erpnext/selling/page/point_of_sale/pos_item_cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -959,13 +959,15 @@ erpnext.PointOfSale.ItemCart = class {

if (!res.length) {
transaction_container.html(
`<div class="no-transactions-placeholder">No recent transactions found</div>`
`<div class="no-transactions-placeholder">${__("No recent transactions found")}</div>`
);
return;
}

const elapsed_time = moment(res[0].posting_date + " " + res[0].posting_time).fromNow();
this.$customer_section.find(".customer-desc").html(`Last transacted ${elapsed_time}`);
this.$customer_section
.find(".customer-desc")
.html(`${__("Last transacted")} ${__(elapsed_time)}`);

res.forEach((invoice) => {
const posting_datetime = moment(invoice.posting_date + " " + invoice.posting_time).format(
Expand All @@ -990,7 +992,7 @@ erpnext.PointOfSale.ItemCart = class {
</div>
<div class="invoice-status">
<span class="indicator-pill whitespace-nowrap ${indicator_color[invoice.status]}">
<span>${invoice.status}</span>
<span>${__(invoice.status)}</span>
</span>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions erpnext/selling/page/point_of_sale/pos_past_order_summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ erpnext.PointOfSale.PastOrderSummary = class {

init_email_print_dialog() {
const email_dialog = new frappe.ui.Dialog({
title: "Email Receipt",
title: __("Email Receipt"),
fields: [
{ fieldname: "email_id", fieldtype: "Data", options: "Email", label: "Email ID" },
// {fieldname:'remarks', fieldtype:'Text', label:'Remarks (if any)'}
Expand All @@ -59,7 +59,7 @@ erpnext.PointOfSale.PastOrderSummary = class {
this.email_dialog = email_dialog;

const print_dialog = new frappe.ui.Dialog({
title: "Print Receipt",
title: __("Print Receipt"),
fields: [{ fieldname: "print", fieldtype: "Data", label: "Print Preview" }],
primary_action: () => {
this.print_receipt();
Expand Down Expand Up @@ -112,7 +112,7 @@ erpnext.PointOfSale.PastOrderSummary = class {
get_discount_html(doc) {
if (doc.discount_amount) {
return `<div class="summary-row-wrapper">
<div>Discount (${doc.additional_discount_percentage} %)</div>
<div>${__("Discount")} (${doc.additional_discount_percentage} %)</div>
<div>${format_currency(doc.discount_amount, doc.currency)}</div>
</div>`;
} else {
Expand Down
2 changes: 1 addition & 1 deletion erpnext/selling/page/point_of_sale/pos_payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ erpnext.PointOfSale.Payment = class {
const remaining = grand_total - doc.paid_amount;
const change = doc.change_amount || remaining <= 0 ? -1 * remaining : undefined;
const currency = doc.currency;
const label = change ? __("Change") : __("To Be Paid");
const label = __("Change Amount");

this.$totals.html(
`<div class="col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ def prepare_chart(s_orders):
"labels": [term.payment_term for term in s_orders],
"datasets": [
{
"name": "Payment Amount",
"name": _("Payment Amount"),
"values": [x.base_payment_amount for x in s_orders],
},
{
"name": "Paid Amount",
"name": _("Paid Amount"),
"values": [x.paid_amount for x in s_orders],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def prepare_data(data, so_elapsed_time, filters):


def prepare_chart_data(pending, completed):
labels = ["Amount to Bill", "Billed Amount"]
labels = [_("Amount to Bill"), _("Billed Amount")]

return {
"data": {"labels": labels, "datasets": [{"values": [pending, completed]}]},
Expand Down
2 changes: 1 addition & 1 deletion erpnext/stock/doctype/delivery_note/delivery_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ def get_pending_qty(item_row):
automatically_fetch_payment_terms = cint(
frappe.db.get_single_value("Accounts Settings", "automatically_fetch_payment_terms")
)
if automatically_fetch_payment_terms:
if automatically_fetch_payment_terms and not doc.is_return:
doc.set_payment_schedule()

return doc
Expand Down
16 changes: 11 additions & 5 deletions erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,10 @@ def add_custom_fields(self):
dimension_fields = []
if self.apply_to_all_doctypes:
for doctype in get_inventory_documents():
if field_exists(doctype[0], self.source_fieldname):
continue

dimension_fields = self.get_dimension_fields(doctype[0])
self.add_transfer_field(doctype[0], dimension_fields)
custom_fields.setdefault(doctype[0], dimension_fields)
elif not field_exists(self.document_type, self.source_fieldname):
else:
dimension_fields = self.get_dimension_fields()

self.add_transfer_field(self.document_type, dimension_fields)
Expand All @@ -198,8 +195,17 @@ def add_custom_fields(self):
dimension_field["fieldname"] = self.target_fieldname
custom_fields["Stock Ledger Entry"] = dimension_field

filter_custom_fields = {}
if custom_fields:
create_custom_fields(custom_fields)
for doctype, fields in custom_fields.items():
if isinstance(fields, dict):
fields = [fields]

for field in fields:
if not field_exists(doctype, field["fieldname"]):
filter_custom_fields.setdefault(doctype, []).append(field)

create_custom_fields(filter_custom_fields)

def add_transfer_field(self, doctype, dimension_fields):
if doctype not in [
Expand Down
13 changes: 9 additions & 4 deletions erpnext/stock/doctype/material_request/material_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,16 @@ frappe.ui.form.on('Material Request', {
},
callback: function(r) {
const d = item;
const allow_to_change_fields = ['actual_qty', 'projected_qty', 'min_order_qty', 'item_name', 'description', 'stock_uom', 'uom', 'conversion_factor', 'stock_qty'];

if(!r.exc) {
$.each(r.message, function(key, value) {
if(!d[key] || allow_to_change_fields.includes(key)) {
let allow_to_change_fields = ['actual_qty', 'projected_qty', 'min_order_qty', 'item_name', 'description', 'stock_uom', 'uom', 'conversion_factor', 'stock_qty'];

if (overwrite_warehouse) {
allow_to_change_fields.push("description");
}

if (!r.exc) {
$.each(r.message, function (key, value) {
if (!d[key] || allow_to_change_fields.includes(key)) {
d[key] = value;
}
});
Expand Down
2 changes: 1 addition & 1 deletion erpnext/templates/includes/issue_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{% if doc.status == "Open" %}
{{ doc.priority }}
{% else %}
{{ doc.status }}
{{ _(doc.status) }}
{%- endif -%}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion erpnext/templates/includes/projects/project_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>
{% else %}
<span class="indicator-pill {{ " red" if doc.status=="Open" else "darkgrey" }}">
{{ doc.status }}</span>
{{ _(doc.status) }}</span>
{% endif %}
</div>
{% if doc["_assign"] %}
Expand Down
2 changes: 1 addition & 1 deletion erpnext/templates/includes/transaction_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
</div>
<div class="col-sm-3">
<span class="indicator-pill {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "gray") }} list-item-status">{{doc.status}}</span>
<span class="indicator-pill {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "gray") }} list-item-status">{{ _(doc.status) }}</span>
</div>
<div class="col-sm-2">
<div class="small text-muted items-preview ellipsis ellipsis-width">
Expand Down
Loading

0 comments on commit e092322

Please sign in to comment.