Merge pull request #33195 from ruthra-kumar/type_error_on_sales_pipeline_report
fix: type error on Sales Pipeline Analytics
diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py
index 136a033..2bec273 100644
--- a/erpnext/assets/doctype/asset/test_asset.py
+++ b/erpnext/assets/doctype/asset/test_asset.py
@@ -12,6 +12,7 @@
get_first_day,
get_last_day,
getdate,
+ is_last_day_of_the_month,
nowdate,
)
@@ -264,7 +265,7 @@
asset.gross_purchase_amount - asset.finance_books[0].value_after_depreciation,
asset.precision("gross_purchase_amount"),
)
- this_month_depr_amount = 9000.0 if get_last_day(date) == date else 0
+ this_month_depr_amount = 9000.0 if is_last_day_of_the_month(date) else 0
self.assertEquals(accumulated_depr_amount, 18000.0 + this_month_depr_amount)
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
index 31a4837..98c7dc9 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -22,6 +22,13 @@
}
};
}
+
+ frm.set_query('warehouse', 'items', () => ({
+ filters: {
+ company: frm.doc.company,
+ is_group: 0
+ }
+ }));
},
onload: function(frm) {
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index b7a80c1..5a051e3 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -2311,7 +2311,7 @@
elif term.due_date_based_on == "Day(s) after the end of the invoice month":
due_date = add_days(get_last_day(date), term.credit_days)
elif term.due_date_based_on == "Month(s) after the end of the invoice month":
- due_date = add_months(get_last_day(date), term.credit_months)
+ due_date = get_last_day(add_months(date, term.credit_months))
return due_date
@@ -2323,7 +2323,7 @@
elif term.discount_validity_based_on == "Day(s) after the end of the invoice month":
discount_validity = add_days(get_last_day(date), term.discount_validity)
elif term.discount_validity_based_on == "Month(s) after the end of the invoice month":
- discount_validity = add_months(get_last_day(date), term.discount_validity)
+ discount_validity = get_last_day(add_months(date, term.discount_validity))
return discount_validity
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 4c3e9dc..7481000 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -47,29 +47,36 @@
await this.calculate_shipping_charges();
- // Advance calculation applicable to Sales /Purchase Invoice
- if(in_list(["Sales Invoice", "POS Invoice", "Purchase Invoice"], this.frm.doc.doctype)
- && this.frm.doc.docstatus < 2 && !this.frm.doc.is_return) {
+ // Advance calculation applicable to Sales/Purchase Invoice
+ if (
+ in_list(["Sales Invoice", "POS Invoice", "Purchase Invoice"], this.frm.doc.doctype)
+ && this.frm.doc.docstatus < 2
+ && !this.frm.doc.is_return
+ ) {
this.calculate_total_advance(update_paid_amount);
}
- if (in_list(["Sales Invoice", "POS Invoice"], this.frm.doc.doctype) && this.frm.doc.is_pos &&
- this.frm.doc.is_return) {
- if (this.frm.doc.doctype == "Sales Invoice") {
- this.set_total_amount_to_default_mop();
- }
+ if (
+ in_list(["Sales Invoice", "POS Invoice"], this.frm.doc.doctype)
+ && this.frm.doc.s_pos
+ && this.frm.doc.is_return
+ ) {
+ this.set_total_amount_to_default_mop();
this.calculate_paid_amount();
}
// Sales person's commission
- if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) {
+ if (in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) {
this.calculate_commission();
this.calculate_contribution();
}
// Update paid amount on return/debit note creation
- if(this.frm.doc.doctype === "Purchase Invoice" && this.frm.doc.is_return
- && (this.frm.doc.grand_total > this.frm.doc.paid_amount)) {
+ if (
+ this.frm.doc.doctype === "Purchase Invoice"
+ && this.frm.doc.is_return
+ && (this.frm.doc.grand_total > this.frm.doc.paid_amount)
+ ) {
this.frm.doc.paid_amount = flt(this.frm.doc.grand_total, precision("grand_total"));
}
@@ -775,21 +782,30 @@
let grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total;
let base_grand_total = this.frm.doc.base_rounded_total || this.frm.doc.base_grand_total;
- if(this.frm.doc.party_account_currency == this.frm.doc.currency) {
- var total_amount_to_pay = flt((grand_total - this.frm.doc.total_advance
- - this.frm.doc.write_off_amount), precision("grand_total"));
+ if (this.frm.doc.party_account_currency == this.frm.doc.currency) {
+ var total_amount_to_pay = flt(
+ grand_total - this.frm.doc.total_advance - this.frm.doc.write_off_amount,
+ precision("grand_total")
+ );
} else {
var total_amount_to_pay = flt(
- (flt(base_grand_total, precision("base_grand_total"))
- - this.frm.doc.total_advance - this.frm.doc.base_write_off_amount),
+ (
+ flt(
+ base_grand_total,
+ precision("base_grand_total")
+ )
+ - this.frm.doc.total_advance - this.frm.doc.base_write_off_amount
+ ),
precision("base_grand_total")
);
}
+
this.frm.doc.payments.find(pay => {
if (pay.default) {
pay.amount = total_amount_to_pay;
}
});
+
this.frm.refresh_fields();
}
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 04aee42..afad751 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -596,7 +596,9 @@
if source.material_request_type == "Customer Provided":
target.purpose = "Material Receipt"
- target.set_missing_values()
+ target.set_transfer_qty()
+ target.set_actual_qty()
+ target.calculate_rate_and_amount(raise_error_if_no_rate=False)
target.set_stock_entry_type()
target.set_job_card_data()
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index b116735..83c280f 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -659,6 +659,13 @@
if d.allow_zero_valuation_rate:
d.basic_rate = 0.0
+ frappe.msgprint(
+ _(
+ "Row {0}: Item rate has been updated to zero as Allow Zero Valuation Rate is checked for item {1}"
+ ).format(d.idx, d.item_code),
+ alert=1,
+ )
+
elif d.is_finished_item:
if self.purpose == "Manufacture":
d.basic_rate = self.get_basic_rate_for_manufactured_item(