Skip to content

Commit

Permalink
Merge pull request #30694 from frappe/version-13-pre-release
Browse files Browse the repository at this point in the history
chore: Release for v13.26.0
  • Loading branch information
deepeshgarg007 authored Apr 12, 2022
2 parents 71f7245 + 08e2b91 commit 2c2d5cc
Show file tree
Hide file tree
Showing 47 changed files with 671 additions and 170 deletions.
3 changes: 1 addition & 2 deletions erpnext/accounts/deferred_revenue.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ def _book_deferred_revenue_or_expense(
doc,
credit_account,
debit_account,
against,
amount,
base_amount,
end_date,
Expand Down Expand Up @@ -570,7 +569,6 @@ def book_revenue_via_journal_entry(
doc,
credit_account,
debit_account,
against,
amount,
base_amount,
posting_date,
Expand All @@ -591,6 +589,7 @@ def book_revenue_via_journal_entry(
journal_entry.voucher_type = (
"Deferred Revenue" if doc.doctype == "Sales Invoice" else "Deferred Expense"
)
journal_entry.process_deferred_accounting = deferred_process

debit_entry = {
"account": credit_account,
Expand Down
10 changes: 9 additions & 1 deletion erpnext/accounts/doctype/gst_account/gst_account.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"sgst_account",
"igst_account",
"cess_account",
"utgst_account",
"is_reverse_charge_account"
],
"fields": [
Expand Down Expand Up @@ -64,12 +65,18 @@
"fieldtype": "Check",
"in_list_view": 1,
"label": "Is Reverse Charge Account"
},
{
"fieldname": "utgst_account",
"fieldtype": "Link",
"label": "UTGST Account",
"options": "Account"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-04-09 12:30:25.889993",
"modified": "2022-04-07 12:59:14.039768",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GST Account",
Expand All @@ -78,5 +85,6 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
13 changes: 11 additions & 2 deletions erpnext/accounts/doctype/journal_entry/journal_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"allow_auto_repeat": 1,
"allow_import": 1,
"autoname": "naming_series:",
"creation": "2013-03-25 10:53:52",
"creation": "2022-01-25 10:29:58.717206",
"doctype": "DocType",
"document_type": "Document",
"engine": "InnoDB",
Expand All @@ -13,6 +13,7 @@
"voucher_type",
"naming_series",
"finance_book",
"process_deferred_accounting",
"reversal_of",
"tax_withholding_category",
"column_break1",
Expand Down Expand Up @@ -524,13 +525,20 @@
"label": "Reversal Of",
"options": "Journal Entry",
"read_only": 1
},
{
"fieldname": "process_deferred_accounting",
"fieldtype": "Link",
"label": "Process Deferred Accounting",
"options": "Process Deferred Accounting",
"read_only": 1
}
],
"icon": "fa fa-file-text",
"idx": 176,
"is_submittable": 1,
"links": [],
"modified": "2022-01-04 13:39:36.485954",
"modified": "2022-04-06 17:18:46.865259",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry",
Expand Down Expand Up @@ -578,6 +586,7 @@
"search_fields": "voucher_type,posting_date, due_date, cheque_no",
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "title",
"track_changes": 1
}
5 changes: 1 addition & 4 deletions erpnext/accounts/doctype/payment_entry/payment_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,7 @@ frappe.ui.form.on('Payment Entry', {
(frm.doc.total_allocated_amount > party_amount)));

frm.toggle_display("set_exchange_gain_loss",
(frm.doc.paid_amount && frm.doc.received_amount && frm.doc.difference_amount &&
((frm.doc.paid_from_account_currency != company_currency ||
frm.doc.paid_to_account_currency != company_currency) &&
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency)));
frm.doc.paid_amount && frm.doc.received_amount && frm.doc.difference_amount);

frm.refresh_fields();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
convert_deferred_expense_to_expense,
convert_deferred_revenue_to_income,
)
from erpnext.accounts.general_ledger import make_reverse_gl_entries
from erpnext.accounts.general_ledger import make_gl_entries


class ProcessDeferredAccounting(Document):
Expand All @@ -34,4 +34,4 @@ def on_cancel(self):
filters={"against_voucher_type": self.doctype, "against_voucher": self.name},
)

make_reverse_gl_entries(gl_entries=gl_entries)
make_gl_entries(gl_entries=gl_entries, cancel=1)
10 changes: 9 additions & 1 deletion erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2270,6 +2270,14 @@ def test_deferred_revenue(self):

