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 #39246

Merged
merged 41 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1cbe1e8
fix: asset WDV depreciation calc according to IT act
anandbaburajan Dec 31, 2023
7d64df0
fix: Ignore UP on "allowed to transact with" (backport #39103) (#39104)
mergify[bot] Jan 3, 2024
26ae708
fix(UX): dont override framework's permission check messages (backpor…
mergify[bot] Jan 3, 2024
71ecf08
fix: typerror on multi select dialog
ruthra-kumar Jan 3, 2024
20aac93
Merge pull request #39121 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Jan 3, 2024
080a742
fix(Employee): treeview (#39126)
barredterra Jan 4, 2024
948045e
Merge pull request #39147 from frappe/mergify/bp/version-14-hotfix/pr…
barredterra Jan 4, 2024
2866f7c
fix: inventory dimension negative stock validation (backport #39149) …
mergify[bot] Jan 4, 2024
f236a2c
refactor: prevent permissions by always processing in background
ruthra-kumar Jan 5, 2024
f6b10f3
Merge pull request #39180 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Jan 8, 2024
06d193a
fix: don't set rate for non-stock item in Internal Transfer (backport…
mergify[bot] Jan 8, 2024
69c460c
fix: set `First Name` in Supplier Contact
s-aga-r Jan 8, 2024
580e9f6
fix: improved validation message
nabinhait Jan 5, 2024
0f6477a
fix: Purchase date and amount is not mandatory for composite asset cr…
nabinhait Jan 5, 2024
856926d
Merge pull request #39184 from s-aga-r/FIX-7838
s-aga-r Jan 8, 2024
2ea2146
fix: update Maintenance Schedule status on Maintenance Visit submit (…
mergify[bot] Jan 8, 2024
5e517cf
fix: FG Item incorrect qty in the work order (backport #39200) (#39210)
mergify[bot] Jan 8, 2024
7b4b630
fix: Show maintain-stock and is-fixed-asset checkbox in item quick en…
nabinhait Jan 8, 2024
d0e1162
feat: Copy project_name, from_time, to_time from timesheet details to…
batonac Jan 20, 2023
0ebd133
Merge pull request #39236 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Jan 9, 2024
71f9b7f
fix: total allocated percentage for sales team issue
ruthra-kumar Jan 9, 2024
c9d4c41
Merge pull request #39240 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Jan 9, 2024
c2eeeec
fix: BOM replace tool does not update exploded items of root (backpor…
mergify[bot] Jan 9, 2024
36ba33c
fix: TypeError is pricing rules (backport #39252) (#39259)
mergify[bot] Jan 9, 2024
8c496fb
fix: incorrect indicator title for portal sales order (backport #3924…
mergify[bot] Jan 9, 2024
a15ad80
fix: add read permission to Buying Settings (backport #39158) (#39257)
mergify[bot] Jan 9, 2024
a3146c3
fix: Duplicate Closing Stock Balance (backport #39262) (#39263)
mergify[bot] Jan 9, 2024
f42e93b
fix: skip rate validation for return `DN Items` with `Moving Average`…
mergify[bot] Jan 10, 2024
41e3843
fix: Set asset purchase amount based on qty and valuation_rate
nabinhait Jan 9, 2024
952cee3
fix: Ignore asset qty and status validation while cancelling LCV
nabinhait Jan 8, 2024
8fe346a
fix: possible typeerror on transaction.js
ruthra-kumar Jan 10, 2024
3d621d4
Merge pull request #39283 from frappe/mergify/bp/version-14-hotfix/pr…
ruthra-kumar Jan 10, 2024
b529883
fix: resolved conflict
nabinhait Jan 10, 2024
3f3fc82
Merge pull request #39217 from frappe/mergify/bp/version-14-hotfix/pr…
nabinhait Jan 10, 2024
65005d8
Merge pull request #39050 from anandbaburajan/asset_wdv_india
nabinhait Jan 10, 2024
0379ea5
Merge pull request #39277 from frappe/mergify/bp/version-14-hotfix/pr…
nabinhait Jan 10, 2024
f4e3f0d
Merge pull request #39278 from frappe/mergify/bp/version-14-hotfix/pr…
nabinhait Jan 10, 2024
cc07213
Merge pull request #39189 from frappe/mergify/bp/version-14-hotfix/pr…
nabinhait Jan 10, 2024
a2a8558
fix: set parent doctype on chart (backport #39286) (#39287)
mergify[bot] Jan 10, 2024
ee7474b
fix: remove global _("translation") calls (backport #32828) (#39231)
mergify[bot] Jan 10, 2024
1cc887a
fix: Show timesheet table after fetching data from timesheet (backpor…
mergify[bot] Jan 10, 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 @@ -11,6 +11,7 @@
{
"fieldname": "company",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Company",
"options": "Company",
Expand All @@ -19,7 +20,7 @@
],
"istable": 1,
"links": [],
"modified": "2020-05-01 12:32:34.044911",
"modified": "2024-01-03 11:13:02.669632",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Allowed To Transact With",
Expand All @@ -28,5 +29,6 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
2 changes: 1 addition & 1 deletion erpnext/accounts/doctype/pricing_rule/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def get_qty_amount_data_for_cumulative(pr_doc, doc, items=None):
values.extend(warehouses)

if items:
condition = " and `tab{child_doc}`.{apply_on} in ({items})".format(
condition += " and `tab{child_doc}`.{apply_on} in ({items})".format(
child_doc=child_doctype, apply_on=apply_on, items=",".join(["%s"] * len(items))
)

Expand Down
26 changes: 11 additions & 15 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,17 +925,6 @@ def make_item_gl_entries(self, gl_entries):
item=item,
)
)

# update gross amount of asset bought through this document
assets = frappe.db.get_all(
"Asset", filters={"purchase_invoice": self.name, "item_code": item.item_code}
)
for asset in assets:
frappe.db.set_value("Asset", asset.name, "gross_purchase_amount", flt(item.valuation_rate))
frappe.db.set_value(
"Asset", asset.name, "purchase_receipt_amount", flt(item.valuation_rate)
)

if (
self.auto_accounting_for_stock
and self.is_opening == "No"
Expand Down Expand Up @@ -975,17 +964,24 @@ def make_item_gl_entries(self, gl_entries):
item.item_tax_amount, item.precision("item_tax_amount")
)

if item.is_fixed_asset and item.landed_cost_voucher_amount:
self.update_gross_purchase_amount_for_linked_assets(item)

def update_gross_purchase_amount_for_linked_assets(self, item):
assets = frappe.db.get_all(
"Asset",
filters={"purchase_invoice": self.name, "item_code": item.item_code},
fields=["name", "asset_quantity"],
)
for asset in assets:
purchase_amount = flt(item.valuation_rate) * asset.asset_quantity
frappe.db.set_value(
"Asset", asset.name, "gross_purchase_amount", flt(item.valuation_rate) * asset.asset_quantity
)
frappe.db.set_value(
"Asset", asset.name, "purchase_receipt_amount", flt(item.valuation_rate) * asset.asset_quantity
"Asset",
asset.name,
{
"gross_purchase_amount": purchase_amount,
"purchase_receipt_amount": purchase_amount,
},
)

def make_stock_adjustment_entry(
Expand Down
2 changes: 1 addition & 1 deletion erpnext/accounts/doctype/sales_invoice/sales_invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ frappe.ui.form.on('Sales Invoice', {
frm.events.append_time_log(frm, timesheet, 1.0);
}
});
frm.refresh_field("timesheets");
frm.trigger("calculate_timesheet_totals");
frm.refresh();
},

async get_exchange_rate(frm, from_currency, to_currency) {
Expand Down
10 changes: 4 additions & 6 deletions erpnext/accounts/party.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,12 @@ def _get_party_details(
set_account_and_due_date(party, account, party_type, company, posting_date, bill_date, doctype)
)
party = party_details[party_type.lower()]
party = frappe.get_doc(party_type, party)

if not ignore_permissions and not (
frappe.has_permission(party_type, "read", party)
or frappe.has_permission(party_type, "select", party)
):
frappe.throw(_("Not permitted for {0}").format(party), frappe.PermissionError)
if not ignore_permissions:
ptype = "select" if frappe.only_has_select_perm(party_type) else "read"
frappe.has_permission(party_type, ptype, party, throw=True)

party = frappe.get_doc(party_type, party)
currency = party.get("default_currency") or currency or get_company_currency(company)

party_address, shipping_address = set_address_details(
Expand Down
12 changes: 9 additions & 3 deletions erpnext/assets/doctype/asset/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,16 @@ frappe.ui.form.on('Asset', {
indicator: 'red'
});
}
frm.set_value('gross_purchase_amount', item.base_net_rate + item.item_tax_amount);
frm.set_value('purchase_receipt_amount', item.base_net_rate + item.item_tax_amount);
item.asset_location && frm.set_value('location', item.asset_location);
var is_grouped_asset = frappe.db.get_value('Item', item.item_code, 'is_grouped_asset');
var asset_quantity = is_grouped_asset ? item.qty : 1;
var purchase_amount = flt(item.valuation_rate * asset_quantity, precision('gross_purchase_amount'));

frm.set_value('gross_purchase_amount', purchase_amount);
frm.set_value('purchase_receipt_amount', purchase_amount);
frm.set_value('asset_quantity', asset_quantity);
frm.set_value('cost_center', item.cost_center || purchase_doc.cost_center);
if(item.asset_location) { frm.set_value('location', item.asset_location); }

},

set_depreciation_rate: function(frm, row) {
Expand Down
12 changes: 6 additions & 6 deletions erpnext/assets/doctype/asset/asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@
"fieldname": "purchase_date",
"fieldtype": "Date",
"label": "Purchase Date",
"mandatory_depends_on": "eval:!doc.is_existing_asset",
"read_only": 1,
"read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset",
"reqd": 1
"read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset"
},
{
"fieldname": "disposal_date",
Expand All @@ -227,15 +227,15 @@
"fieldname": "gross_purchase_amount",
"fieldtype": "Currency",
"label": "Gross Purchase Amount",
"mandatory_depends_on": "eval:(!doc.is_composite_asset || doc.docstatus==1)",
"options": "Company:company:default_currency",
"read_only_depends_on": "eval:!doc.is_existing_asset",
"reqd": 1
"read_only_depends_on": "eval:!doc.is_existing_asset"
},
{
"fieldname": "available_for_use_date",
"fieldtype": "Date",
"label": "Available-for-use Date",
"reqd": 1
"mandatory_depends_on": "eval:(!doc.is_composite_asset || doc.docstatus==1)"
},
{
"default": "0",
Expand Down Expand Up @@ -583,7 +583,7 @@
"link_fieldname": "target_asset"
}
],
"modified": "2023-12-21 16:46:20.732869",
"modified": "2024-01-05 17:36:53.131512",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",
Expand Down
69 changes: 42 additions & 27 deletions erpnext/assets/doctype/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,12 @@ def validate_asset_values(self):
frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)

if is_cwip_accounting_enabled(self.asset_category):
if not self.is_existing_asset and not (self.purchase_receipt or self.purchase_invoice):
if (
not self.is_existing_asset
and not self.is_composite_asset
and not self.purchase_receipt
and not self.purchase_invoice
):
frappe.throw(
_("Please create purchase receipt or purchase invoice for the item {0}").format(
self.item_code
Expand All @@ -260,7 +265,7 @@ def validate_asset_values(self):
and not frappe.db.get_value("Purchase Invoice", self.purchase_invoice, "update_stock")
):
frappe.throw(
_("Update stock must be enable for the purchase invoice {0}").format(self.purchase_invoice)
_("Update stock must be enabled for the purchase invoice {0}").format(self.purchase_invoice)
)

if not self.calculate_depreciation:
Expand Down Expand Up @@ -428,10 +433,7 @@ def _make_depreciation_schedule(
n == 0
and (has_pro_rata or has_wdv_or_dd_non_yearly_pro_rata)
and not self.opening_accumulated_depreciation
and get_updated_rate_of_depreciation_for_wdv_and_dd(
self, value_after_depreciation, finance_book, False
)
== finance_book.rate_of_depreciation
and not self.flags.wdv_it_act_applied
):
from_date = add_days(
self.available_for_use_date, -1
Expand Down Expand Up @@ -1378,26 +1380,16 @@ def get_depreciation_amount(
asset, fb_row, schedule_idx, number_of_pending_depreciations
)
else:
rate_of_depreciation = get_updated_rate_of_depreciation_for_wdv_and_dd(
asset, depreciable_value, fb_row
)
return get_wdv_or_dd_depr_amount(
asset,
fb_row,
depreciable_value,
rate_of_depreciation,
fb_row.frequency_of_depreciation,
schedule_idx,
prev_depreciation_amount,
has_wdv_or_dd_non_yearly_pro_rata,
)


@erpnext.allow_regional
def get_updated_rate_of_depreciation_for_wdv_and_dd(
asset, depreciable_value, fb_row, show_msg=True
):
return fb_row.rate_of_depreciation


def get_straight_line_or_manual_depr_amount(
asset, row, schedule_idx, number_of_pending_depreciations
):
Expand Down Expand Up @@ -1532,30 +1524,53 @@ def get_asset_shift_factors_map():
return dict(frappe.db.get_all("Asset Shift Factor", ["shift_name", "shift_factor"], as_list=True))


@erpnext.allow_regional
def get_wdv_or_dd_depr_amount(
asset,
fb_row,
depreciable_value,
schedule_idx,
prev_depreciation_amount,
has_wdv_or_dd_non_yearly_pro_rata,
):
return get_default_wdv_or_dd_depr_amount(
asset,
fb_row,
depreciable_value,
schedule_idx,
prev_depreciation_amount,
has_wdv_or_dd_non_yearly_pro_rata,
)


def get_default_wdv_or_dd_depr_amount(
asset,
fb_row,
depreciable_value,
rate_of_depreciation,
frequency_of_depreciation,
schedule_idx,
prev_depreciation_amount,
has_wdv_or_dd_non_yearly_pro_rata,
):
if cint(frequency_of_depreciation) == 12:
return flt(depreciable_value) * (flt(rate_of_depreciation) / 100)
if cint(fb_row.frequency_of_depreciation) == 12:
return flt(depreciable_value) * (flt(fb_row.rate_of_depreciation) / 100)
else:
if has_wdv_or_dd_non_yearly_pro_rata:
if schedule_idx == 0:
return flt(depreciable_value) * (flt(rate_of_depreciation) / 100)
elif schedule_idx % (12 / cint(frequency_of_depreciation)) == 1:
return flt(depreciable_value) * (flt(fb_row.rate_of_depreciation) / 100)
elif schedule_idx % (12 / cint(fb_row.frequency_of_depreciation)) == 1:
return (
flt(depreciable_value) * flt(frequency_of_depreciation) * (flt(rate_of_depreciation) / 1200)
flt(depreciable_value)
* flt(fb_row.frequency_of_depreciation)
* (flt(fb_row.rate_of_depreciation) / 1200)
)
else:
return prev_depreciation_amount
else:
if schedule_idx % (12 / cint(frequency_of_depreciation)) == 0:
if schedule_idx % (12 / cint(fb_row.frequency_of_depreciation)) == 0:
return (
flt(depreciable_value) * flt(frequency_of_depreciation) * (flt(rate_of_depreciation) / 1200)
flt(depreciable_value)
* flt(fb_row.frequency_of_depreciation)
* (flt(fb_row.rate_of_depreciation) / 1200)
)
else:
return prev_depreciation_amount
Expand Down
8 changes: 8 additions & 0 deletions erpnext/assets/doctype/asset/depreciation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from frappe.utils.data import get_link_to_form
from frappe.utils.user import get_users_with_role

import erpnext
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_checks_for_pl_and_bs_accounts,
)
Expand Down Expand Up @@ -473,6 +474,13 @@ def depreciate_asset(asset, date):

make_depreciation_entry(asset.name, date)

cancel_depreciation_entries(asset, date)


@erpnext.allow_regional
def cancel_depreciation_entries(asset, date):
pass


def reset_depreciation_schedule(asset, date):
if not asset.calculate_depreciation:
Expand Down
4 changes: 2 additions & 2 deletions erpnext/assets/doctype/asset_category/asset_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ def validate_account_types(self):
if selected_key_type not in expected_key_types:
frappe.throw(
_(
"Row #{}: {} of {} should be {}. Please modify the account or select a different account."
"Row #{0}: {1} of {2} should be {3}. Please update the {1} or select a different account."
).format(
d.idx,
frappe.unscrub(key_to_match),
frappe.bold(selected_account),
frappe.bold(expected_key_types),
frappe.bold(" or ".join(expected_key_types)),
),
title=_("Invalid Account"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
},
{
"default": "0",
"depends_on": "eval:doc.depreciation_method == \"Straight Line\" || doc.depreciation_method == \"Manual\"",
"fieldname": "daily_prorata_based",
"fieldtype": "Check",
"label": "Depreciate based on daily pro-rata"
Expand All @@ -106,7 +105,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-11-29 03:53:03.591098",
"modified": "2023-12-29 08:49:39.876439",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Finance Book",
Expand Down
Loading
Loading