fixed bug with tittle and other
This commit is contained in:
parent
6ef03d2319
commit
c037dfe45c
|
|
@ -42,7 +42,8 @@ doc_events = {
|
|||
},
|
||||
"Journal Entry": {
|
||||
"on_trash": "invoice_az.vat_operations.on_delete_journal_entry",
|
||||
"on_cancel": "invoice_az.vat_operations.on_delete_journal_entry"
|
||||
"on_cancel": "invoice_az.vat_operations.on_delete_journal_entry",
|
||||
"before_save": "invoice_az.vat_operations.set_title_from_customer_name"
|
||||
},
|
||||
"E-Taxes Settings": {
|
||||
"on_update": "invoice_az.api.update_mapped_statuses"
|
||||
|
|
@ -57,8 +58,22 @@ scheduler_events = {
|
|||
}
|
||||
}
|
||||
|
||||
after_install = "invoice_az.auth.setup_token_renewal"
|
||||
after_migrate = "invoice_az.auth.setup_token_renewal"
|
||||
def after_install():
|
||||
"""Run installation tasks"""
|
||||
from invoice_az.auth import setup_token_renewal
|
||||
from invoice_az.install import after_install as install_custom_fields
|
||||
|
||||
setup_token_renewal()
|
||||
install_custom_fields()
|
||||
|
||||
|
||||
def after_migrate():
|
||||
"""Run migration tasks"""
|
||||
from invoice_az.auth import setup_token_renewal
|
||||
from invoice_az.install import create_journal_entry_custom_fields
|
||||
|
||||
setup_token_renewal()
|
||||
create_journal_entry_custom_fields()
|
||||
|
||||
# Fixtures for master data
|
||||
# ------------------------
|
||||
|
|
|
|||
|
|
@ -455,6 +455,7 @@ def create_journal_entry_from_vat_operation(operation_data, company, create_as_d
|
|||
je.voucher_type = 'Journal Entry'
|
||||
je.user_remark = f"VAT Operation: {operation_data.get('explanation', '')}"
|
||||
je.expense_income_type = expense_income_type
|
||||
je.customer_name_etaxes = operation_data.get('name', '')
|
||||
|
||||
# Строка 1: Дебет
|
||||
debit_entry = {
|
||||
|
|
|
|||
|
|
@ -40,3 +40,15 @@ def on_delete_journal_entry(doc, method):
|
|||
"Journal Entry Delete Error"
|
||||
)
|
||||
# Не прерываем удаление JE, только логируем ошибку
|
||||
|
||||
|
||||
def set_title_from_customer_name(doc, method):
|
||||
"""
|
||||
Устанавливает title из customer_name_etaxes если поле заполнено
|
||||
|
||||
Args:
|
||||
doc: Документ Journal Entry
|
||||
method: Метод события (before_save)
|
||||
"""
|
||||
if hasattr(doc, 'customer_name_etaxes') and doc.customer_name_etaxes:
|
||||
doc.title = doc.customer_name_etaxes
|
||||
|
|
|
|||
Loading…
Reference in New Issue