check_gl_entries(self, si.name, expected_gle, "2019-01-30")

def test_deferred_revenue_missing_account(self):
si = create_sales_invoice(posting_date="2019-01-10", do_not_submit=True)
si.items[0].enable_deferred_revenue = 1
si.items[0].service_start_date = "2019-01-10"
si.items[0].service_end_date = "2019-03-15"

self.assertRaises(frappe.ValidationError, si.save)

def test_fixed_deferred_revenue(self):
deferred_account = create_account(
account_name="Deferred Revenue",
Expand Down Expand Up @@ -3042,7 +3050,7 @@ def test_multi_currency_deferred_revenue_via_journal_entry(self):

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

frappe.db.set_value("Accounts Settings", None, "acc_frozen_upto", None)
Expand Down
16 changes: 16 additions & 0 deletions erpnext/accounts/report/accounts_payable/accounts_payable.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ frappe.query_reports["Accounts Payable"] = {
}
}
},
{
"fieldname": "party_account",
"label": __("Payable Account"),
"fieldtype": "Link",
"options": "Account",
get_query: () => {
var company = frappe.query_report.get_filter_value('company');
return {
filters: {
'company': company,
'account_type': 'Payable',
'is_group': 0
}
};
}
},
{
"fieldname": "ageing_based_on",
"label": __("Ageing Based On"),
Expand Down
16 changes: 16 additions & 0 deletions erpnext/accounts/report/accounts_receivable/accounts_receivable.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ frappe.query_reports["Accounts Receivable"] = {
}
}
},
{
"fieldname": "party_account",
"label": __("Receivable Account"),
"fieldtype": "Link",
"options": "Account",
get_query: () => {
var company = frappe.query_report.get_filter_value('company');
return {
filters: {
'company': company,
'account_type': 'Receivable',
'is_group': 0
}
};
}
},
{
"fieldname": "ageing_based_on",
"label": __("Ageing Based On"),
Expand Down
36 changes: 24 additions & 12 deletions erpnext/accounts/report/accounts_receivable/accounts_receivable.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def init_voucher_balance(self):
voucher_type=gle.voucher_type,
voucher_no=gle.voucher_no,
party=gle.party,
party_account=gle.account,
posting_date=gle.posting_date,
account_currency=gle.account_currency,
remarks=gle.remarks if self.filters.get("show_remarks") else None,
Expand Down Expand Up @@ -777,18 +778,21 @@ def add_common_filters(self, conditions, values, party_type_field):
conditions.append("party=%s")
values.append(self.filters.get(party_type_field))

# get GL with "receivable" or "payable" account_type
account_type = "Receivable" if self.party_type == "Customer" else "Payable"
accounts = [
d.name
for d in frappe.get_all(
"Account", filters={"account_type": account_type, "company": self.filters.company}
)
]

if accounts:
conditions.append("account in (%s)" % ",".join(["%s"] * len(accounts)))
values += accounts
if self.filters.party_account:
conditions.append("account =%s")
values.append(self.filters.party_account)
else:
# get GL with "receivable" or "payable" account_type
account_type = "Receivable" if self.party_type == "Customer" else "Payable"
accounts = [
d.name
for d in frappe.get_all(
"Account", filters={"account_type": account_type, "company": self.filters.company}
)
]
if accounts:
conditions.append("account in (%s)" % ",".join(["%s"] * len(accounts)))
values += accounts

def add_customer_filters(self, conditions, values):
if self.filters.get("customer_group"):
Expand Down Expand Up @@ -889,6 +893,14 @@ def get_columns(self):
width=180,
)

self.add_column(
label="Receivable Account" if self.party_type == "Customer" else "Payable Account",
fieldname="party_account",
fieldtype="Link",
options="Account",
width=180,
)

