Replaced the combined localized data models into flexible, separated localized data models and their accompanying localization data models, so that adding new languages works automatically without having to change the data model definitions.

This commit is contained in:
2020-08-24 21:59:50 +08:00
parent b25d1875ef
commit 04703df6b5
5 changed files with 181 additions and 75 deletions

View File

@ -155,10 +155,12 @@ class DataFiller:
code = str(code)
parent = None if len(code) == 1\
else Account.objects.get(code=code[:-1])
Account(pk=new_pk(Account), parent=parent, code=code,
title_zh_hant=data[1], title_en=data[2],
title_zh_hans=data[3],
created_by=self.user, updated_by=self.user).save()
account = Account(parent=parent, code=code)
account.current_user = self.user
account.set_l10n_in("title", "zh-hant", data[1])
account.set_l10n_in("title", "en", data[2])
account.set_l10n_in("title", "zh-hans", data[3])
account.save()
def add_transfer_transaction(self, date: Union[datetime.date, int],
debit: List[RecordData],