Пример #1
0
 def from_csv(fcsv):
     if os.path.exists(fcsv):
         handle = file(fcsv)
         for i in handle.readlines():
             values = i.split(';')
             p = PlanComptable(code=values[0], label=values[1])
             p.save()
     else:
         print "Err: unable to find file '%s'" % fcsv
Пример #2
0
 def from_csv(fcsv):
     if os.path.exists(fcsv):
         handle = file(fcsv)
         for i in handle.readlines():
             values = i.split(";")
             p = PlanComptable(code=values[0], label=values[1])
             p.save()
     else:
         print "Err: unable to find file '%s'" % fcsv
Пример #3
0
    def save_compta(self):
        from compta.models import Operation, PaymentMethod, ClientAccount, PlanComptable
        curdate = date.now()
        user_account = None
        try:
            user_account = ClientAccount.objects.filter(user=self.user)[0]
        except:
            user_account = None

        if not user_account:
            user_account = ClientAccount(
                    label="Client: %s #%d" % (self.user.get_full_name(), self.user.id),
                    plan=PlanComptable.get_client_account(),
                    user=self.user)
            user_account.save()

        method = PaymentMethod.get_internal_method()
        for o in self.orderdetail_set.all():
            for i in range(1, o.quantity+1):
                op = Operation(
                    debit=o.product.product_account,
                    credit=user_account,
                    label=o.product.label(),
                    comment='',
                    amount=o.price,
                    payment=method,
                    date=curdate,
                    order=self,
                    user=self.user)
                op.save()
Пример #4
0
    def save_compta(self):
        from compta.models import Operation, PaymentMethod, ClientAccount, PlanComptable
        curdate = date.now()
        user_account = None
        try:
            user_account = ClientAccount.objects.filter(user=self.user)[0]
        except:
            user_account = None

        if not user_account:
            user_account = ClientAccount(
                label="Client: %s #%d" %
                (self.user.get_full_name(), self.user.id),
                plan=PlanComptable.get_client_account(),
                user=self.user)
            user_account.save()

        method = PaymentMethod.get_internal_method()
        for o in self.orderdetail_set.all():
            for i in range(1, o.quantity + 1):
                op = Operation(debit=o.product.product_account,
                               credit=user_account,
                               label=o.product.label(),
                               comment='',
                               amount=o.price,
                               payment=method,
                               date=curdate,
                               order=self,
                               user=self.user)
                op.save()