Skip to Content
Menú
This question has been flagged
3 Respostes
1919 Vistes

i have listed out Employees from hr_employee, now how to list students, faculty and Inventory Items in pgAdmin Query Tool writing query (sql statement) something like e.g.:

select * from tablename where ??

i just want to create Template files to import related data.

please help.

regards

Avatar
Descartar
Autor

any help please?

Autor

is here anyone know how to retrieve the required data in pgAdmin using Query Tool??

Best Answer

Hi Smith,

In your custom module, check how it differentiates between students and faculty.

For example,

Let's assume that there is a selection field called "type," where the options are  [('student', 'Student'), ('faculty', 'Faculty'), ('others', 'Others')], 

Then query for students will be  

SELECT * FROM hr_employee WHERE type = 'student'

If the students have separate model, for example, 'student.student' in odoo.
Then the query will be,

SELECT * FROM student_student.

Remember to replace the '.' in the model name with '_' when mentioning the table name in the query.

Hope it helps,
Kiran K

Avatar
Descartar
Autor

so, there is nothing in existing Odoo ERP... thanks to all. what about Inventory Items?
regards

Best Answer

For example, let's assume the following table names for Odoo:

  • Students: school_student
  • Faculty: school_faculty
  • Inventory Items: product_template

Your queries might look like this:

sqlCopy code-- List Students
SELECT * FROM school_student;

-- List Faculty
SELECT * FROM school_faculty;

-- List Inventory Items
SELECT * FROM product_template;

Note: The table names I provided are just placeholders. You need to replace them with the actual table names or models used in your Odoo instance. You can find this information by checking the database structure or consulting the Odoo documentation.

Additionally, you may want to refine your queries by specifying conditions or joining tables based on the relationships between different entities in your Odoo system. For example, if students are associated with a particular faculty, you might use a JOIN clause to retrieve data from both the school_student and school_faculty tables.

Here's a simple example assuming there's a foreign key relationship between school_student and school_faculty:

 code-- List Students with Faculty Information
SELECT school_student.*, school_faculty.*
FROM school_student
JOIN school_faculty ON school_student.faculty_id = school_faculty.id;

Again, you should adapt these queries based on your actual Odoo database structure and relationships.

Avatar
Descartar
Autor

thank you @Arshad, i know how to " write query " but i don't know what are the tables in Odoo (PostgreSQL database) and what are the fields which i can reference to get "Students" or others like category_id or product_id. i want to know these informations that's why i mentioned "example" in my opening post above.

eg : You can get employee details by select * from hr_employee where id = 2
product : product_product

Autor

i think still i failed to convey... i want something like :

select * from res_partner where customer_rank > 0

this will retrieve all Customers and if i write:

select * from res_partner where supplier_rank > 0

this will retrieve all Suppliers

your query for hr_employee will return just what is stored with id=2 no matter he/she is student or not.

hope this clear what i want to achieve. and as mentioned in opening post, i just want to create Template files to import.

regards

Based on what I understand from your statement:
Create a new field in hr_employee to differentiate if an employee is a student or a faculty member and use it in queries ,
As a selection field, you can create

Related Posts Respostes Vistes Activitat
1
de febr. 24
1282
3
de nov. 23
1497
0
de set. 16
4637
0
de set. 15
5373
0
de jul. 24
722