Files
Odoo-18.0-20251222/account_global_discount/models/global_discount.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

30 lines
920 B
Python

# Copyright 2019 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class GlobalDiscount(models.Model):
_inherit = "global.discount"
_check_company_auto = True
account_id = fields.Many2one(
comodel_name="account.account",
string="Account",
domain=(
"[('account_type', 'not in', ['asset_receivable', 'liability_payable'])]"
),
check_company=True,
)
account_analytic_id = fields.Many2one(
comodel_name="account.analytic.account",
string="Analytic account",
check_company=True,
)
def _get_global_discount_vals(self, base, account_id=False, **kwargs):
"""Return account as well if passed"""
res = super()._get_global_discount_vals(base)
if account_id:
res.update({"account_id": account_id})
return res