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 v14 #37545

Merged
merged 54 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8dd2694
refactor: for non-repost fields, don't validate
ruthra-kumar Oct 10, 2023
d37a181
refactor: add validation for Advances in SI/PI
ruthra-kumar Oct 11, 2023
f9b2355
fix: german tranlations of "Is Return"
barredterra Oct 9, 2023
f434548
Merge pull request #37465 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 12, 2023
020d2e2
Merge pull request #37464 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 12, 2023
bbdf26c
Merge pull request #37468 from frappe/mergify/bp/version-14-hotfix/pr…
sagarvora Oct 12, 2023
0590f21
fix: don't set finance books if gross_purchase_amount is not set (bac…
mergify[bot] Oct 12, 2023
cf0ab51
refactor(patch): ignore links on closing balance patch
ruthra-kumar Oct 12, 2023
c43d0b8
Merge pull request #37488 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 13, 2023
d2b22db
fix: use `flt` to ignore TypeError (#37481)
s-aga-r Oct 13, 2023
d266423
fix(gp): wrong `allocated_amount` on multi sales person invoice
rtdany10 Oct 10, 2023
6f143d3
fix: keyerror on gl and pl comparision report
ruthra-kumar Oct 13, 2023
cf9acd1
Merge pull request #37501 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 14, 2023
bae6c5b
Merge pull request #37500 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 14, 2023
9406ddb
fix: Stock Reconciliation Insufficient Stock Error (#37494)
s-aga-r Oct 14, 2023
f1814a1
fix: serial and batch no get removed on save of return DN (#37476)
s-aga-r Oct 15, 2023
405d152
test: use fixtures for sales and purchase invoice
ruthra-kumar Oct 2, 2023
9d6b434
refactor(test): unset accounts frozen date
ruthra-kumar Oct 2, 2023
485cb7d
refactor(test): use @change_settings in sales invoice
ruthra-kumar Oct 2, 2023
91a5bd8
refactor(test): fix broken test cases in Sales Invoice
ruthra-kumar Oct 2, 2023
5699a8d
refactor(test): use @change_settings to fix failing test cases
ruthra-kumar Oct 11, 2023
b97fdbe
refactor(test): use test fixture in subscription
ruthra-kumar Oct 15, 2023
33becb7
refactor(test): use test fixture in purchase invoice
ruthra-kumar Oct 15, 2023
d783168
refactor(test): make use of @change_settings in PI test cases
ruthra-kumar Oct 15, 2023
8d1eac8
refactor(test): make sure TDS Payable is available for testing
ruthra-kumar Oct 15, 2023
7f90353
chore: resovle conflicts
ruthra-kumar Oct 15, 2023
78e22af
fix: inflated total amt in TDS report using back calculation
ruthra-kumar Oct 15, 2023
77e7a6c
Merge pull request #37512 from ruthra-kumar/back_calculate_tds
ruthra-kumar Oct 15, 2023
d1f6d62
chore: fix flaky test case
ruthra-kumar Oct 15, 2023
65b7fb1
Merge pull request #37511 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 15, 2023
1b94510
fix: consider received qty while creating SO -> MR (backport #37414) …
mergify[bot] Oct 15, 2023
c32258e
fix: GL Entries not getting created for PR Return (backport #37513) (…
mergify[bot] Oct 15, 2023
44f7de0
fix: Incorrect vat amount in KSA VAT report
deepeshgarg007 Oct 16, 2023
001c230
perf: index `dn_detail` in `Delivery Note Item` (backport #37528) (#3…
mergify[bot] Oct 16, 2023
76ef61c
fix: keep customer/supplier website role by default
ankush Oct 16, 2023
d598dad
Merge pull request #37533 from frappe/mergify/bp/version-14-hotfix/pr…
ankush Oct 16, 2023
5b1016c
Merge pull request #37524 from deepeshgarg007/ksa_vat
deepeshgarg007 Oct 16, 2023
71cb7d3
refactor: checkbox to toggle exchange rate inheritence in PO->PI
ruthra-kumar Oct 3, 2023
4736105
Merge pull request #37540 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 17, 2023
5025850
fix: same Serial No get mapped while creating SO -> DN (#37527)
s-aga-r Oct 17, 2023
e23710b
fix(test): project test case (backport #37541) (#37543)
mergify[bot] Oct 17, 2023
bfa93cd
chore: Add accounting dimensions to Sales Order Item table
deepeshgarg007 Oct 17, 2023
7db6988
chore: resolve conflicts
deepeshgarg007 Oct 18, 2023
3499089
refactor: use account in key while grouping voucher in ar/ap report
ruthra-kumar Oct 17, 2023
760eab9
test: report output if party is missing
ruthra-kumar Oct 17, 2023
e2e8949
Merge pull request #37556 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 18, 2023
ac7d6d6
fix: billed_qty to show a sum of all invoiced qty from the purchase o…
mergify[bot] Oct 18, 2023
e8d0825
refactor: move `unreconcile` btn inside a drop down
ruthra-kumar Sep 15, 2023
54f672e
refactor: add `unreconcile` btn to purchase invoice
ruthra-kumar Sep 15, 2023
f6a550f
Merge pull request #37569 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Oct 18, 2023
837a6b5
Merge pull request #37555 from frappe/mergify/bp/version-14-hotfix/pr…
deepeshgarg007 Oct 18, 2023
022f85d
fix: e-commerce permissions for address (#37554)
mergify[bot] Oct 18, 2023
95abd79
fix: payment entry count on supplier dashboard (backport #37571) (#37…
mergify[bot] Oct 19, 2023
e1504ef
fix: Issues related to RFQ and Supplier Quotation on Portal (backport…
mergify[bot] Oct 19, 2023
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 @@ -37,6 +37,7 @@ def make_closing_entries(closing_entries, voucher_name, company, closing_date):
}
)
cle.flags.ignore_permissions = True
cle.flags.ignore_links = True
cle.submit()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,30 @@ def get_dimensions(with_cost_center_and_project=False):
default_dimensions_map[dimension.company][dimension.fieldname] = dimension.default_dimension

return dimension_filters, default_dimensions_map


def create_accounting_dimensions_for_doctype(doctype):
accounting_dimensions = frappe.db.get_all(
"Accounting Dimension", fields=["fieldname", "label", "document_type", "disabled"]
)

if not accounting_dimensions:
return

for d in accounting_dimensions:
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": d.fieldname})

if field:
continue

df = {
"fieldname": d.fieldname,
"label": d.label,
"fieldtype": "Link",
"options": d.document_type,
"insert_after": "accounting_dimensions_section",
}

create_custom_field(doctype, df, ignore_validate=True)

frappe.clear_cache(doctype=doctype)
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
}

this.frm.set_df_property("tax_withholding_category", "hidden", doc.apply_tds ? 0 : 1);
erpnext.accounts.unreconcile_payments.add_unreconcile_btn(me.frm);
}

unblock_invoice() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"currency_and_price_list",
"currency",
"conversion_rate",
"use_transaction_date_exchange_rate",
"column_break2",
"buying_price_list",
"price_list_currency",
Expand Down Expand Up @@ -1578,13 +1579,20 @@
"label": "Repost Required",
"options": "Account",
"read_only": 1
},
{
"default": "0",
"fieldname": "use_transaction_date_exchange_rate",
"fieldtype": "Check",
"label": "Use Transaction Date Exchange Rate",
"read_only": 1
}
],
"icon": "fa fa-file-text",
"idx": 204,
"is_submittable": 1,
"links": [],
"modified": "2023-10-01 21:01:47.282533",
"modified": "2023-10-16 16:24:51.886231",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,9 @@ def on_update_after_submit(self):
]
child_tables = {"items": ("expense_account",), "taxes": ("account_head",)}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)
if self.needs_repost:
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)

def make_gl_entries(self, gl_entries=None, from_repost=False):
if not gl_entries:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import unittest

import frappe
from frappe.tests.utils import change_settings
from frappe.tests.utils import FrappeTestCase, change_settings
from frappe.utils import add_days, cint, flt, getdate, nowdate, today

import erpnext
Expand Down Expand Up @@ -33,7 +33,7 @@
test_ignore = ["Serial No"]


class TestPurchaseInvoice(unittest.TestCase, StockTestMixin):
class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
@classmethod
def setUpClass(self):
unlink_payment_on_cancel_of_invoice()
Expand All @@ -43,6 +43,9 @@ def setUpClass(self):
def tearDownClass(self):
unlink_payment_on_cancel_of_invoice(0)

def tearDown(self):
frappe.db.rollback()

def test_purchase_invoice_received_qty(self):
"""
1. Test if received qty is validated against accepted + rejected
Expand Down Expand Up @@ -417,6 +420,7 @@ def test_purchase_invoice_calculation(self):
self.assertEqual(tax.tax_amount, expected_values[i][1])
self.assertEqual(tax.total, expected_values[i][2])

@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_purchase_invoice_with_advance(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
test_records as jv_test_records,
Expand Down Expand Up @@ -471,6 +475,7 @@ def test_purchase_invoice_with_advance(self):
)
)

@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_invoice_with_advance_and_multi_payment_terms(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
test_records as jv_test_records,
Expand Down Expand Up @@ -1209,6 +1214,7 @@ def test_deferred_expense_via_journal_entry(self):
acc_settings.submit_journal_entriessubmit_journal_entries = 0
acc_settings.save()

@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_gain_loss_with_advance_entry(self):
unlink_enabled = frappe.db.get_value(
"Accounts Settings", "Accounts Settings", "unlink_payment_on_cancel_of_invoice"
Expand Down Expand Up @@ -1411,6 +1417,7 @@ def test_gain_loss_with_advance_entry(self):
)
frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account)

@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_purchase_invoice_advance_taxes(self):
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry

Expand Down
5 changes: 3 additions & 2 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,9 @@ def on_update_after_submit(self):
"taxes": ("account_head",),
}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)
if self.needs_repost:
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)

def set_paid_amount(self):
paid_amount = 0.0
Expand Down
40 changes: 23 additions & 17 deletions erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import frappe
from frappe.model.dynamic_links import get_dynamic_link_map
from frappe.model.naming import make_autoname
from frappe.tests.utils import change_settings
from frappe.tests.utils import FrappeTestCase, change_settings
from frappe.utils import add_days, flt, getdate, nowdate, today

import erpnext
Expand Down Expand Up @@ -38,13 +38,17 @@
from erpnext.stock.utils import get_incoming_rate, get_stock_balance


class TestSalesInvoice(unittest.TestCase):
class TestSalesInvoice(FrappeTestCase):
def setUp(self):
from erpnext.stock.doctype.stock_ledger_entry.test_stock_ledger_entry import create_items

create_items(["_Test Internal Transfer Item"], uoms=[{"uom": "Box", "conversion_factor": 10}])
create_internal_parties()
setup_accounts()
frappe.db.set_single_value("Accounts Settings", "acc_frozen_upto", None)

def tearDown(self):
frappe.db.rollback()

def make(self):
w = frappe.copy_doc(test_records[0])
Expand Down Expand Up @@ -172,6 +176,7 @@ def test_payment_entry_unlink_against_invoice(self):
self.assertRaises(frappe.LinkExistsError, si.cancel)
unlink_payment_on_cancel_of_invoice()

@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_payment_entry_unlink_against_standalone_credit_note(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry

Expand Down Expand Up @@ -1293,6 +1298,7 @@ def _insert_delivery_note(self):
dn.submit()
return dn

@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_sales_invoice_with_advance(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
test_records as jv_test_records,
Expand Down Expand Up @@ -2774,6 +2780,13 @@ def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(
company="_Test Company",
)

tds_payable_account = create_account(
account_name="TDS Payable",
account_type="Tax",
parent_account="Duties and Taxes - _TC",
company="_Test Company",
)

si = create_sales_invoice(parent_cost_center="Main - _TC", do_not_save=1)
si.apply_discount_on = "Grand Total"
si.additional_discount_account = additional_discount_account
Expand Down Expand Up @@ -3072,8 +3085,8 @@ def test_sales_commission(self):
si.commission_rate = commission_rate
self.assertRaises(frappe.ValidationError, si.save)

@change_settings("Accounts Settings", {"acc_frozen_upto": add_days(getdate(), 1)})
def test_sales_invoice_submission_post_account_freezing_date(self):
frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", add_days(getdate(), 1))
si = create_sales_invoice(do_not_save=True)
si.posting_date = add_days(getdate(), 1)
si.save()
Expand All @@ -3082,8 +3095,6 @@ def test_sales_invoice_submission_post_account_freezing_date(self):
si.posting_date = getdate()
si.submit()

frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", None)

def test_over_billing_case_against_delivery_note(self):
"""
Test a case where duplicating the item with qty = 1 in the invoice
Expand Down Expand Up @@ -3112,18 +3123,20 @@ def test_over_billing_case_against_delivery_note(self):

frappe.db.set_value("Accounts Settings", None, "over_billing_allowance", over_billing_allowance)

@change_settings(
"Accounts Settings",
{
"book_deferred_entries_via_journal_entry": 1,
"submit_journal_entries": 1,
},
)
def test_multi_currency_deferred_revenue_via_journal_entry(self):
deferred_account = create_account(
account_name="Deferred Revenue",
parent_account="Current Liabilities - _TC",
company="_Test Company",
)

acc_settings = frappe.get_single("Accounts Settings")
acc_settings.book_deferred_entries_via_journal_entry = 1
acc_settings.submit_journal_entries = 1
acc_settings.save()

item = create_item("_Test Item for Deferred Accounting")
item.enable_deferred_expense = 1
item.item_defaults[0].deferred_revenue_account = deferred_account
Expand Down Expand Up @@ -3189,13 +3202,6 @@ def test_multi_currency_deferred_revenue_via_journal_entry(self):
self.assertEqual(expected_gle[i][2], gle.debit)
self.assertEqual(getdate(expected_gle[i][3]), gle.posting_date)

acc_settings = frappe.get_single("Accounts Settings")
acc_settings.book_deferred_entries_via_journal_entry = 0
acc_settings.submit_journal_entries = 0
acc_settings.save()

frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", None)

def test_standalone_serial_no_return(self):
si = create_sales_invoice(
item_code="_Test Serialized Item With Series", update_stock=True, is_return=True, qty=-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import unittest

import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.utils.data import (
add_days,
add_months,
Expand Down Expand Up @@ -90,10 +91,14 @@ def create_parties():
customer.insert()


class TestSubscription(unittest.TestCase):
class TestSubscription(FrappeTestCase):
def setUp(self):
create_plan()
create_parties()
frappe.db.set_single_value("Accounts Settings", "acc_frozen_upto", None)

def tearDown(self):
frappe.db.rollback()

def test_create_subscription_with_trial_with_correct_period(self):
subscription = frappe.new_doc("Subscription")
Expand Down
Loading
Loading