refactor: Update account field domains and validation to use active status for Odoo 19 compatibility.
This commit is contained in:
parent
4fd5edfc20
commit
5ddb93e2ec
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
__init__.py
Normal file → Executable file
0
__init__.py
Normal file → Executable file
2
__manifest__.py
Normal file → Executable file
2
__manifest__.py
Normal file → Executable file
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
'author': "Suherdy Yacob",
|
'author': "Suherdy Yacob",
|
||||||
'category': 'Accounting',
|
'category': 'Accounting',
|
||||||
'version': '18.0.1.0.0',
|
'version': '19.0.1.0.0',
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
'depends': [
|
'depends': [
|
||||||
|
|||||||
0
models/__init__.py
Normal file → Executable file
0
models/__init__.py
Normal file → Executable file
0
models/account_move_line.py
Normal file → Executable file
0
models/account_move_line.py
Normal file → Executable file
12
models/res_partner.py
Normal file → Executable file
12
models/res_partner.py
Normal file → Executable file
@ -15,7 +15,7 @@ class ResPartner(models.Model):
|
|||||||
'account.account',
|
'account.account',
|
||||||
company_dependent=True,
|
company_dependent=True,
|
||||||
string='Customer Income Account',
|
string='Customer Income Account',
|
||||||
domain="[('account_type', '=', 'income'), ('deprecated', '=', False)]",
|
domain="[('account_type', '=', 'income'), ('active', '=', True)]",
|
||||||
help="This account will be used for revenue entries when selling to this customer. "
|
help="This account will be used for revenue entries when selling to this customer. "
|
||||||
"If not set, the income account from the product category will be used."
|
"If not set, the income account from the product category will be used."
|
||||||
)
|
)
|
||||||
@ -24,7 +24,7 @@ class ResPartner(models.Model):
|
|||||||
'account.account',
|
'account.account',
|
||||||
company_dependent=True,
|
company_dependent=True,
|
||||||
string='Customer Expense Account (COGS)',
|
string='Customer Expense Account (COGS)',
|
||||||
domain="[('account_type', '=', 'expense'), ('deprecated', '=', False)]",
|
domain="[('account_type', '=', 'expense'), ('active', '=', True)]",
|
||||||
help="This account will be used for COGS entries when selling to this customer. "
|
help="This account will be used for COGS entries when selling to this customer. "
|
||||||
"If not set, the expense account from the product category will be used."
|
"If not set, the expense account from the product category will be used."
|
||||||
)
|
)
|
||||||
@ -49,7 +49,7 @@ class ResPartner(models.Model):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Runtime validation: Check if account is still active
|
# Runtime validation: Check if account is still active
|
||||||
if account.deprecated:
|
if not account.active:
|
||||||
_logger.error(
|
_logger.error(
|
||||||
"Customer income account %s (ID: %s) for partner %s (ID: %s) is deprecated",
|
"Customer income account %s (ID: %s) for partner %s (ID: %s) is deprecated",
|
||||||
account.code, account.id, self.name, self.id
|
account.code, account.id, self.name, self.id
|
||||||
@ -105,7 +105,7 @@ class ResPartner(models.Model):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Runtime validation: Check if account is still active
|
# Runtime validation: Check if account is still active
|
||||||
if account.deprecated:
|
if not account.active:
|
||||||
_logger.error(
|
_logger.error(
|
||||||
"Customer expense account %s (ID: %s) for partner %s (ID: %s) is deprecated",
|
"Customer expense account %s (ID: %s) for partner %s (ID: %s) is deprecated",
|
||||||
account.code, account.id, self.name, self.id
|
account.code, account.id, self.name, self.id
|
||||||
@ -158,7 +158,7 @@ class ResPartner(models.Model):
|
|||||||
) % account.display_name)
|
) % account.display_name)
|
||||||
|
|
||||||
# Check if account is deprecated
|
# Check if account is deprecated
|
||||||
if account.deprecated:
|
if not account.active:
|
||||||
raise ValidationError(_(
|
raise ValidationError(_(
|
||||||
"The selected income account '%s' is deprecated and cannot be used. "
|
"The selected income account '%s' is deprecated and cannot be used. "
|
||||||
"Please select an active income account."
|
"Please select an active income account."
|
||||||
@ -189,7 +189,7 @@ class ResPartner(models.Model):
|
|||||||
) % account.display_name)
|
) % account.display_name)
|
||||||
|
|
||||||
# Check if account is deprecated
|
# Check if account is deprecated
|
||||||
if account.deprecated:
|
if not account.active:
|
||||||
raise ValidationError(_(
|
raise ValidationError(_(
|
||||||
"The selected expense account '%s' is deprecated and cannot be used. "
|
"The selected expense account '%s' is deprecated and cannot be used. "
|
||||||
"Please select an active expense account."
|
"Please select an active expense account."
|
||||||
|
|||||||
0
models/stock_move.py
Normal file → Executable file
0
models/stock_move.py
Normal file → Executable file
0
tests/__init__.py
Normal file → Executable file
0
tests/__init__.py
Normal file → Executable file
0
tests/test_account_validation.py
Normal file → Executable file
0
tests/test_account_validation.py
Normal file → Executable file
0
tests/test_audit_trail.py
Normal file → Executable file
0
tests/test_audit_trail.py
Normal file → Executable file
0
tests/test_customer_account_fields.py
Normal file → Executable file
0
tests/test_customer_account_fields.py
Normal file → Executable file
0
tests/test_error_handling.py
Normal file → Executable file
0
tests/test_error_handling.py
Normal file → Executable file
0
tests/test_expense_account_determination.py
Normal file → Executable file
0
tests/test_expense_account_determination.py
Normal file → Executable file
0
tests/test_form_view.py
Normal file → Executable file
0
tests/test_form_view.py
Normal file → Executable file
0
tests/test_income_account_determination.py
Normal file → Executable file
0
tests/test_income_account_determination.py
Normal file → Executable file
0
tests/test_sales_flow_integration.py
Normal file → Executable file
0
tests/test_sales_flow_integration.py
Normal file → Executable file
0
views/.gitkeep
Normal file → Executable file
0
views/.gitkeep
Normal file → Executable file
0
views/account_move_views.xml
Normal file → Executable file
0
views/account_move_views.xml
Normal file → Executable file
0
views/res_partner_views.xml
Normal file → Executable file
0
views/res_partner_views.xml
Normal file → Executable file
Loading…
Reference in New Issue
Block a user