From 9492826b0816ed974d80555e584d3b577e17d68b Mon Sep 17 00:00:00 2001 From: mav-adhoc Date: Thu, 1 Feb 2024 11:20:24 -0300 Subject: [PATCH] [MIG] okr: Migration to 17.0 --- okr/__manifest__.py | 9 +++++---- okr/ir.model.access.csv | 5 ----- okr/models/okr_key_result.py | 5 ++++- okr/security/ir.model.access.csv | 3 +++ okr/views/okr_key_result_views.xml | 10 ++++++---- okr/views/okr_objective_views.xml | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) delete mode 100644 okr/ir.model.access.csv create mode 100644 okr/security/ir.model.access.csv diff --git a/okr/__manifest__.py b/okr/__manifest__.py index 7d23bd94..0f1fe453 100644 --- a/okr/__manifest__.py +++ b/okr/__manifest__.py @@ -1,17 +1,18 @@ { "name": "OKR", "author": "Adhoc SA", - "version": "16.0.1.0", + "version": "17.0.1.0.0", "depends": [ 'base', + 'hr', ], - "views":[ + "data": [ 'security/ir.model.access.csv', + 'views/okr_objective_views.xml', 'views/okr_key_result_views.xml', - 'views/okr_objective_views.xml.xml', ], "license": "AGPL-3", "installable": True, "auto_install": False, - "application": False, + "application": True, } diff --git a/okr/ir.model.access.csv b/okr/ir.model.access.csv deleted file mode 100644 index e4666e16..00000000 --- a/okr/ir.model.access.csv +++ /dev/null @@ -1,5 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_okr_key_result,access_okr_key_result,model_okr_key_result,okr_key_result_user,1,0,0,0 -access_okr_key_result,access_okr_key_result,model_okr_key_result,okr_key_result_manager,1,1,1,1 -access_okr_objective,access_okr_objective,model_okr_objective,okr_objective_user,1,0,0,0 -access_okr_objective,access_okr_objective,model_okr_objective,okr_objective_manager,1,1,1,1 diff --git a/okr/models/okr_key_result.py b/okr/models/okr_key_result.py index 4f540cb1..9c3e4145 100644 --- a/okr/models/okr_key_result.py +++ b/okr/models/okr_key_result.py @@ -32,4 +32,7 @@ class OkrKeyResult(models.Model): @api.depends('result', 'target') def _compute_progress(self): for rec in self: - rec.progress = (rec.result / rec.target)*100 + if rec.target: + rec.progress = (rec.result / rec.target)*100 + else: + rec.progress = 0 diff --git a/okr/security/ir.model.access.csv b/okr/security/ir.model.access.csv new file mode 100644 index 00000000..1ef71303 --- /dev/null +++ b/okr/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +okr.access_okr_objective,access_okr_objective,model_okr_objective,base.group_user,1,1,1,1 +okr.access_okr_key_result,access_okr_key_result,model_okr_key_result,base.group_user,1,1,1,1 diff --git a/okr/views/okr_key_result_views.xml b/okr/views/okr_key_result_views.xml index f2b7c615..c518fc57 100644 --- a/okr/views/okr_key_result_views.xml +++ b/okr/views/okr_key_result_views.xml @@ -19,9 +19,11 @@ - - - + + + + + @@ -48,6 +50,6 @@ tree,form - + diff --git a/okr/views/okr_objective_views.xml b/okr/views/okr_objective_views.xml index 2e36de70..5264c6ac 100644 --- a/okr/views/okr_objective_views.xml +++ b/okr/views/okr_objective_views.xml @@ -42,6 +42,6 @@ tree,form - +