Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
publish muk_dms - 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
keshrath committed Jul 5, 2019
1 parent 0198265 commit cb30e29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion muk_dms/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{
"name": "MuK Documents",
"summary": """Document Management System""",
"version": '12.0.2.7.43',
"version": '12.0.2.7.44',
"category": 'Document Management',
"license": "AGPL-3",
"website": "http://www.mukit.at",
Expand Down
16 changes: 12 additions & 4 deletions muk_dms/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,13 @@ class File(models.Model):

category = fields.Many2one(
comodel_name='muk_dms.category',
domain="[('category', '=', False)]",
context="{'dms_category_show_path': True}",
string="Category")

tags = fields.Many2many(
comodel_name='muk_dms.tag',
relation='muk_dms_file_tag_rel',
domain="""[
'|', ['category', '=', False],
['category', 'child_of', category]]
""",
column1='fid',
column2='tid',
string='Tags')
Expand Down Expand Up @@ -391,11 +388,22 @@ def read(self, fields=None, load='_classic_read'):

@api.onchange('category')
def _change_category(self):
res = {'domain': {
'tags': [('category', '=', False)]
}}
if self.category:
res.update({'domain': {
'tags': ['|',
('category', '=', False),
('category', 'child_of', self.category.id)
]
}})
tags = self.tags.filtered(
lambda rec: not rec.category or \
rec.category == self.category
)
self.tags = tags
return res

#----------------------------------------------------------
# Security
Expand Down

0 comments on commit cb30e29

Please sign in to comment.