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 @@
from . import test_account_lock_date_update

View File

@@ -0,0 +1,66 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import Command, fields
from odoo.exceptions import AccessError
from odoo.tests.common import TransactionCase
class TestAccountLockDateUpdate(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.company = cls.env.ref("base.main_company")
cls.demo_user = cls.env.ref("base.user_demo")
cls.adviser_group = cls.env.ref("account.group_account_manager")
def test_01_update_without_access(self):
self.demo_user.write({"groups_id": [Command.unlink(self.adviser_group.id)]})
with self.assertRaises(AccessError):
self.env["account.update.lock_date"].with_user(self.demo_user.id).create(
{"company_id": self.company.id}
)
def test_02_update_with_access(self):
self.demo_user.write({"groups_id": [Command.link(self.adviser_group.id)]})
wizard = (
self.env["account.update.lock_date"]
.with_user(self.demo_user.id)
.create({"company_id": self.company.id})
)
wizard.write(
{
"sale_lock_date": "2000-05-01",
"purchase_lock_date": "2000-04-01",
"tax_lock_date": "2000-03-01",
"fiscalyear_lock_date": "2000-02-01",
"hard_lock_date": "2000-01-01",
}
)
wizard.with_user(self.demo_user.id).execute()
self.assertEqual(
fields.Date.to_string(self.company.sale_lock_date), "2000-05-01"
)
self.assertEqual(
fields.Date.to_string(self.company.purchase_lock_date), "2000-04-01"
)
self.assertEqual(
fields.Date.to_string(self.company.tax_lock_date), "2000-03-01"
)
self.assertEqual(
fields.Date.to_string(self.company.fiscalyear_lock_date), "2000-02-01"
)
self.assertEqual(
fields.Date.to_string(self.company.hard_lock_date), "2000-01-01"
)