From 0b6c9503926853725a02f08c785b07d7753f07d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 19 Nov 2024 10:19:13 +0100 Subject: [PATCH] [IMP] dms_field: Add partner embedded DMS template Fixes https://github.com/OCA/dms/issues/377 --- dms_field/demo/partner_dms.xml | 16 ++++++++++++++++ dms_field/tests/test_dms_field.py | 15 +-------------- .../tests/test_dms_field_auto_classification.py | 1 + 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/dms_field/demo/partner_dms.xml b/dms_field/demo/partner_dms.xml index 2faa85980..a4737e8bc 100644 --- a/dms_field/demo/partner_dms.xml +++ b/dms_field/demo/partner_dms.xml @@ -16,4 +16,20 @@ + + Admin (dms_field module) + True + True + True + + + + Partner + + + + diff --git a/dms_field/tests/test_dms_field.py b/dms_field/tests/test_dms_field.py index a96ca43f8..5ea9ef4ed 100644 --- a/dms_field/tests/test_dms_field.py +++ b/dms_field/tests/test_dms_field.py @@ -27,23 +27,10 @@ def setUpClass(cls): {"name": "Test group", "users": [(4, cls.user_a.id)]} ) cls.user_b = new_test_user(cls.env, login="test-user-b") - cls.template = cls.env["dms.field.template"].create( - { - "name": "Partner", - "storage_id": cls.env.ref("dms.storage_demo").id, - "model_id": cls.env.ref("base.model_res_partner").id, - "group_ids": [(4, cls.env.ref("dms.access_group_01_demo").id)], - "directory_format_name": "{{object.display_name}}", - } - ) + cls.template = cls.env.ref("dms_field.field_template_partner") cls.template.group_ids.group_ids = [(4, cls.group.id)] cls.template.group_ids.explicit_user_ids = [(4, cls.user_b.id)] cls.storage = cls.template.storage_id - template_ctx = cls.template.with_context( - res_model=cls.template._name, res_id=cls.template.id - ) - template_ctx.create_dms_directory() - cls.template.invalidate_model() cls.directory = cls.template.dms_directory_ids cls.subdirectory_1 = cls.env["dms.directory"].create( { diff --git a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py index c8424cec1..68aae6a02 100644 --- a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py +++ b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py @@ -22,6 +22,7 @@ def setUpClass(cls): ) access_group = cls.env.ref("dms.access_group_01_demo") access_group.explicit_user_ids = [(4, cls.user.id)] + cls.env.ref("dms_field.field_template_partner").unlink() file_template = cls.env["dms.field.template"].create( { "name": "Test partner template",