diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index f3c41da5e22b..99824b7f67bf 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -193,6 +193,7 @@ def test_purchase_of_grouped_asset(self): def test_is_fixed_asset_set(self): asset = create_asset(is_existing_asset=1) doc = frappe.new_doc("Purchase Invoice") + doc.company = "_Test Company" doc.supplier = "_Test Supplier" doc.append("items", {"item_code": "Macbook Pro", "qty": 1, "asset": asset.name}) @@ -566,7 +567,8 @@ def test_cwip_accounting(self): pr.submit() expected_gle = ( - ("Asset Received But Not Billed - _TC", 0.0, 5250.0), + ("_Test Account Shipping Charges - _TC", 0.0, 250.0), + ("Asset Received But Not Billed - _TC", 0.0, 5000.0), ("CWIP Account - _TC", 5250.0, 0.0), ) @@ -585,9 +587,8 @@ def test_cwip_accounting(self): expected_gle = ( ("_Test Account Service Tax - _TC", 250.0, 0.0), ("_Test Account Shipping Charges - _TC", 250.0, 0.0), - ("Asset Received But Not Billed - _TC", 5250.0, 0.0), + ("Asset Received But Not Billed - _TC", 5000.0, 0.0), ("Creditors - _TC", 0.0, 5500.0), - ("Expenses Included In Asset Valuation - _TC", 0.0, 250.0), ) pi_gle = frappe.db.sql( diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index c1714479b8e9..5853f3233965 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -332,7 +332,7 @@ def make_item_gl_entries(self, gl_entries, warehouse_account=None): def validate_account(account_type): frappe.throw(_("{0} account not found while submitting purchase receipt").format(account_type)) - def make_item_asset_inward_entries(item, stock_value_diff, stock_asset_account_name): + def make_item_asset_inward_gl_entry(item, stock_value_diff, stock_asset_account_name): account_currency = get_account_currency(stock_asset_account_name) if not stock_asset_account_name: @@ -356,7 +356,6 @@ def make_stock_received_but_not_billed_entry(item): ) account_currency = get_account_currency(account) - outgoing_amount = item.base_net_amount # GL Entry for from warehouse or Stock Received but not billed # Intentionally passed negative debit amount to avoid incorrect GL Entry validation credit_amount = ( @@ -365,6 +364,7 @@ def make_stock_received_but_not_billed_entry(item): else flt(item.net_amount, item.precision("net_amount")) ) + outgoing_amount = item.base_net_amount if self.is_internal_transfer() and item.valuation_rate: outgoing_amount = abs(get_stock_value_difference(self.name, item.name, item.from_warehouse)) credit_amount = outgoing_amount @@ -381,7 +381,7 @@ def make_stock_received_but_not_billed_entry(item): credit=0.0, remarks=remarks, against_account=stock_asset_account_name, - debit_in_account_currency=-1 * credit_amount, + debit_in_account_currency=-1 * flt(outgoing_amount, item.precision("base_net_amount")), account_currency=account_currency, item=item, ) @@ -569,7 +569,11 @@ def make_divisional_loss_gl_entry(item): account_type, asset_category=d.asset_category, company=self.company ) - stock_value_diff = flt(d.net_amount) + flt(d.item_tax_amount / self.conversion_rate) + stock_value_diff = ( + flt(d.net_amount) + + flt(d.item_tax_amount / self.conversion_rate) + + flt(d.landed_cost_voucher_amount) + ) elif warehouse_account.get(d.warehouse): stock_value_diff = get_stock_value_difference(self.name, d.name, d.warehouse) stock_asset_account_name = warehouse_account[d.warehouse]["account"] @@ -589,7 +593,7 @@ def make_divisional_loss_gl_entry(item): continue if (flt(d.valuation_rate) or self.is_return or d.is_fixed_asset) and flt(d.qty): - make_item_asset_inward_entries(d, stock_value_diff, stock_asset_account_name) + make_item_asset_inward_gl_entry(d, stock_value_diff, stock_asset_account_name) make_stock_received_but_not_billed_entry(d) make_landed_cost_gl_entries(d) make_rate_difference_entry(d)