mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 13:12:01 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
from . import base_exception_confirm
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2011 Raphaël Valyi, Renato Lima, Guewen Baconnier, Sodexis
|
||||
# Copyright 2017 Akretion (http://www.akretion.com)
|
||||
# Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
|
||||
# Copyright 2020 Hibou Corp.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class ExceptionRuleConfirm(models.AbstractModel):
|
||||
_name = "exception.rule.confirm"
|
||||
_description = "Exception Rule Confirm Wizard"
|
||||
|
||||
related_model_id = fields.Many2one("base.exception")
|
||||
exception_ids = fields.Many2many(
|
||||
"exception.rule", string="Exceptions to resolve", readonly=True
|
||||
)
|
||||
ignore = fields.Boolean("Ignore Exceptions")
|
||||
|
||||
@api.model
|
||||
def default_get(self, field_list):
|
||||
res = super().default_get(field_list)
|
||||
current_model = self.env.context.get("active_model")
|
||||
model_except_obj = self.env[current_model]
|
||||
active_ids = self.env.context.get("active_ids")
|
||||
if len(active_ids) > 1:
|
||||
raise ValidationError(_("Only 1 ID accepted, got %r.") % active_ids)
|
||||
active_id = active_ids[0]
|
||||
related_model_except = model_except_obj.browse(active_id)
|
||||
exception_ids = related_model_except.exception_ids.ids
|
||||
res.update({"exception_ids": [(6, 0, exception_ids)]})
|
||||
res.update({"related_model_id": active_id})
|
||||
return res
|
||||
|
||||
def action_confirm(self):
|
||||
self.ensure_one()
|
||||
return {"type": "ir.actions.act_window_close"}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_exception_rule_confirm" model="ir.ui.view">
|
||||
<field name="name">Exceptions Rules</field>
|
||||
<field name="model">exception.rule.confirm</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Outstanding exceptions to manager" version="7.0">
|
||||
<group>
|
||||
<field name="exception_ids" nolabel="1" colspan="2">
|
||||
<tree>
|
||||
<field name="name" />
|
||||
<field name="description" />
|
||||
</tree>
|
||||
</field>
|
||||
<newline />
|
||||
</group>
|
||||
<group>
|
||||
<field
|
||||
name="ignore"
|
||||
groups='base_exception.group_exception_rule_manager'
|
||||
/>
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
name="action_confirm"
|
||||
string="Close"
|
||||
colspan="1"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_exception_rule_confirm" model="ir.actions.act_window">
|
||||
<field name="name">Outstanding exceptions to manage</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">exception.rule.confirm</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_exception_rule_confirm" />
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue