Skip to content

Commit

Permalink
FIX: issues on adding document
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Dec 21, 2024
1 parent ee52fc1 commit 09428d8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions plm_box/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,14 @@ def checkOutOrFalse(self, docDict):
return False

@api.model
def saveBoxDocRel(self, docDict,doc_id):
docName = docDict.get("docName", "")
boxName = docDict.get("boxName", "")
def saveBoxDocRel(self,
box_id,
doc_id):
boxObj = self.env.get("plm.box")
boxBrwsList = boxObj.search([("name", "=", boxName)])
for boxBrws in boxBrwsList:
docId = self.search([("name", "=", docName)]).ids
if docId:
res = boxBrws.write({"document_rel": [(4, docId[0])]})
return res
for boxBrws in boxObj.search([("id", "=", box_id)]):
if doc_id:
res = boxBrws.write({"document_rel": [(4, doc_id)]})
return True
return False

@api.model
Expand Down

0 comments on commit 09428d8

Please sign in to comment.