User Manual: BOM Additional Costs Management
1. Overview
This module enables tracking of additional costs associated with a Bill of Materials (BOM) in ERPNext. It helps in accurate cost management by allowing entry of cost types, per-unit costs, and related expense accounts, which can be seamlessly imported into related documents like Stock Entry.
2. Key Features
- Custom Child Table: BOM Additional Costs.
- Fields: Cost Type, Cost Per Unit, Expense Account.
- Editable Grid with list view support.
- JavaScript query filter for valid Expense Accounts.
- Import additional costs from BOM to Stock Entry via server-side script.
3. Pre-Requisites
- Active ERPNext system.
- BOM records with defined additional costs.
- Properly configured Chart of Accounts.
- User with necessary permissions.
4. Step-by-Step Usage
In BOM DocType:
- Navigate to the BOM form.
- Under the "Additional Costs" table:
- Enter Cost Type (e.g., Transport, Packaging).
- Enter Cost Per Unit.
- Select Expense Account (filtered by company and valid account types).
- Save the BOM.
In Stock Entry:
- Create a Stock Entry with type Manufacture.
- Set BOM No. and ensure stock entry type is correctly selected.
- Call
import_from_bom
function (can be automated or triggered via custom button/script). - Review the imported additional costs.
5. Script Customizations
JavaScript (BOM):
frappe.ui.form.on("BOM", {
refresh: function (frm) {
frm.set_query("expense_account", "additional_costs", function () {
return {
filters: {
account_type: [
"in",
[
"Tax",
"Chargeable",
"Income Account",
"Expenses Included In Valuation",
"Expenses Included In Asset Valuation",
],
],
company: frm.doc.company,
},
};
});
},
});
Python (Stock Entry):
def import_from_bom(self, method):
if self.stock_entry_type == "Manufacture" and self.bom_no:
bom = frappe.get_doc("BOM", self.bom_no)
for d in bom.additional_costs:
self.append("additional_costs", {
"expense_account": d.expense_account,
"amount": d.cost_per_unit,
"base_amount": d.cost_per_unit,
"description": d.cost_type
})
6. Troubleshooting (Common Errors and Resolutions)
Error Message | Cause | Resolution |
---|---|---|
"Expense Account not found or invalid." | Account not in allowed types or company. | Ensure account is valid and meets filter rules. |
"No BOM selected for Stock Entry." | bom_no not set. |
Set a valid BOM No. in Stock Entry. |
"No additional costs available in BOM." | BOM lacks additional cost entries. | Add additional costs in BOM before import. |
7. User Roles and Permissions
- System Manager: Full access.
- Stock User: Read and update access.
- Accounts Manager: Can manage expense accounts.
8. Key Notes
- Ensure
additional_costs
table is correctly configured in both BOM and Stock Entry. - Expense accounts must align with specified account types for filtering.
- Always validate entries before saving to avoid import errors.
- Custom buttons can be added for user-triggered import actions if required.