Skip to content

Commit

Permalink
Merge pull request #192 from mkumar-02/17.0-develop
Browse files Browse the repository at this point in the history
Updated develop with 1.3
  • Loading branch information
shibu-narayanan authored Oct 17, 2024
2 parents 3f0eec5 + 164b034 commit 9a53d43
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions g2p_odk_importer/models/odk_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,6 @@ def import_records(self):
},
}

def import_records_by_cron(self, _id):
config = self.env["odk.config"].browse(_id)
if not config.base_url:
raise UserError(_("Please configure the ODK."))
client = ODKClient(
self.env,
config.id,
config.base_url,
config.username,
config.password,
config.project,
config.form_id,
self.target_registry,
self.json_formatter,
)
client.login()
client.import_delta_records(last_sync_timestamp=config.last_sync_time)
config.update({"last_sync_time": fields.Datetime.now()})

def odk_import_action_trigger(self):
for rec in self:
if rec.job_status == "draft" or rec.job_status == "completed":
Expand All @@ -205,7 +186,7 @@ def odk_import_action_trigger(self):
"interval_type": "minutes",
"model_id": self.env["ir.model"].search([("model", "=", "odk.import")]).id,
"state": "code",
"code": "model.import_records_by_cron(" + str(rec.id) + ")",
"code": "model.browse(" + str(rec.id) + ").import_records()",
"doall": False,
"numbercall": -1,
}
Expand Down

0 comments on commit 9a53d43

Please sign in to comment.