Odoo Automation On Update Run More than Once, How To Restrict? - automation

I'm currently using Odoo 12.0+e-20181025 and I'm currently using the Automated Action feature of it to send email whenever the ticket has been updated by someone. I put two different actions, one is to send an email while the other is to make an internal log in the internal log (logger) of the ticket.
The on update domain is as the following:
["&",["user_id","!=",False],["team_id","!=",False]]
At first, it works. But then I noticed that some of them tend to be activated more than once, six (6) times to be exact. As I tried to look for the culprit, I found that it was whenever I choose the "Assigned to" field and/or "Helpdesk Team" field. For some reason I don't know, every time I changed them, the system perceived it as more than one update. It will work normal on any other field.
Can anyone help me how to either (1) make my domain in the automated action work only once each time or (2) how to make the system read my action of filling the field as only one update.Any help is greatly appreciated.
Thank you

Here is what I suggest to restrict multiple attempts from scheduled action.
Add a flag (boolean) field on your target object,
When a scheduled action is executed, search only flag = False,
Afterwards, when you done with event email send, update current record set with flag = True
Now, flag = True will never fetch by scheduled action --- see 2nd point.

Related

Change RZ11 Profile parameters programmatically

I was asked by the IT Department to write an ABAP program that switches the profile parameter login/server_logon_restriction from 0 to 1 and back automatically triggered (time etc) on all of our SAP servers.
I am not very familiar in the SAP environment yet and until now I managed to get the wanted parameter by using:
RSAN_SYSTEM_PARAMETERS_GET
and
RSAN_SYSTEM_PARAMETERS_READ
But I cannot find anything to change and save them dynamically. Is this even possible?
Cheers, Nils
login/server_logon_restriction parameter dynamic so you can change it via cl_spfl_profile_parameter=>change_value class method.
You can configure background job for automatically trigger it in t-code SM36.
The method don't save the given value to profile file, so the parameter turn back profile value after system restart.
Current logged-in users can continue to use system. May be you can want to inform them with TH_POPUP function then kick from the system.

Listing current Ignite jobs and cancelling them

I got a partial answer here but not exactly what I wanted.
The link describes how to get a list of task futures but what I'd really like to be able to do is list out and cancel individual jobs (that might be hung, long running etc etc). I've seen another post implying that this is not possible but I'd like to confirm (see second link)
Thanks
http://apache-ignite-users.70518.x6.nabble.com/How-can-I-obtain-a-list-of-executing-jobs-on-an-ignite-node-td8841.html
http://apache-ignite-users.70518.x6.nabble.com/Cancel-tasks-on-Ignite-compute-grid-worker-nodes-td5027.html
Yes, this is not possible and actually I'm not sure how this can be done in general case. Imagine there are 5 jobs running and you want to cancel one of them. How are you going to identify it? It seems to be very use case specific to me.
However, you can always implement your own mechanism to do this. One of the possible ways is to use ComputeTaskSession API and task attributes. E.g., set a special attribute that will act as signal for job cancellation and create attribute listener that will stop job execution accordingly.

How to use Automated actions in Odoo 8?

I wanted to send emails a day(fewdays) before a particular due date.
I went on to try with automation actions and was confused with on how it would work
and also the server action for that respective automated action
I would like to know whether "based on timed condition" works or does not work, as far as I have tried and researched, this seems to be a bug or which does not work.
Automated Actions do work, and are quite useful.
One catch with timed conditions is that they are triggered once and only once for each document/record, when the time condition is reached for the first time.
If you are playing around with timed conditions and use the same document/record for your tests, it will seem that later tries don't work, since triggered once it won't be triggered again.
In this scenario, you need to test changes to the Automated Action using a different test record.
Other things that might be wrong:
Your outgoing email might not be working properly.
The filter in your Automated Action might not be correct. Make sure you test it on a list view, and that the "User" field is blank.

CQS and CRUD operation

I working on high-scalability web site for learning purpose. I decided to use CQS pattern and some ideas of CQRS. I have separate write and read layers used by command handlers and event handlers which system sends and receives from message buses (two separate message- buses).
I have some problem dealing with commands. I read that command shouldn't return anything. And now the point is: for example I have a form on with user can create an event or for example change something in his profile (photo or name). After user clicked save i want to show him, his profile or add a new event to his wall. But how can I know that his profile has been already updated when command is only send to the bus ? I How connect idea of command and CRUD operations ? Or maybe this wrong idea at all ?
Well first off, the split should not be between commands and events, but rather between domain and read models. You can't really map CQRS commands to CRUD operations as a general rule, although most of the commands in your system will change the state of your repositories. I will give you a general overview of how this works. Say you want to add a user, you create a command AddUserCommand and assign an id to that message. On the back end, you have an handler for that command and you're right that the command does not return nothing. Once that command is handled you should publish and event reflecting the change: UserWasAddedEvent. The id of this message will be unique, but it can and should have an id related to the command which you created in the UI. Your read models should handle the event and update a read model with the command status (waiting, processing, completedOnError, completedSuccessfully) depending on the event you published. On the UI after you submited the command, you should start querying the read models whith the ID of the command you created to get the status and then update your UI accordigly.
Your right that CQRS handlers return void, but you should bear in mind that typically in an architecture like this, the backend should return the validation results of the submited commands, not the handler itself but the infrastucture around your cqrs handlers.
Just update te UI on the assumption the command succeeds - which most of the time it will.
If validation is required on the user input, you could run validation as the user types or tabs to increase the likelyhood the command will succeed.

Can I stop certain sections of code excution after it's intetend function or work is done?

Sorry for not posting any code as I have no idea about this logic.
I have a while loop where it runs as soon as the user presses the button and stops after he presses again. But I have a condition that needed to be checked for small period of time until it's condition gets satisfied(Timer will not satisfy my need). So I want to execute that part of code until it satisfies that condition and after that I do not need that part of the code to check that condition or in other words I want the program to stop executing that part of code so that I can save my execution time wasted for that part of code.
So is this possible? Or it's something that we can not achieve in programming?
Please note, I don't want to implement a timer to get this done!
Edited(Work i need to established)
It's accelerometer updates that i m checking...Updates start as the user presses the button. I have set a condition to check whether it exceeds a certain value, If exceeded i wanted to store a count to a global variable. Then after as i said, I dnt need it to repeat checking for that condition.As i m not going to stop accel data once started unless stop by the user by pressing the button?
I have no idea what your code will look like... but yes, this is something you can easily accomplish via Notifications (i.e. register for "NSNotifications" and when some condition is satisfied, it posts a notification and then any other objects listening will run a selector to "stop"). Or you can have your other threads monitoring some condition via Key-Value-Observing, so when some BOOL condition (that each of your sections of code are observing) changes, they can finish up whatever they're doing.
Hopefully this makes sense so far, but the overall idea is "yes, what you're asking for shouldn't be too hard to do".
while(mainCondition)
{
if(!extraCondidion)
{
// Do extra bit of code only until extra condition is met
}
// Do normal code that runs before and after extra condition is met
}