Skip to content

Commit

Permalink
Merge PR #368 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 1, 2024
2 parents 508669d + 89c9848 commit 3c6d545
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
10 changes: 10 additions & 0 deletions dms_field/models/dms_field_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ def _compute_model(self):
def _get_template_from_model(self, model):
return self.search([("model", "=", model)], limit=1)

@api.model_create_multi
def create(self, vals_list):
"""Create dms directory automatically in the creation in install mode."""
result = super().create(vals_list)
if self.env.context.get("install_mode"):
for item in result:
item_ctx = item.with_context(res_model=item._name, res_id=item.id)
item_ctx.create_dms_directory()
return result

@api.model
def create_dms_directory(self):
"""According to the model, create the directory linked to that record
Expand Down
3 changes: 0 additions & 3 deletions hr_dms_field/demo/dms_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@
<field name="user_field_id" ref="hr.field_hr_employee__user_id" />
<field name="group_ids" eval="[(4, ref('read_access_hr_employee_group'))]" />
</record>
<function model="dms.field.template" name="_create_dms_directory">
<value eval="[ref('field_template_employee')]" />
</function>
</odoo>
1 change: 0 additions & 1 deletion hr_dms_field/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import dms_field_template
from . import hr_employee
from . import hr_employee_public
17 changes: 0 additions & 17 deletions hr_dms_field/models/dms_field_template.py

This file was deleted.

0 comments on commit 3c6d545

Please sign in to comment.