def get_attributes(objectid): """Returns the required attributes for record editing.""" editable_obj = BibWorkflowObject.query.get(objectid) model = get_model_from_obj(editable_obj) sip = model.get_latest_sip() metadata = sip.metadata return model, sip, metadata
def store_record_sip(obj, *args, **kwargs): """Update existing record via `control_number` or create new (SIP).""" from inspirehep.utils.helpers import get_model_from_obj from invenio_records.tasks import create_record as create model = get_model_from_obj(obj) sip = model.get_latest_sip() record = sip.metadata force = False if "control_number" in record: record['recid'] = record.get('control_number') force = True create.delay(json=record, force=force)