Change the state of hr.contract state - odoo-12

I would like to automate the process of changing the state of the contract based on the date, on the standard I found the function that updates the state but it didn't call in the model, but in the data file.
thank you in advance.

Odoo hr_contract module has scheduled action(cron) which call method update_state and this method is responsible for updating the status of the contract.
The scheduled action defined in hr_contract_data.xml as below:
<record id="ir_cron_data_contract_update_state" model="ir.cron">
<field name="name">HR Contract: update state</field>
<field name="model_id" ref="model_hr_contract"/>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="code">model.update_state()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
This action should be active by default and will be called every day and update the status of the contracts.
So you need to check if this scheduled action in your system is not active and activate it, you can do it in Odoo GUI as below:
Enable developer mode.
Go to Settings.
Go to Technical menu -> Scheduled actions.
Search for HR Contract: update state and open it.
In the right side of the form, If the Smart button showing off that's mean the action is not active and you can click on the button to switch it on. If the action is active but you found that it's not updating the contracts status so you need to check the Odoo log to see if there is any error related to this action.

Related

Datepicker not able to just allow future dates on ODOO V11

Hello team I am using ODOO V11 and a need a rule in the datepicker that not allow choose past dates.
For that I am using a module from community
https://apps.odoo.com/apps/modules/11.0/web_widget_datepicker_options/
I got some error when I put as parameter 0 in the min date to allow just dates from the current date:
<field name="active_date" options="{'datepicker':{'minDate': '0'}}"/>
eError: maxDate() Could not parse date parameter: 0.
When I try pass a specific date it works successfully
<field name="active_date" options="{'datepicker':{'minDate': '2018-09-01'}}"/>
Could you please take a look and tell me the parameter correctly to put in the option for datepicker?
for making datepicker only accept future dates, you need to change your code into
<field name="active_date" options="{'datepicker':{'minDate': 'now'}}"/>

Event listener in Fiori List line item action

I have a requirement where I need to listen to a line item action of Fiori List elements report.
I have embedded Fiori list component 'L' inside a freestyle app component 'F 'because I need to display multiple independent reports in app 'F'.
Compoent F (Freestyle)
embeds component L (List report created from Web IDE List report template).
Component 'L' has a line item action defined upon which I need to update an element which is part of component 'F'. The action is achieved by BOPF action.
The local annotation will be something like below:
`<Record Type="UI.DataFieldForAction">
<PropertyValue Property="Label" String="AddToCart"/>
<PropertyValue Property="Action"
String="some_Entities/actionAddToCart"/>
<PropertyValue Property="Inline" Bool="true"/>
<Annotation Term="UI. InvocationGrouping"
EnumMember="UI.OperationGroupingType/Isolated"/>
</Record>`
How do I know when the action gets completed so that I can update the element value in component 'F'? Precisely, I need to show the number of items in cart after user adds a line item to cart through BOPF action. So I need to capture the action 'completed' event and read the count from OData again.
Regards.
Sumit

HP ALM Rest API - unable to update Custom column created under Test-Instance -> user Fields -> Comments

I am trying to update custom column "Comments" created under Test-Instance -> User Fields --> Comments.
I am able to update columns which are under Test-Instance -> System fields using same code.
I am passing following payloads ->
1. payload giving issue:
PAYLOADCUSTOM = "%s%s";
payload working properly:
PAYLOADCUSTOM = "%s%s";
Basically i am able to update Status, Iteration fields but not comments field.
Any help is greatlly appreciated
ALM Screenshot:-
was using incorrect name. Custom names start as "user_01"
So correct payload was:-
PAYLOAD =
"<Entity Type="test-instance">
<Fields>
<Field Name="status"><Value>%S</Value></Field>
<Field Name="iterations"><Value>%s</Value></Field>
<Field Name="user-01"><Value>%s</Value></Field>
</Fields>
</Entity>";
Regards,
Vikram

Bypassing parameters in ireport 5.6.0

I created a simple report in i-report and i added a parameter on a field salary. Now every time i click on preview i get the parameter pop-up to filter. And if the value if not correct i get a blank page. Now that's exactly what i was trying to do. However i am wondering if there's a way to enter a certain value in the parameter box to display all records. Any idea if this possible and if yes how? Thank you.
WHERE EMPLOYEES."SALARY" = ${P1}
You need to change your query (lets imagine that SALARY is numeric, Double). to
WHERE EMPLOYEES."SALARY" = $P{parameter1} OR 0=$P{parameter1}
and define your parameter with a defaultValueExpression and set attribute isForPrompting="false"
<parameter name="parameter1" class="java.lang.Double" isForPrompting="false">
<defaultValueExpression><![CDATA[new java.lang.Double(0)]]></defaultValueExpression>
</parameter>
You will see no more prompt and display all data, if SALARY is of other class naturally you need to adjust the example accordingly.

How to access input control parameters from Jasper server?

I want to create a jasper report which changes the query and add/removes additional conditons in its where clause based on the input provided by the user in the jasper server.
One option is to sql inject the querystring in the jrxml file, but that looks messy as we may have additional conditions in the where clause which may be added.
The other approach mentioned in this post Dynamic querystring in JRXML seems to be a good one.
I would like to know how can I access the control parameters in the java code passed from jasper server?
Or can I give some kind of conditional logic within the jrxml file? which checks if some of the input controls are empty then assign one query in the queryString variable and another query if other conditions are valid?
Thanks.
Buld a "fake" parameter named P_DYNAMIC_WHERE_CLAUSE, based on your real input parameters. For instance:
<parameter name="PARAM1" class="java.lang.Long">
<parameterDescription><![CDATA[Real query criteria on column1]]></parameterDescription>
</parameter>
...
<parameter name="P_WHERE_CLAUSE_PARAM1" class="java.lang.String" isForPrompting="false">
<parameterDescription><![CDATA[Computed parameter, containing the optional SQL where clause corresponding to parameter PARAM1]]></parameterDescription>
<defaultValueExpression><![CDATA[$P{PARAM1} != null ? " $X{EQUAL, COLUMN1, PARAM1} " : " "]]></defaultValueExpression>
</parameter>
and use the $P!{P_DYNAMIC_WHERE_CLAUSE} syntax in the queryString.
For instance:
<queryString>
<![CDATA[SELECT /* my_jasper_report */ column1
FROM my_table
WHERE (1=1)
$P!{P_DYNAMIC_WHERE_CLAUSE}
]]>
</queryString>