diff --git a/api/__pycache__/settings.cpython-313.pyc b/api/__pycache__/settings.cpython-313.pyc index 8515a2d1..3afd3a6f 100644 Binary files a/api/__pycache__/settings.cpython-313.pyc and b/api/__pycache__/settings.cpython-313.pyc differ diff --git a/app/__pycache__/document_generator.cpython-313.pyc b/app/__pycache__/document_generator.cpython-313.pyc index 3ce56329..fdb81829 100644 Binary files a/app/__pycache__/document_generator.cpython-313.pyc and b/app/__pycache__/document_generator.cpython-313.pyc differ diff --git a/app/__pycache__/models.cpython-313.pyc b/app/__pycache__/models.cpython-313.pyc index 8ec6c8f5..a232008f 100644 Binary files a/app/__pycache__/models.cpython-313.pyc and b/app/__pycache__/models.cpython-313.pyc differ diff --git a/app/__pycache__/workflow_utils.cpython-313.pyc b/app/__pycache__/workflow_utils.cpython-313.pyc index c001eda6..2094ebb0 100644 Binary files a/app/__pycache__/workflow_utils.cpython-313.pyc and b/app/__pycache__/workflow_utils.cpython-313.pyc differ diff --git a/app/document_generator.py b/app/document_generator.py index 7ce2bf4b..1faaf680 100644 --- a/app/document_generator.py +++ b/app/document_generator.py @@ -287,7 +287,7 @@ class DocumentGenerator: return str(val) if fmt_type == "number_to_words": try: - return num2words(val, lang=fmt.get("lang", "en")) + return num2words(val, lang=fmt.get("lang", "vi")) except Exception: return str(val) if fmt_type == "conditional": @@ -397,16 +397,37 @@ class DocumentGenerator: return placeholders def _parse_format_args(self, args_string): - """Parses a string like 'lang:vi, type:number_to_words' into a dictionary.""" if not args_string: return {} - format_config = {} - args = args_string.split(',') - for arg in args: - if ':' in arg: - key, value = arg.split(':', 1) - format_config[key.strip()] = value.strip() - return format_config + + parts = [p.strip() for p in args_string.split(',')] + root = {} + current = root + + for part in parts: + if ':' not in part: + continue + + key, value = part.split(':', 1) + key = key.strip() + value = value.strip() + + if key == "next": + # nếu next chưa tồn tại thì tạo + if "next" not in current or not isinstance(current["next"], dict): + current["next"] = {} + current = current["next"] + + # hỗ trợ next:type:number_to_words + if ':' in value: + sub_key, sub_val = value.split(':', 1) + current[sub_key.strip()] = sub_val.strip() + else: + current[key] = value + + return root + + def prepare_replacements(self, doc): """ diff --git a/static/contract/.~lock.3. Thoả thuận thực hiện nguyện vọng cá nhân.docx# b/static/contract/.~lock.3. Thoả thuận thực hiện nguyện vọng cá nhân.docx# new file mode 100644 index 00000000..d63325ce --- /dev/null +++ b/static/contract/.~lock.3. Thoả thuận thực hiện nguyện vọng cá nhân.docx# @@ -0,0 +1 @@ +,kumduy,duy-pc,15.01.2026 12:11,file:///home/kumduy/.config/libreoffice/4; \ No newline at end of file diff --git a/static/contract/3. Thoả thuận thực hiện nguyện vọng cá nhân.docx b/static/contract/3. Thoả thuận thực hiện nguyện vọng cá nhân.docx index 437d0b86..94eb0457 100644 Binary files a/static/contract/3. Thoả thuận thực hiện nguyện vọng cá nhân.docx and b/static/contract/3. Thoả thuận thực hiện nguyện vọng cá nhân.docx differ