Skip to content

Commit

Permalink
[FIX] dms: Improve search by model
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella authored and victoralmau committed Jan 18, 2024
1 parent ef8782f commit 974fa83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dms/models/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class Storage(models.Model):
help="Indicate if directories and files auto-create in mail "
"composition process too",
)
model = fields.Char(search="_search_model", store=False)

def _search_model(self, operator, value):
allowed_items = self.env["ir.model"].sudo().search([("model", operator, value)])
return [("model_ids", "in", allowed_items.ids)]

Check warning on line 105 in dms/models/storage.py

View check run for this annotation

Codecov / codecov/patch

dms/models/storage.py#L104-L105

Added lines #L104 - L105 were not covered by tests

@api.onchange("save_type")
def _onchange_save_type(self):
Expand Down

0 comments on commit 974fa83

Please sign in to comment.