wbaccounting 1.59.16__py2.py3-none-any.whl → 1.60.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wbaccounting/models/booking_entry.py +6 -0
- wbaccounting/models/entry_accounting_information.py +12 -0
- wbaccounting/models/invoice.py +8 -3
- {wbaccounting-1.59.16.dist-info → wbaccounting-1.60.0.dist-info}/METADATA +1 -1
- {wbaccounting-1.59.16.dist-info → wbaccounting-1.60.0.dist-info}/RECORD +6 -6
- {wbaccounting-1.59.16.dist-info → wbaccounting-1.60.0.dist-info}/WHEEL +0 -0
|
@@ -5,6 +5,7 @@ from django.db.models.signals import post_delete, post_save
|
|
|
5
5
|
from django.dispatch import receiver
|
|
6
6
|
from wbcore.contrib.authentication.models import User
|
|
7
7
|
from wbcore.models import WBModel
|
|
8
|
+
from wbcore.signals import pre_merge
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class BookingEntryDefaultQuerySet(models.QuerySet):
|
|
@@ -165,3 +166,8 @@ def booking_entry_changed(sender, instance: BookingEntry, created: bool, raw: bo
|
|
|
165
166
|
def booking_entry_deleted(sender, instance, **kwargs):
|
|
166
167
|
if instance.invoice:
|
|
167
168
|
instance.invoice.save()
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
@receiver(pre_merge, sender="directory.Entry")
|
|
172
|
+
def pre_merge_entry_bookinentry(sender: models.Model, merged_object, main_object, **kwargs):
|
|
173
|
+
BookingEntry.objects.filter(counterparty=merged_object).update(counterparty=main_object)
|
|
@@ -9,6 +9,7 @@ from django.utils.module_loading import import_string
|
|
|
9
9
|
from dynamic_preferences.registries import global_preferences_registry as gpr
|
|
10
10
|
from wbcore.contrib.authentication.models import User
|
|
11
11
|
from wbcore.contrib.currency.models import Currency
|
|
12
|
+
from wbcore.signals import pre_merge
|
|
12
13
|
|
|
13
14
|
from wbaccounting.models.model_tasks import generate_booking_entries_as_task
|
|
14
15
|
|
|
@@ -156,3 +157,14 @@ def post_save_entry(sender, instance, **kwargs):
|
|
|
156
157
|
"""If the EAI does not have any email_to, then we add the entries primary email address to it (if it exists)"""
|
|
157
158
|
if not instance.email_to.exists() and (email := instance.entry.primary_email_contact()):
|
|
158
159
|
instance.email_to.add(email)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@receiver(pre_merge, sender="directory.Entry")
|
|
163
|
+
def pre_merge_entry_entryaccountinginformation(sender: models.Model, merged_object, main_object, **kwargs):
|
|
164
|
+
with suppress(EntryAccountingInformation.DoesNotExist):
|
|
165
|
+
rel = EntryAccountingInformation.objects.get(entry=merged_object)
|
|
166
|
+
if not EntryAccountingInformation.objects.filter(entry=main_object).exists():
|
|
167
|
+
rel.entry = main_object
|
|
168
|
+
rel.save()
|
|
169
|
+
else:
|
|
170
|
+
rel.delete()
|
wbaccounting/models/invoice.py
CHANGED
|
@@ -3,7 +3,6 @@ from decimal import Decimal
|
|
|
3
3
|
from io import BytesIO
|
|
4
4
|
from typing import TYPE_CHECKING
|
|
5
5
|
|
|
6
|
-
from django.contrib.auth import get_user_model
|
|
7
6
|
from django.core.files import File
|
|
8
7
|
from django.db import models, transaction
|
|
9
8
|
from django.db.models import Max, Q, QuerySet, Sum
|
|
@@ -15,7 +14,7 @@ from django.utils.translation import gettext_lazy as _
|
|
|
15
14
|
from django_fsm import FSMField, transition
|
|
16
15
|
from dynamic_preferences.registries import global_preferences_registry
|
|
17
16
|
from slugify import slugify
|
|
18
|
-
from wbcore.contrib.authentication.models import User
|
|
17
|
+
from wbcore.contrib.authentication.models.users import User
|
|
19
18
|
from wbcore.contrib.directory.models import Company, Entry
|
|
20
19
|
from wbcore.contrib.documents.models import Document, DocumentType
|
|
21
20
|
from wbcore.contrib.icons import WBIcon
|
|
@@ -24,6 +23,7 @@ from wbcore.contrib.notifications.utils import create_notification_type
|
|
|
24
23
|
from wbcore.enums import RequestType
|
|
25
24
|
from wbcore.metadata.configs.buttons import ActionButton, ButtonDefaultColor
|
|
26
25
|
from wbcore.models import WBModel
|
|
26
|
+
from wbcore.signals import pre_merge
|
|
27
27
|
|
|
28
28
|
from wbaccounting.dynamic_preferences_registry import format_invoice_number
|
|
29
29
|
from wbaccounting.files.invoice_document_file import generate_file
|
|
@@ -248,7 +248,7 @@ class Invoice(WBModel):
|
|
|
248
248
|
},
|
|
249
249
|
)
|
|
250
250
|
def submit(self, by=None, description=None, **kwargs):
|
|
251
|
-
for user in
|
|
251
|
+
for user in User.objects.filter(
|
|
252
252
|
Q(user_permissions__codename="administrate_invoice")
|
|
253
253
|
| Q(groups__permissions__codename="administrate_invoice")
|
|
254
254
|
):
|
|
@@ -475,3 +475,8 @@ def post_save_handle_processor(sender, instance, **kwargs):
|
|
|
475
475
|
processor = import_string(processor_path)
|
|
476
476
|
processor(instance)
|
|
477
477
|
instance.status = instance.Status.SENT
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
@receiver(pre_merge, sender="directory.Entry")
|
|
481
|
+
def pre_merge_entry_invoice(sender: models.Model, merged_object, main_object, **kwargs):
|
|
482
|
+
Invoice.objects.filter(counterparty=merged_object).update(counterparty=main_object)
|
|
@@ -34,9 +34,9 @@ wbaccounting/migrations/0011_transaction.py,sha256=CAFDQiZFIP-xJ__GqCyvsmMUazgMU
|
|
|
34
34
|
wbaccounting/migrations/0012_entryaccountinginformation_external_invoice_users.py,sha256=4uGToqhfM5VGMgHNnBgvASjoVTox1sYvjx0RY_mgbDA,815
|
|
35
35
|
wbaccounting/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
36
|
wbaccounting/models/__init__.py,sha256=qk2F9CHovzTR-opHJpPpp9HbblLX95izFNfL0FnQCts,263
|
|
37
|
-
wbaccounting/models/booking_entry.py,sha256=
|
|
38
|
-
wbaccounting/models/entry_accounting_information.py,sha256=
|
|
39
|
-
wbaccounting/models/invoice.py,sha256=
|
|
37
|
+
wbaccounting/models/booking_entry.py,sha256=7apQyTySBU-vILPyMIOJlNCuPLYy4jgMnneJehOrHpk,6927
|
|
38
|
+
wbaccounting/models/entry_accounting_information.py,sha256=jU-WVhxjBPtOVQhcenmrPUdQtSipZO12AHqU9ACH-vs,6291
|
|
39
|
+
wbaccounting/models/invoice.py,sha256=ILaUC3lWG6oM4GpNpEVuuEbiijYk5a5fRv0BsnW8NFE,19258
|
|
40
40
|
wbaccounting/models/invoice_type.py,sha256=SMYKJGyL7rm4_7Sb6yaLT88ZIqXDmh9LA2KpyELsDBg,855
|
|
41
41
|
wbaccounting/models/model_tasks.py,sha256=V0p8xXORYSf98mbZLb6y9mcgkrpKiFqF8afXlNEtw9s,2361
|
|
42
42
|
wbaccounting/models/transactions.py,sha256=V6tOJjLSJJVsqynT53KABqHJGtp22f6Gl2kQy9ok53o,3875
|
|
@@ -97,6 +97,6 @@ wbaccounting/viewsets/titles/booking_entry.py,sha256=SNQJOYXf3QcjTtL3Co2uIYZC69d
|
|
|
97
97
|
wbaccounting/viewsets/titles/entry_accounting_information.py,sha256=76kXkK5ij-HV29tt8efUuvplQ9d1CrQklT8sSv6zHYE,344
|
|
98
98
|
wbaccounting/viewsets/titles/invoice.py,sha256=mr-iufJpM2SYuvexZ3XPLjBmQgPatgIMn1JC4eHLdnY,566
|
|
99
99
|
wbaccounting/viewsets/titles/invoice_type.py,sha256=szgA0iSYVILjLvhFhuLcq_WhMWv04_ESEVvogMYOkyk,301
|
|
100
|
-
wbaccounting-1.
|
|
101
|
-
wbaccounting-1.
|
|
102
|
-
wbaccounting-1.
|
|
100
|
+
wbaccounting-1.60.0.dist-info/METADATA,sha256=tRWZR2J8Bb0FkoWHkD8XSofBcfJwEVoef89xS28A3QM,217
|
|
101
|
+
wbaccounting-1.60.0.dist-info/WHEEL,sha256=aha0VrrYvgDJ3Xxl3db_g_MDIW-ZexDdrc_m-Hk8YY4,105
|
|
102
|
+
wbaccounting-1.60.0.dist-info/RECORD,,
|
|
File without changes
|