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 account_update_lock_to_date

View File

@@ -0,0 +1,68 @@
# Copyright 2019 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, _, api, fields, models
from odoo.exceptions import ValidationError
class AccountUpdateLockToDate(models.TransientModel):
_name = "account.update.lock_to_date"
_description = "Account Update Lock_to_date"
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
required=True,
default=lambda self: self.env.user.company_id,
)
sale_lock_to_date = fields.Date(
string="Sales Lock To Date",
help="Prevents creation and modification of entries in sales journals"
" posterior to the defined date inclusive.",
)
purchase_lock_to_date = fields.Date(
help="Prevents creation and modification of entries in purchase journals"
" posterior to the defined date inclusive.",
)
fiscalyear_lock_to_date = fields.Date(
string="Global Lock To Date",
help="No users can edit accounts posterior to this date."
" Use it for fiscal year locking for example.",
)
hard_lock_to_date = fields.Date(
string="Lock To Date",
help='Like the "Global Lock Date", but no exceptions are possible.',
)
@api.model
def default_get(self, field_list):
res = super().default_get(field_list)
company = self.env.user.company_id
res.update(
{
"company_id": company.id,
"sale_lock_to_date": company.sale_lock_to_date,
"purchase_lock_to_date": company.purchase_lock_to_date,
"fiscalyear_lock_to_date": company.fiscalyear_lock_to_date,
"hard_lock_to_date": company.hard_lock_to_date,
}
)
return res
def _check_execute_allowed(self):
self.ensure_one()
has_adviser_group = self.env.user.has_group("account.group_account_manager")
if not (has_adviser_group or self.env.uid == SUPERUSER_ID):
raise ValidationError(_("You are not allowed to execute this action."))
def execute(self):
self.ensure_one()
self._check_execute_allowed()
self.company_id.sudo().write(
{
"sale_lock_to_date": self.sale_lock_to_date,
"purchase_lock_to_date": self.purchase_lock_to_date,
"fiscalyear_lock_to_date": self.fiscalyear_lock_to_date,
"hard_lock_to_date": self.hard_lock_to_date,
}
)

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- # Copyright 2019 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).-->
<odoo>
<record model="ir.ui.view" id="account_update_lock_to_date_form_view">
<field name="name">account.update.lock_to_date.form</field>
<field name="model">account.update.lock_to_date</field>
<field name="arch" type="xml">
<form>
<header />
<sheet>
<group>
<field
name="company_id"
options="{'no_create': True}"
groups="base.group_multi_company"
/>
<field name="sale_lock_to_date" />
<field name="purchase_lock_to_date" />
<field name="fiscalyear_lock_to_date" />
<field name="hard_lock_to_date" />
</group>
</sheet>
<footer>
<button
string="Update"
name="execute"
type="object"
class="btn-primary"
/>
<button string="Cancel" class="btn-default" special="cancel" />
</footer>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="account_update_lock_to_date_act_window">
<field name="name">Update accounting lock to dates</field>
<field name="res_model">account.update.lock_to_date</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.ui.menu" id="account_update_lock_to_date_menu">
<field name="name">Update accounting lock to dates</field>
<field name="parent_id" ref="account.menu_finance_entries" />
<field name="action" ref="account_update_lock_to_date_act_window" />
<field
name="groups_id"
eval="[(6, 0, [ref('account.group_account_manager')])]"
/>
<field name="sequence" eval="70" />
</record>
</odoo>