Files
Odoo-18.0-20251222/account_asset_management/models/account_account.py
tocmo0nlord adbe430761
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled
Initial commit: Odoo 18.0-20251222 extra-addons
2026-03-13 20:43:25 +00:00

31 lines
977 B
Python
Executable File

# Copyright 2009-2017 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.exceptions import ValidationError
class AccountAccount(models.Model):
_inherit = "account.account"
asset_profile_id = fields.Many2one(
comodel_name="account.asset.profile",
string="Asset Profile",
check_company=True,
help="Default Asset Profile when creating invoice lines with this account.",
)
@api.constrains("asset_profile_id")
def _check_asset_profile(self):
for account in self:
if (
account.asset_profile_id
and account.asset_profile_id.account_asset_id != account
):
raise ValidationError(
self.env._(
"The Asset Account defined in the Asset Profile "
"must be equal to the account."
)
)