mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 03:09:09 +00:00
feat: GL entries
This commit is contained in:
@@ -562,6 +562,18 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
def make_item_gl_entries(self, gl_entries, warehouse_account=None):
|
def make_item_gl_entries(self, gl_entries, warehouse_account=None):
|
||||||
warehouse_with_no_account = []
|
warehouse_with_no_account = []
|
||||||
|
|
||||||
|
supplied_items_details = frappe._dict()
|
||||||
|
for item in self.supplied_items:
|
||||||
|
supplied_items_details.setdefault(item.reference_name, []).append(
|
||||||
|
frappe._dict(
|
||||||
|
{
|
||||||
|
"amount": item.amount,
|
||||||
|
"expense_account": item.expense_account,
|
||||||
|
"cost_center": item.cost_center,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
if flt(item.rate) and flt(item.qty):
|
if flt(item.rate) and flt(item.qty):
|
||||||
if warehouse_account.get(item.warehouse):
|
if warehouse_account.get(item.warehouse):
|
||||||
@@ -611,32 +623,33 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if flt(item.rm_supp_cost) and supplier_warehouse_account:
|
if flt(item.rm_supp_cost) and supplier_warehouse_account:
|
||||||
# Supplier Warehouse Account (Credit)
|
for rm_item in supplied_items_details.get(item.name):
|
||||||
self.add_gl_entry(
|
# Supplier Warehouse Account (Credit)
|
||||||
gl_entries=gl_entries,
|
self.add_gl_entry(
|
||||||
account=supplier_warehouse_account,
|
gl_entries=gl_entries,
|
||||||
cost_center=item.cost_center,
|
account=supplier_warehouse_account,
|
||||||
debit=0.0,
|
cost_center=rm_item.cost_center,
|
||||||
credit=flt(item.rm_supp_cost),
|
debit=0.0,
|
||||||
remarks=remarks,
|
credit=flt(rm_item.amount),
|
||||||
against_account=item.expense_account,
|
remarks=remarks,
|
||||||
account_currency=get_account_currency(supplier_warehouse_account),
|
against_account=rm_item.expense_account,
|
||||||
project=item.project,
|
account_currency=get_account_currency(supplier_warehouse_account),
|
||||||
item=item,
|
project=item.project,
|
||||||
)
|
item=item,
|
||||||
# Expense Account (Debit)
|
)
|
||||||
self.add_gl_entry(
|
# Expense Account (Debit)
|
||||||
gl_entries=gl_entries,
|
self.add_gl_entry(
|
||||||
account=item.expense_account,
|
gl_entries=gl_entries,
|
||||||
cost_center=item.cost_center,
|
account=rm_item.expense_account,
|
||||||
debit=flt(item.rm_supp_cost),
|
cost_center=rm_item.cost_center,
|
||||||
credit=0.0,
|
debit=flt(rm_item.amount),
|
||||||
remarks=remarks,
|
credit=0.0,
|
||||||
against_account=supplier_warehouse_account,
|
remarks=remarks,
|
||||||
account_currency=get_account_currency(item.expense_account),
|
against_account=supplier_warehouse_account,
|
||||||
project=item.project,
|
account_currency=get_account_currency(item.expense_account),
|
||||||
item=item,
|
project=item.project,
|
||||||
)
|
item=item,
|
||||||
|
)
|
||||||
|
|
||||||
# Expense Account (Debit)
|
# Expense Account (Debit)
|
||||||
if item.additional_cost_per_qty:
|
if item.additional_cost_per_qty:
|
||||||
|
|||||||
Reference in New Issue
Block a user