odoo-addon-dms 16.0.1.8.1__py3-none-any.whl → 16.0.1.8.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ Document Management System
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:a204637d29c3762955a5d324a79237c44f2a05581eeb8072afac98f8723a14ee
10
+ !! source digest: sha256:47e1474a4f285eefc01f31e5393d7ec85323c8f27d7cd2044cd55fa12da5fe96
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "name": "Document Management System",
6
6
  "summary": """Document Management System for Odoo""",
7
- "version": "16.0.1.8.1",
7
+ "version": "16.0.1.8.2",
8
8
  "category": "Document Management",
9
9
  "license": "LGPL-3",
10
10
  "website": "https://github.com/OCA/dms",
@@ -134,8 +134,11 @@ class DmsSecurityMixin(models.AbstractModel):
134
134
  continue
135
135
  domains.append([("res_model", "=", model._name), ("res_id", "=", False)])
136
136
  # Check record access in batch too
137
- group_ids = [i for i in group["res_id"] if i] # Hack to remove None res_id
138
- related_ok = model.browse(group_ids)._filter_access_rules_python(operation)
137
+ res_ids = [i for i in group["res_id"] if i] # Hack to remove None res_id
138
+ # Apply exists to skip records that do not exist. (e.g. a res.partner deleted
139
+ # by database).
140
+ model_records = model.browse(res_ids).exists()
141
+ related_ok = model_records._filter_access_rules_python(operation)
139
142
  if not related_ok:
140
143
  continue
141
144
  domains.append(
@@ -1,6 +1,7 @@
1
1
  # Copyright 2021 Tecnativa - Víctor Martínez
2
2
  # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
3
3
  from odoo import api, models
4
+ from odoo.tools import ormcache
4
5
 
5
6
 
6
7
  class IrAttachment(models.Model):
@@ -35,9 +36,26 @@ class IrAttachment(models.Model):
35
36
  }
36
37
  )
37
38
 
39
+ @ormcache("model")
40
+ def _dms_operations_from_model(self, model):
41
+ # Apply sudo to prevent ir.rule from being applied.
42
+ item = self.env["dms.storage"].sudo().search([("model_ids.model", "=", model)])
43
+ return bool(item)
44
+
38
45
  def _dms_operations(self):
46
+ """Perform the operation only if there is a storage with linked models.
47
+ The directory (dms.directory) linked to the record (if it does not exist)
48
+ and the file (dms.file) with the linked attachment would be created.
49
+ """
39
50
  for attachment in self:
40
- if not attachment.res_model or not attachment.res_id:
51
+ if (
52
+ not attachment.res_model
53
+ or not attachment.res_id
54
+ or (
55
+ attachment.res_model
56
+ and not self._dms_operations_from_model(attachment.res_model)
57
+ )
58
+ ):
41
59
  continue
