Compare commits

...

16 Commits

Author SHA1 Message Date
Nabin Hait
84c373fd88 Revert "fix: asset WDV depreciation calc according to IT act [dev]" 2024-01-10 12:36:35 +05:30
Raffael Meyer
6f9fe6a792 fix: wrong usage of get_single_value (#39268)
* fix: wrong usage of get_single_value

* test: fix wrong fieldname

* chore: typo

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2024-01-10 12:32:27 +05:30
Ankush Menat
38c5ecf007 fix: set parent doctype on chart (#39286) 2024-01-10 12:26:03 +05:30
Nabin Hait
c1922ea5de Merge pull request #39052 from anandbaburajan/asset_wdv_india_dev
fix: asset WDV depreciation calc according to IT act [dev]
2024-01-10 12:17:09 +05:30
ruthra kumar
54bcbd0bc6 Merge pull request #39282 from ruthra-kumar/type_error_on_transaction_js
fix: possible typeerror on transaction.js
2024-01-10 11:53:22 +05:30
ruthra kumar
9f27ac142b fix: possible typeerror on transaction.js 2024-01-10 11:34:28 +05:30
Nabin Hait
2ef0596df2 Merge pull request #39275 from nabinhait/fetch-timesheet-in-invoice
fix: Show timesheet table after fetching data from timesheet
2024-01-10 11:33:51 +05:30
Nabin Hait
3ff562cb8a Merge pull request #39191 from nabinhait/asset-lcv-validation-fix
fix: Ignore asset qty and status validation while cancelling LCV
2024-01-10 11:33:17 +05:30
Nabin Hait
8fdf0ca2d3 Merge pull request #39207 from nabinhait/get-fixed-asset-acc
fix: Get fixed_asset_account from asset category
2024-01-10 11:32:06 +05:30
Nabin Hait
01f507ebcb Merge pull request #39238 from nabinhait/asset-purchase-amount
fix: Set asset purchase amount based on qty and valuation_rate
2024-01-10 11:31:30 +05:30
Nabin Hait
e1ba5878a3 fix: Show timesheet table after fetching data from timesheet 2024-01-10 11:26:33 +05:30
hyaray
6dceb25fb2 chore: typo 2024-01-10 10:53:14 +05:30
Nabin Hait
135e19d0aa fix: Set asset purchase amount based on qty and valuation_rate 2024-01-09 12:51:57 +05:30
Nabin Hait
8548eae368 fix: Get fixed_asset_account from asset category 2024-01-08 16:11:04 +05:30
Nabin Hait
e9d36242ce fix: Ignore asset qty and status validation while cancelling LCV 2024-01-08 12:45:42 +05:30
anandbaburajan
026824880d fix: asset WDV depreciation calc according to IT act 2024-01-01 00:23:19 +05:30
12 changed files with 62 additions and 62 deletions

View File

@@ -1104,17 +1104,6 @@ class PurchaseInvoice(BuyingController):
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"
@@ -1156,17 +1145,24 @@ class PurchaseInvoice(BuyingController):
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(

View File

@@ -1238,10 +1238,10 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1})
def test_gain_loss_with_advance_entry(self):
unlink_enabled = frappe.db.get_single_value(
"Accounts Settings", "unlink_payment_on_cancel_of_invoice"
"Accounts Settings", "unlink_payment_on_cancellation_of_invoice"
)
frappe.db.set_single_value("Accounts Settings", "unlink_payment_on_cancel_of_invoice", 1)
frappe.db.set_single_value("Accounts Settings", "unlink_payment_on_cancellation_of_invoice", 1)
original_account = frappe.db.get_value("Company", "_Test Company", "exchange_gain_loss_account")
frappe.db.set_value(
@@ -1432,7 +1432,7 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
pay.cancel()
frappe.db.set_single_value(
"Accounts Settings", "unlink_payment_on_cancel_of_invoice", unlink_enabled
"Accounts Settings", "unlink_payment_on_cancellation_of_invoice", unlink_enabled
)
frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account)

View File

@@ -898,8 +898,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) {

View File

@@ -571,10 +571,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) {

View File

@@ -744,11 +744,8 @@ class BuyingController(SubcontractingController):
item_data = frappe.db.get_value(
"Item", row.item_code, ["asset_naming_series", "asset_category"], as_dict=1
)
if is_grouped_asset:
purchase_amount = flt(row.base_amount + row.item_tax_amount)
else:
purchase_amount = flt(row.base_rate + row.item_tax_amount)
asset_quantity = row.qty if is_grouped_asset else 1
purchase_amount = flt(row.valuation_rate) * asset_quantity
asset = frappe.get_doc(
{
@@ -764,7 +761,7 @@ class BuyingController(SubcontractingController):
"calculate_depreciation": 0,
"purchase_receipt_amount": purchase_amount,
"gross_purchase_amount": purchase_amount,
"asset_quantity": row.qty if is_grouped_asset else 1,
"asset_quantity": asset_quantity,
"purchase_receipt": self.name if self.doctype == "Purchase Receipt" else None,
"purchase_invoice": self.name if self.doctype == "Purchase Invoice" else None,
}

View File

@@ -12,12 +12,13 @@
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-21 16:57:09.767009",
"modified": "2020-07-21 16:57:55.719802",
"modified": "2024-01-10 12:21:25.134075",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Completed Operation",
"number_of_groups": 0,
"owner": "Administrator",
"parent_document_type": "Work Order",
"time_interval": "Quarterly",
"timeseries": 1,
"timespan": "Last Year",

View File

@@ -2,11 +2,7 @@ import frappe
def execute():
settings = frappe.db.get_single_value(
"Selling Settings",
["campaign_naming_by", "close_opportunity_after_days", "default_valid_till"],
as_dict=True,
)
settings = frappe.db.get_singles_dict("Selling Settings", cast=True)
frappe.reload_doc("crm", "doctype", "crm_settings")
if settings:

View File

@@ -790,7 +790,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
if (me.frm.doc.price_list_currency == company_currency) {
me.frm.set_value('plc_conversion_rate', 1.0);
}
if (company_doc.default_letter_head) {
if (company_doc && company_doc.default_letter_head) {
if(me.frm.fields_dict.letter_head) {
me.frm.set_value("letter_head", company_doc.default_letter_head);
}

View File

@@ -194,7 +194,8 @@ class LandedCostVoucher(Document):
for d in self.get("purchase_receipts"):
doc = frappe.get_doc(d.receipt_document_type, d.receipt_document)
# check if there are {qty} assets created and linked to this receipt document
self.validate_asset_qty_and_status(d.receipt_document_type, doc)
if self.docstatus != 2:
self.validate_asset_qty_and_status(d.receipt_document_type, doc)
# set landed cost voucher amount in pr item
doc.set_landed_cost_voucher_amount()
@@ -239,20 +240,20 @@ class LandedCostVoucher(Document):
},
fields=["name", "docstatus"],
)
if not docs or len(docs) != item.qty:
if not docs or len(docs) < item.qty:
frappe.throw(
_(
"There are not enough asset created or linked to {0}. Please create or link {1} Assets with respective document."
).format(item.receipt_document, item.qty)
"There are only {0} asset created or linked to {1}. Please create or link {2} Assets with respective document."
).format(len(docs), item.receipt_document, item.qty)
)
if docs:
for d in docs:
if d.docstatus == 1:
frappe.throw(
_(
"{2} <b>{0}</b> has submitted Assets. Remove Item <b>{1}</b> from table to continue."
"{0} <b>{1}</b> has submitted Assets. Remove Item <b>{2}</b> from table to continue."
).format(
item.receipt_document, item.item_code, item.receipt_document_type
item.receipt_document_type, item.receipt_document, item.item_code
)
)

View File

@@ -13,6 +13,7 @@ from pypika import functions as fn
import erpnext
from erpnext.accounts.utils import get_account_currency
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_enabled
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
from erpnext.buying.utils import check_on_hold_or_closed_status
from erpnext.controllers.buying_controller import BuyingController
from erpnext.stock.doctype.delivery_note.delivery_note import make_inter_company_transaction
@@ -674,15 +675,16 @@ class PurchaseReceipt(BuyingController):
landed_cost_entries = get_item_account_wise_additional_cost(self.name)
if d.is_fixed_asset:
account_type = (
"capital_work_in_progress_account"
if is_cwip_accounting_enabled(d.asset_category)
else "fixed_asset_account"
)
stock_asset_account_name = get_asset_account(
account_type, asset_category=d.asset_category, company=self.company
)
if is_cwip_accounting_enabled(d.asset_category):
stock_asset_account_name = get_asset_account(
"capital_work_in_progress_account",
asset_category=d.asset_category,
company=self.company,
)
else:
stock_asset_account_name = get_asset_category_account(
"fixed_asset_account", asset_category=d.asset_category, company=self.company
)
stock_value_diff = (
flt(d.base_net_amount)
@@ -719,7 +721,7 @@ class PurchaseReceipt(BuyingController):
):
warehouse_with_no_account.append(d.warehouse or d.rejected_warehouse)
if d.is_fixed_asset:
if d.is_fixed_asset and d.landed_cost_voucher_amount:
self.update_assets(d, d.valuation_rate)
if warehouse_with_no_account:
@@ -852,11 +854,14 @@ class PurchaseReceipt(BuyingController):
)
for asset in assets:
purchase_amount = flt(valuation_rate) * asset.asset_quantity
frappe.db.set_value(
"Asset", asset.name, "gross_purchase_amount", flt(valuation_rate) * asset.asset_quantity
)
frappe.db.set_value(
"Asset", asset.name, "purchase_receipt_amount", flt(valuation_rate) * asset.asset_quantity
"Asset",
asset.name,
{
"gross_purchase_amount": purchase_amount,
"purchase_receipt_amount": purchase_amount,
},
)
def update_status(self, status):

