Compare commits
16 Commits
fix-get_si
...
revert-390
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84c373fd88 | ||
|
|
6f9fe6a792 | ||
|
|
38c5ecf007 | ||
|
|
c1922ea5de | ||
|
|
54bcbd0bc6 | ||
|
|
9f27ac142b | ||
|
|
2ef0596df2 | ||
|
|
3ff562cb8a | ||
|
|
8fdf0ca2d3 | ||
|
|
01f507ebcb | ||
|
|
e1ba5878a3 | ||
|
|
6dceb25fb2 | ||
|
|
135e19d0aa | ||
|
|
8548eae368 | ||
|
|
e9d36242ce | ||
|
|
026824880d |
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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"))
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user