Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] dms_field + hr_dms_field: Create dms directory automatically in the creation in install mode #368

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading