#88 Action detail codes
* adds codelist 1035 for compensation action detail codes * extends CompensationAction model * extends NewActionForm * extends detail view of compensation action related models * add/updates translations * adds autocomplete tests
This commit is contained in:
@@ -9,7 +9,7 @@ from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from codelist.models import KonovaCode
|
||||
from codelist.settings import CODELIST_COMPENSATION_ACTION_ID
|
||||
from codelist.settings import CODELIST_COMPENSATION_ACTION_ID, CODELIST_COMPENSATION_ACTION_DETAIL_ID
|
||||
from compensation.managers import CompensationActionManager
|
||||
from konova.models import BaseResource
|
||||
|
||||
@@ -39,7 +39,18 @@ class CompensationAction(BaseResource):
|
||||
"code_lists__in": [CODELIST_COMPENSATION_ACTION_ID],
|
||||
"is_selectable": True,
|
||||
"is_archived": False,
|
||||
}
|
||||
},
|
||||
related_name='+',
|
||||
)
|
||||
action_type_details = models.ManyToManyField(
|
||||
KonovaCode,
|
||||
blank=True,
|
||||
limit_choices_to={
|
||||
"code_lists__in": [CODELIST_COMPENSATION_ACTION_DETAIL_ID],
|
||||
"is_selectable": True,
|
||||
"is_archived": False,
|
||||
},
|
||||
related_name='+',
|
||||
)
|
||||
amount = models.FloatField()
|
||||
unit = models.CharField(max_length=100, null=True, blank=True, choices=UnitChoices.choices)
|
||||
|
||||
@@ -95,6 +95,8 @@ class AbstractCompensation(BaseObject, GeoReferencedMixin):
|
||||
comment=form_data["comment"],
|
||||
created=user_action,
|
||||
)
|
||||
comp_action_details = form_data["action_type_details"]
|
||||
comp_action.action_type_details.set(comp_action_details)
|
||||
self.actions.add(comp_action)
|
||||
return comp_action
|
||||
|
||||
|
||||
Reference in New Issue
Block a user