if self.party_naming_by == "Naming Series":
self.add_column(
_("{0} Name").format(self.party_type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,19 @@ def test_accounts_receivable(self):
make_credit_note(name)
report = execute(filters)

expected_data_after_credit_note = [100, 0, 0, 40, -40]
expected_data_after_credit_note = [100, 0, 0, 40, -40, "Debtors - _TC2"]

row = report[1][0]
self.assertEqual(
expected_data_after_credit_note,
[row.invoice_grand_total, row.invoiced, row.paid, row.credit_note, row.outstanding],
[
row.invoice_grand_total,
row.invoiced,
row.paid,
row.credit_note,
row.outstanding,
row.party_account,
],
)


Expand Down
18 changes: 9 additions & 9 deletions erpnext/accounts/report/purchase_register/purchase_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ def get_columns(invoice_list, additional_table_columns):
_("Purchase Receipt") + ":Link/Purchase Receipt:100",
{"fieldname": "currency", "label": _("Currency"), "fieldtype": "Data", "width": 80},
]
expense_accounts = (
tax_accounts
) = (
expense_columns
) = tax_columns = unrealized_profit_loss_accounts = unrealized_profit_loss_account_columns = []

expense_accounts = []
tax_accounts = []
unrealized_profit_loss_accounts = []

if invoice_list:
expense_accounts = frappe.db.sql_list(
Expand Down Expand Up @@ -163,10 +162,11 @@ def get_columns(invoice_list, additional_table_columns):
unrealized_profit_loss_account_columns = [
(account + ":Currency/currency:120") for account in unrealized_profit_loss_accounts
]

for account in tax_accounts:
if account not in expense_accounts:
tax_columns.append(account + ":Currency/currency:120")
tax_columns = [
(account + ":Currency/currency:120")
for account in tax_accounts
if account not in expense_accounts
]

columns = (
columns
Expand Down
22 changes: 22 additions & 0 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def validate(self):
else:
self.validate_deferred_start_and_end_date()

self.validate_deferred_income_expense_account()
self.set_inter_company_account()

if self.doctype == "Purchase Invoice":
Expand Down Expand Up @@ -209,6 +210,27 @@ def on_trash(self):
(self.doctype, self.name),
)

def validate_deferred_income_expense_account(self):
field_map = {
"Sales Invoice": "deferred_revenue_account",
"Purchase Invoice": "deferred_expense_account",
}

for item in self.get("items"):
if item.get("enable_deferred_revenue") or item.get("enable_deferred_expense"):
if not item.get(field_map.get(self.doctype)):
default_deferred_account = frappe.db.get_value(
"Company", self.company, "default_" + field_map.get(self.doctype)
)
if not default_deferred_account:
frappe.throw(
_(
"Row #{0}: Please update deferred revenue/expense account in item row or default account in company master"
).format(item.idx)
)
else:
item.set(field_map.get(self.doctype), default_deferred_account)

def validate_deferred_start_and_end_date(self):
for d in self.items:
if d.get("enable_deferred_revenue") or d.get("enable_deferred_expense"):
Expand Down
3 changes: 3 additions & 0 deletions erpnext/controllers/buying_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class QtyMismatchError(ValidationError):


class BuyingController(StockController, Subcontracting):
def __setup__(self):
self.flags.ignore_permlevel_for_fields = ["buying_price_list", "price_list_currency"]

def get_feed(self):
if self.get("supplier_name"):
return _("From {0} | {1} {2}").format(self.supplier_name, self.currency, self.grand_total)
Expand Down
1 change: 0 additions & 1 deletion erpnext/controllers/sales_and_purchase_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ def set_missing_values(source, target):
doc = frappe.get_doc(target)
doc.is_return = 1
doc.return_against = source.name
doc.ignore_pricing_rule = 1
doc.set_warehouse = ""
if doctype == "Sales Invoice" or doctype == "POS Invoice":
doc.is_pos = source.is_pos
Expand Down
3 changes: 3 additions & 0 deletions erpnext/controllers/selling_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@


class SellingController(StockController):
def __setup__(self):
self.flags.ignore_permlevel_for_fields = ["selling_price_list", "price_list_currency"]

def get_feed(self):
return _("To {0} | {1} {2}").format(self.customer_name, self.currency, self.grand_total)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ frappe.ui.form.on("Shopify Settings", "refresh", function(frm){

}

let app_link = "<a href='https://frappecloud.com/marketplace/apps/ecommerce-integrations' target='_blank'>Ecommerce Integrations</a>"
let app_link = "<a href='https://frappecloud.com/marketplace/apps/ecommerce_integrations' target='_blank'>Ecommerce Integrations</a>"
frm.dashboard.add_comment(__("Shopify Integration will be removed from ERPNext in Version 14. Please install {0} app to continue using it.", [app_link]), "yellow", true);

})
Expand Down
Loading

0 comments on commit 2c2d5cc

Please sign in to comment.