View File

@@ -140,7 +140,7 @@ class RepostItemValuation(Document):
return query[0][0] if query else None
def validate_accounts_freeze(self):
acc_settings = frappe.get_cached_doc("Account Settings")
acc_settings = frappe.get_cached_doc("Accounts Settings")
if not acc_settings.acc_frozen_upto:
return
if getdate(self.posting_date) <= getdate(acc_settings.acc_frozen_upto):
@@ -219,7 +219,7 @@ class RepostItemValuation(Document):
transaction_status = frappe.db.get_value(self.voucher_type, self.voucher_no, "docstatus")
if transaction_status == 2:
msg = _("Cannot cancel as processing of cancelled documents is pending.")
msg = _("Cannot cancel as processing of cancelled documents is pending.")
msg += "<br>" + _("Please try again in an hour.")
frappe.throw(msg, title=_("Pending processing"))

View File

@@ -78,13 +78,11 @@ def get_frequency(value):
def update_youtube_data():
# Called every 30 minutes via hooks
enable_youtube_tracking = frappe.db.get_single_value("Video Settings", "enable_youtube_tracking")
frequency = frappe.db.get_single_value("Video Settings", "frequency")
if not cint(enable_youtube_tracking):
video_settings = frappe.get_cached_doc("Video Settings")
if not video_settings.enable_youtube_tracking:
return
frequency = get_frequency(frequency)
frequency = get_frequency(video_settings.frequency)
time = datetime.now()
timezone = pytz.timezone(get_system_timezone())
site_time = time.astimezone(timezone)