Skip to content

Commit

Permalink
Merge branch 'development' into feature/salespricelogic
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Dobbelaere committed Jul 10, 2024
2 parents 021fae1 + 7e811c8 commit a533935
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions OneSila/contacts/schema/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class CompanyType(relay.Node, GetQuerysetMultiTenantMixin):
currency: Optional[CurrencyType]
person_set: List[Annotated['PersonType', lazy("contacts.schema.types.types")]]

@field()
def country(self, info) -> str | None:
try:
return InvoiceAddress.objects.filter_multi_tenant(self.multi_tenant_company).filter(company=self).first().get_country_display()
except Exception:
return None

@type(Supplier, filters=SupplierFilter, order=SupplierOrder, pagination=True, fields="__all__")
class SupplierType(relay.Node, GetQuerysetMultiTenantMixin):
Expand Down
3 changes: 2 additions & 1 deletion OneSila/eancodes/schema/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from typing import List

from eancodes.models import EanCode
from products.schema.types.filters import ProductFilter
from .filters import EanCodeFilter
from .ordering import EanCodeOrder


@type(EanCode, filters=EanCodeFilter, order=EanCodeOrder, pagination=True, fields="__all__")
class EanCodeType(relay.Node, GetQuerysetMultiTenantMixin):
pass
product: ProductFilter | None
7 changes: 7 additions & 0 deletions OneSila/orders/schema/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class OrderType(relay.Node, GetQuerysetMultiTenantMixin):
def total_value(self) -> str | None:
return self.total_value_currency

@field()
def country(self, info) -> str | None:
try:
return self.shipping_address.get_country_display()
except Exception:
return None


@type(OrderItem, filters=OrderItemFilter, order=OrderItemOrder, pagination=True, fields="__all__")
class OrderItemType(relay.Node, GetQuerysetMultiTenantMixin):
Expand Down
7 changes: 7 additions & 0 deletions OneSila/purchasing/schema/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class PurchaseOrderType(relay.Node, GetQuerysetMultiTenantMixin):
def total_value(self) -> str | None:
return self.total_value

@field()
def country(self, info) -> str | None:
try:
return self.invoice_address.get_country_display()
except Exception:
return None


@type(PurchaseOrderItem, filters=PurchaseOrderItemFilter, order=PurchaseOrderItemOrder, pagination=True, fields="__all__")
class PurchaseOrderItemType(relay.Node, GetQuerysetMultiTenantMixin):
Expand Down

0 comments on commit a533935

Please sign in to comment.