Merge pull request #33193 from rohitwaghchaure/clear-repost-logs
fix: clear repost logs using Log Settings
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index 5c1cb0d..1fa7e7f 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -40,7 +40,6 @@
"discount_amount",
"base_rate_with_margin",
"sec_break2",
- "apply_tds",
"rate",
"amount",
"item_tax_template",
@@ -50,6 +49,7 @@
"pricing_rules",
"stock_uom_rate",
"is_free_item",
+ "apply_tds",
"section_break_22",
"net_rate",
"net_amount",
@@ -871,16 +871,16 @@
"read_only": 1
},
{
- "default": "1",
- "fieldname": "apply_tds",
- "fieldtype": "Check",
- "label": "Apply TDS"
+ "default": "1",
+ "fieldname": "apply_tds",
+ "fieldtype": "Check",
+ "label": "Apply TDS"
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2022-10-26 16:05:37.304788",
+ "modified": "2022-11-29 13:01:20.438217",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",
diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py
index db3d5d4..c6aa21c 100644
--- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py
+++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py
@@ -14,9 +14,17 @@
filters.naming_series = frappe.db.get_single_value("Buying Settings", "supp_master_name")
columns = get_columns(filters)
- tds_docs, tds_accounts, tax_category_map, journal_entry_party_map = get_tds_docs(filters)
+ (
+ tds_docs,
+ tds_accounts,
+ tax_category_map,
+ journal_entry_party_map,
+ invoice_total_map,
+ ) = get_tds_docs(filters)
- res = get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map)
+ res = get_result(
+ filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map, invoice_total_map
+ )
final_result = group_by_supplier_and_category(res)
return columns, final_result
diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
index f2809a9..9883890 100644
--- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
+++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
@@ -8,11 +8,19 @@
def execute(filters=None):
validate_filters(filters)
- tds_docs, tds_accounts, tax_category_map, journal_entry_party_map = get_tds_docs(filters)
+ (
+ tds_docs,
+ tds_accounts,
+ tax_category_map,
+ journal_entry_party_map,
+ invoice_net_total_map,
+ ) = get_tds_docs(filters)
columns = get_columns(filters)
- res = get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map)
+ res = get_result(
+ filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map, invoice_net_total_map
+ )
return columns, res
@@ -22,7 +30,9 @@
frappe.throw(_("From Date must be before To Date"))
-def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map):
+def get_result(
+ filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map, invoice_net_total_map
+):
supplier_map = get_supplier_pan_map()
tax_rate_map = get_tax_rate_map(filters)
gle_map = get_gle_map(tds_docs)
@@ -50,7 +60,10 @@
if entry.account in tds_accounts:
tds_deducted += entry.credit - entry.debit
- total_amount_credited += entry.credit
+ if invoice_net_total_map.get(name):
+ total_amount_credited = invoice_net_total_map.get(name)
+ else:
+ total_amount_credited += entry.credit
if tds_deducted:
row = {
@@ -179,9 +192,10 @@
purchase_invoices = []
payment_entries = []
journal_entries = []
- tax_category_map = {}
- or_filters = {}
- journal_entry_party_map = {}
+ tax_category_map = frappe._dict()
+ invoice_net_total_map = frappe._dict()
+ or_filters = frappe._dict()
+ journal_entry_party_map = frappe._dict()
bank_accounts = frappe.get_all("Account", {"is_group": 0, "account_type": "Bank"}, pluck="name")
tds_accounts = frappe.get_all(
@@ -218,16 +232,22 @@
tds_documents.append(d.voucher_no)
if purchase_invoices:
- get_tax_category_map(purchase_invoices, "Purchase Invoice", tax_category_map)
+ get_doc_info(purchase_invoices, "Purchase Invoice", tax_category_map, invoice_net_total_map)
if payment_entries:
- get_tax_category_map(payment_entries, "Payment Entry", tax_category_map)
+ get_doc_info(payment_entries, "Payment Entry", tax_category_map)
if journal_entries:
journal_entry_party_map = get_journal_entry_party_map(journal_entries)
- get_tax_category_map(journal_entries, "Journal Entry", tax_category_map)
+ get_doc_info(journal_entries, "Journal Entry", tax_category_map)
- return tds_documents, tds_accounts, tax_category_map, journal_entry_party_map
+ return (
+ tds_documents,
+ tds_accounts,
+ tax_category_map,
+ journal_entry_party_map,
+ invoice_net_total_map,
+ )
def get_journal_entry_party_map(journal_entries):
@@ -244,17 +264,18 @@
return journal_entry_party_map
-def get_tax_category_map(vouchers, doctype, tax_category_map):
- tax_category_map.update(
- frappe._dict(
- frappe.get_all(
- doctype,
- filters={"name": ("in", vouchers)},
- fields=["name", "tax_withholding_category"],
- as_list=1,
- )
- )
- )
+def get_doc_info(vouchers, doctype, tax_category_map, invoice_net_total_map=None):
+ if doctype == "Purchase Invoice":
+ fields = ["name", "tax_withholding_category", "base_tax_withholding_net_total"]
+ else:
+ fields = ["name", "tax_withholding_category"]
+
+ entries = frappe.get_all(doctype, filters={"name": ("in", vouchers)}, fields=fields)
+
+ for entry in entries:
+ tax_category_map.update({entry.name: entry.tax_withholding_category})
+ if doctype == "Purchase Invoice":
+ invoice_net_total_map.update({entry.name: entry.base_tax_withholding_net_total})
def get_tax_rate_map(filters):
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/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index d471783..c645b04 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -44,7 +44,6 @@
"discount_amount",
"base_rate_with_margin",
"sec_break2",
- "apply_tds",
"rate",
"amount",
"item_tax_template",
@@ -54,6 +53,7 @@
"pricing_rules",
"stock_uom_rate",
"is_free_item",
+ "apply_tds",
"section_break_29",
"net_rate",
"net_amount",
@@ -902,7 +902,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2022-10-26 16:47:41.364387",
+ "modified": "2022-11-29 16:47:41.364387",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",
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/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.py b/erpnext/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.py
index d23a22a..dea3f2d 100644
--- a/erpnext/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.py
+++ b/erpnext/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.py
@@ -217,7 +217,7 @@
def check_for_assigned_to(self, period, value, count_or_amount, assigned_to, info):
if self.filters.get("assigned_to"):
- for data in json.loads(info.get("opportunity_owner")):
+ for data in json.loads(info.get("opportunity_owner") or "[]"):
if data == self.filters.get("assigned_to"):
self.set_formatted_data(period, data, count_or_amount, assigned_to)
else:
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(