feat: LCV for Work Order and Subcontracting Receipt

This commit is contained in:
Rohit Waghchaure
2025-06-09 17:51:32 +05:30
parent 7211609725
commit 6be6eab6ff
19 changed files with 581 additions and 124 deletions

View File

@@ -432,10 +432,15 @@ class SubcontractingReceipt(SubcontractingController):
else:
item.scrap_cost_per_qty = 0
lcv_cost_per_qty = 0.0
if item.landed_cost_voucher_amount:
lcv_cost_per_qty = item.landed_cost_voucher_amount / item.qty
item.rate = (
flt(item.rm_cost_per_qty)
+ flt(item.service_cost_per_qty)
+ flt(item.additional_cost_per_qty)
+ flt(lcv_cost_per_qty)
- flt(item.scrap_cost_per_qty)
)
@@ -567,6 +572,7 @@ class SubcontractingReceipt(SubcontractingController):
gl_entries = []
self.make_item_gl_entries(gl_entries, warehouse_account)
self.make_item_gl_entries_for_lcv(gl_entries, warehouse_account)
return process_gl_map(gl_entries)
@@ -738,6 +744,53 @@ class SubcontractingReceipt(SubcontractingController):
+ "\n".join(warehouse_with_no_account)
)
def make_item_gl_entries_for_lcv(self, gl_entries, warehouse_account):
landed_cost_entries = self.get_item_account_wise_lcv_entries()
if not landed_cost_entries:
return
for item in self.items:
if item.landed_cost_voucher_amount and landed_cost_entries:
remarks = _("Accounting Entry for Landed Cost Voucher for SCR {0}").format(self.name)
if (item.item_code, item.name) in landed_cost_entries:
for account, amount in landed_cost_entries[(item.item_code, item.name)].items():
account_currency = get_account_currency(account)
credit_amount = (
flt(amount["base_amount"])
if (amount["base_amount"] or account_currency != self.company_currency)
else flt(amount["amount"])
)
self.add_gl_entry(
gl_entries=gl_entries,
account=account,
cost_center=item.cost_center,
debit=0.0,
credit=credit_amount,
remarks=remarks,
against_account=warehouse_account.get(item.warehouse)["account"],
credit_in_account_currency=flt(amount["amount"]),
account_currency=account_currency,
project=item.project,
item=item,
)
account_currency = get_account_currency(item.expense_account)
self.add_gl_entry(
gl_entries=gl_entries,
account=item.expense_account,
cost_center=item.cost_center,
debit=credit_amount,
credit=0.0,
remarks=remarks,
against_account=warehouse_account.get(item.warehouse)["account"],
debit_in_account_currency=flt(amount["amount"]),
account_currency=account_currency,
project=item.project,
item=item,
)
def auto_create_purchase_receipt(self):
if frappe.db.get_single_value("Buying Settings", "auto_create_purchase_receipt"):
make_purchase_receipt(self, save=True, notify=True)

View File

@@ -28,6 +28,7 @@
"rate_and_amount",
"rate",
"amount",
"landed_cost_voucher_amount",
"column_break_19",
"rm_cost_per_qty",
"service_cost_per_qty",
@@ -589,12 +590,20 @@
"options": "Job Card",
"read_only": 1,
"search_index": 1
},
{
"fieldname": "landed_cost_voucher_amount",
"fieldtype": "Currency",
"label": "Landed Cost Voucher Amount",
"no_copy": 1,
"read_only": 1
}
],
"grid_page_length": 50,
"idx": 1,
"istable": 1,
"links": [],
"modified": "2024-12-06 15:23:58.680169",
"modified": "2025-06-11 08:45:18.903036",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt Item",
@@ -602,7 +611,8 @@
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"row_format": "Dynamic",
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
}

View File

@@ -29,6 +29,7 @@ class SubcontractingReceiptItem(Document):
item_code: DF.Link
item_name: DF.Data | None
job_card: DF.Link | None
landed_cost_voucher_amount: DF.Currency
manufacturer: DF.Link | None
manufacturer_part_no: DF.Data | None
page_break: DF.Check