Public release from ruodoo-project: 19.0 - 2026-07-26 21:17:35 UTC

This commit is contained in:
CI Publish Bot
2026-07-26 21:17:45 +00:00
commit 4f7b594ec8
1335 changed files with 191620 additions and 0 deletions

View File

@ -0,0 +1,2 @@
from . import directive_delete_wizard
from . import directive_choose_group_wizard

View File

@ -0,0 +1,35 @@
from odoo import api, fields, models
from odoo.exceptions import UserError
class DirectiveChooseGroupWizard(models.TransientModel):
_name = "directive.choose.group.wizard"
_description = "Choose Directive Template Group"
template_group_id = fields.Many2one(
"directive.template.group",
string="Группа шаблонов",
required=True,
# domain=lambda self: self._domain_template_group(),
)
@api.model
def _domain_template_group(self):
active_model = self.env.context.get("active_model")
return ["|", ("applicable_model", "=", False), ("applicable_model", "=", active_model or False)]
def action_confirm(self):
active_model = self.env.context.get("active_model")
active_id = self.env.context.get("active_id")
if not active_model or not active_id:
raise UserError("No active record in context.")
record = self.env[active_model].browse(active_id).exists()
if not record:
raise UserError("Source record not found.")
if not hasattr(record, "directive_template_group_id"):
raise UserError("Model does not support directive template group (directive.mixin is not applied).")
record.write({"directive_template_group_id": self.template_group_id.id})
return {"type": "ir.actions.act_window_close"}

View File

@ -0,0 +1,32 @@
from odoo import fields, models
from odoo.exceptions import UserError
class DirectiveDeleteWizard(models.TransientModel):
_name = "directive.delete.wizard"
_description = "Directive Delete Wizard"
mode = fields.Selection(
[
("archive", "Мягкое удаление (архивировать)"),
("delete", "Полное удаление (unlink)"),
],
string="Режим",
required=True,
default="archive",
)
def action_confirm(self):
active_model = self.env.context.get("active_model")
active_id = self.env.context.get("active_id")
if not active_model or not active_id:
raise UserError("No active record in context.")
record = self.env[active_model].browse(active_id).exists()
if not record:
return {"type": "ir.actions.act_window_close"}
if self.mode == "archive":
record._action_archive()
else:
record._action_delete_hard()
return {"type": "ir.actions.act_window_close"}

View File

@ -0,0 +1,37 @@
<odoo>
<record id="view_directive_choose_group_wizard_form" model="ir.ui.view">
<field name="name">directive.choose.group.wizard.form</field>
<field name="model">directive.choose.group.wizard</field>
<field name="arch" type="xml">
<form string="Выбор группы директив">
<sheet>
<group>
<field name="template_group_id"/>
</group>
<footer>
<button string="Подтвердить" type="object" name="action_confirm" class="btn-primary"/>
<button string="Отмена" special="cancel" class="btn-secondary"/>
</footer>
</sheet>
</form>
</field>
</record>
<record id="view_directive_delete_wizard_form" model="ir.ui.view">
<field name="name">directive.delete.wizard.form</field>
<field name="model">directive.delete.wizard</field>
<field name="arch" type="xml">
<form string="Удаление директивы">
<sheet>
<group>
<field name="mode"/>
</group>
<footer>
<button string="Выполнить" type="object" name="action_confirm" class="btn-danger"/>
<button string="Отмена" special="cancel" class="btn-secondary"/>
</footer>
</sheet>
</form>
</field>
</record>
</odoo>