Trigger Odoo's Scheduled Action During Specific Hours (e.g. everyday every 1AM to 6AM)











up vote
0
down vote

favorite
1












I want to have Scheduled Action that executes one after another from 1AM to 6AM everyday.



How can I achieve this?



Since the only menus I have are "Execute Every" and "Next Execution Date" I do not know how can I mention the specific hours range. I am using Odoo 11.










share|improve this question






















  • Do you have multiple actions or one action which should be repeated every x min from 1AM to 6AM?
    – CZoellner
    Nov 8 at 15:09










  • One action that is executed from 1AM to 6AM. If the action finishes at 2AM it executed again.
    – notalentgeek
    Nov 12 at 14:57










  • That's not possible with Odoo Vanilla. So you need a customization for it. I didn't find a custom module, but i only looked into the OCA repositories.
    – CZoellner
    Nov 12 at 17:39















up vote
0
down vote

favorite
1












I want to have Scheduled Action that executes one after another from 1AM to 6AM everyday.



How can I achieve this?



Since the only menus I have are "Execute Every" and "Next Execution Date" I do not know how can I mention the specific hours range. I am using Odoo 11.










share|improve this question






















  • Do you have multiple actions or one action which should be repeated every x min from 1AM to 6AM?
    – CZoellner
    Nov 8 at 15:09










  • One action that is executed from 1AM to 6AM. If the action finishes at 2AM it executed again.
    – notalentgeek
    Nov 12 at 14:57










  • That's not possible with Odoo Vanilla. So you need a customization for it. I didn't find a custom module, but i only looked into the OCA repositories.
    – CZoellner
    Nov 12 at 17:39













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I want to have Scheduled Action that executes one after another from 1AM to 6AM everyday.



How can I achieve this?



Since the only menus I have are "Execute Every" and "Next Execution Date" I do not know how can I mention the specific hours range. I am using Odoo 11.










share|improve this question













I want to have Scheduled Action that executes one after another from 1AM to 6AM everyday.



How can I achieve this?



Since the only menus I have are "Execute Every" and "Next Execution Date" I do not know how can I mention the specific hours range. I am using Odoo 11.







odoo odoo-11






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 7 at 18:25









notalentgeek

544619




544619












  • Do you have multiple actions or one action which should be repeated every x min from 1AM to 6AM?
    – CZoellner
    Nov 8 at 15:09










  • One action that is executed from 1AM to 6AM. If the action finishes at 2AM it executed again.
    – notalentgeek
    Nov 12 at 14:57










  • That's not possible with Odoo Vanilla. So you need a customization for it. I didn't find a custom module, but i only looked into the OCA repositories.
    – CZoellner
    Nov 12 at 17:39


















  • Do you have multiple actions or one action which should be repeated every x min from 1AM to 6AM?
    – CZoellner
    Nov 8 at 15:09










  • One action that is executed from 1AM to 6AM. If the action finishes at 2AM it executed again.
    – notalentgeek
    Nov 12 at 14:57










  • That's not possible with Odoo Vanilla. So you need a customization for it. I didn't find a custom module, but i only looked into the OCA repositories.
    – CZoellner
    Nov 12 at 17:39
















Do you have multiple actions or one action which should be repeated every x min from 1AM to 6AM?
– CZoellner
Nov 8 at 15:09




Do you have multiple actions or one action which should be repeated every x min from 1AM to 6AM?
– CZoellner
Nov 8 at 15:09












One action that is executed from 1AM to 6AM. If the action finishes at 2AM it executed again.
– notalentgeek
Nov 12 at 14:57




One action that is executed from 1AM to 6AM. If the action finishes at 2AM it executed again.
– notalentgeek
Nov 12 at 14:57












That's not possible with Odoo Vanilla. So you need a customization for it. I didn't find a custom module, but i only looked into the OCA repositories.
– CZoellner
Nov 12 at 17:39




That's not possible with Odoo Vanilla. So you need a customization for it. I didn't find a custom module, but i only looked into the OCA repositories.
– CZoellner
Nov 12 at 17:39












1 Answer
1






active

oldest

votes

















up vote
0
down vote













