| 1 |
import { CharField, charField } from "@web/views/fields/char/char_field"; |
| 2 |
import { registry } from "@web/core/registry"; |
| 3 |
|
| 4 |
import { useService } from "@web/core/utils/hooks"; |
| 5 |
|
| 6 |
export class ApplicantCharField extends CharField { |
| 7 |
static template = "hr_recruitment.ApplicantCharField"; |
| 8 |
setup() { |
| 9 |
super.setup(); |
| 10 |
|
| 11 |
this.action = useService("action"); |
| 12 |
} |
| 13 |
|
| 14 |
onClick() { |
| 15 |
const record = this.props.record.data; |
| 16 |
if (record.res_id && record.res_model == 'hr.applicant') { |
| 17 |
this.action.doAction({ |
| 18 |
type: 'ir.actions.act_window', |
| 19 |
res_model: 'hr.applicant', |
| 20 |
res_id: record.res_id.resId, |
| 21 |
views: [[false, "form"]], |
| 22 |
view_mode: "form", |
| 23 |
target: "current", |
| 24 |
}); |
| 25 |
} |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
export const applicantCharField = { |
| 30 |
...charField, |
| 31 |
component: ApplicantCharField, |
| 32 |
}; |
| 33 |
|
| 34 |
registry.category("fields").add("applicant_char", applicantCharField); |