fix: incorrect number of gl entries issue (#20352)
This commit is contained in:
parent
7653a8b9fa
commit
6ae61a1693
@ -783,11 +783,12 @@ def add_non_stock_items_cost(stock_entry, work_order, expense_account):
|
|||||||
for name in non_stock_items:
|
for name in non_stock_items:
|
||||||
non_stock_items_cost += flt(items.get(name[0])) * flt(stock_entry.fg_completed_qty) / flt(bom.quantity)
|
non_stock_items_cost += flt(items.get(name[0])) * flt(stock_entry.fg_completed_qty) / flt(bom.quantity)
|
||||||
|
|
||||||
stock_entry.append('additional_costs', {
|
if non_stock_items_cost:
|
||||||
'expense_account': expense_account,
|
stock_entry.append('additional_costs', {
|
||||||
'description': _("Non stock items"),
|
'expense_account': expense_account,
|
||||||
'amount': non_stock_items_cost
|
'description': _("Non stock items"),
|
||||||
})
|
'amount': non_stock_items_cost
|
||||||
|
})
|
||||||
|
|
||||||
def add_operations_cost(stock_entry, work_order=None, expense_account=None):
|
def add_operations_cost(stock_entry, work_order=None, expense_account=None):
|
||||||
from erpnext.stock.doctype.stock_entry.stock_entry import get_operating_cost_per_unit
|
from erpnext.stock.doctype.stock_entry.stock_entry import get_operating_cost_per_unit
|
||||||
@ -804,11 +805,12 @@ def add_operations_cost(stock_entry, work_order=None, expense_account=None):
|
|||||||
additional_operating_cost_per_unit = \
|
additional_operating_cost_per_unit = \
|
||||||
flt(work_order.additional_operating_cost) / flt(work_order.qty)
|
flt(work_order.additional_operating_cost) / flt(work_order.qty)
|
||||||
|
|
||||||
stock_entry.append('additional_costs', {
|
if additional_operating_cost_per_unit:
|
||||||
"expense_account": expense_account,
|
stock_entry.append('additional_costs', {
|
||||||
"description": "Additional Operating Cost",
|
"expense_account": expense_account,
|
||||||
"amount": additional_operating_cost_per_unit * flt(stock_entry.fg_completed_qty)
|
"description": "Additional Operating Cost",
|
||||||
})
|
"amount": additional_operating_cost_per_unit * flt(stock_entry.fg_completed_qty)
|
||||||
|
})
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_bom_diff(bom1, bom2):
|
def get_bom_diff(bom1, bom2):
|
||||||
|
@ -682,6 +682,8 @@ class StockEntry(StockController):
|
|||||||
if item_account_wise_additional_cost:
|
if item_account_wise_additional_cost:
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
for account, amount in iteritems(item_account_wise_additional_cost.get((d.item_code, d.name), {})):
|
for account, amount in iteritems(item_account_wise_additional_cost.get((d.item_code, d.name), {})):
|
||||||
|
if not amount: continue
|
||||||
|
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": account,
|
"account": account,
|
||||||
"against": d.expense_account,
|
"against": d.expense_account,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user