How to get current salary rule name as variable in python code field - odoo-12

Is that possible to get current salary rule name in python code inside salary rule? I know that there are some variable exist, such as "payslip", "rules", "categories" and etc. But I need to use my current salary rule name in my function inside salary rule? I use Odoo 12

Related

SQL to return all students with minimum GPA

I'm trying to do a query which, as the title says, returns the name of all the students that share the minimum GPA.
Since the minimum GPA from all the students I have in the table is 0, right now I have:
Select s.name from Student s
where s.gpa = 0
However, I don't want to put the value '0' since it could not always be the case, instead I'm trying to find the minimum gpa with MIN(gpa)
I've been trying to use that aggregate function in combination with group by But I cannot make it work. So far I have this:
Select s.name from Student s
having s.gpa = min(s.gpa)
group by s.gpa
How should I change it to make it work? Thanks in advance
You need to first find what is the minimum GPA, then get students that have it.
To get the minimum GPA in the entire table:
SELECT MIN(gpa) FROM Student;
This query can be nested inside your original query:
SELECT name FROM Student
WHERE gpa = (SELECT MIN(gpa) FROM Student);
I am not sure if there is a simpler way to do it. I hope this helps!

How to perform conditional de-duplication in talend

I have a table with the employee ID, name, and last effective date. I want to keep only the employee ID with max(last effective date) and discard the other duplicate employee id rows that have an earlier last effective date.
I am trying to implement this usingtAggregate and tFilterRow. I attemped to perform count using tAggregate but it does not capture max(lasteffectivedate).
With a tAggreggateRow you can do :
If you want to get the ID too you need to reuse your primary flow in tMap (Main branch) and put the flow with the tAggregateRow in the lookup of the tMap.
After that you do a join on name AND date.

for each List lastname and people they supervise, include All employees must be listed (even those who do not supervise anyone)

order by most number of employees supervised, then by last name.
SELECT Lname,COUNT(*)
FROM EMPLOYEE
WHERE Ssn=Super_ssn IS NOT NULL
GROUP BY Super_ssn,lname
The problem here is, I am not sure about what to include in WHERE to actually count those ssn
Example setup:
https://www.db-fiddle.com/f/xhEj2sAgdTMABBkCtJvmoC/0#&togetherjs=z3CKywAccH

How to find out the columns to be grouped when a query is generated dynamically?

I need to implement a feature where the user will be generating reports dynamically.
In that feature, the user will be presented with an interface to select some specific modules. Each module will point to a set of tables internally.
Consider the following tables,
**Table Name : module_location**
location_id
location_name ->Contains a location name
**Table Name : module_streets**
street_id
street_location_id (F.K module_location.location_id)
street_name ->Contains street name in a location
If the user selects the module name Location, he is indeed choosing the list tables to be queried on(which is done internally)
In this case, module_location and module_streets (They will be joined by location id).
After selecting the Location module the user has to choose the set of fields which needs to be shown in the dynamic report, once generated.
So he'll be provided with an interface to select those fields. The names given in the interface will be alias names for the respective fields in the tables
ie,
The user will be presented with option to select the following
Location Name -> Corresponds to the field 'location_name'
Street Name -> Corresponds to the field 'street_name'
After selecting the required fields to be shown, the user will have to select some conditions like(count,sum etc)
Suppose, the condition is like Get the number of streets in a location, the user will have to add condition count against the option Street Name.
After selecting the conditions, the user have to simply click the submit button in-order to generate the report.
The issue I'm facing here is how to decide the columns to be grouped. If this is done manually, I know that I need to group the location_id to get the count. So how can I do that, if the query is generated dynamically?
Kindly help. The database I'm using is postgresql8.4

FileMaker - How to have distinct values listed on-screen?

I would like to have the distinct values of a repeating field listed in another field (in browse mode). The case is as follows:
I have a field that contains country names. The country names in this field may repeat themselves, thus when using the "List" function I get something like "France, France, France, Germany, Germany, Hungary".
How can I create a field that lists all the values from my country field, but has it grouped as "France, Germany, Hungary"?
In the case I could directly use a SQL query to interfere with the FileMaker databse I would use the GROUP BY statement.
To make a summary of all the values across every record, do as follows:
Make a new value list labeled 'Countries' (File Menu > Manage > Value Lists)
Make the value list 'Use Values From Field' and specify your repeating field
Create a new Calculation field, 'Listed Countries'
Set the calculation to type 'Text' and with the following code:
ValueListItems ( Get(FileName) ; "Countries" )
If you'd like to find the value for only the current record:
Make a new Table Occurrence, 'NewTO' of the same base table and link the two records by a unique index.
Change the 'Countries' value list so that it obtains values from 'NewTO' and your repeating field.
Select 'Only include related values starting from' and select your original Table Occurrence
If you'd like the list to update as the repeating field value changes, make certain that you Do Not Store Calculation Results for the field.