Initial commit: Odoo 18.0-20251222 extra-addons
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

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
from . import account_account
from . import account_group
from . import account_tag
from . import account_tax_group
from . import res_config_settings

View File

@@ -0,0 +1,58 @@
from odoo import api, fields, models
class Account(models.Model):
_inherit = "account.account"
group_id = fields.Many2one(search="_search_group_id")
def _search_group_id(self, operator, value):
if operator not in ("in", "="):
raise NotImplementedError
# Browse groups because value can be an odoo.tools.query.Query
groups = self.env["account.group"].browse(value)
if not groups:
return [("id", "=", 0)]
query = """
SELECT
a.id
FROM
account_account a
JOIN
account_group g
ON g.code_prefix_start <= LEFT(
(a.code_store::json ->> %(company_id)s),
char_length(g.code_prefix_start)
)
AND g.code_prefix_end >= LEFT(
(a.code_store::json ->> %(company_id)s),
char_length(g.code_prefix_end)
)
AND g.company_id = %(company_id)s
WHERE g.id IN %(group_ids)s
"""
self.env.cr.execute(
query,
{
"group_ids": tuple(groups.ids),
"company_id": str(self.env.company.root_id.id),
},
)
account_ids = [row[0] for row in self.env.cr.fetchall()]
return [("id", "in", account_ids)]
@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
res.mapped("group_id").invalidate_recordset()
return res
def write(self, vals):
groups = self.mapped("group_id")
res = super().write(vals)
if "code" in vals:
(self.mapped("group_id") | groups).invalidate_recordset()
return res

View File

@@ -0,0 +1,14 @@
# Copyright 2018 FOREST AND BIOMASS ROMANIA SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountGroup(models.Model):
_inherit = "account.group"
account_ids = fields.One2many(
comodel_name="account.account",
inverse_name="group_id",
string="Accounts",
)

View File

@@ -0,0 +1,14 @@
# Copyright 2018 FOREST AND BIOMASS ROMANIA SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountAccountTag(models.Model):
_inherit = "account.account.tag"
account_ids = fields.Many2many(
comodel_name="account.account",
relation="account_account_account_tag",
string="Accounts",
)

View File

@@ -0,0 +1,14 @@
# Copyright 2018 FOREST AND BIOMASS ROMANIA SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountTaxGroup(models.Model):
_inherit = "account.tax.group"
tax_ids = fields.One2many(
comodel_name="account.tax",
inverse_name="tax_group_id",
string="Taxes",
)

View File

@@ -0,0 +1,17 @@
# Copyright 2021 Opener B.V. <stefan@opener.amsterdam>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
anglo_saxon_accounting = fields.Boolean(
related="company_id.anglo_saxon_accounting",
readonly=False,
string="Use anglo-saxon accounting",
help=(
"Record the cost of a good as an expense when this good is "
"invoiced to a final customer."
),
)