Skip to content

Commit

Permalink
fix changes based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
agent-z28 committed Oct 15, 2024
1 parent a403e98 commit 028dfc1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
4 changes: 0 additions & 4 deletions account_dms_field/demo/account_dms_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,4 @@
<field name="user_field_id" ref="account.field_account_move__user_id" />
<field name="group_ids" eval="[(4, ref('read_access_account_move_group'))]" />
</record>

<function model="dms.field.template" name="_create_dms_directory">
<value eval="[ref('field_template_account')]" />
</function>
</odoo>
3 changes: 1 addition & 2 deletions account_dms_field/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import dms_field_template
from . import account_move
from . import dms_directory
from . import dms_field_template
14 changes: 6 additions & 8 deletions account_dms_field/models/dms_field_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
class DmsFieldTemplate(models.Model):
_inherit = "dms.field.template"

def _create_dms_directory(self):
"""New method to define the directory automatically in demo data avoiding
error if it already exists."""
self.ensure_one()
if not self.dms_directory_ids:
self.with_context(
res_model=self._name, res_id=self.id
).create_dms_directory()
def _prepare_directory_vals(self, directory, record):
vals = super()._prepare_directory_vals(directory, record)
if "/" not in vals["name"]:
return vals
vals["name"] = vals["name"].replace("/", "-")
return vals
4 changes: 0 additions & 4 deletions account_dms_field/tests/test_account_dms_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ def setUp(self):
)

def test_01_account_document_directory(self):
template_ctx = self.template.with_context(
res_model=self.template._name, res_id=self.template.id
)
template_ctx._create_dms_directory()
account_move = self.account_model.create(
{
"partner_id": self.partner.id,
Expand Down

0 comments on commit 028dfc1

Please sign in to comment.