feat: add create department, user form as well as reports for them

This commit is contained in:
prafull-opensignlabs
2024-07-01 16:47:01 +05:30
parent 17b9fc772e
commit d46ba8f307
10 changed files with 302 additions and 193 deletions
@@ -0,0 +1,30 @@
export default async function DepartmentsAftersave(req) {
if (!req.original) {
try {
const Ancestors = req.object.get('Ancestors');
let updatedAncestors;
if (Ancestors && Ancestors.length > 0) {
updatedAncestors = [
...Ancestors,
{
__type: 'Pointer',
className: 'contracts_Departments',
objectId: req.object.id,
},
];
} else {
updatedAncestors = [
{
__type: 'Pointer',
className: 'contracts_Departments',
objectId: req.object.id,
},
];
}
req.object.set('Ancestors', updatedAncestors);
await req.object.save(null, { useMasterKey: true });
} catch (err) {
console.log('Err in department aftersave', err);
}
}
}