mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
Merge pull request #48337 from frappe/version-14-hotfix
chore: release v14
This commit is contained in:
@@ -1124,6 +1124,33 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
warehouse_debit_amount = stock_amount
|
warehouse_debit_amount = stock_amount
|
||||||
|
|
||||||
|
elif self.is_return and self.update_stock and (self.is_internal_supplier or not self.return_against):
|
||||||
|
net_rate = item.base_net_amount
|
||||||
|
if item.sales_incoming_rate: # for internal transfer
|
||||||
|
net_rate = item.qty * item.sales_incoming_rate
|
||||||
|
|
||||||
|
stock_amount = net_rate + item.item_tax_amount + flt(item.landed_cost_voucher_amount)
|
||||||
|
|
||||||
|
if flt(stock_amount, net_amt_precision) != flt(warehouse_debit_amount, net_amt_precision):
|
||||||
|
cost_of_goods_sold_account = self.get_company_default("default_expense_account")
|
||||||
|
stock_adjustment_amt = stock_amount - warehouse_debit_amount
|
||||||
|
|
||||||
|
gl_entries.append(
|
||||||
|
self.get_gl_dict(
|
||||||
|
{
|
||||||
|
"account": cost_of_goods_sold_account,
|
||||||
|
"against": item.expense_account,
|
||||||
|
"debit": stock_adjustment_amt,
|
||||||
|
"debit_in_transaction_currency": stock_adjustment_amt / self.conversion_rate,
|
||||||
|
"remarks": self.get("remarks") or _("Stock Adjustment"),
|
||||||
|
"cost_center": item.cost_center,
|
||||||
|
"project": item.project or self.project,
|
||||||
|
},
|
||||||
|
account_currency,
|
||||||
|
item=item,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
return warehouse_debit_amount
|
return warehouse_debit_amount
|
||||||
|
|
||||||
def make_tax_gl_entries(self, gl_entries):
|
def make_tax_gl_entries(self, gl_entries):
|
||||||
|
|||||||
@@ -107,7 +107,11 @@ def convert_to_presentation_currency(gl_entries, currency_info):
|
|||||||
credit_in_account_currency = flt(entry["credit_in_account_currency"])
|
credit_in_account_currency = flt(entry["credit_in_account_currency"])
|
||||||
account_currency = entry["account_currency"]
|
account_currency = entry["account_currency"]
|
||||||
|
|
||||||
if len(account_currencies) == 1 and account_currency == presentation_currency:
|
if (
|
||||||
|
len(account_currencies) == 1
|
||||||
|
and account_currency == presentation_currency
|
||||||
|
and (debit_in_account_currency or credit_in_account_currency)
|
||||||
|
):
|
||||||
entry["debit"] = debit_in_account_currency
|
entry["debit"] = debit_in_account_currency
|
||||||
entry["credit"] = credit_in_account_currency
|
entry["credit"] = credit_in_account_currency
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -893,12 +893,19 @@ class update_entries_after:
|
|||||||
|
|
||||||
def update_rate_on_purchase_receipt(self, sle, outgoing_rate):
|
def update_rate_on_purchase_receipt(self, sle, outgoing_rate):
|
||||||
if frappe.db.exists(sle.voucher_type + " Item", sle.voucher_detail_no):
|
if frappe.db.exists(sle.voucher_type + " Item", sle.voucher_detail_no):
|
||||||
if sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"] and frappe.get_cached_value(
|
if sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]:
|
||||||
sle.voucher_type, sle.voucher_no, "is_internal_supplier"
|
details = frappe.get_cached_value(
|
||||||
):
|
sle.voucher_type,
|
||||||
frappe.db.set_value(
|
sle.voucher_no,
|
||||||
f"{sle.voucher_type} Item", sle.voucher_detail_no, "valuation_rate", sle.outgoing_rate
|
["is_internal_supplier", "is_return", "return_against"],
|
||||||
|
as_dict=True,
|
||||||
)
|
)
|
||||||
|
if details.is_internal_supplier or (details.is_return and not details.return_against):
|
||||||
|
rate = outgoing_rate if details.is_return else sle.outgoing_rate
|
||||||
|
|
||||||
|
frappe.db.set_value(
|
||||||
|
f"{sle.voucher_type} Item", sle.voucher_detail_no, "valuation_rate", rate
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Purchase Receipt Item Supplied", sle.voucher_detail_no, "rate", outgoing_rate
|
"Purchase Receipt Item Supplied", sle.voucher_detail_no, "rate", outgoing_rate
|
||||||
|
|||||||
Reference in New Issue
Block a user