mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
Improve UX for accounting linked operation
This commit is contained in:
@ -62,7 +62,16 @@
|
||||
{% else %}
|
||||
<td>{% trans %}No{% endtrans %}</td>
|
||||
{% endif %}
|
||||
<td>{{ o.remark }}</td>
|
||||
<td>{{ o.remark }}
|
||||
{% if not o.linked_operation and o.target_type == "ACCOUNT" and not o.target.has_open_journal() %}
|
||||
<p><strong>
|
||||
{% trans %}Warning: this operation has no linked operation because the targeted club account has no opened journal.{% endtrans %}
|
||||
</strong></p>
|
||||
<p><strong>
|
||||
{% trans url=o.target.get_absolute_url() %}Open a journal in <a href="{{ url }}">this club account</a>, then save this operation again to make the linked operation.{% endtrans %}
|
||||
</strong></p>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if o.invoice %}
|
||||
<td><a href="{{ url('core:download', file_id=o.invoice.id) }}">{{ o.invoice.name }}</a></td>
|
||||
{% else %}
|
||||
|
@ -38,6 +38,16 @@
|
||||
form.accounting_type }}</p>
|
||||
<p>{{ form.label.errors }}<label for="{{ form.label.name }}">{{ form.label.label }}</label> {{ form.label }}</p>
|
||||
<p>{{ form.done.errors }}<label for="{{ form.done.name }}">{{ form.done.label }}</label> {{ form.done }}</p>
|
||||
{% if form.instance.linked_operation %}
|
||||
{% set obj = form.instance.linked_operation %}
|
||||
<p><strong>{% trans %}Linked operation:{% endtrans %}</strong><br>
|
||||
<a href="{{ url('accounting:bank_details', b_account_id=obj.journal.club_account.bank_account.id) }}">
|
||||
{{obj.journal.club_account.bank_account }}</a> >
|
||||
<a href="{{ url('accounting:club_details', c_account_id=obj.journal.club_account.id) }}">{{ obj.journal.club_account }}</a> >
|
||||
<a href="{{ url('accounting:journal_details', j_id=obj.journal.id) }}">{{ obj.journal }}</a> >
|
||||
n°{{ obj.number }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse_lazy, reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.forms.models import modelform_factory
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.forms import HiddenInput
|
||||
from django.forms import HiddenInput, TextInput
|
||||
from django.db import transaction
|
||||
from django.db.models import Sum
|
||||
from django.conf import settings
|
||||
@ -237,7 +237,7 @@ class OperationForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Operation
|
||||
fields = ['amount', 'remark', 'journal', 'target_type', 'target_id', 'target_label', 'date', 'mode',
|
||||
'cheque_number', 'invoice', 'simpleaccounting_type', 'accounting_type', 'label', 'done']
|
||||
'cheque_number', 'invoice', 'simpleaccounting_type', 'accounting_type', 'label', 'done' ]
|
||||
widgets = {
|
||||
'journal': HiddenInput,
|
||||
'target_id': HiddenInput,
|
||||
@ -281,7 +281,7 @@ class OperationForm(forms.ModelForm):
|
||||
inst = self.instance
|
||||
club_account = inst.target
|
||||
acc_type = AccountingType.objects.exclude(movement_type="NEUTRAL").exclude(
|
||||
movement_type=inst.accounting_type.movement_type).first() # Select a random opposite accounting type
|
||||
movement_type=inst.accounting_type.movement_type).order_by('code').first() # Select a random opposite accounting type
|
||||
op = Operation(
|
||||
journal=club_account.get_open_journal(),
|
||||
amount=inst.amount,
|
||||
|
Reference in New Issue
Block a user