feat: R2 Device QA workflow with Shipping & Receiving role
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_qa_ready_serials(limit=50):
|
||||
"""Get Serial Nos ready for QA (Erasure Complete state)."""
|
||||
return frappe.get_all('Serial No',
|
||||
filters={'r2_status': 'Erasure Complete'},
|
||||
fields=['name', 'item_code', 'item_name', 'pallet', 'cosmetic_grade'],
|
||||
limit=limit,
|
||||
order_by='creation asc'
|
||||
)
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_qa_from_serial(serial_no):
|
||||
"""Create QA inspection for a Serial No."""
|
||||
if not frappe.db.exists('Serial No', serial_no):
|
||||
return {'error': 'Serial No not found'}
|
||||
|
||||
serial = frappe.get_doc('Serial No', serial_no)
|
||||
|
||||
# Check if already has active inspection
|
||||
existing = frappe.db.get_value('R2 Device Inspection',
|
||||
{'serial_no': serial_no, 'docstatus': ['!=', 2]}, 'name')
|
||||
if existing:
|
||||
return {'error': f'Inspection {existing} already exists for this serial'}
|
||||
|
||||
insp = frappe.get_doc({
|
||||
'doctype': 'R2 Device Inspection',
|
||||
'serial_no': serial_no,
|
||||
'item_code': serial.item_code,
|
||||
'inspection_date': frappe.utils.today(),
|
||||
'inspector': frappe.session.user,
|
||||
'cosmetic_grade': serial.cosmetic_grade,
|
||||
'screen_condition': serial.screen_condition,
|
||||
'keyboard_condition': serial.keyboard_condition,
|
||||
'case_condition': serial.case_condition
|
||||
})
|
||||
insp.insert(ignore_permissions=True)
|
||||
|
||||
return {'success': True, 'inspection': insp.name}
|
||||
@@ -3,10 +3,16 @@
|
||||
"route": "sales-manager",
|
||||
"icon": "fa fa-dollar-sign",
|
||||
"roles": [
|
||||
{"role": "System Manager"},
|
||||
{"role": "Sales User"}
|
||||
{
|
||||
"role": "System Manager"
|
||||
},
|
||||
{
|
||||
"role": "Sales User"
|
||||
}
|
||||
],
|
||||
"standard": "Yes",
|
||||
"type": "page",
|
||||
"module": "Westech R2"
|
||||
}
|
||||
"module": "Westech R2",
|
||||
"doctype": "Page",
|
||||
"name": "sales-manager"
|
||||
}
|
||||
@@ -3,10 +3,16 @@
|
||||
"route": "sales-manager",
|
||||
"icon": "fa fa-dollar-sign",
|
||||
"roles": [
|
||||
{"role": "System Manager"},
|
||||
{"role": "Sales User"}
|
||||
{
|
||||
"role": "System Manager"
|
||||
},
|
||||
{
|
||||
"role": "Sales User"
|
||||
}
|
||||
],
|
||||
"standard": "Yes",
|
||||
"type": "page",
|
||||
"module": "Westech R2"
|
||||
}
|
||||
"module": "Westech R2",
|
||||
"doctype": "Page",
|
||||
"name": "sales-manager"
|
||||
}
|
||||
Reference in New Issue
Block a user