fix the car accounts not all created
This commit is contained in:
parent
6e344926b9
commit
38f4731a9a
@ -146,7 +146,7 @@ class StaffForm(forms.ModelForm):
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
||||
|
||||
model = Staff
|
||||
fields = ["first_name","last_name", "arabic_name", "phone_number", "address", "logo", "group"]
|
||||
|
||||
@ -1077,7 +1077,7 @@ class LeadForm(forms.ModelForm):
|
||||
:type id_car_model: ModelChoiceField
|
||||
"""
|
||||
|
||||
phone_number = SaudiPhoneNumberField(label=_("Phone Number"))
|
||||
# phone_number = SaudiPhoneNumberField(label=_("Phone Number"))
|
||||
|
||||
# email = forms.EmailField(
|
||||
# label=_("Email"),
|
||||
|
||||
@ -6,8 +6,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
def check_create_coa_accounts(task):
|
||||
logger.info("Checking if all accounts are created")
|
||||
instance_id = task.args[0]
|
||||
instance = Dealer.objects.get(pk=instance_id)
|
||||
instance = task.kwargs["dealer"]
|
||||
entity = instance.entity
|
||||
coa = entity.get_default_coa()
|
||||
|
||||
@ -19,4 +18,6 @@ def check_create_coa_accounts(task):
|
||||
create_account(entity, coa, account_data)
|
||||
|
||||
def print_results(task):
|
||||
print(task.kwargs.get("dealer"))
|
||||
dealer= task.kwargs["dealer"]
|
||||
print("HOOK: ",dealer)
|
||||
print("HOOK: ",dealer.pk)
|
||||
@ -6,4 +6,4 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **kwargs):
|
||||
from inventory.models import Dealer
|
||||
instance = Dealer.objects.first()
|
||||
async_task(name="test_task_test",func="inventory.tasks.test_task",dealer=instance,hook="inventory.hooks.print_results")
|
||||
async_task(func="inventory.tasks.test_task",dealer=instance,hook="inventory.hooks.print_results")
|
||||
@ -1,7 +1,6 @@
|
||||
from datetime import datetime, timedelta
|
||||
from decimal import Decimal
|
||||
from django.urls import reverse
|
||||
from inventory.tasks import create_coa_accounts, create_make_accounts
|
||||
from django.contrib.auth.models import Group
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
@ -178,7 +177,7 @@ def create_ledger_entity(sender, instance, created, **kwargs):
|
||||
entity.create_uom(name=u[1], unit_abbr=u[0])
|
||||
|
||||
# Create COA accounts, background task
|
||||
async_task(name="create_coa_accounts",func=create_coa_accounts,dealer_pk=instance.pk,hook="inventory.hooks.check_create_coa_accounts")
|
||||
async_task(func="inventory.tasks.create_coa_accounts",dealer=instance,hook="inventory.hooks.check_create_coa_accounts")
|
||||
# async_task('inventory.tasks.check_create_coa_accounts', instance, schedule_type='O', schedule_time=timedelta(seconds=20))
|
||||
|
||||
# create_settings(instance.pk)
|
||||
|
||||
@ -50,7 +50,7 @@ def create_settings(pk):
|
||||
|
||||
def create_coa_accounts(**kwargs):
|
||||
logger.info("creating all accounts are created")
|
||||
instance = Dealer.objects.get(pk=kwargs['dealer_pk'])
|
||||
instance = kwargs.get("dealer")
|
||||
entity = instance.entity
|
||||
coa = entity.get_default_coa()
|
||||
|
||||
@ -927,5 +927,5 @@ def remove_reservation_by_id(reservation_id):
|
||||
except Exception as e:
|
||||
logger.error(f"Error removing reservation with ID {reservation_id}: {e}")
|
||||
|
||||
def test_task(instance):
|
||||
print(instance.pk)
|
||||
def test_task(**kwargs):
|
||||
print("TASK : ",kwargs.get("dealer"))
|
||||
Loading…
x
Reference in New Issue
Block a user