Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v15 #43254

Merged
merged 59 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0d9741f
refactor: enable no-copy on Purchase Invoice status
ruthra-kumar Sep 11, 2024
aab91a2
Merge pull request #43169 from ruthra-kumar/no_copy_on_purchase_invoi…
ruthra-kumar Sep 11, 2024
1657a83
fix: typo with po_date when creating remarks
vorasmit Sep 12, 2024
28607f0
Merge pull request #43183 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 12, 2024
45ff8fa
fix: set party_type null when payment_type is changed to Internal Tra…
vishakhdesai Sep 11, 2024
4df38d3
Merge pull request #43186 from frappe/mergify/bp/version-15-hotfix/pr…
sagarvora Sep 12, 2024
5789de2
fix: delete exchange gain loss journal entry while deleting payment e…
Navin-S-R Sep 12, 2024
d618c9a
test: add unit test for deletion of gain loss jv while deleting payme…
Navin-S-R Sep 12, 2024
055e782
refactor(test): use test fixture on pricing rule test suite
ruthra-kumar Sep 12, 2024
7989bc2
Merge pull request #43204 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 13, 2024
b7e95bf
Merge pull request #43202 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 13, 2024
c1a6c56
fix: item list view in website (backport #43165) (#43207)
mergify[bot] Sep 13, 2024
61a42ea
fix: batch based item price not working (backport #43172) (#43206)
mergify[bot] Sep 13, 2024
ef6b172
fix: currency changing while making PO from Supplier Quotation (backp…
mergify[bot] Sep 13, 2024
f101a1c
fix(holiday-list): use same date format for same holiday error messag…
mergify[bot] Sep 14, 2024
f060534
feat: API for crm integration
nabinhait Sep 12, 2024
00f144e
Merge pull request #43223 from frappe/mergify/bp/version-15-hotfix/pr…
shariquerik Sep 14, 2024
984acb6
fix: prevent KeyError by checking `report_filter` existence
ljain112 Sep 13, 2024
d8d4cd2
fix(ux): set amount on foreign currency when foreign currency account…
venkat102 Sep 14, 2024
564ff03
Merge pull request #43232 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 16, 2024
2ad6d63
fix: revert 091c5496b20864577d133b0804e957ff8995606f
ljain112 Aug 20, 2024
11359bd
fix: tds workflow in purchase order
ljain112 Aug 23, 2024
5edebb2
fix: do not check appy_tds in Purchase Order Automatically
ljain112 Sep 3, 2024
01f3068
fix: consistent behaviour on refresh
ljain112 Sep 3, 2024
7027be8
fix: set tax_withholding_category from Purchase Order while creating …
ljain112 Sep 4, 2024
741c18b
fix: do not auto apply tds in purchase order
ljain112 Sep 10, 2024
a6a2b2d
Merge pull request #43237 from frappe/mergify/bp/version-15-hotfix/pr…
vorasmit Sep 16, 2024
42494db
fix: hide and reset discount control on new POS order
ljain112 Sep 11, 2024
30e9f08
Merge pull request #43241 from frappe/mergify/bp/version-15-hotfix/pr…
vorasmit Sep 16, 2024
d6a3d0d
fix: create and link address while creating prospect & customer
shariquerik Sep 16, 2024
48158fb
Merge pull request #43242 from frappe/mergify/bp/version-15-hotfix/pr…
shariquerik Sep 16, 2024
c505156
fix: do not validate purchase document for composite asset
khushi8112 Sep 16, 2024
f7cedac
fix(ux): set amount based on account currency while adding new row
Navin-S-R Sep 14, 2024
dea735d
fix: A project without tasks should be able to complete
lbrandh Aug 28, 2024
c9b6b0d
refactor(test): fix linter
ruthra-kumar Sep 16, 2024
bee27f3
Merge pull request #43230 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 17, 2024
53c4c15
Merge pull request #43245 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 17, 2024
9c4eaa2
Merge pull request #43246 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 17, 2024
291f0a5
fix: invalid gp calculation
rtdany10 Sep 12, 2024
44dde1c
Merge pull request #43243 from frappe/mergify/bp/version-15-hotfix/pr…
khushi8112 Sep 17, 2024
5fe347c
Merge pull request #43249 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 17, 2024
86e1818
fix: map rows on journal entry by validating account, party, debit an…
Navin-S-R Sep 14, 2024
310b131
test: reconcile payment jv from closed fiscal year
Navin-S-R Sep 14, 2024
d91013a
fix: ignore repost logic on Payment Reconciliation
ruthra-kumar Sep 17, 2024
861edb4
refactor(test): make use existing test data and dynamic fy creation
ruthra-kumar Sep 17, 2024
edcdfdd
refactor: update formatting changes
Navin-S-R Sep 17, 2024
78768f8
fix: create fiscal year without overlapping existing Fiscal Years
Navin-S-R Sep 17, 2024
f61cec2
Merge pull request #43259 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 17, 2024
78c6839
fix: updated filtering in depreciation and balances report
khushi8112 Sep 13, 2024
1e89c00
chore: resolved linter check with #nosemgrep
khushi8112 Sep 13, 2024
4ba37e4
chore: resolved failing check
khushi8112 Sep 13, 2024
8c28cb6
Merge pull request #43264 from frappe/mergify/bp/version-15-hotfix/pr…
khushi8112 Sep 17, 2024
0fe901a
fix: fetch cost center allocation percentage only from the applicable…
venkat102 Sep 13, 2024
52a161f
test: add unit test for validating multiple cost center allocation wi…
venkat102 Sep 13, 2024
3d29007
fix: cancel cost center allocation and journal entry after test
venkat102 Sep 13, 2024
dfe4726
Merge pull request #43266 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 18, 2024
782c9dd
fix: add currency in options for rate field in pricing rule
Yesha-Krishna Sep 16, 2024
82982e2
chore: resolve conflict
ruthra-kumar Sep 18, 2024
7aeadcb
Merge pull request #43268 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def setUp(self):
cost_centers = [
"Main Cost Center 1",
"Main Cost Center 2",
"Main Cost Center 3",
"Sub Cost Center 1",
"Sub Cost Center 2",
"Sub Cost Center 3",
]
for cc in cost_centers:
create_cost_center(cost_center_name=cc, company="_Test Company")
Expand All @@ -36,7 +38,7 @@ def test_gle_based_on_cost_center_allocation(self):
)

jv = make_journal_entry(
"_Test Cash - _TC", "Sales - _TC", 100, cost_center="Main Cost Center 1 - _TC", submit=True
"Cash - _TC", "Sales - _TC", 100, cost_center="Main Cost Center 1 - _TC", submit=True
)

expected_values = [["Sub Cost Center 1 - _TC", 0.0, 60], ["Sub Cost Center 2 - _TC", 0.0, 40]]
Expand Down Expand Up @@ -120,7 +122,7 @@ def test_total_percentage(self):
def test_valid_from_based_on_existing_gle(self):
# GLE posted against Sub Cost Center 1 on today
jv = make_journal_entry(
"_Test Cash - _TC",
"Cash - _TC",
"Sales - _TC",
100,
cost_center="Main Cost Center 1 - _TC",
Expand All @@ -141,6 +143,53 @@ def test_valid_from_based_on_existing_gle(self):

jv.cancel()

def test_multiple_cost_center_allocation_on_same_main_cost_center(self):
coa1 = create_cost_center_allocation(
"_Test Company",
"Main Cost Center 3 - _TC",
{"Sub Cost Center 1 - _TC": 30, "Sub Cost Center 2 - _TC": 30, "Sub Cost Center 3 - _TC": 40},
valid_from=add_days(today(), -5),
)

coa2 = create_cost_center_allocation(
"_Test Company",
"Main Cost Center 3 - _TC",
{"Sub Cost Center 1 - _TC": 50, "Sub Cost Center 2 - _TC": 50},
valid_from=add_days(today(), -1),
)

jv = make_journal_entry(
"Cash - _TC",
"Sales - _TC",
100,
cost_center="Main Cost Center 3 - _TC",
posting_date=today(),
submit=True,
)

expected_values = {"Sub Cost Center 1 - _TC": 50, "Sub Cost Center 2 - _TC": 50}

gle = frappe.qb.DocType("GL Entry")
gl_entries = (
frappe.qb.from_(gle)
.select(gle.cost_center, gle.debit, gle.credit)
.where(gle.voucher_type == "Journal Entry")
.where(gle.voucher_no == jv.name)
.where(gle.account == "Sales - _TC")
.orderby(gle.cost_center)
).run(as_dict=1)

self.assertTrue(gl_entries)

for gle in gl_entries:
self.assertTrue(gle.cost_center in expected_values)
self.assertEqual(gle.debit, 0)
self.assertEqual(gle.credit, expected_values[gle.cost_center])

coa1.cancel()
coa2.cancel()
jv.cancel()


def create_cost_center_allocation(
company,
Expand Down
29 changes: 27 additions & 2 deletions erpnext/accounts/doctype/journal_entry/journal_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,21 +360,23 @@ erpnext.accounts.JournalEntry = class JournalEntry extends frappe.ui.form.Contro

accounts_add(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
row.exchange_rate = 1;
$.each(doc.accounts, function (i, d) {
if (d.account && d.party && d.party_type) {
row.account = d.account;
row.party = d.party;
row.party_type = d.party_type;
row.exchange_rate = d.exchange_rate;
}
});

// set difference
if (doc.difference) {
if (doc.difference > 0) {
row.credit_in_account_currency = doc.difference;
row.credit_in_account_currency = doc.difference / row.exchange_rate;
row.credit = doc.difference;
} else {
row.debit_in_account_currency = -doc.difference;
row.debit_in_account_currency = -doc.difference / row.exchange_rate;
row.debit = -doc.difference;
}
}
Expand Down Expand Up @@ -680,11 +682,34 @@ $.extend(erpnext.journal_entry, {
callback: function (r) {
if (r.message) {
$.extend(d, r.message);
erpnext.journal_entry.set_amount_on_last_row(frm, dt, dn);
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, dt, dn);
refresh_field("accounts");
}
},
});
}
},
set_amount_on_last_row: function (frm, dt, dn) {
let row = locals[dt][dn];
let length = frm.doc.accounts.length;
if (row.idx != length) return;

let difference = frm.doc.accounts.reduce((total, row) => {
if (row.idx == length) return total;

return total + row.debit - row.credit;
}, 0);

if (difference) {
if (difference > 0) {
row.credit_in_account_currency = difference / row.exchange_rate;
row.credit = difference;
} else {
row.debit_in_account_currency = -difference / row.exchange_rate;
row.debit = -difference;
}
}
refresh_field("accounts");
},
});
5 changes: 5 additions & 0 deletions erpnext/accounts/doctype/journal_entry/journal_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ def on_submit(self):
self.update_booked_depreciation()