42
60
  directories = attachment._get_dms_directories(
43
61
  attachment.res_model, attachment.res_id
@@ -145,3 +145,9 @@ class Storage(models.Model):
145
145
  def _compute_count_storage_files(self):
146
146
  for record in self:
147
147
  record.count_storage_files = len(record.storage_file_ids)
148
+
149
+ def write(self, values):
150
+ res = super().write(values)
151
+ if "model_ids" in values:
152
+ self.env["ir.attachment"].clear_caches()
153
+ return res
@@ -367,7 +367,7 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:a204637d29c3762955a5d324a79237c44f2a05581eeb8072afac98f8723a14ee
370
+ !! source digest: sha256:47e1474a4f285eefc01f31e5393d7ec85323c8f27d7cd2044cd55fa12da5fe96
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
372
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/dms/tree/16.0/dms"><img alt="OCA/dms" src="https://img.shields.io/badge/github-OCA%2Fdms-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/dms&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
373
  <p>DMS is a module for creating, managing and viewing document files directly
@@ -29,6 +29,19 @@ class StorageAttachmentTestCase(StorageAttachmentBaseCase):
29
29
  self.assertFalse(file_01.exists())
30
30
  self.assertFalse(directory.exists())
31
31
 
32
+ @users("dms-manager")
33
+ def test_storage_attachment_record_db_unlink(self):
34
+ self._create_attachment("demo.txt")
35
+ self.assertTrue(
36
+ self.storage.storage_file_ids.filtered(lambda x: x.name == "demo.txt")
37
+ )
38
+ directory = self._get_partner_directory()
39
+ self.assertEqual(directory.res_model, self.partner._name)
40
+ self.assertEqual(directory.res_id, self.partner.id)
41
+ directory.res_id = -1 # Trick to reference a non-existing record
42
+ directories = self.env["dms.directory"].search([])
43
+ self.assertNotIn(directory.id, directories.ids)
44
+
32
45
  @users("dms-manager")
33
46
  def test_storage_attachment_misc(self):
34
47
  attachment = self._create_attachment("demo.txt")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-dms
3
- Version: 16.0.1.8.1
3
+ Version: 16.0.1.8.2
4
4
  Summary: Document Management System for Odoo
5
5
  Home-page: https://github.com/OCA/dms
6
6
  Author: MuK IT, Tecnativa, Odoo Community Association (OCA)
@@ -22,7 +22,7 @@ Document Management System
22
22
  !! This file is generated by oca-gen-addon-readme !!
23
23
  !! changes will be overwritten. !!
24
24
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25
- !! source digest: sha256:a204637d29c3762955a5d324a79237c44f2a05581eeb8072afac98f8723a14ee
25
+ !! source digest: sha256:47e1474a4f285eefc01f31e5393d7ec85323c8f27d7cd2044cd55fa12da5fe96
26
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
27
 
28
28
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,6 +1,6 @@
1
- odoo/addons/dms/README.rst,sha256=CQsgWWKm3PJEXrdx5Bcmrvv2YgEnbALr2SesVxY1AwQ,7748
1
+ odoo/addons/dms/README.rst,sha256=PPlr5S6hXWi7iOO4QMl4QlAAV-YwbTMdxBeUb0wY6hU,7748
2
2
  odoo/addons/dms/__init__.py,sha256=dnUeA_K1torbiMNF3tt2dtECdk-FkWm01DByr9MBMIA,69
3
- odoo/addons/dms/__manifest__.py,sha256=voZN5Q5zz9EsHHGTKEnd7v5XILX8EahMUYLazNAa-P8,1863
3
+ odoo/addons/dms/__manifest__.py,sha256=lNRX-nL7Ukev5qtz_q2O9pQBy56StjTlumZObhvo-WE,1863
4
4
  odoo/addons/dms/actions/file.xml,sha256=NlRIQoCbbDSaRmsumJP9dcrNtYpQji74hwhfi5TillE,524
5
5
  odoo/addons/dms/controllers/__init__.py,sha256=akfNDwFGryweTYowOA3DbbP0zvLmQtCdihtGhYvsIPQ,40
6
6
  odoo/addons/dms/controllers/main.py,sha256=9TjOKDeNerPNN4CKL0TWQiqOpNug8pqG6F5uBJO3bkM,1960
@@ -31,13 +31,13 @@ odoo/addons/dms/models/base.py,sha256=t7uhbkDE9L4UdvYJAwPTlX5ff2Y9S01urlFfC3KlLx
31
31
  odoo/addons/dms/models/category.py,sha256=MB36VPKw3DItR5ZYM7CCROO3LDDTpTx87clML966GAs,4132
32
32
  odoo/addons/dms/models/directory.py,sha256=agc1vxXW13w_q18W4Y9arE2zg1b96r-9jBPzyafQWgQ,28826
33
33
  odoo/addons/dms/models/dms_file.py,sha256=khNVtNZ08ddcyVevViUnN-Hhm-jxUqY_lkQwxAw-Wns,25568
34
- odoo/addons/dms/models/dms_security_mixin.py,sha256=PE5o_TvOn746OckncuZs73zVStP348Tlmy9C68PaI2U,9733
35
- odoo/addons/dms/models/ir_attachment.py,sha256=-AwkedqL2cgPZ794O31UIMvchrf_a9TPVE1rEb--CXQ,3248
34
+ odoo/addons/dms/models/dms_security_mixin.py,sha256=DfbwMbV8itLQhZp1I9_uORHG91KeXY9rlhddz0DxZGU,9898
35
+ odoo/addons/dms/models/ir_attachment.py,sha256=aEhmB_nH0aLyOqv4ECKX4yRBUn2txbdMgH0cUa8eCPw,3988
36
36
  odoo/addons/dms/models/mail_thread.py,sha256=ccAn2MHONCncjsJewBrLqMVBl6tmn2kezyJVJq2utVk,583
37
37
  odoo/addons/dms/models/mixins_thumbnail.py,sha256=DCb8wrWTjdQp2ev9SfYHe9LLZuC18c5jSftm2Er9Aho,1466
38
38
  odoo/addons/dms/models/res_company.py,sha256=dyQUHq9H_idTcytaV9QgO1QFWsHBBj_xW2mQHedqY6E,3370
39
39
  odoo/addons/dms/models/res_config_settings.py,sha256=3kAoWaq8j1HRdtuJI-uLStVdVh-qAwza72oLvy9N4Ds,665
40
- odoo/addons/dms/models/storage.py,sha256=lIvjDcW9iJAXrxqBGjP5I-2c55KSb8F_cXDKDJJg_OA,4904
40
+ odoo/addons/dms/models/storage.py,sha256=VGvDINTR2BXz6kJGVbXDkYsXaimYBFVc0rgP7c0IamI,5076
41
41
  odoo/addons/dms/models/tag.py,sha256=Gjz4dTU2NRBdKg1hqeQcVWl85KSf8FEktxp97bJkCII,1729
42
42
  odoo/addons/dms/readme/CONFIGURE.rst,sha256=oECnKyii9btOFtG2E4yyw7gqY36_tKhdg5V-w10SII0,1910
43
43
  odoo/addons/dms/readme/CONTRIBUTORS.rst,sha256=VvXo3gvhZI_HfryjhzEwY7cwYxrhPGfiPD3MXrU144I,413
@@ -50,7 +50,7 @@ odoo/addons/dms/security/ir.model.access.csv,sha256=_SuEwHD3SOXbpLalbr5FqGjPvwtD
50
50
  odoo/addons/dms/security/security.xml,sha256=plasjSwS2w5GK07BvW9obXNOpPgeBLKeEkUJ6Wpc6nA,9085
51
51
  odoo/addons/dms/static/description/icon.png,sha256=8xwcyAfhzMOu_xBinu4KwZsvmqUj6X5aF2LUQvvwdc4,7197
52
52
  odoo/addons/dms/static/description/icon.svg,sha256=cICSzGzl0Z00q7m0yhriujt2ip5_v4ymxAMTGzolxsc,8025
53
- odoo/addons/dms/static/description/index.html,sha256=k3qTVoEbu4qQhOLM5sebbXhtm4m_UDiQ6B8mhmqrOds,20441
53
+ odoo/addons/dms/static/description/index.html,sha256=dMac2YquX3tJdCvUwJOGErJQ-fwRle53IXhvDTq8iDI,20441
54
54
  odoo/addons/dms/static/icons/file_ai.svg,sha256=HeCXVJivVnn6jjj__5WJiLfZv4mrmAamPFek0CwozCc,3343
55
55
  odoo/addons/dms/static/icons/file_aj.svg,sha256=mUbfvaV5_m3zJ3zZKldBbaFz4AZNQNecSZ1W_JCZeE4,3063
56
56
  odoo/addons/dms/static/icons/file_avi.svg,sha256=Pf78IrO6gGsg3aUVguOu6osDwLYz5ceIOLMbTRpya5s,1862
@@ -185,7 +185,7 @@ odoo/addons/dms/tests/test_directory.py,sha256=qVti7SPiLEGl38LHcZnNUshlguP3uDMPG
185
185
  odoo/addons/dms/tests/test_file.py,sha256=U8-RNRPQipIst6Js36Tz1xPHFziRfwFlRSX_6a9D4Rs,4651
186
186
  odoo/addons/dms/tests/test_file_database.py,sha256=et3PD45scSfmQhfR-bGgEglLFkLxKpkSZJPQ4kgdJsM,4715
187
187
  odoo/addons/dms/tests/test_portal.py,sha256=cnoAyxeaESErn4FkTeFzsH4FTr-k0HKDv0CZ76WKjLc,3350
188
- odoo/addons/dms/tests/test_storage_attachment.py,sha256=vGU0isqnvMVMVgb33rdUANdlX-7U_Awh-lF05S_eks0,5237
188
+ odoo/addons/dms/tests/test_storage_attachment.py,sha256=itCx4omjp8gRQn6O7YnIYJTQdTe-02i_5CyIcjPhjDQ,5847
189
189
  odoo/addons/dms/tests/test_storage_database.py,sha256=XN-Se2BgLxgFx_mWqmZ6mClgRoc9odSrD6EEIqLUSMs,3943
190
190
  odoo/addons/dms/tests/data/dms.category.csv,sha256=VBWa6-PEA6__yv_D6CXUZ7xU-8AAxD7z8jWo4sKb8S0,2631
191
191
  odoo/addons/dms/tests/data/dms.directory.csv,sha256=Klh3tEdMt_BB9hWgc_FRUsv_q4Uy-asUut0EuTmnLLU,53514
@@ -210,7 +210,7 @@ odoo/addons/dms/wizards/wizard_dms_file_move.py,sha256=zQouQDJuLWOrjzkksiUaTf0DF
210
210
  odoo/addons/dms/wizards/wizard_dms_file_move_views.xml,sha256=bYWdX_QlMpIOS5gRk7iEyddHKLCvAkvzDxfT3oM1lCo,1931
211
211
  odoo/addons/dms/wizards/wizard_dms_share.py,sha256=s7n6nQy0I6qVsvQ7Z57lfY28wi8tbd9062Bdw-BSoWg,558
212
212
  odoo/addons/dms/wizards/wizard_dms_share_views.xml,sha256=63BhWyowqJ2Yf3RdOdjT6WvC13jXxTKzsJEZXmaHv-A,1230
213
- odoo_addon_dms-16.0.1.8.1.dist-info/METADATA,sha256=nRdv5ZZMDZr90vcT48yqsYLPSMpzBEkKeaBR2v7Rh-g,8269
214
- odoo_addon_dms-16.0.1.8.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
215
- odoo_addon_dms-16.0.1.8.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
216
- odoo_addon_dms-16.0.1.8.1.dist-info/RECORD,,
213
+ odoo_addon_dms-16.0.1.8.2.dist-info/METADATA,sha256=dHzC6i8ocv4jTnor0y5VSfzVKOQWjnikURKFnnx61Vw,8269
214
+ odoo_addon_dms-16.0.1.8.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
215
+ odoo_addon_dms-16.0.1.8.2.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
216
+ odoo_addon_dms-16.0.1.8.2.dist-info/RECORD,,