mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[ADD] base_exception_user,sale_exception_user,stock_exception: allow certain users to ignore exceptions, add exceptions on delivery orders
This commit is contained in:
42
stock_exception/models/stock.py
Normal file
42
stock_exception/models/stock.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models, fields
|
||||
|
||||
|
||||
class ExceptionRule(models.Model):
|
||||
_inherit = 'exception.rule'
|
||||
|
||||
model = fields.Selection(
|
||||
selection_add=[
|
||||
('stock.picking', 'Transfer'),
|
||||
]
|
||||
)
|
||||
picking_ids = fields.Many2many(
|
||||
'stock.picking',
|
||||
string="Transfers")
|
||||
|
||||
class Picking(models.Model):
|
||||
_inherit = ['stock.picking', 'base.exception']
|
||||
_name = 'stock.picking'
|
||||
_order = 'main_exception_id asc, priority desc, date asc, id desc'
|
||||
|
||||
@api.model
|
||||
def _exception_rule_eval_context(self, rec):
|
||||
res = super(Picking, self)._exception_rule_eval_context(rec)
|
||||
res['picking'] = rec
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def _reverse_field(self):
|
||||
return 'picking_ids'
|
||||
|
||||
def button_validate(self):
|
||||
self.ensure_one()
|
||||
if self.detect_exceptions():
|
||||
return self._popup_exceptions()
|
||||
return super().button_validate()
|
||||
|
||||
@api.model
|
||||
def _get_popup_action(self):
|
||||
return self.env.ref('stock_exception.action_stock_exception_confirm')
|
||||
|
||||
Reference in New Issue
Block a user