8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-22 23:13:46 +00:00

Fais la distinction entre un baseinvoice avec et sans objet facture.

This commit is contained in:
Hugo LEVY-FALK 2018-08-23 22:57:55 +02:00 committed by chirac
parent b137ddc5a4
commit dfc765f5e5
2 changed files with 12 additions and 3 deletions

View file

@ -110,11 +110,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<td>{{ v.datetime }}</td>
<td>
{% blocktrans with username=v.username number=v.version.object.number name=v.version.object.name %}{{ username }} has sold {{ number }}x {{ name }} to{% endblocktrans %}
<a href="{% url 'users:profil' v.version.object.facture.user_id %}">{{ v.version.object.facture.user.get_username }}</a>
{% blocktrans with username=v.username number=v.version.object.number name=v.version.object.name %}{{ username }} has sold {{ number }}x {{ name }}{% endblocktrans %}
{% with invoice=v.version.object.facture %}
{% if invoice|is_facture %}
{% trans " to" %}
<a href="{% url 'users:profil' v.version.object.facture.facture.user_id %}">{{ v.version.object.facture.facture.user.get_username }}</a>
{% if v.version.object.iscotisation %}
(<i>{% blocktrans with duration=v.version.object.duration %}+{{ duration }} months{% endblocktrans %}</i>)
{% endif %}
{% endif %}
{% endwith %}
</td>
{% can_edit_history %}
<td>

View file

@ -19,7 +19,7 @@
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# 51 Franklin Street, Fifth Floor, Boston, MA 021}10-1301 USA.
"""logs.templatetags.logs_extra
A templatetag to get the class name for a given object
"""
@ -34,6 +34,10 @@ def classname(obj):
""" Returns the object class name """
return obj.__class__.__name__
@register.filter
def is_facture(baseinvoice):
"""Returns True if a baseinvoice has a `Facture` child."""
return hasattr(baseinvoice, 'facture')
@register.inclusion_tag('buttons/history.html')
def history_button(instance, text=False, html_class=True):