You can use a wrapper action which is scheduled to run more frequently.



def action_function():
# you will need to store a value (is_running: True|False) in the database, maybe in ir.config_parameter
if current_hour not in (1, 2, 3, 4, 5):
return None
elif is_running:
return None
else:
# Mark that the action is in process, have to commit to the database
is_running = True
self.env.cr.commit()
# Then call your actual action function
do_some_real_thing()
# Mark that the action is done
is_running = False


Basically, the wrapper action of below steps repeats frequently like every 10 minutes.




  • Check the time, if not between 1am and 6am, do nothing;

  • Check if the action is already running, if yes, do nothing;

  • Else, mark that the action as in process, and do the actual thing,
    once done, mark the action as finished.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53195565%2ftrigger-odoos-scheduled-action-during-specific-hours-e-g-everyday-every-1am-t%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You can use a wrapper action which is scheduled to run more frequently.



    def action_function():
    # you will need to store a value (is_running: True|False) in the database, maybe in ir.config_parameter
    if current_hour not in (1, 2, 3, 4, 5):
    return None
    elif is_running:
    return None
    else:
    # Mark that the action is in process, have to commit to the database
    is_running = True
    self.env.cr.commit()
    # Then call your actual action function
    do_some_real_thing()
    # Mark that the action is done
    is_running = False


    Basically, the wrapper action of below steps repeats frequently like every 10 minutes.




    • Check the time, if not between 1am and 6am, do nothing;

    • Check if the action is already running, if yes, do nothing;

    • Else, mark that the action as in process, and do the actual thing,
      once done, mark the action as finished.






    share|improve this answer

























      up vote
      0
      down vote













      You can use a wrapper action which is scheduled to run more frequently.



      def action_function():
      # you will need to store a value (is_running: True|False) in the database, maybe in ir.config_parameter
      if current_hour not in (1, 2, 3, 4, 5):
      return None
      elif is_running:
      return None
      else:
      # Mark that the action is in process, have to commit to the database
      is_running = True
      self.env.cr.commit()
      # Then call your actual action function
      do_some_real_thing()
      # Mark that the action is done
      is_running = False


      Basically, the wrapper action of below steps repeats frequently like every 10 minutes.




      • Check the time, if not between 1am and 6am, do nothing;

      • Check if the action is already running, if yes, do nothing;

      • Else, mark that the action as in process, and do the actual thing,
        once done, mark the action as finished.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        You can use a wrapper action which is scheduled to run more frequently.



        def action_function():
        # you will need to store a value (is_running: True|False) in the database, maybe in ir.config_parameter
        if current_hour not in (1, 2, 3, 4, 5):
        return None
        elif is_running:
        return None
        else:
        # Mark that the action is in process, have to commit to the database
        is_running = True
        self.env.cr.commit()
        # Then call your actual action function
        do_some_real_thing()
        # Mark that the action is done
        is_running = False


        Basically, the wrapper action of below steps repeats frequently like every 10 minutes.




        • Check the time, if not between 1am and 6am, do nothing;

        • Check if the action is already running, if yes, do nothing;

        • Else, mark that the action as in process, and do the actual thing,
          once done, mark the action as finished.






        share|improve this answer












        You can use a wrapper action which is scheduled to run more frequently.



        def action_function():
        # you will need to store a value (is_running: True|False) in the database, maybe in ir.config_parameter
        if current_hour not in (1, 2, 3, 4, 5):
        return None
        elif is_running:
        return None
        else:
        # Mark that the action is in process, have to commit to the database
        is_running = True
        self.env.cr.commit()
        # Then call your actual action function
        do_some_real_thing()
        # Mark that the action is done
        is_running = False


        Basically, the wrapper action of below steps repeats frequently like every 10 minutes.




        • Check the time, if not between 1am and 6am, do nothing;

        • Check if the action is already running, if yes, do nothing;

        • Else, mark that the action as in process, and do the actual thing,
          once done, mark the action as finished.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 20:32









        mingtwo_h9

        462




        462






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53195565%2ftrigger-odoos-scheduled-action-during-specific-hours-e-g-everyday-every-1am-t%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()