Skip to content
Extraits de code Groupes Projets
Valider d9df680b rédigé par Juliana's avatar Juliana
Parcourir les fichiers

[UPD]Change function module fil_gene_alfre

parent 92daf319
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -142,7 +142,8 @@ class AdefpatProjectJustifZip(models.TransientModel):
file_name = "justifs_factures_fournisseurs_" + str(date.today()) + "_" + self.type_convention_id.name
else:
file_name = "justifs_factures_fournisseurs_" + str(date.today())
self.create_json_file(file_name, virtual_json)
json_file_cmis = self.env.user.company_id.proof_justif_cmis
self.create_json_file(file_name, virtual_json, json_file_cmis)
@api.multi
def build_facture_client(self):
......@@ -170,7 +171,8 @@ class AdefpatProjectJustifZip(models.TransientModel):
file_name = "justifs_factures_clients_" + str(date.today()) + "_" + self.type_convention_id.name
else:
file_name = "justifs_factures_clients_" + str(date.today())
self.create_json_file(file_name, virtual_json)
json_file_cmis = self.env.user.company_id.proof_justif_cmis
self.create_json_file(file_name, virtual_json, json_file_cmis)
@api.multi
def build_expense_zip(self):
......@@ -215,56 +217,5 @@ class AdefpatProjectJustifZip(models.TransientModel):
else:
file_name = "justifs_frais_" + str(
date.today())
self.create_json_file(file_name, virtual_json)
def create_json_file(self, file_name, virtual_json):
backend = self.env['cmis.backend'].search([], limit=1)
json_file_cmis = self.env.user.company_id.proof_justif_cmis
parent_path = backend.get_cmis_repository().getFolder(
json_file_cmis).getPaths()
path_to_create = parent_path + [file_name]
path = '/'.join(path_to_create)
try:
# Mise à jour des propriétés du dossier virtuel
cmis_folder = backend.get_folder_by_path(path)
js = json.dumps(virtual_json, indent=4)
prop = {
'cmis:secondaryObjectTypeIds': ['P:adefpat:justificatif'],
}
repo = backend.get_cmis_repository().getObject(json_file_cmis)
file = repo.createDocument(
name=file_name + ".json",
properties=prop,
contentFile=js,
contentType="application/json"
)
noderef_file_id = file.getProperties().get('alfcmis:nodeRef')
prop_folder = {
'cmis:secondaryObjectTypeIds': [
'P:smf:customConfigSmartFolder',
'P:cm:taggable',
'P:up:UploadFolder',
'P:cm:titled',
'P:sys:localized'
],
}
cmis_folder.updateProperties(prop_folder)
noderef_folder_id = cmis_folder.getProperties().get('cmis:objectId')
url = '/alfresco/s/api/node/workspace/SpacesStore/' + noderef_folder_id + '/formprocessor'
result = self.alfresco_get_by_url(
url=url,
call_type='post',
json={
"assoc_smf_custom-template-association_added": noderef_file_id
},
backend=backend)
except Exception as e:
raise UserError(json.loads(e.details).get('message'))
\ No newline at end of file
self.create_json_file(file_name, virtual_json, json_file_cmis)
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter