
from openerp.openupgrade import openupgrade


@openupgrade.migrate()
def migrate(cr, version):
    cr.execute(
        "UPDATE base_action_rule SET kind = 'on_create_or_write', "
        "filter_pre_id = null, trg_date_id = null, trg_date_range = null, "
        "trg_date_range_type = null"
    )


from openerp.openupgrade import openupgrade


@openupgrade.migrate()
def migrate(cr, version):
    cr.execute(
        "UPDATE base_action_rule SET kind = 'on_create_or_write', "
        "filter_pre_id = null, trg_date_id = null, trg_date_range = null, "
        "trg_date_range_type = null where trg_date_id = null"
    )
    cr.exceute(
        "UPDATE base_action_rule SET kind = 'on_time', "
        "filter_pre_id = null where trg_date_id != null"
    )

Set action rules kind to 'on_time'
Set action rules kind to 'on_time'
  
  from openerp.openupgrade import openupgrade
  
  
  @openupgrade.migrate()
  def migrate(cr, version):
      cr.execute(
          "UPDATE base_action_rule SET kind = 'on_create_or_write', "
          "filter_pre_id = null, trg_date_id = null, trg_date_range = null, "
-         "trg_date_range_type = null"
+         "trg_date_range_type = null where trg_date_id = null"
+     )
+     cr.exceute(
+         "UPDATE base_action_rule SET kind = 'on_time', "
+         "filter_pre_id = null where trg_date_id != null"
      )
  
Set action rules kind to 'on_time'
## Code Before:

from openerp.openupgrade import openupgrade


@openupgrade.migrate()
def migrate(cr, version):
    cr.execute(
        "UPDATE base_action_rule SET kind = 'on_create_or_write', "
        "filter_pre_id = null, trg_date_id = null, trg_date_range = null, "
        "trg_date_range_type = null"
    )

## Instruction:
Set action rules kind to 'on_time'
## Code After:

from openerp.openupgrade import openupgrade


@openupgrade.migrate()
def migrate(cr, version):
    cr.execute(
        "UPDATE base_action_rule SET kind = 'on_create_or_write', "
        "filter_pre_id = null, trg_date_id = null, trg_date_range = null, "
        "trg_date_range_type = null where trg_date_id = null"
    )
    cr.exceute(
        "UPDATE base_action_rule SET kind = 'on_time', "
        "filter_pre_id = null where trg_date_id != null"
    )