def on_update_after_submit(self):
# Flag will be set on Reconciliation
# Reconciliation tool will anyways repost ledger entries. So, no need to check and do implicit repost.
if self.flags.get("ignore_reposting_on_reconciliation"):
return

self.needs_repost = self.check_if_fields_updated(fields_to_check=[], child_tables={"accounts": []})
if self.needs_repost:
self.validate_for_repost()
Expand Down
10 changes: 9 additions & 1 deletion erpnext/accounts/doctype/payment_entry/payment_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,15 @@ frappe.ui.form.on("Payment Entry", {
payment_type: function (frm) {
if (frm.doc.payment_type == "Internal Transfer") {
$.each(
["party", "party_balance", "paid_from", "paid_to", "references", "total_allocated_amount"],
[
"party",
"party_type",
"party_balance",
"paid_from",
"paid_to",
"references",
"total_allocated_amount",
],
function (i, field) {
frm.set_value(field, null);
}
Expand Down
73 changes: 73 additions & 0 deletions erpnext/accounts/doctype/payment_entry/test_payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,79 @@ def test_opening_flag_for_advance_as_liability(self):
# 'Is Opening' should always be 'No' for normal advance payments
self.assertEqual(gl_with_opening_set, [])

@change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1})
def test_delete_linked_exchange_gain_loss_journal(self):
from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
make_customer,
)

debtors = create_account(
account_name="Debtors USD",
parent_account="Accounts Receivable - _TC",
company="_Test Company",
account_currency="USD",
account_type="Receivable",
)

# create a customer
customer = make_customer(customer="_Test Party USD")
cust_doc = frappe.get_doc("Customer", customer)
cust_doc.default_currency = "USD"
test_account_details = {
"company": "_Test Company",
"account": debtors,
}
cust_doc.append("accounts", test_account_details)
cust_doc.save()

# create a sales invoice
si = create_sales_invoice(
customer=customer,
currency="USD",
conversion_rate=83.970000000,
debit_to=debtors,
do_not_save=1,
)
si.party_account_currency = "USD"
si.save()
si.submit()

# create a payment entry for the invoice
pe = get_payment_entry("Sales Invoice", si.name)
pe.reference_no = "1"
pe.reference_date = frappe.utils.nowdate()
pe.paid_amount = 100
pe.source_exchange_rate = 90
pe.append(
"deductions",
{
"account": "_Test Exchange Gain/Loss - _TC",
"cost_center": "_Test Cost Center - _TC",
"amount": 2710,
},
)
pe.save()
pe.submit()

# check creation of journal entry
jv = frappe.get_all(
"Journal Entry Account",
{"reference_type": pe.doctype, "reference_name": pe.name, "docstatus": 1},
pluck="parent",
)
self.assertTrue(jv)

# check cancellation of payment entry and journal entry
pe.cancel()
self.assertTrue(pe.docstatus == 2)
self.assertTrue(frappe.db.get_value("Journal Entry", {"name": jv[0]}, "docstatus") == 2)

# check deletion of payment entry and journal entry
pe.delete()
self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, pe.doctype, pe.name)
self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, "Journal Entry", jv[0])


def create_payment_entry(**args):
payment_entry = frappe.new_doc("Payment Entry")
Expand Down
Loading
Loading