Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - 508-dev/engineer_onboarding: ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup · GitHub
Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 508-dev/engineer_onboarding: ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup · GitHub
Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 508-dev/engineer_onboarding: ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup · GitHub
Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - 508-dev/engineer_onboarding: ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup · GitHub
Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 508-dev/engineer_onboarding: ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup · GitHub
Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 508-dev/engineer_onboarding: ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup · GitHub
Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - 508-dev/engineer_onboarding: ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup · GitHub
Skip to content

Repository files navigation

Engineer Onboarding

A Frappe custom app for ERPNext that automates engineer onboarding in one step.

Instead of manually creating 4 records across different modules, this app adds a "Setup as Engineer" button to the User form. Fill in the required fields, click Create, and the following records are created automatically:

  • User — with role assigned (see Prerequisites)
  • Employee — linked to the User
  • Supplier — name matches Employee (required for Purchase Invoice matching), with the User added to portal_users
  • Activity Cost — billing rate and costing rate for the engineer's activity type

Prerequisites

Before installing, confirm the following exist on the target site:

Option A — Engineer Role Profile (preferred)

Create a Role Profile named exactly Engineer in ERPNext (Settings > Role Profile > New).
The app detects it automatically and assigns it to the new User.

For 508.dev prod: the "Engineer" Role Profile already exists and assigns the Employee role.
See engineer_onboarding_flow.md § Role Architecture for the recommended long-term improvement.

Option B — No Role Profile (fallback)

If no "Engineer" Role Profile exists, the app assigns the built-in Employee role directly.
In this case, confirm the Employee role has been configured with the permissions engineers need:

DocumentMinimum permissions
TimesheetSelect, Read, Write, Create, Submit, Cancel, Amend
Purchase InvoiceRead, Write, Create (Only If Creator checked)
ProjectSelect, Read
CustomerSelect, Read
SupplierSelect, Read, Write
Activity TypeRead

Check via: Settings > Role Permissions Manager, filter by role = Employee.

Other requirements

  • A Subcontractors Supplier Group must exist (Buying > Supplier Group)
  • At least one Activity Type must exist (Projects > Activity Type)

Installation

cd frappe-bench
bench get-app https://github.com/508-dev/engineer_onboarding
bench --site <your-site> install-app engineer_onboarding
bench build --app engineer_onboarding

Usage

  1. Go to Settings > User
  2. Open an existing User record (or create a new one and save it first)
  3. Click the "Setup as Engineer" button in the top-right button area
  4. Fill in the dialog fields:
FieldRequiredNotes
First NameYesAuto-filled from User
Last NameNoAuto-filled from User
CountryYesUsed for Supplier country
DepartmentNoAssigned to Employee
Activity TypeYesLinks to Activity Cost
Billing Rate (USD/hr)YesRate charged to the client
Costing Rate (USD/hr)YesRate paid to the engineer
  1. Click Create
  2. A success message appears with links to all 4 created records

The button is disabled (greyed out) if the User already has a linked Employee.

Setting a password for the new engineer (local / no email)

bench --site <your-site> set-password <engineer-email><password>

How It Works

User ──(user_id)──► Employee ──(Activity Cost)──► billing_rate / costing_rate
│ │
│ activity_type
│
└──(portal_users)──► Supplier ◄──────── Purchase Invoice
(name = Employee Name)

The Supplier name is intentionally set to match the Employee name exactly — ERPNext links Timesheets (via Employee) to Purchase Invoices (via Supplier) by name match.

Testing

Automated tests (required before every change)

# One-time: allow tests on the site
bench --site <your-site> set-config allow_tests true# Run the suite
bench --site <your-site> run-tests --app engineer_onboarding

Expected: OK with 9 passing tests (role tests skip on the path that isn't active on the current site).

Tests cover:

  • Guard — error if User doesn't exist before calling setup
  • Happy path — all four records created
  • Correct fields on Employee / Supplier / Activity Cost
  • Critical invariant: Supplier.name == Employee.employee_name
  • Role Profile assigned when it exists on the site; Employee role as fallback
  • last_name is optional
  • Idempotency — re-running updates rates, doesn't create duplicates

Manual testing

Confirm prerequisites exist:

  • http://localhost:8080/app/activity-type
  • http://localhost:8080/app/supplier-group (must have "Subcontractors")

Happy path:

  1. Create User: test.engineer@example.com, First: Test, Last: Engineer, Save
  2. Click "Setup as Engineer", fill: Country = Taiwan, Activity Type = any, Billing = 120, Costing = 80
  3. Click Create → green success message with 4 links

Verify:

RecordWhat to check
UserHas Engineer Role Profile or Employee role
Employeeuser_id = engineer email, date_of_joining = today
Suppliersupplier_group = Subcontractors, portal_users includes the User
Activity CostCorrect rates, linked to the Employee

Other scenarios: idempotency (run twice, rates update, no duplicates), no last name, already-set-up button greyed out.

API Test (curl)

curl -s -X POST "http://localhost:8080/api/method/engineer_onboarding.engineer_onboarding.onboarding_utils.create_engineer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-b "sid=<your-session-id>" \
--data-urlencode "email=test.engineer@example.com" \
--data-urlencode "first_name=Test" \
--data-urlencode "last_name=Engineer" \
--data-urlencode "country=Taiwan" \
--data-urlencode "activity_type=Engineering" \
--data-urlencode "billing_rate=120" \
--data-urlencode "costing_rate=80" \
| python3 -m json.tool

File Structure

engineer_onboarding/
├── engineer_onboarding/
│ ├── hooks.py # Injects JS into User doctype
│ ├── engineer_onboarding/
│ │ ├── onboarding_utils.py # create_engineer() API
│ │ └── test_onboarding_utils.py # Unit tests (must pass before merging)
│ └── public/
│ └── js/
│ └── user_onboarding.js # "Setup as Engineer" button + dialog
└── pyproject.toml

License

MIT

About

ERPNext app for 508.dev engineer onboarding — automates Employee, Supplier, and Activity Cost setup

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages