django-ledger 0.7.10__py3-none-any.whl → 0.8.0__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.
Potentially problematic release.
This version of django-ledger might be problematic. Click here for more details.
- django_ledger/__init__.py +1 -1
- django_ledger/context.py +12 -0
- django_ledger/forms/bill.py +0 -4
- django_ledger/forms/closing_entry.py +13 -1
- django_ledger/forms/data_import.py +1 -1
- django_ledger/forms/estimate.py +3 -6
- django_ledger/forms/invoice.py +3 -7
- django_ledger/forms/item.py +10 -18
- django_ledger/forms/purchase_order.py +2 -4
- django_ledger/io/io_core.py +25 -32
- django_ledger/io/io_generator.py +7 -6
- django_ledger/io/io_library.py +1 -2
- django_ledger/migrations/0024_billmodel_entity_model_invoicemodel_entity_model.py +24 -0
- django_ledger/migrations/0025_alter_billmodel_cash_account_and_more.py +70 -0
- django_ledger/models/accounts.py +109 -69
- django_ledger/models/bank_account.py +40 -23
- django_ledger/models/bill.py +89 -63
- django_ledger/models/chart_of_accounts.py +173 -105
- django_ledger/models/closing_entry.py +99 -48
- django_ledger/models/customer.py +60 -39
- django_ledger/models/data_import.py +55 -41
- django_ledger/models/deprecations.py +61 -0
- django_ledger/models/entity.py +18 -16
- django_ledger/models/estimate.py +57 -28
- django_ledger/models/invoice.py +58 -28
- django_ledger/models/items.py +503 -142
- django_ledger/models/journal_entry.py +61 -47
- django_ledger/models/ledger.py +106 -42
- django_ledger/models/mixins.py +16 -10
- django_ledger/models/purchase_order.py +39 -17
- django_ledger/models/transactions.py +152 -113
- django_ledger/models/unit.py +57 -30
- django_ledger/models/vendor.py +75 -43
- django_ledger/report/core.py +2 -14
- django_ledger/settings.py +56 -71
- django_ledger/static/django_ledger/bundle/djetler.bundle.js +1 -1
- django_ledger/static/django_ledger/bundle/djetler.bundle.js.LICENSE.txt +25 -0
- django_ledger/static/django_ledger/bundle/styles.bundle.js +1 -1
- django_ledger/static/django_ledger/css/djl_styles.css +273 -0
- django_ledger/templates/django_ledger/bills/includes/card_bill.html +2 -2
- django_ledger/templates/django_ledger/components/menu.html +41 -26
- django_ledger/templates/django_ledger/customer/tags/customer_table.html +5 -5
- django_ledger/templates/django_ledger/entity/includes/card_entity.html +12 -6
- django_ledger/templates/django_ledger/financial_statements/balance_sheet.html +1 -1
- django_ledger/templates/django_ledger/financial_statements/cash_flow.html +4 -1
- django_ledger/templates/django_ledger/financial_statements/income_statement.html +4 -1
- django_ledger/templates/django_ledger/financial_statements/tags/balance_sheet_statement.html +27 -3
- django_ledger/templates/django_ledger/financial_statements/tags/cash_flow_statement.html +16 -4
- django_ledger/templates/django_ledger/financial_statements/tags/income_statement.html +73 -18
- django_ledger/templates/django_ledger/includes/widget_ratios.html +18 -24
- django_ledger/templates/django_ledger/invoice/includes/card_invoice.html +3 -3
- django_ledger/templates/django_ledger/layouts/base.html +6 -1
- django_ledger/templates/django_ledger/vendor/tags/vendor_table.html +9 -5
- django_ledger/tests/test_accounts.py +1 -2
- django_ledger/tests/test_io.py +17 -0
- django_ledger/tests/test_purchase_order.py +3 -3
- django_ledger/tests/test_transactions.py +1 -2
- django_ledger/urls/__init__.py +0 -4
- django_ledger/views/bill.py +8 -13
- django_ledger/views/chart_of_accounts.py +6 -4
- django_ledger/views/closing_entry.py +11 -7
- django_ledger/views/customer.py +13 -17
- django_ledger/views/data_import.py +7 -6
- django_ledger/views/djl_api.py +3 -5
- django_ledger/views/entity.py +2 -4
- django_ledger/views/estimate.py +3 -7
- django_ledger/views/inventory.py +3 -5
- django_ledger/views/invoice.py +4 -6
- django_ledger/views/item.py +7 -11
- django_ledger/views/journal_entry.py +1 -2
- django_ledger/views/mixins.py +25 -19
- django_ledger/views/purchase_order.py +24 -35
- django_ledger/views/unit.py +1 -2
- django_ledger/views/vendor.py +1 -2
- {django_ledger-0.7.10.dist-info → django_ledger-0.8.0.dist-info}/METADATA +43 -75
- {django_ledger-0.7.10.dist-info → django_ledger-0.8.0.dist-info}/RECORD +80 -108
- {django_ledger-0.7.10.dist-info → django_ledger-0.8.0.dist-info}/WHEEL +1 -1
- django_ledger-0.8.0.dist-info/top_level.txt +1 -0
- django_ledger/contrib/django_ledger_graphene/__init__.py +0 -0
- django_ledger/contrib/django_ledger_graphene/accounts/schema.py +0 -33
- django_ledger/contrib/django_ledger_graphene/api.py +0 -42
- django_ledger/contrib/django_ledger_graphene/apps.py +0 -6
- django_ledger/contrib/django_ledger_graphene/auth/mutations.py +0 -49
- django_ledger/contrib/django_ledger_graphene/auth/schema.py +0 -6
- django_ledger/contrib/django_ledger_graphene/bank_account/mutations.py +0 -61
- django_ledger/contrib/django_ledger_graphene/bank_account/schema.py +0 -34
- django_ledger/contrib/django_ledger_graphene/bill/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/bill/schema.py +0 -34
- django_ledger/contrib/django_ledger_graphene/coa/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/coa/schema.py +0 -30
- django_ledger/contrib/django_ledger_graphene/customers/__init__.py +0 -0
- django_ledger/contrib/django_ledger_graphene/customers/mutations.py +0 -71
- django_ledger/contrib/django_ledger_graphene/customers/schema.py +0 -43
- django_ledger/contrib/django_ledger_graphene/data_import/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/data_import/schema.py +0 -0
- django_ledger/contrib/django_ledger_graphene/entity/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/entity/schema.py +0 -94
- django_ledger/contrib/django_ledger_graphene/item/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/item/schema.py +0 -31
- django_ledger/contrib/django_ledger_graphene/journal_entry/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/journal_entry/schema.py +0 -35
- django_ledger/contrib/django_ledger_graphene/ledger/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/ledger/schema.py +0 -32
- django_ledger/contrib/django_ledger_graphene/purchase_order/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/purchase_order/schema.py +0 -31
- django_ledger/contrib/django_ledger_graphene/transaction/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/transaction/schema.py +0 -36
- django_ledger/contrib/django_ledger_graphene/unit/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/unit/schema.py +0 -27
- django_ledger/contrib/django_ledger_graphene/vendor/mutations.py +0 -0
- django_ledger/contrib/django_ledger_graphene/vendor/schema.py +0 -37
- django_ledger/contrib/django_ledger_graphene/views.py +0 -12
- django_ledger-0.7.10.dist-info/top_level.txt +0 -4
- {django_ledger-0.7.10.dist-info → django_ledger-0.8.0.dist-info/licenses}/AUTHORS.md +0 -0
- {django_ledger-0.7.10.dist-info → django_ledger-0.8.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import BillModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class BillNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = BillModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'vendor': ['exact'],
|
|
14
|
-
'xref': ['exact', 'icontains', 'istartswith'],
|
|
15
|
-
'date_draft': ['exact', 'icontains', 'istartswith'],
|
|
16
|
-
'terms': ['exact', 'icontains', 'istartswith'],
|
|
17
|
-
'cash_account': ['exact'],
|
|
18
|
-
'prepaid_account': ['exact'],
|
|
19
|
-
'unearned_account': ['exact'],
|
|
20
|
-
}
|
|
21
|
-
interfaces = (relay.Node,)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class Bill_list_Query(graphene.ObjectType):
|
|
25
|
-
all_bills = DjangoFilterConnectionField(BillNode, slug_name=graphene.String(required=True))
|
|
26
|
-
|
|
27
|
-
def resolve_all_bills(self, info, slug_name, **kwargs):
|
|
28
|
-
if info.context.user.is_authenticated:
|
|
29
|
-
return BillModel.objects.for_entity(
|
|
30
|
-
entity_slug=slug_name,
|
|
31
|
-
user_model=info.context.user
|
|
32
|
-
).select_related('vendor').order_by('-updated')
|
|
33
|
-
else:
|
|
34
|
-
return BillModel.objects.none()
|
|
File without changes
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
|
|
5
|
-
from django_ledger.models import ChartOfAccountModel
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class ChartOfAccountsModelType(DjangoObjectType):
|
|
9
|
-
class Meta:
|
|
10
|
-
model = ChartOfAccountModel
|
|
11
|
-
fields = [
|
|
12
|
-
'uuid',
|
|
13
|
-
'slug',
|
|
14
|
-
'name',
|
|
15
|
-
'locked'
|
|
16
|
-
]
|
|
17
|
-
interfaces = (relay.Node,)
|
|
18
|
-
|
|
19
|
-
# class ChartOfAccountsModelQuery(graphene.ObjectType):
|
|
20
|
-
# all_coa = graphene.List(ChartOfAccountsModelType, slug=graphene.String(required=True))
|
|
21
|
-
#
|
|
22
|
-
# def resolve_all_coa(self, info, slug, **kwargs):
|
|
23
|
-
#
|
|
24
|
-
# if info.context.user.is_authenticated:
|
|
25
|
-
# return ChartOfAccountModel.objects.for_entity(
|
|
26
|
-
# entity_slug=slug,
|
|
27
|
-
# user_model=info.context.user,
|
|
28
|
-
# )
|
|
29
|
-
# else:
|
|
30
|
-
# return ChartOfAccountModel.objects.none()
|
|
File without changes
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
|
|
5
|
-
from django_ledger.models.customer import CustomerModel
|
|
6
|
-
from django_ledger.models.entity import EntityModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class CustomerType(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = CustomerModel
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class CustomerMutation(graphene.Mutation):
|
|
15
|
-
class Arguments:
|
|
16
|
-
# The input arguments for this mutation
|
|
17
|
-
customer_name = graphene.String(required=True)
|
|
18
|
-
address_1 = graphene.String(required=True)
|
|
19
|
-
address_2 = graphene.String(required=True)
|
|
20
|
-
city = graphene.String(required=True)
|
|
21
|
-
state = graphene.String(required=True)
|
|
22
|
-
zip_code = graphene.String(required=True)
|
|
23
|
-
country = graphene.String(required=True)
|
|
24
|
-
phone = graphene.String(required=True)
|
|
25
|
-
email = graphene.String(required=True)
|
|
26
|
-
website = graphene.String(required=True)
|
|
27
|
-
slug_name = graphene.String(required=True)
|
|
28
|
-
|
|
29
|
-
# The class attributes define the response of the mutation
|
|
30
|
-
customer = graphene.Field(CustomerType)
|
|
31
|
-
|
|
32
|
-
@classmethod
|
|
33
|
-
def mutate(
|
|
34
|
-
cls,
|
|
35
|
-
root,
|
|
36
|
-
info,
|
|
37
|
-
customer_name,
|
|
38
|
-
address_1,
|
|
39
|
-
address_2,
|
|
40
|
-
city,
|
|
41
|
-
state,
|
|
42
|
-
zip_code,
|
|
43
|
-
country,
|
|
44
|
-
phone,
|
|
45
|
-
email,
|
|
46
|
-
website,
|
|
47
|
-
slug_name,
|
|
48
|
-
**kwargs):
|
|
49
|
-
customer_model = CustomerModel(
|
|
50
|
-
customer_name=customer_name,
|
|
51
|
-
address_1=address_1,
|
|
52
|
-
address_2=address_2,
|
|
53
|
-
city=city,
|
|
54
|
-
state=state,
|
|
55
|
-
zip_code=zip_code,
|
|
56
|
-
country=country,
|
|
57
|
-
phone=phone,
|
|
58
|
-
email=email,
|
|
59
|
-
website=website,
|
|
60
|
-
)
|
|
61
|
-
entity_model = EntityModel.objects.for_user(
|
|
62
|
-
user_model=info.context.user
|
|
63
|
-
).get(slug__exact=slug_name)
|
|
64
|
-
customer_model.entity_model = entity_model
|
|
65
|
-
customer_model.save()
|
|
66
|
-
# Notice we return an instance of this mutation
|
|
67
|
-
return CustomerMutation(customer=customer_model)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class CustomerMutations(graphene.ObjectType):
|
|
71
|
-
create_customer = CustomerMutation.Field()
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import CustomerModel, EntityModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class CustomerNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = CustomerModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'customer_name': ['exact', 'icontains', 'istartswith'],
|
|
14
|
-
'address_1': ['exact', 'icontains', 'istartswith'],
|
|
15
|
-
'address_2': ['exact', 'icontains', 'istartswith'],
|
|
16
|
-
'city': ['exact', 'icontains', 'istartswith'],
|
|
17
|
-
'state': ['exact', 'icontains', 'istartswith'],
|
|
18
|
-
'zip_code': ['exact', 'icontains', 'istartswith'],
|
|
19
|
-
'country': ['exact', 'icontains', 'istartswith'],
|
|
20
|
-
'phone': ['exact', 'icontains', 'istartswith'],
|
|
21
|
-
'email': ['exact', 'icontains', 'istartswith'],
|
|
22
|
-
'website': ['exact', 'icontains', 'istartswith'],
|
|
23
|
-
}
|
|
24
|
-
interfaces = (relay.Node,)
|
|
25
|
-
class EntityList(DjangoObjectType):
|
|
26
|
-
class Meta:
|
|
27
|
-
model = EntityModel
|
|
28
|
-
|
|
29
|
-
class CustomerQuery(graphene.ObjectType):
|
|
30
|
-
all_customers = DjangoFilterConnectionField(CustomerNode, slug_name=graphene.String(required=True))
|
|
31
|
-
|
|
32
|
-
def resolve_all_customers(self, info, slug_name, **kwargs):
|
|
33
|
-
if info.context.user.is_authenticated:
|
|
34
|
-
CustomerModel.objects.for_entity(
|
|
35
|
-
entity_slug=slug_name,
|
|
36
|
-
user_model=info.context.user
|
|
37
|
-
).order_by('-updated')
|
|
38
|
-
else:
|
|
39
|
-
return CustomerModel.objects.none()
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
|
|
5
|
-
from django_ledger.models import EntityModel, EntityModelQuerySet
|
|
6
|
-
|
|
7
|
-
ENTITY_MODEL_BASE_FIELDS = [
|
|
8
|
-
'uuid',
|
|
9
|
-
'slug',
|
|
10
|
-
'name',
|
|
11
|
-
'accrual_method',
|
|
12
|
-
'fy_start_month',
|
|
13
|
-
'picture',
|
|
14
|
-
'is_admin',
|
|
15
|
-
'hidden',
|
|
16
|
-
'created',
|
|
17
|
-
'updated'
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class EntityModelType(DjangoObjectType):
|
|
22
|
-
is_admin = graphene.Boolean()
|
|
23
|
-
|
|
24
|
-
def resolve_is_admin(self, info):
|
|
25
|
-
entity_model: EntityModel = self
|
|
26
|
-
return entity_model.is_admin_user(user_model=info.context.resource_owner)
|
|
27
|
-
|
|
28
|
-
class Meta:
|
|
29
|
-
model = EntityModel
|
|
30
|
-
fields = ENTITY_MODEL_BASE_FIELDS
|
|
31
|
-
filter_fields = {
|
|
32
|
-
'name': [
|
|
33
|
-
'exact',
|
|
34
|
-
'icontains',
|
|
35
|
-
'istartswith'
|
|
36
|
-
],
|
|
37
|
-
}
|
|
38
|
-
interfaces = (relay.Node,)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class EntityModelTypeDetail(EntityModelType):
|
|
42
|
-
class Meta:
|
|
43
|
-
model = EntityModel
|
|
44
|
-
fields = ENTITY_MODEL_BASE_FIELDS + [
|
|
45
|
-
'default_coa'
|
|
46
|
-
]
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class EntityModelQuery(graphene.ObjectType):
|
|
50
|
-
entity_model_list_all = graphene.List(EntityModelType)
|
|
51
|
-
entity_model_list_visible = graphene.List(EntityModelType)
|
|
52
|
-
entity_model_list_hidden = graphene.List(EntityModelType)
|
|
53
|
-
entity_model_list_managed = graphene.List(EntityModelType)
|
|
54
|
-
entity_model_list_is_admin = graphene.List(EntityModelType)
|
|
55
|
-
|
|
56
|
-
entity_model_detail_by_uuid = graphene.Field(EntityModelTypeDetail, uuid=graphene.String(required=True))
|
|
57
|
-
entity_model_detail_by_slug = graphene.Field(EntityModelTypeDetail, slug=graphene.String(required=True))
|
|
58
|
-
|
|
59
|
-
@staticmethod
|
|
60
|
-
def get_base_queryset(info):
|
|
61
|
-
if info.context.resource_owner.is_authenticated:
|
|
62
|
-
return EntityModel.objects.for_user(user_model=info.context.resource_owner)
|
|
63
|
-
return EntityModel.objects.none()
|
|
64
|
-
|
|
65
|
-
# list ....
|
|
66
|
-
def resolve_entity_model_list_all(self, info, **kwargs):
|
|
67
|
-
return EntityModelQuery.get_base_queryset(info)
|
|
68
|
-
|
|
69
|
-
def resolve_entity_model_list_visible(self, info, **kwargs):
|
|
70
|
-
qs = EntityModelQuery.get_base_queryset(info)
|
|
71
|
-
return qs.visible()
|
|
72
|
-
|
|
73
|
-
def resolve_entity_model_list_hidden(self, info, **kwargs):
|
|
74
|
-
qs = EntityModelQuery.get_base_queryset(info)
|
|
75
|
-
return qs.hidden()
|
|
76
|
-
|
|
77
|
-
def resolve_entity_model_list_managed(self, info, **kwargs):
|
|
78
|
-
qs: EntityModelQuerySet = EntityModelQuery.get_base_queryset(info)
|
|
79
|
-
user_model = info.context.resource_owner
|
|
80
|
-
return qs.filter(managers__in=[user_model])
|
|
81
|
-
|
|
82
|
-
def resolve_entity_model_list_is_admin(self, info, **kwargs):
|
|
83
|
-
qs: EntityModelQuerySet = EntityModelQuery.get_base_queryset(info)
|
|
84
|
-
user_model = info.context.resource_owner
|
|
85
|
-
return qs.filter(admin=user_model)
|
|
86
|
-
|
|
87
|
-
# detail...
|
|
88
|
-
def resolve_entity_model_detail_by_slug(self, info, slug, **kwargs):
|
|
89
|
-
qs: EntityModelQuerySet = EntityModelQuery.get_base_queryset(info)
|
|
90
|
-
return qs.select_related('default_coa').get(slug__exact=slug)
|
|
91
|
-
|
|
92
|
-
def resolve_entity_model_detail_by_uuid(self, info, uuid, **kwargs):
|
|
93
|
-
qs: EntityModelQuerySet = EntityModelQuery.get_base_queryset(info)
|
|
94
|
-
return qs.select_related('default_coa').get(uuid__exact=uuid)
|
|
File without changes
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import UnitOfMeasureModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class UnitOfMeasureNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = UnitOfMeasureModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'name' : ['exact', 'icontains', 'istartswith'],
|
|
14
|
-
'unit_abbr': ['exact', 'icontains', 'istartswith'],
|
|
15
|
-
'is_active' : ['exact']
|
|
16
|
-
}
|
|
17
|
-
interfaces = (relay.Node,)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class UnitOfMeasureQuery(graphene.ObjectType):
|
|
21
|
-
all_unit_of_measure = DjangoFilterConnectionField(UnitOfMeasureNode, slug_name=graphene.String(required=True))
|
|
22
|
-
#token=graphene.String(required=True)
|
|
23
|
-
|
|
24
|
-
def resolve_all_unit_of_measure(self, info, slug_name):
|
|
25
|
-
if info.context.user.is_authenticated:
|
|
26
|
-
return UnitOfMeasureModel.objects.for_entity(
|
|
27
|
-
entity_slug=slug_name,
|
|
28
|
-
user_model=info.context.user
|
|
29
|
-
)
|
|
30
|
-
else:
|
|
31
|
-
return UnitOfMeasureModel.objects.none()
|
|
File without changes
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import JournalEntryModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class JournalEntryNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = JournalEntryModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'activity': ['exact', 'icontains', 'istartswith'],
|
|
14
|
-
'timestamp': ['exact'],
|
|
15
|
-
'description': ['exact'],
|
|
16
|
-
}
|
|
17
|
-
interfaces = (relay.Node,)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class JournalEntryQuery(graphene.ObjectType):
|
|
21
|
-
all_journal_entries = DjangoFilterConnectionField(
|
|
22
|
-
JournalEntryNode, slug_name=graphene.String(
|
|
23
|
-
required=True), pk_ledger=graphene.UUID())
|
|
24
|
-
|
|
25
|
-
def resolve_all_journal_entry(self, info, slug_name, pk_ledger, **kwargs):
|
|
26
|
-
if info.context.user.is_authenticated:
|
|
27
|
-
sort = info.context.GET.get('sort')
|
|
28
|
-
if not sort:
|
|
29
|
-
sort = '-updated'
|
|
30
|
-
return JournalEntryModel.objects.for_entity(
|
|
31
|
-
entity_slug=slug_name,
|
|
32
|
-
user_model=info.context.user
|
|
33
|
-
).for_ledger(ledger_pk=pk_ledger).order_by(sort)
|
|
34
|
-
else:
|
|
35
|
-
return JournalEntryModel.objects.none()
|
|
File without changes
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import LedgerModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class LedgerNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = LedgerModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'name': ['exact', 'icontains', 'istartswith'],
|
|
14
|
-
}
|
|
15
|
-
interfaces = (relay.Node,)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class LedgerQuery(graphene.ObjectType):
|
|
19
|
-
all_ledger = DjangoFilterConnectionField(
|
|
20
|
-
LedgerNode, slug_name=graphene.String(required=True))
|
|
21
|
-
|
|
22
|
-
def resolve_all_vendors(self, info, slug_name, **kwargs):
|
|
23
|
-
if info.context.user.is_authenticated:
|
|
24
|
-
sort = info.context.GET.get('sort')
|
|
25
|
-
if not sort:
|
|
26
|
-
sort = '-updated'
|
|
27
|
-
return LedgerModel.objects.for_entity(
|
|
28
|
-
entity_slug=slug_name,
|
|
29
|
-
user_model=info.context.user
|
|
30
|
-
).order_by(sort)
|
|
31
|
-
else:
|
|
32
|
-
return LedgerModel.objects.none()
|
|
File without changes
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import PurchaseOrderModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class PurchaseOrderNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = PurchaseOrderModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'date_draft': ['exact'],
|
|
14
|
-
'po_title': ['exact', 'icontains', 'istartswith'],
|
|
15
|
-
}
|
|
16
|
-
interfaces = (relay.Node,)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class PurchaseOrderQuery(graphene.ObjectType):
|
|
20
|
-
all_purchase_order = DjangoFilterConnectionField(
|
|
21
|
-
PurchaseOrderNode, slug_name=graphene.String(required=True))
|
|
22
|
-
|
|
23
|
-
def resolve_all_purchase_order(self, info, slug_name, **kwargs):
|
|
24
|
-
if info.context.user.is_authenticated:
|
|
25
|
-
return PurchaseOrderModel.objects.for_entity(
|
|
26
|
-
entity_slug=slug_name,
|
|
27
|
-
user_model=info.context.user
|
|
28
|
-
).order_by('-date_draft')
|
|
29
|
-
|
|
30
|
-
else:
|
|
31
|
-
return PurchaseOrderModel.objects.none()
|
|
File without changes
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import TransactionModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TransactionNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = TransactionModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'journal_entry': ['exact'],
|
|
14
|
-
'account': ['exact'],
|
|
15
|
-
'tx_type': ['exact', 'icontains', 'istartswith'],
|
|
16
|
-
'amount': ['exact', 'icontains', 'istartswith'],
|
|
17
|
-
'description': ['exact', 'icontains', 'istartswith'],
|
|
18
|
-
}
|
|
19
|
-
interfaces = (relay.Node,)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class TransactionsQuery(graphene.ObjectType):
|
|
23
|
-
all_transactions = DjangoFilterConnectionField(
|
|
24
|
-
TransactionNode,
|
|
25
|
-
slug_name=graphene.String(required=True),
|
|
26
|
-
pk_je=graphene.UUID(),
|
|
27
|
-
pk_ledger=graphene.UUID())
|
|
28
|
-
|
|
29
|
-
def resolve_all_transactions(self, info, slug_name, pk_je, pk_ledger, **kwargs):
|
|
30
|
-
if info.context.user.is_authenticated:
|
|
31
|
-
return TransactionModel.objects.for_entity(
|
|
32
|
-
entity_slug=slug_name,
|
|
33
|
-
user_model=info.context.user,
|
|
34
|
-
).for_journal_entry(je_model=pk_je).order_by('account__code')
|
|
35
|
-
else:
|
|
36
|
-
return TransactionModel.objects.none()
|
|
File without changes
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import EntityUnitModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class EntityUnitNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = EntityUnitModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'name': ['exact', 'icontains', 'istartswith'],
|
|
14
|
-
}
|
|
15
|
-
interfaces = (relay.Node,)
|
|
16
|
-
class EntityUnitQuery(graphene.ObjectType):
|
|
17
|
-
all_entity_unit = DjangoFilterConnectionField(EntityUnitNode, slug_name=graphene.String(required=True))
|
|
18
|
-
|
|
19
|
-
def resolve_all_vendors(self, info, slug_name, **kwargs):
|
|
20
|
-
if info.context.user.is_authenticated:
|
|
21
|
-
return EntityUnitModel.objects.for_entity(
|
|
22
|
-
entity_slug=slug_name,
|
|
23
|
-
user_model=info.context.user
|
|
24
|
-
)
|
|
25
|
-
else:
|
|
26
|
-
return EntityUnitModel.objects.none()
|
|
27
|
-
|
|
File without changes
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import graphene
|
|
2
|
-
from graphene import relay
|
|
3
|
-
from graphene_django import DjangoObjectType
|
|
4
|
-
from graphene_django.filter import DjangoFilterConnectionField
|
|
5
|
-
|
|
6
|
-
from django_ledger.models import VendorModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class VendorNode(DjangoObjectType):
|
|
10
|
-
class Meta:
|
|
11
|
-
model = VendorModel
|
|
12
|
-
filter_fields = {
|
|
13
|
-
'vendor_name': ['exact', 'icontains', 'istartswith'],
|
|
14
|
-
'address_1': ['exact', 'icontains', 'istartswith'],
|
|
15
|
-
'address_2': ['exact', 'icontains', 'istartswith'],
|
|
16
|
-
'city': ['exact', 'icontains', 'istartswith'],
|
|
17
|
-
'state': ['exact', 'icontains', 'istartswith'],
|
|
18
|
-
'zip_code': ['exact', 'icontains', 'istartswith'],
|
|
19
|
-
'country': ['exact', 'icontains', 'istartswith'],
|
|
20
|
-
'phone': ['exact', 'icontains', 'istartswith'],
|
|
21
|
-
'email': ['exact', 'icontains', 'istartswith'],
|
|
22
|
-
'website': ['exact', 'icontains', 'istartswith'],
|
|
23
|
-
}
|
|
24
|
-
interfaces = (relay.Node,)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class VendorsQuery(graphene.ObjectType):
|
|
28
|
-
all_vendors = DjangoFilterConnectionField(VendorNode, slug_name=graphene.String(required=True))
|
|
29
|
-
|
|
30
|
-
def resolve_all_vendors(self, info, slug_name, **kwargs):
|
|
31
|
-
if info.context.user.is_authenticated:
|
|
32
|
-
return VendorModel.objects.for_entity(
|
|
33
|
-
entity_slug=slug_name,
|
|
34
|
-
user_model=info.context.user
|
|
35
|
-
).order_by('-updated')
|
|
36
|
-
else:
|
|
37
|
-
return VendorModel.objects.none()
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
from django.utils.decorators import method_decorator
|
|
2
|
-
from django.views.decorators.csrf import csrf_exempt
|
|
3
|
-
from graphene_django.views import GraphQLView
|
|
4
|
-
from oauth2_provider.views import ProtectedResourceView
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@method_decorator(csrf_exempt, name='dispatch')
|
|
8
|
-
class DjangoLedgerOAuth2GraphQLView(
|
|
9
|
-
ProtectedResourceView,
|
|
10
|
-
GraphQLView
|
|
11
|
-
):
|
|
12
|
-
raise_exception = True
|
|
File without changes
|
|
File without changes
|