Wrapped the accounting_sample command in a transaction in the accounting application.
This commit is contained in:
parent
2b9034cfe8
commit
6cbef81088
@ -21,6 +21,7 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
from django.core.management import BaseCommand, CommandParser
|
from django.core.management import BaseCommand, CommandParser
|
||||||
|
from django.db import transaction
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from accounting.utils import Populator
|
from accounting.utils import Populator
|
||||||
@ -50,9 +51,10 @@ class Command(BaseCommand):
|
|||||||
if input().lower() not in ("y", "yes"):
|
if input().lower() not in ("y", "yes"):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
with transaction.atomic():
|
||||||
user = User(pk=923153018, login_id="imacat",
|
user = User(pk=923153018, login_id="imacat",
|
||||||
password="5486b64881adaf7bc1485cc26e57e51e", name="依瑪貓",
|
password="5486b64881adaf7bc1485cc26e57e51e",
|
||||||
is_disabled=False, is_deleted=False)
|
name="依瑪貓", is_disabled=False, is_deleted=False)
|
||||||
user.created_by = user
|
user.created_by = user
|
||||||
user.updated_by = user
|
user.updated_by = user
|
||||||
user.save()
|
user.save()
|
||||||
@ -70,10 +72,12 @@ class Command(BaseCommand):
|
|||||||
"营业外收入及费用"),
|
"营业外收入及费用"),
|
||||||
(8, "所得稅費用(或利益)", "income tax expense (or benefit)",
|
(8, "所得稅費用(或利益)", "income tax expense (or benefit)",
|
||||||
"所得税费用(或利益)"),
|
"所得税费用(或利益)"),
|
||||||
(9, "非經常營業損益", "nonrecurring gain or loss", "非经常营业损益"),
|
(9, "非經常營業損益", "nonrecurring gain or loss",
|
||||||
|
"非经常营业损益"),
|
||||||
|
|
||||||
(11, "流動資產", "current assets", "流动资产"),
|
(11, "流動資產", "current assets", "流动资产"),
|
||||||
(111, "現金及約當現金", "cash and cash equivalents", "现金及约当现金"),
|
(111, "現金及約當現金", "cash and cash equivalents",
|
||||||
|
"现金及约当现金"),
|
||||||
(1111, "庫存現金", "petty cash/revolving funds", "库存现金"),
|
(1111, "庫存現金", "petty cash/revolving funds", "库存现金"),
|
||||||
(1112, "零用金/週轉金", "cash on hand", "零用金/周转金"),
|
(1112, "零用金/週轉金", "cash on hand", "零用金/周转金"),
|
||||||
(1113, "銀行存款", "cash in banks", "银行存款"),
|
(1113, "銀行存款", "cash in banks", "银行存款"),
|
||||||
@ -90,23 +94,29 @@ class Command(BaseCommand):
|
|||||||
(2141, "應付帳款", "accounts payable", "应付帐款"),
|
(2141, "應付帳款", "accounts payable", "应付帐款"),
|
||||||
|
|
||||||
(33, "保留盈餘(或累積虧損)",
|
(33, "保留盈餘(或累積虧損)",
|
||||||
"retained earnings (accumulated deficit)", "保留盈余(或累积亏损)"),
|
"retained earnings (accumulated deficit)",
|
||||||
|
"保留盈余(或累积亏损)"),
|
||||||
(335, "未分配盈餘(或累積虧損)",
|
(335, "未分配盈餘(或累積虧損)",
|
||||||
"retained earnings-unappropriated (or accumulated deficit)",
|
"retained earnings-unappropriated (or accumulated deficit)",
|
||||||
"未分配盈余(或累积亏损)"),
|
"未分配盈余(或累积亏损)"),
|
||||||
(3351, "累積盈虧", "accumulated profit or loss", "累积盈亏"),
|
(3351, "累積盈虧", "accumulated profit or loss", "累积盈亏"),
|
||||||
(3353, "本期損益", "net income or loss for current period", "本期损益"),
|
(3353, "本期損益", "net income or loss for current period",
|
||||||
|
"本期损益"),
|
||||||
|
|
||||||
(46, "勞務收入", "service revenue", "劳务收入"),
|
(46, "勞務收入", "service revenue", "劳务收入"),
|
||||||
(461, "勞務收入", "service revenue", "劳务收入"),
|
(461, "勞務收入", "service revenue", "劳务收入"),
|
||||||
(4611, "勞務收入", "service revenue", "劳务收入"),
|
(4611, "勞務收入", "service revenue", "劳务收入"),
|
||||||
|
|
||||||
(62, "管理及總務費用", "general & administrative expenses", "管理及总务费用"),
|
(62, "管理及總務費用", "general & administrative expenses",
|
||||||
(625, "管理及總務費用", "general & administrative expenses", "管理及总务费用"),
|
"管理及总务费用"),
|
||||||
|
(625, "管理及總務費用", "general & administrative expenses",
|
||||||
|
"管理及总务费用"),
|
||||||
(6254, "旅費", "travelling expense, travel", "旅费"),
|
(6254, "旅費", "travelling expense, travel", "旅费"),
|
||||||
(626, "管理及總務費用", "general & administrative expenses", "管理及总务费用"),
|
(626, "管理及總務費用", "general & administrative expenses",
|
||||||
|
"管理及总务费用"),
|
||||||
(6262, "保險費", "insurance (expense)", "保险费"),
|
(6262, "保險費", "insurance (expense)", "保险费"),
|
||||||
(627, "管理及總務費用", "general & administrative expenses", "管理及总务费用"),
|
(627, "管理及總務費用", "general & administrative expenses",
|
||||||
|
"管理及总务费用"),
|
||||||
(6272, "伙食費", "meal (expenses)", "伙食费"),
|
(6272, "伙食費", "meal (expenses)", "伙食费"),
|
||||||
(6273, "職工福利", "employee benefits/welfare", "职工福利"),
|
(6273, "職工福利", "employee benefits/welfare", "职工福利"),
|
||||||
))
|
))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user