@bb4first/odoo-xmlrpc
Version:
Odoo XMLRPC Interface
34 lines (30 loc) • 929 B
text/typescript
/**
* Copyright (C) 2022 Intelica. Scientific and Software Solutions
* Author: Reinier Millo Sánchez <millo@intelica.mx>
*
* This file is part of the @intelica/odoo-xmlrpc package.
* This project is distributed under MIT License.
* Check LICENSE file in project root folder.
*/
import { type IEmployee, MODEL_TYPE } from "../models/odoo.types";
import type { Odoo } from "./odoo";
import { OdooCRUD } from "./odoo.crud";
export class Employees extends OdooCRUD<IEmployee> {
constructor(odoo: Odoo) {
super(MODEL_TYPE.EMPLOYEES, odoo);
this._keys = [
"id",
"department_id",
"name",
"work_phone",
"work_email",
"category_ids",
];
}
searchByEmail(email: string): Promise<IEmployee[]> {
return this.searchRead([["work_email", "=", email]]);
}
searchByPhone(phone: string): Promise<IEmployee[]> {
return this.searchRead([["work_phone", "=", phone]]);
}
}