Exemplo n.º 1
0
    def retrieve_to_print_common(receipt: models.QuerySet) -> dict:
        from apps.variable.utils import VariableUtils
        from apps.address.serializers import AddressBaseSr

        return {
            'company_info': VariableUtils.get_company_info(),
            'customer': {
                'fullname': Tools.get_fullname(receipt.customer),
            },
            'staff': {
                'fullname': Tools.get_fullname(receipt.staff),
            },
            'address': AddressBaseSr(receipt.address).data,
            'uid': receipt.uid,
            'created_at': receipt.created_at,
            'vnd_delivery_fee': receipt.vnd_delivery_fee,
            'vnd_total': receipt.vnd_total,
            'note': receipt.note
        }
Exemplo n.º 2
0
Arquivo: models.py Projeto: tbson/24ho
    def save(self, *args, **kwargs):
        from .utils import TransactionUtils

        self.is_assets = TransactionUtils.is_assets(self.type)

        if not self.uid:
            self.uid = Tools.get_uuid()

        if self.customer:
            self.customer_username = Tools.get_fullname(self.customer.user, True)
        if self.staff:
            self.staff_username = Tools.get_fullname(self.staff.user, True)

        if self.order:
            self.order_uid = self.order.uid
        if self.bol:
            self.bol_uid = self.bol.uid
        self.balance = TransactionUtils.get_transaction_balance(self)

        super(Transaction, self).save(*args, **kwargs)
Exemplo n.º 3
0
Arquivo: views.py Projeto: tbson/24ho
    def retrieve_to_print(self, request, pk=None):
        transaction = get_object_or_404(Transaction, pk=pk)

        return res({
            'company_info': VariableUtils.get_company_info(),
            'customer': {
                'fullname': Tools.get_fullname(transaction.customer),
                'address': transaction.customer.address,
            },
            'uid': transaction.uid,
            'created_at': transaction.created_at,
            'amount': transaction.amount,
            'note': transaction.note
        })
Exemplo n.º 4
0
 def get_approver_name(self, obj):
     if not obj.approver:
         return ''
     return Tools.get_fullname(obj.approver)
Exemplo n.º 5
0
 def get_cust_care_name(self, obj):
     if not obj.cust_care:
         return ''
     return Tools.get_fullname(obj.cust_care)
Exemplo n.º 6
0
 def get_sale_name(self, obj):
     if not obj.sale:
         return ''
     return Tools.get_fullname(obj.sale)
Exemplo n.º 7
0
 def get_customer_name(self, obj):
     return Tools.get_fullname(obj.customer)
Exemplo n.º 8
0
 def get_label(self, obj):
     return "{} / {}".format(obj.pk, Tools.get_fullname(obj))
Exemplo n.º 9
0
 def get_fullname(obj):
     return Tools.get_fullname(obj, True)