Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated develop with 1.3 #192

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading